[11 - Antlr Parser] Fix grammar file and TestAntlrXScanner1#tokenID
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g 2020-05-27 11:44:58
|
||||
// $ANTLR 3.5.2 /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g 2020-05-27 12:40:05
|
||||
package de.dhbw.compiler.antlrxparser;
|
||||
|
||||
import org.antlr.runtime.*;
|
||||
import java.util.Stack;
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.antlr.runtime.tree.*;
|
||||
|
||||
@@ -12,16 +14,13 @@ import org.antlr.runtime.tree.*;
|
||||
@SuppressWarnings("all")
|
||||
public class XParser extends Parser {
|
||||
public static final String[] tokenNames = new String[] {
|
||||
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "DECL", "DECLLIST", "INVALID",
|
||||
"STATLIST", "UMINUS", "'TODO'"
|
||||
"<invalid>", "<EOR>", "<DOWN>", "<UP>", "ID", "INTCONST", "WS", "'TODO'"
|
||||
};
|
||||
public static final int EOF=-1;
|
||||
public static final int T__9=9;
|
||||
public static final int DECL=4;
|
||||
public static final int DECLLIST=5;
|
||||
public static final int INVALID=6;
|
||||
public static final int STATLIST=7;
|
||||
public static final int UMINUS=8;
|
||||
public static final int T__7=7;
|
||||
public static final int ID=4;
|
||||
public static final int INTCONST=5;
|
||||
public static final int WS=6;
|
||||
|
||||
// delegates
|
||||
public Parser[] getDelegates() {
|
||||
@@ -51,47 +50,50 @@ public class XParser extends Parser {
|
||||
|
||||
|
||||
public static class program_return extends ParserRuleReturnScope {
|
||||
Object tree;
|
||||
CommonTree tree;
|
||||
@Override
|
||||
public Object getTree() { return tree; }
|
||||
public CommonTree getTree() { return tree; }
|
||||
};
|
||||
|
||||
|
||||
// $ANTLR start "program"
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:33:1: program : 'TODO' ;
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:42:1: program : 'TODO' ;
|
||||
public final XParser.program_return program() throws RecognitionException {
|
||||
XParser.program_return retval = new XParser.program_return();
|
||||
retval.start = input.LT(1);
|
||||
|
||||
Object root_0 = null;
|
||||
CommonTree root_0 = null;
|
||||
|
||||
Token string_literal1=null;
|
||||
|
||||
Object string_literal1_tree=null;
|
||||
CommonTree string_literal1_tree=null;
|
||||
|
||||
try {
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:33:8: ( 'TODO' )
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:33:10: 'TODO'
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:42:8: ( 'TODO' )
|
||||
// /Users/kreis/git/gitea.humenius.me/dhbw-compilerbau/CC-Praxis-Antlr Parser fuer X-Leer/src/de/dhbw/compiler/antlrxparser/X.g:42:13: 'TODO'
|
||||
{
|
||||
root_0 = (Object)adaptor.nil();
|
||||
root_0 = (CommonTree)adaptor.nil();
|
||||
|
||||
|
||||
string_literal1=(Token)match(input,9,FOLLOW_9_in_program95);
|
||||
string_literal1_tree = (Object)adaptor.create(string_literal1);
|
||||
string_literal1=(Token)match(input,7,FOLLOW_7_in_program256); if (state.failed) return retval;
|
||||
if ( state.backtracking==0 ) {
|
||||
string_literal1_tree = (CommonTree)adaptor.create(string_literal1);
|
||||
adaptor.addChild(root_0, string_literal1_tree);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
retval.stop = input.LT(-1);
|
||||
|
||||
retval.tree = (Object)adaptor.rulePostProcessing(root_0);
|
||||
if ( state.backtracking==0 ) {
|
||||
retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0);
|
||||
adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop);
|
||||
|
||||
}
|
||||
}
|
||||
catch (RecognitionException re) {
|
||||
reportError(re);
|
||||
recover(input,re);
|
||||
retval.tree = (Object)adaptor.errorNode(input, retval.start, input.LT(-1), re);
|
||||
retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re);
|
||||
}
|
||||
finally {
|
||||
// do for sure before leaving
|
||||
@@ -104,5 +106,5 @@ public class XParser extends Parser {
|
||||
|
||||
|
||||
|
||||
public static final BitSet FOLLOW_9_in_program95 = new BitSet(new long[]{0x0000000000000002L});
|
||||
public static final BitSet FOLLOW_7_in_program256 = new BitSet(new long[]{0x0000000000000002L});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user