UNPKG

@mike-lischke/antlr-tgen

Version:

A generator for antlr-ng runtime test cases

64 lines (50 loc) 846 B
[type] Lexer [grammar] lexer grammar PositionAdjustingLexer; @definitions { <PositionAdjustingLexerDef()> } @members { <PositionAdjustingLexer()> } 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 ; [input] tokens tokens { notLabel label1 = label2 += notLabel [output] [@0,0:5='tokens',<6>,1:0] [@1,7:12='tokens',<4>,2:0] [@2,14:14='{',<3>,2:7] [@3,16:23='notLabel',<6>,3:0] [@4,25:30='label1',<5>,4:0] [@5,32:32='=',<1>,4:7] [@6,34:39='label2',<5>,5:0] [@7,41:42='+=',<2>,5:7] [@8,44:51='notLabel',<6>,6:0] [@9,53:52='<EOF>',<-1>,7:0]