. , . , !:)
: . NL , . , () , , . , . ( ) T:
grammar T;
foo
: ~A
;
A
: 'a'
;
B
: 'b'
;
C
: 'c'
;
, lexer A foo. foo , 'a', lexer, A. , 'b' 'c'.
, :
options {
language = Java;
}
: Java ( , ).
, , data - text -line . :
logfile
: line+
;
line
: dataline
| textline
;
dataline
: DataLine
;
textline
: TextLine
;
DataLine
: TwoDigits TwoDigits '.' TwoDigits '.' TwoDigits Space+ TwoDigits ':' TwoDigits ':' TwoDigits Space+ ':' TextLine
;
TextLine
: ~('\r' | '\n')* (NewLine | EOF)
;
fragment
NewLine
: '\r'? '\n'
| '\r'
;
fragment
TwoDigits
: '0'..'9' '0'..'9'
;
fragment
Space
: ' '
| '\t'
;
, fragment lexer , : lexer. , : DataLine TextLine.