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

QualifiedAttr() public method

public QualifiedAttr ( string expr, Antlr.Runtime.IToken x, Antlr.Runtime.IToken y ) : void
expr string
x Antlr.Runtime.IToken
y Antlr.Runtime.IToken
return void
        public virtual void QualifiedAttr(string expr, IToken x, IToken y)
        {
            if (g.IsLexer())
            {
                errMgr.GrammarError(ErrorType.ATTRIBUTE_IN_LEXER_ACTION,
                                    g.fileName, x, x.Text + "." + y.Text, expr);
                return;
            }
            if (node.resolver.ResolveToAttribute(x.Text, node) != null)
            {
                // must be a member access to a predefined attribute like $ctx.foo
                Attr(expr, x);
                return;
            }

            if (node.resolver.ResolveToAttribute(x.Text, y.Text, node) == null)
            {
                Rule rref = IsolatedRuleRef(x.Text);
                if (rref != null)
                {
                    if (rref.args != null && rref.args.Get(y.Text) != null)
                    {
                        g.tool.errMgr.GrammarError(ErrorType.INVALID_RULE_PARAMETER_REF,
                                                  g.fileName, y, y.Text, rref.name, expr);
                    }
                    else
                    {
                        errMgr.GrammarError(ErrorType.UNKNOWN_RULE_ATTRIBUTE,
                                                  g.fileName, y, y.Text, rref.name, expr);
                    }
                }
                else if (!node.resolver.ResolvesToAttributeDict(x.Text, node))
                {
                    errMgr.GrammarError(ErrorType.UNKNOWN_SIMPLE_ATTRIBUTE,
                                              g.fileName, x, x.Text, expr);
                }
                else
                {
                    errMgr.GrammarError(ErrorType.UNKNOWN_ATTRIBUTE_IN_SCOPE,
                                              g.fileName, y, y.Text, expr);
                }
            }
        }