Get() публичный Метод

public Get ( string name ) : Attribute
name string
Результат Attribute
Пример #1
0
        public virtual Attribute ResolveRetvalOrProperty(string y)
        {
            if (retvals != null)
            {
                Attribute a = retvals.Get(y);
                if (a != null)
                {
                    return(a);
                }
            }
            AttributeDict d = GetPredefinedScope(LabelType.RULE_LABEL);

            return(d.Get(y));
        }
Пример #2
0
        /**  $x		Attribute: rule arguments, return values, predefined rule prop.
         */
        public virtual Attribute ResolveToAttribute(string x, ActionAST node)
        {
            if (args != null)
            {
                Attribute a = args.Get(x);
                if (a != null)
                {
                    return(a);
                }
            }
            if (retvals != null)
            {
                Attribute a = retvals.Get(x);
                if (a != null)
                {
                    return(a);
                }
            }
            if (locals != null)
            {
                Attribute a = locals.Get(x);
                if (a != null)
                {
                    return(a);
                }
            }
            AttributeDict properties = GetPredefinedScope(LabelType.RULE_LABEL);

            return(properties.Get(x));
        }
Пример #3
0
        /** $x.y, x can be surrounding rule, token/rule/label ref. y is visible
         *  attr in that dictionary.  Can't see args on rule refs.
         */
        public virtual Attribute ResolveToAttribute(string x, string y, ActionAST node)
        {
            if (tokenRefs.ContainsKey(x) && tokenRefs[x] != null)
            {
                // token ref in this alt?
                return(rule.GetPredefinedScope(LabelType.TOKEN_LABEL).Get(y));
            }

            if (ruleRefs.ContainsKey(x) && ruleRefs[x] != null)
            {
                // rule ref in this alt?
                // look up rule, ask it to resolve y (must be retval or predefined)
                return(rule.g.GetRule(x).ResolveRetvalOrProperty(y));
            }

            LabelElementPair anyLabelDef = GetAnyLabelDef(x);

            if (anyLabelDef != null && anyLabelDef.type == LabelType.RULE_LABEL)
            {
                return(rule.g.GetRule(anyLabelDef.element.Text).ResolveRetvalOrProperty(y));
            }
            else if (anyLabelDef != null)
            {
                AttributeDict scope = rule.GetPredefinedScope(anyLabelDef.type);
                if (scope == null)
                {
                    return(null);
                }

                return(scope.Get(y));
            }
            return(null);
        }
Пример #4
0
        /** $x.y	Attribute: x is surrounding rule, label ref (in any alts) */
        public virtual Attribute ResolveToAttribute(string x, string y, ActionAST node)
        {
            LabelElementPair anyLabelDef = GetAnyLabelDef(x);

            if (anyLabelDef != null)
            {
                if (anyLabelDef.type == LabelType.RULE_LABEL)
                {
                    return(g.GetRule(anyLabelDef.element.Text).ResolveRetvalOrProperty(y));
                }
                else
                {
                    AttributeDict scope = GetPredefinedScope(anyLabelDef.type);
                    if (scope == null)
                    {
                        return(null);
                    }

                    return(scope.Get(y));
                }
            }
            return(null);
        }