pref: remove CommonLexer and use EOF

This commit is contained in:
Reda Al Sulais
2023-11-03 22:12:09 +03:00
parent 6a4ad8af06
commit 55d7e9ec61
6 changed files with 8 additions and 19 deletions

View File

@@ -5,7 +5,11 @@ interface Common {
}
fragment TitleAndAccessibilities:
((accDescr=ACC_DESCR | accTitle=ACC_TITLE | title=TITLE) NEWLINE+)+
((accDescr=ACC_DESCR | accTitle=ACC_TITLE | title=TITLE) EOL)+
;
fragment EOL returns string:
NEWLINE+ | EOF
;
terminal NEWLINE: /\r?\n/;
@@ -14,6 +18,6 @@ terminal ACC_TITLE: /accTitle[\t ]*:[^\n\r]*(?=%%)|accTitle[\t ]*:[^\n\r]*/;
terminal TITLE: /title([\t ][^\n\r]*|)(?=%%)|title([\t ][^\n\r]*|)/;
hidden terminal WHITESPACE: /[\t ]+/;
hidden terminal YAML: /---[\t ]*\r?\n[\S\s]*?---[\t ]*(?!.)/;
hidden terminal DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%\s*/;
hidden terminal YAML: /---[\t ]*\r?\n(?:[\S\s]*?\r?\n)?---(?:\r?\n|(?!\S))/;
hidden terminal DIRECTIVE: /[\t ]*%%{[\S\s]*?}%%(?:\r?\n|(?!\S))/;
hidden terminal SINGLE_LINE_COMMENT: /[\t ]*%%[^\n\r]*/;

View File

@@ -1,3 +1,2 @@
export * from './lexer.js';
export * from './tokenBuilder.js';
export { MermaidValueConverter } from './valueConverter.js';

View File

@@ -1,8 +0,0 @@
import type { LexerResult } from 'langium';
import { DefaultLexer } from 'langium';
export class CommonLexer extends DefaultLexer {
public override tokenize(text: string): LexerResult {
return super.tokenize(text + '\n');
}
}