All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.antlr.v4.test.runtime.templates.LexerExec.ZeroLengthToken.stg Maven / Gradle / Ivy

There is a newer version: 4.9.0
Show newest version
/*
 * 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