/** Is this DFA derived from the NFA for the Tokens rule? */ public boolean isTokensRuleDecision() { if ( nfa.grammar.type!=Grammar.LEXER ) { return false; } NFAState nfaStart = getNFADecisionStartState(); Rule r = nfa.grammar.getLocallyDefinedRule(Grammar.ARTIFICIAL_TOKENS_RULENAME); NFAState TokensRuleStart = r.startState; NFAState TokensDecisionStart = (NFAState)TokensRuleStart.transition[0].target; return nfaStart == TokensDecisionStart; }
/** Return a string like "3:22: ( A {;} | B )" that describes this * decision. */ public String getDescription() { return dfa.getNFADecisionStartState().getDescription(); }
/** Return a string like "3:22: ( A {;} | B )" that describes this * decision. */ public String getDescription() { return dfa.getNFADecisionStartState().getDescription(); }
/** Is this DFA derived from the NFA for the Tokens rule? */ public boolean isTokensRuleDecision() { if ( nfa.grammar.type!=Grammar.LEXER ) { return false; } NFAState nfaStart = getNFADecisionStartState(); Rule r = nfa.grammar.getLocallyDefinedRule(Grammar.ARTIFICIAL_TOKENS_RULENAME); NFAState TokensRuleStart = r.startState; NFAState TokensDecisionStart = (NFAState)TokensRuleStart.transition[0].target; return nfaStart == TokensDecisionStart; }
/** Return a string like "3:22: ( A {;} | B )" that describes this * decision. */ public String getDescription() { return dfa.getNFADecisionStartState().getDescription(); }
/** Is this DFA derived from the NFA for the Tokens rule? */ public boolean isTokensRuleDecision() { if ( nfa.grammar.type!=Grammar.LEXER ) { return false; } NFAState nfaStart = getNFADecisionStartState(); Rule r = nfa.grammar.getLocallyDefinedRule(Grammar.ARTIFICIAL_TOKENS_RULENAME); NFAState TokensRuleStart = r.startState; NFAState TokensDecisionStart = (NFAState)TokensRuleStart.transition[0].target; return nfaStart == TokensDecisionStart; }
/** Return a string like "3:22: ( A {;} | B )" that describes this * decision. */ public String getDescription() { return dfa.getNFADecisionStartState().getDescription(); }
/** Is this DFA derived from the NFA for the Tokens rule? */ public boolean isTokensRuleDecision() { if ( nfa.grammar.type!=Grammar.LEXER ) { return false; } NFAState nfaStart = getNFADecisionStartState(); Rule r = nfa.grammar.getLocallyDefinedRule(Grammar.ARTIFICIAL_TOKENS_RULENAME); NFAState TokensRuleStart = r.startState; NFAState TokensDecisionStart = (NFAState)TokensRuleStart.transition[0].target; return nfaStart == TokensDecisionStart; }
/** From an alt number associated with artificial Tokens rule, return * the name of the token that is associated with that alt. */ public String getTokenNameForTokensRuleAlt(int alt) { NFAState decisionState = dfa.getNFADecisionStartState(); NFAState altState = dfa.nfa.grammar.getNFAStateForAltOfDecision(decisionState,alt); NFAState decisionLeft = (NFAState)altState.transition[0].target; RuleClosureTransition ruleCallEdge = (RuleClosureTransition)decisionLeft.transition[0]; NFAState ruleStartState = (NFAState)ruleCallEdge.target; //System.out.println("alt = "+decisionLeft.getEnclosingRule()); return ruleStartState.enclosingRule.name; }
/** From an alt number associated with artificial Tokens rule, return * the name of the token that is associated with that alt. */ public String getTokenNameForTokensRuleAlt(int alt) { NFAState decisionState = dfa.getNFADecisionStartState(); NFAState altState = dfa.nfa.grammar.getNFAStateForAltOfDecision(decisionState,alt); NFAState decisionLeft = (NFAState)altState.transition[0].target; RuleClosureTransition ruleCallEdge = (RuleClosureTransition)decisionLeft.transition[0]; NFAState ruleStartState = (NFAState)ruleCallEdge.target; //System.out.println("alt = "+decisionLeft.getEnclosingRule()); return ruleStartState.enclosingRule.name; }
/** From an alt number associated with artificial Tokens rule, return * the name of the token that is associated with that alt. */ public String getTokenNameForTokensRuleAlt(int alt) { NFAState decisionState = dfa.getNFADecisionStartState(); NFAState altState = dfa.nfa.grammar.getNFAStateForAltOfDecision(decisionState,alt); NFAState decisionLeft = (NFAState)altState.transition[0].target; RuleClosureTransition ruleCallEdge = (RuleClosureTransition)decisionLeft.transition[0]; NFAState ruleStartState = (NFAState)ruleCallEdge.target; //System.out.println("alt = "+decisionLeft.getEnclosingRule()); return ruleStartState.enclosingRule.name; }
/** From an alt number associated with artificial Tokens rule, return * the name of the token that is associated with that alt. */ public String getTokenNameForTokensRuleAlt(int alt) { NFAState decisionState = dfa.getNFADecisionStartState(); NFAState altState = dfa.nfa.grammar.getNFAStateForAltOfDecision(decisionState,alt); NFAState decisionLeft = (NFAState)altState.transition[0].target; RuleClosureTransition ruleCallEdge = (RuleClosureTransition)decisionLeft.transition[0]; NFAState ruleStartState = (NFAState)ruleCallEdge.target; //System.out.println("alt = "+decisionLeft.getEnclosingRule()); return ruleStartState.enclosingRule.name; }
private void computeRuleError(GrammarError error, GrammarUnreachableAltsMessage message) { NFAState state = message.probe.dfa.getNFADecisionStartState(); for (Object alt : message.alts) { error.addUnreachableAlt(state, (Integer) alt); error.addStates(state); error.addRule(state.enclosingRule.name); } }
private void computeRuleError(GrammarError error, NonRegularDecisionMessage message) { NFAState state = message.probe.dfa.getNFADecisionStartState(); for (Object alt : message.altsWithRecursion) { // Use currently the unreachable alt for display purpose only error.addUnreachableAlt(state, (Integer) alt); error.addStates(state); error.addRule(state.enclosingRule.name); } }
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 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 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); }