ok, working on java again...same functionality as antlr-rewrite dir. ready to move forward

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 8664]
This commit is contained in:
parrt 2011-06-18 11:10:03 -08:00
parent 1a17eb3be1
commit bd5df8ed53
3 changed files with 6 additions and 6 deletions

View File

@ -134,7 +134,7 @@ public abstract class Lexer extends Recognizer<LexerSharedState, LexerInterprete
}
public void pushMode(int m) {
System.out.println("pushMode "+m);
// System.out.println("pushMode "+m);
if ( state.modeStack==null ) state.modeStack = new QStack<Integer>();
state.modeStack.push(state.mode);
mode(m);
@ -142,7 +142,7 @@ public abstract class Lexer extends Recognizer<LexerSharedState, LexerInterprete
public int popMode() {
if ( state.modeStack==null ) throw new EmptyStackException();
System.out.println("popMode back to "+state.modeStack.peek());
// System.out.println("popMode back to "+state.modeStack.peek());
mode( state.modeStack.pop() );
return state.mode;
}

View File

@ -6,8 +6,8 @@ import org.antlr.v4.runtime.dfa.*;
/** "dup" of ParserInterpreter */
public class LexerInterpreter extends ATNInterpreter {
public static boolean debug = true;
public static boolean dfa_debug = true;
public static boolean debug = false;
public static boolean dfa_debug = false;
public static final int NUM_EDGES = 255;
protected Lexer recog;
@ -54,7 +54,7 @@ public class LexerInterpreter extends ATNInterpreter {
}
public int exec(CharStream input, DFAState s0) {
if ( dfa_debug ) System.out.println("DFA[mode "+recog.state.mode+"] exec LA(1)=="+
if ( dfa_debug ) System.out.println("DFA[mode "+(recog==null?0:recog.state.mode)+"] exec LA(1)=="+
(char)input.LA(1));
//System.out.println("DFA start of execDFA: "+dfa[mode].toLexerString());
int prevAcceptMarker = -1;

View File

@ -8,6 +8,7 @@ import org.stringtemplate.v4.misc.MultiMap;
public class LexerGrammar extends Grammar {
public static final String DEFAULT_MODE_NAME = "DEFAULT_MODE";
/** DEFAULT_MODE rules are added first due to grammar syntax order */
public MultiMap<String, Rule> modes = new MultiMap<String, Rule>();
public LexerGrammar(Tool tool, GrammarRootAST ast) {
@ -26,7 +27,6 @@ public class LexerGrammar extends Grammar {
super(fileName, grammarText, listener);
}
@Override
public void defineRule(Rule r) {
super.defineRule(r);