@mike-lischke/antlr-tgen
Version:
A generator for antlr-ng runtime test cases
29 lines (23 loc) • 585 B
Plain Text
[notes]
This is a regression test for antlr/antlr4#687 "Empty zero-length tokens
cannot have lexer commands" and antlr/antlr4#688 "Lexer cannot match
zero-length tokens"
https://github.com/antlr/antlr4/issues/687
https://github.com/antlr/antlr4/issues/688
[type]
Lexer
[grammar]
lexer grammar L;
BeginString
: '\'' -> more, pushMode(StringMode)
;
mode StringMode;
StringMode_X : 'x' -> more;
StringMode_Done : -> more, mode(EndStringMode);
mode EndStringMode;
EndString : '\'' -> popMode;
[input]
'xxx'
[output]
[@0,0:4=''xxx'',<1>,1:0]
[@1,5:4='<EOF>',<-1>,1:5]