[11 - Antlr Parser] Fix grammar file and TestAntlrXScanner1#tokenID
This commit is contained in:
Binary file not shown.
@@ -14,20 +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')+;
|
||||
|
||||
INVALID: .;
|
||||
WS: ('\t' | ' ' | '\r' | '\n' | '\f')+ { skip(); };
|
||||
|
||||
program: 'TODO';
|
||||
// Parser stuff
|
||||
program: 'TODO';
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user