private void HandleSetElementTokenReference(IIntSet elements, GrammarAST t) { int ttype; if (grammar.type == GrammarType.Lexer) { // recursively will invoke this rule to match elements in target rule ref IIntSet ruleSet = grammar.GetSetFromRule(this, t.Text); if (ruleSet == null) { ErrorManager.GrammarError(ErrorManager.MSG_RULE_INVALID_SET, grammar, t.Token, t.Text); } else { elements.AddAll(ruleSet); } } else { ttype = grammar.GetTokenType(t.Text); if (elements.Contains(ttype)) { ErrorManager.GrammarError(ErrorManager.MSG_DUPLICATE_SET_ENTRY, grammar, t.Token, t.Text); } elements.Add(ttype); } }
private void HandleSetElementStringLiteral(IIntSet elements, GrammarAST s) { int ttype = grammar.GetTokenType(s.Text); if (elements.Contains(ttype)) ErrorManager.GrammarError(ErrorManager.MSG_DUPLICATE_SET_ENTRY, grammar, s.Token, s.Text); elements.Add(ttype); }
public virtual bool Matches(int atom) { if (label == atom) { return(true); // handle the single atom case efficiently } if (IsSet) { return(_labelSet.Contains(atom)); } return(false); }
private void HandleSetElementCharLiteral(IIntSet elements, GrammarAST c) { int ttype; if (grammar.type == GrammarType.Lexer) ttype = Grammar.GetCharValueFromGrammarCharLiteral(c.Text); else ttype = grammar.GetTokenType(c.Text); if (elements.Contains(ttype)) ErrorManager.GrammarError(ErrorManager.MSG_DUPLICATE_SET_ENTRY, grammar, c.Token, c.Text); elements.Add(ttype); }
public virtual bool Matches(IIntSet set) { if (IsAtom) { return(set.Contains(Atom)); } if (IsSet) { // matches if intersection non-nil return(!Set.And(set).IsNil); } return(false); }
private void HandleSetElementTokenReference(IIntSet elements, GrammarAST t) { int ttype; if (grammar.type == GrammarType.Lexer) { // recursively will invoke this rule to match elements in target rule ref IIntSet ruleSet = grammar.GetSetFromRule(this, t.Text); if (ruleSet == null) ErrorManager.GrammarError(ErrorManager.MSG_RULE_INVALID_SET, grammar, t.Token, t.Text); else elements.AddAll(ruleSet); } else { ttype = grammar.GetTokenType(t.Text); if (elements.Contains(ttype)) ErrorManager.GrammarError(ErrorManager.MSG_DUPLICATE_SET_ENTRY, grammar, t.Token, t.Text); elements.Add(ttype); } }
public virtual bool Matches( IIntSet set ) { if ( IsAtom ) { return set.Contains( Atom ); } if ( IsSet ) { // matches if intersection non-nil return !Set.And( set ).IsNil; } return false; }