/** add an EOF transition to any rule end NFAState that points to nothing * (i.e., for all those rules not invoked by another rule). These * are start symbols then. * * Return the number of grammar entry points; i.e., how many rules are * not invoked by another rule (they can only be invoked from outside). * These are the start rules. */ public int build_EOFStates(Collection<Rule> rules) { int numberUnInvokedRules = 0; for (Rule r : rules) { NFAState endNFAState = r.stopState; // Is this rule a start symbol? (no follow links) if ( endNFAState.transition[0] ==null ) { // if so, then don't let algorithm fall off the end of // the rule, make it hit EOF/EOT. build_EOFState(endNFAState); // track how many rules have been invoked by another rule numberUnInvokedRules++; } } return numberUnInvokedRules; }
/** add an EOF transition to any rule end NFAState that points to nothing * (i.e., for all those rules not invoked by another rule). These * are start symbols then. * * Return the number of grammar entry points; i.e., how many rules are * not invoked by another rule (they can only be invoked from outside). * These are the start rules. */ public int build_EOFStates(Collection<Rule> rules) { int numberUnInvokedRules = 0; for (Rule r : rules) { NFAState endNFAState = r.stopState; // Is this rule a start symbol? (no follow links) if ( endNFAState.transition[0] ==null ) { // if so, then don't let algorithm fall off the end of // the rule, make it hit EOF/EOT. build_EOFState(endNFAState); // track how many rules have been invoked by another rule numberUnInvokedRules++; } } return numberUnInvokedRules; }
/** add an EOF transition to any rule end NFAState that points to nothing * (i.e., for all those rules not invoked by another rule). These * are start symbols then. * * Return the number of grammar entry points; i.e., how many rules are * not invoked by another rule (they can only be invoked from outside). * These are the start rules. */ public int build_EOFStates(List rules) { int numberUnInvokedRules = 0; for (Iterator iterator = rules.iterator(); iterator.hasNext();) { Rule r = (Rule) iterator.next(); NFAState endNFAState = r.stopState; // Is this rule a start symbol? (no follow links) if ( endNFAState.transition[0] ==null ) { // if so, then don't let algorithm fall off the end of // the rule, make it hit EOF/EOT. build_EOFState(endNFAState); // track how many rules have been invoked by another rule numberUnInvokedRules++; } } return numberUnInvokedRules; }
/** add an EOF transition to any rule end NFAState that points to nothing * (i.e., for all those rules not invoked by another rule). These * are start symbols then. * * Return the number of grammar entry points; i.e., how many rules are * not invoked by another rule (they can only be invoked from outside). * These are the start rules. */ public int build_EOFStates(List rules) { int numberUnInvokedRules = 0; for (Iterator iterator = rules.iterator(); iterator.hasNext();) { Rule r = (Rule) iterator.next(); NFAState endNFAState = r.stopState; // Is this rule a start symbol? (no follow links) if ( endNFAState.transition[0] ==null ) { // if so, then don't let algorithm fall off the end of // the rule, make it hit EOF/EOT. build_EOFState(endNFAState); // track how many rules have been invoked by another rule numberUnInvokedRules++; } } return numberUnInvokedRules; }