private void transitionBetweenStates(NFAState a, NFAState b, int label) { Transition e = new Transition(label,b); a.addTransition(e); } }
private void transitionBetweenStates(NFAState a, NFAState b, int label) { Transition e = new Transition(label,b); a.addTransition(e); } }
private void transitionBetweenStates(NFAState a, NFAState b, int label) { Transition e = new Transition(label,b); a.addTransition(e); } }
private void transitionBetweenStates(NFAState a, NFAState b, int label) { Transition e = new Transition(label,b); a.addTransition(e); } }
/** set up an NFA NFAState that will yield eof tokens or, * in the case of a lexer grammar, an EOT token when the conversion * hits the end of a rule. */ private void build_EOFState(NFAState endNFAState) { NFAState end = newState(); int label = Label.EOF; if ( nfa.grammar.type==Grammar.LEXER ) { label = Label.EOT; end.setEOTTargetState(true); } /* System.out.println("build "+nfa.grammar.getTokenDisplayName(label)+ " loop on end of state "+endNFAState.getDescription()+ " to state "+end.stateNumber); */ Transition toEnd = new Transition(label, end); endNFAState.addTransition(toEnd); }
/** Build what amounts to an epsilon transition with a semantic * predicate action. The pred is a pointer into the AST of * the SEMPRED token. */ public StateCluster build_SemanticPredicate(GrammarAST pred) { // don't count syn preds if ( !pred.getText().toUpperCase() .startsWith(Grammar.SYNPRED_RULE_PREFIX.toUpperCase()) ) { nfa.grammar.numberOfSemanticPredicates++; } NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new PredicateLabel(pred), right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build what amounts to an epsilon transition with a semantic * predicate action. The pred is a pointer into the AST of * the SEMPRED token. */ public StateCluster build_SemanticPredicate(GrammarAST pred) { // don't count syn preds if ( !pred.getText().toUpperCase() .startsWith(Grammar.SYNPRED_RULE_PREFIX.toUpperCase()) ) { nfa.grammar.numberOfSemanticPredicates++; } NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new PredicateLabel(pred), right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build what amounts to an epsilon transition with a semantic * predicate action. The pred is a pointer into the AST of * the SEMPRED token. */ public StateCluster build_SemanticPredicate(GrammarAST pred) { // don't count syn preds if ( !pred.getText().toUpperCase() .startsWith(Grammar.SYNPRED_RULE_PREFIX.toUpperCase()) ) { nfa.grammar.numberOfSemanticPredicates++; } NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new PredicateLabel(pred), right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** From set build single edge graph o->o-set->o. To conform to * what an alt block looks like, must have extra state on left. */ public StateCluster build_Set(IntSet set, GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(set); Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** From set build single edge graph o->o-set->o. To conform to * what an alt block looks like, must have extra state on left. */ public StateCluster build_Set(IntSet set, GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(set); Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** From set build single edge graph o->o-set->o. To conform to * what an alt block looks like, must have extra state on left. */ public StateCluster build_Set(IntSet set, GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(set); Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** From set build single edge graph o->o-set->o. To conform to * what an alt block looks like, must have extra state on left. */ public StateCluster build_Set(IntSet set, GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(set); Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build an atom with all possible values in its label */ public StateCluster build_Wildcard(GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(nfa.grammar.getTokenTypes()); // char or tokens Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build what amounts to an epsilon transition with an action. * The action goes into NFA though it is ignored during analysis. * It slows things down a bit, but I must ignore predicates after * having seen an action (5-5-2008). */ public StateCluster build_Action(GrammarAST action) { NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new ActionLabel(action), right); left.addTransition(e); return new StateCluster(left, right); }
/** Build an atom with all possible values in its label */ public StateCluster build_Wildcard(GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(nfa.grammar.getTokenTypes()); // char or tokens Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build an atom with all possible values in its label */ public StateCluster build_Wildcard(GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(nfa.grammar.getTokenTypes()); // char or tokens Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build what amounts to an epsilon transition with an action. * The action goes into NFA though it is ignored during analysis. * It slows things down a bit, but I must ignore predicates after * having seen an action (5-5-2008). */ public StateCluster build_Action(GrammarAST action) { NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new ActionLabel(action), right); left.addTransition(e); return new StateCluster(left, right); }
/** Build an atom with all possible values in its label */ public StateCluster build_Wildcard(GrammarAST associatedAST) { NFAState left = newState(); NFAState right = newState(); left.associatedASTNode = associatedAST; right.associatedASTNode = associatedAST; Label label = new Label(nfa.grammar.getTokenTypes()); // char or tokens Transition e = new Transition(label,right); left.addTransition(e); StateCluster g = new StateCluster(left, right); return g; }
/** Build what amounts to an epsilon transition with an action. * The action goes into NFA though it is ignored during analysis. * It slows things down a bit, but I must ignore predicates after * having seen an action (5-5-2008). */ public StateCluster build_Action(GrammarAST action) { NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new ActionLabel(action), right); left.addTransition(e); return new StateCluster(left, right); }
/** Build what amounts to an epsilon transition with an action. * The action goes into NFA though it is ignored during analysis. * It slows things down a bit, but I must ignore predicates after * having seen an action (5-5-2008). */ public StateCluster build_Action(GrammarAST action) { NFAState left = newState(); NFAState right = newState(); Transition e = new Transition(new ActionLabel(action), right); left.addTransition(e); return new StateCluster(left, right); }