• Home
  • Raw
  • Download

Lines Matching full:follow

128          *  to the set of symbols that can follow rule ref.
131 public virtual object Match(IIntStream input, int ttype, BitSet follow) { in Match() argument
144 matchedSymbol = RecoverFromMismatchedToken(input, ttype, follow); in Match()
159 public virtual bool MismatchIsMissingToken(IIntStream input, BitSet follow) { in MismatchIsMissingToken() argument
160 if (follow == null) { in MismatchIsMissingToken()
161 // we have no information about the follow; we can only consume in MismatchIsMissingToken()
165 // compute what can follow this grammar element reference in MismatchIsMissingToken()
166 if (follow.Member(TokenTypes.EndOfRule)) { in MismatchIsMissingToken()
168 follow = follow.Or(viableTokensFollowingThisRule); in MismatchIsMissingToken()
170 follow.Remove(TokenTypes.EndOfRule); in MismatchIsMissingToken()
177 //System.out.println("viable tokens="+follow.toString(getTokenNames())); in MismatchIsMissingToken()
181 // in follow set to indicate that the fall of the start symbol is in MismatchIsMissingToken()
182 // in the set (EOF can follow). in MismatchIsMissingToken()
183 if (follow.Member(input.LA(1)) || follow.Member(TokenTypes.EndOfRule)) { in MismatchIsMissingToken()
406 * follow that rule reference on the stack; this amounts to
408 * enclosing rule. This local follow set only includes tokens
417 * can legally follow a call to r *or* any rule that called r.
432 * At each rule invocation, the set of tokens that could follow
434 * follow sets:
436 * FOLLOW(b1_in_a) = FIRST(']') = ']'
437 * FOLLOW(b2_in_a) = FIRST(')') = ')'
438 * FOLLOW(c_in_b) = FIRST('^') = '^'
444 * and, hence, the follow context stack is:
446 * depth local follow set after call to rule
455 * For error recovery, we cannot consider FOLLOW(c)
457 * all context-sensitive FOLLOW sets--the set of all tokens that
458 * could follow any reference in the call chain. We need to
459 * resync to one of those tokens. Note that FOLLOW(c)='^' and if
492 * Like Grosch I implemented local FOLLOW sets that are combined
500 * Compute the context-sensitive FOLLOW set for current rule.
501 * This is set of token types that can follow a specific rule
505 * definition of plain FOLLOW for rule r:
508 * FOLLOW(r)={x | S=>*alpha r beta in G and x in FIRST(beta)}
512 * FOLLOW(r) is the set of all tokens that can possibly follow
520 * stat : ID '=' expr ';' // FOLLOW(stat)=={EOF}
523 * expr : atom ('+' atom)* ; // FOLLOW(expr)=={';','.',')'}
524 * atom : INT // FOLLOW(atom)=={'+',')',';','.'}
528 * The FOLLOW sets are all inclusive whereas context-sensitive
529 * FOLLOW sets are precisely what could follow a rule reference.
543 * What can follow that specific nested ref to atom? Exactly ')'
545 * input. Contrast this with the FOLLOW(atom)={'+',')',';','.'}.
567 System.out.println("local follow depth "+i+"="+ in CombineFollows()
575 // us know if have to include follow(start rule); i.e., EOF in CombineFollows()
613 * is in the set of tokens that can follow the ')' token
616 … protected virtual object RecoverFromMismatchedToken(IIntStream input, int ttype, BitSet follow) { in RecoverFromMismatchedToken() argument
636 if (MismatchIsMissingToken(input, follow)) { in RecoverFromMismatchedToken()
637 object inserted = GetMissingSymbol(input, e, ttype, follow); in RecoverFromMismatchedToken()
650 BitSet follow) { in RecoverFromMismatchedSet() argument
651 if (MismatchIsMissingToken(input, follow)) { in RecoverFromMismatchedSet()
655 return GetMissingSymbol(input, e, TokenTypes.Invalid, follow); in RecoverFromMismatchedSet()
700 BitSet follow) { in GetMissingSymbol() argument
724 /** <summary>Push a rule's follow set using our own hardcoded stack</summary> */