org.antlr.v4.test.runtime.templates.LexerExec.ZeroLengthToken.stg Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of runtime-testsuite Show documentation
Show all versions of runtime-testsuite Show documentation
A collection of tests for ANTLR 4 Runtime libraries.
/*
* 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
*/
TestType() ::= "Lexer"
Grammar ::= [
"L": {}
]
Input() ::= <%
'xxx'
%>
Output() ::= <<
[@0,0:4=''xxx'',\<1>,1:0]
[@1,5:4='\',\<-1>,1:5]<\n>
>>
Errors() ::= ""
grammar(grammarName) ::= <<
lexer grammar ;
BeginString
: '\'' -> more, pushMode(StringMode)
;
mode StringMode;
StringMode_X : 'x' -> more;
StringMode_Done : -> more, mode(EndStringMode);
mode EndStringMode;
EndString : '\'' -> popMode;
>>
© 2015 - 2024 Weber Informatics LLC | Privacy Policy