Antlr4.Semantics.AttributeChecks.Attr C# (CSharp) Method

Attr() public method

public Attr ( string expr, Antlr.Runtime.IToken x ) : void
expr string
x Antlr.Runtime.IToken
return void
        public virtual void Attr(string expr, IToken x)
        {
            if (g.IsLexer())
            {
                errMgr.GrammarError(ErrorType.ATTRIBUTE_IN_LEXER_ACTION,
                                    g.fileName, x, x.Text, expr);
                return;
            }
            if (node.resolver.ResolveToAttribute(x.Text, node) == null)
            {
                if (node.resolver.ResolvesToToken(x.Text, node))
                {
                    return; // $ID for token ref or label of token
                }
                if (node.resolver.ResolvesToListLabel(x.Text, node))
                {
                    return; // $ids for ids+=ID etc...
                }
                if (IsolatedRuleRef(x.Text) != null)
                {
                    errMgr.GrammarError(ErrorType.ISOLATED_RULE_REF,
                                        g.fileName, x, x.Text, expr);
                    return;
                }
                errMgr.GrammarError(ErrorType.UNKNOWN_SIMPLE_ATTRIBUTE,
                                    g.fileName, x, x.Text, expr);
            }
        }