[11 - Antlr Parser] Fix grammar file and TestAntlrXScanner1#tokenID
This commit is contained in:
@@ -14,16 +14,29 @@ grammar X;
|
||||
options {
|
||||
language = Java;
|
||||
output = AST;
|
||||
ASTLabelType = CommonTree;
|
||||
backtrack = true;
|
||||
}
|
||||
|
||||
// AST-Tokens
|
||||
tokens {
|
||||
DECL;
|
||||
STATLIST;
|
||||
DECLLIST;
|
||||
UMINUS;
|
||||
ID;
|
||||
INTCONST;
|
||||
WS;
|
||||
}
|
||||
|
||||
@parser::header {package de.dhbw.compiler.antlrxparser;}
|
||||
@lexer::header {package de.dhbw.compiler.antlrxparser;}
|
||||
|
||||
// Anmerkung: Es müssen Lexer- UND Parser-Regeln stehen, da sonst das Generieren nicht funktionieren
|
||||
// Lexer stuff
|
||||
ID: ('a'..'z' | 'A'..'Z')
|
||||
(options {
|
||||
greedy = true;
|
||||
}: 'a'..'z' | 'A'..'Z' | '0'..'9')*;
|
||||
INTCONST: ('0'..'9')+;
|
||||
|
||||
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
|
||||
|
||||
// Parser stuff
|
||||
program: 'TODO';
|
||||
|
||||
Reference in New Issue
Block a user