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

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

The newest version!
TestType() ::= "Lexer"

Grammar ::= [
	"PositionAdjustingLexer": {}
]

Input() ::= <<
tokens
tokens {
notLabel
label1 =
label2 +=
notLabel<\n>
>>

TOKENS() ::= "\<4>"
LABEL() ::= "\<5>"
IDENTIFIER() ::= "\<6>"

Output() ::= <<
[@0,0:5='tokens',,1:0]
[@1,7:12='tokens',,2:0]
[@2,14:14='{',\<3>,2:7]
[@3,16:23='notLabel',,3:0]
[@4,25:30='label1',,4:0]
[@5,32:32='=',\<1>,4:7]
[@6,34:39='label2',,5:0]
[@7,41:42='+=',\<2>,5:7]
[@8,44:51='notLabel',,6:0]
[@9,53:52='\',\<-1>,7:0]<\n>
>>

Errors() ::= ""

grammar(grammarName) ::= <<
lexer grammar PositionAdjustingLexer;

@definitions {

}

@members {

}

ASSIGN : '=' ;
PLUS_ASSIGN : '+=' ;
LCURLY:	'{';

// 'tokens' followed by '{'
TOKENS : 'tokens' IGNORED '{';

// IDENTIFIER followed by '+=' or '='
LABEL
	:	IDENTIFIER IGNORED '+'? '='
	;

IDENTIFIER
	:	[a-zA-Z_] [a-zA-Z0-9_]*
	;

fragment
IGNORED
	:	[ \t\r\n]*
	;

NEWLINE
	:	[\r\n]+ -> skip
	;

WS
	:	[ \t]+ -> skip
	;
>>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy