@mike-lischke/antlr-tgen
Version:
A generator for antlr-ng runtime test cases
33 lines (28 loc) • 639 B
Plain Text
[type]
Lexer
[grammar]
lexer grammar L;
HexLiteral : '0' ('x'|'X') HexDigit+ ;
DecimalLiteral : ('0' | '1'..'9' '0'..'9'*) ;
FloatingPointLiteral : ('0x' | '0X') HexDigit* ('.' HexDigit*)? ;
DOT : '.' ;
ID : 'a'..'z'+ ;
fragment HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ;
WS : (' '|'\n')+;
[input]
x 0 1 a.b a.l
[output]
[@0,0:0='x',<5>,1:0]
[@1,1:1=' ',<6>,1:1]
[@2,2:2='0',<2>,1:2]
[@3,3:3=' ',<6>,1:3]
[@4,4:4='1',<2>,1:4]
[@5,5:5=' ',<6>,1:5]
[@6,6:6='a',<5>,1:6]
[@7,7:7='.',<4>,1:7]
[@8,8:8='b',<5>,1:8]
[@9,9:9=' ',<6>,1:9]
[@10,10:10='a',<5>,1:10]
[@11,11:11='.',<4>,1:11]
[@12,12:12='l',<5>,1:12]
[@13,13:12='<EOF>',<-1>,1:13]