private void updateLineColumnToLookaheadDFAMap(DFA lookaheadDFA) { GrammarAST decisionAST = nfa.grammar.getDecisionBlockAST(lookaheadDFA.decisionNumber); int line = decisionAST.getLine(); int col = decisionAST.getCharPositionInLine(); lineColumnToLookaheadDFAMap.put(new StringBuffer().append(line).append(":") .append(col).toString(), lookaheadDFA); }
private void updateLineColumnToLookaheadDFAMap(DFA lookaheadDFA) { GrammarAST decisionAST = nfa.grammar.getDecisionBlockAST(lookaheadDFA.decisionNumber); int line = decisionAST.getLine(); int col = decisionAST.getCharPositionInLine(); lineColumnToLookaheadDFAMap.put(new StringBuffer().append(line).append(":") .append(col).toString(), lookaheadDFA); }
private void updateLineColumnToLookaheadDFAMap(DFA lookaheadDFA) { GrammarAST decisionAST = nfa.grammar.getDecisionBlockAST(lookaheadDFA.decisionNumber); int line = decisionAST.getLine(); int col = decisionAST.getColumn(); lineColumnToLookaheadDFAMap.put(new StringBuffer().append(line + ":") .append(col).toString(), lookaheadDFA); }
private void updateLineColumnToLookaheadDFAMap(DFA lookaheadDFA) { GrammarAST decisionAST = nfa.grammar.getDecisionBlockAST(lookaheadDFA.decisionNumber); int line = decisionAST.getLine(); int col = decisionAST.getColumn(); lineColumnToLookaheadDFAMap.put(new StringBuffer().append(line + ":") .append(col).toString(), lookaheadDFA); }
public String grammarTreeToString(GrammarAST t, boolean showActions) { String s = null; try { s = t.getLine()+":"+t.getColumn()+": "; s += new ANTLRTreePrinter().toString((AST)t, this, showActions); } catch (Exception e) { s = "<invalid or missing tree structure>"; } return s; }
public String grammarTreeToString(GrammarAST t, boolean showActions) { String s = null; try { s = t.getLine()+":"+t.getColumn()+": "; s += new ANTLRTreePrinter().toString((AST)t, this, showActions); } catch (Exception e) { s = "<invalid or missing tree structure>"; } return s; }
public String toString() { GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode(); line = decisionASTNode.getLine(); column = decisionASTNode.getColumn(); String fileName = probe.dfa.nfa.grammar.getFileName(); if ( fileName!=null ) { file = fileName; } StringTemplate st = getMessageTemplate(); String ruleName = probe.dfa.getNFADecisionStartState().enclosingRule.name; st.setAttribute("ruleName", ruleName); List sortedAlts = new ArrayList(); sortedAlts.addAll(altsWithRecursion); Collections.sort(sortedAlts); // make sure it's 1, 2, ... st.setAttribute("alts", sortedAlts); return super.toString(st); }
public String grammarTreeToString(GrammarAST t, boolean showActions) { String s; try { s = t.getLine()+":"+(t.getCharPositionInLine()+1)+": "; s += new ANTLRTreePrinter(new CommonTreeNodeStream(t)).toString(this, showActions); } catch (Exception e) { s = "<invalid or missing tree structure>"; } return s; }
public String grammarTreeToString(GrammarAST t, boolean showActions) { String s; try { s = t.getLine()+":"+(t.getCharPositionInLine()+1)+": "; s += new ANTLRTreePrinter(new CommonTreeNodeStream(t)).toString(this, showActions); } catch (Exception e) { s = "<invalid or missing tree structure>"; } return s; }
private GrammarError buildUnreachableAltsError(GrammarUnreachableAltsMessage message) { GrammarError error = new GrammarError(); error.setLine(message.probe.dfa.getDecisionASTNode().getLine()-1); error.setMessageText("The following alternatives are unreachable: "+message.alts); error.setMessage(message); return error; }
/** Make nodes unique based upon Token so we can add them to a Set; if * not a GrammarAST, check type. */ public boolean equals(Object ast) { if ( this == ast ) { return true; } if ( !(ast instanceof GrammarAST) ) { return this.getType() == ((AST)ast).getType(); } GrammarAST t = (GrammarAST)ast; return token.getLine() == t.getLine() && token.getColumn() == t.getColumn(); }
/** Make nodes unique based upon Token so we can add them to a Set; if * not a GrammarAST, check type. */ public boolean equals(Object ast) { if ( this == ast ) { return true; } if ( !(ast instanceof GrammarAST) ) { return this.getType() == ((AST)ast).getType(); } GrammarAST t = (GrammarAST)ast; return token.getLine() == t.getLine() && token.getColumn() == t.getColumn(); }
/** Make nodes unique based upon Token so we can add them to a Set; if * not a GrammarAST, check type. */ @Override public boolean equals(Object ast) { if ( this == ast ) { return true; } if ( !(ast instanceof GrammarAST) ) { return this.getType() == ((Tree)ast).getType(); } GrammarAST t = (GrammarAST)ast; return token.getLine() == t.getLine() && token.getCharPositionInLine() == t.getCharPositionInLine(); }
/** Make nodes unique based upon Token so we can add them to a Set; if * not a GrammarAST, check type. */ @Override public boolean equals(Object ast) { if ( this == ast ) { return true; } if ( !(ast instanceof GrammarAST) ) { return this.getType() == ((Tree)ast).getType(); } GrammarAST t = (GrammarAST)ast; return token.getLine() == t.getLine() && token.getCharPositionInLine() == t.getCharPositionInLine(); }
private GrammarError buildNonRegularDecisionError(NonRegularDecisionMessage message) { GrammarError error = new GrammarError(); error.setLine(message.probe.dfa.getDecisionASTNode().getLine()-1); error.setMessageText(message.toString()); error.setMessage(message); return error; }
public String toString() { GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode(); line = decisionASTNode.getLine(); column = decisionASTNode.getColumn(); String fileName = probe.dfa.nfa.grammar.getFileName(); if ( fileName!=null ) { file = fileName; } StringTemplate st = getMessageTemplate(); st.setAttribute("enclosingRule", probe.dfa.getNFADecisionStartState().enclosingRule.name); return super.toString(st); }
public String toString() { GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode(); line = decisionASTNode.getLine(); column = decisionASTNode.getColumn(); String fileName = probe.dfa.nfa.grammar.getFileName(); if ( fileName!=null ) { file = fileName; } StringTemplate st = getMessageTemplate(); st.setAttribute("enclosingRule", probe.dfa.getNFADecisionStartState().enclosingRule.name); return super.toString(st); }
@Override public String toString() { GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode(); line = decisionASTNode.getLine(); column = decisionASTNode.getCharPositionInLine(); String fileName = probe.dfa.nfa.grammar.getFileName(); if ( fileName!=null ) { file = fileName; } ST st = getMessageTemplate(); st.add("enclosingRule", probe.dfa.getNFADecisionStartState().enclosingRule.name); return super.toString(st); }
@Override public String toString() { GrammarAST decisionASTNode = probe.dfa.getDecisionASTNode(); line = decisionASTNode.getLine(); column = decisionASTNode.getCharPositionInLine(); String fileName = probe.dfa.nfa.grammar.getFileName(); if ( fileName!=null ) { file = fileName; } ST st = getMessageTemplate(); st.add("enclosingRule", probe.dfa.getNFADecisionStartState().enclosingRule.name); return super.toString(st); }
private GrammarError buildNonDeterministicError(GrammarNonDeterminismMessage message) { GrammarError error = new GrammarError(); error.setLine(message.probe.dfa.getDecisionASTNode().getLine()-1); List labels = message.probe.getSampleNonDeterministicInputSequence(message.problemState); error.setLabels(labels); String input = message.probe.getInputSequenceDisplay(labels); error.setMessageText("Decision can match input such as \""+input+"\" using multiple alternatives"); error.setMessage(message); return error; }