grammar MyTest;
myTestFile: line+ EOF;
line: Break Spaces? ((Word | NormalNumbers) Spaces?)+ ;
//Lexer
Word: Prefix? Char Char+ Suffix?;
NormalNumbers
: Prefix? Numbers Suffix?;
Numbers
: LatinNumber | YearNumber | OtherNumber;
Spaces: (Space)+;
Sign: Prefix | Suffix | Special ;
YearNumber
: '(' '1' '9' Digit Digit ')'
| '[' '1' '9' Digit Digit ']'
| '1' '9' Digit Digit;
OtherNumber
: [1-9] Digit* ;
LatinNumber
: 'I' ('I' 'I'?)?
| 'I'? 'V' ('I' ('I' 'I'?)?)?
| 'I'? 'X' ('I' ('I' 'I'?)?)? 'V'? ('I' ('I' 'I'?)?)? ;
Space: ' ';
Tab: '\t';
Break: '\n';
Digit: [0-9];
Char: [A-Z\u00C4\u00D6\u00DCa-z\u00E4\u00F6\u00FC\u00DF];
Prefix: '"' | '\'' | '(' | '[';
Suffix: '\u00AF' | '\u002d' | '.' | ',' | ':' | ';' | '!' | '?' | '"' | '\'' | ')' | ']';
Special: [\u005e\u00ac\u2014\u201e\u2022/><§&{}#*~+\\];Введите код...