Inheritance: SrcOp
示例#1
0
        public virtual void AddDecl(Decl d)
        {
            d.ctx = this;

            if (d is ContextGetterDecl)
                getters.Add(d);
            else
                attrs.Add(d);

            // add to specific "lists"
            if (d is TokenTypeDecl)
            {
                tokenTypeDecls.Add(d);
            }
            else if (d is TokenListDecl)
            {
                tokenListDecls.Add(d);
            }
            else if (d is TokenDecl)
            {
                tokenDecls.Add(d);
            }
            else if (d is RuleContextListDecl)
            {
                ruleContextListDecls.Add(d);
            }
            else if (d is RuleContextDecl)
            {
                ruleContextDecls.Add(d);
            }
            else if (d is AttributeDecl)
            {
                attributeDecls.Add(d);
            }
        }
示例#2
0
 /** Add local var decl */
 public virtual void AddLocalDecl(Decl d)
 {
     if (locals == null)
         locals = new OrderedHashSet<Decl>();
     locals.Add(d);
     d.isLocal = true;
 }
示例#3
0
 /** Add local var decl */
 public virtual void AddLocalDecl(Decl.Decl d)
 {
     if (locals == null)
     {
         locals = new OrderedHashSet <Decl.Decl>();
     }
     locals.Add(d);
     d.isLocal = true;
 }
示例#4
0
        /** Add decl to struct ctx for rule or alt if labeled */
        public virtual void AddContextDecl(string altLabel, Decl.Decl d)
        {
            CodeBlockForOuterMostAlt alt = d.GetOuterMostAltCodeBlock();

            // if we found code blk and might be alt label, try to add to that label ctx
            if (alt != null && altLabelCtxs != null)
            {
                //System.Console.WriteLine(d.name + " lives in alt " + alt.alt.altNum);
                AltLabelStructDecl altCtx;
                if (altLabel != null && altLabelCtxs.TryGetValue(altLabel, out altCtx))
                {
                    // we have an alt ctx
                    //System.Console.WriteLine("ctx is " + altCtx.name);
                    altCtx.AddDecl(d);
                    return;
                }
            }
            ruleCtx.AddDecl(d); // stick in overall rule's ctx
        }
示例#5
0
        public virtual void AddDecl(Decl d)
        {
            d.ctx = this;

            if (d is ContextGetterDecl)
            {
                getters.Add(d);
            }
            else
            {
                attrs.Add(d);
            }

            // add to specific "lists"
            if (d is TokenTypeDecl)
            {
                tokenTypeDecls.Add(d);
            }
            else if (d is TokenListDecl)
            {
                tokenListDecls.Add(d);
            }
            else if (d is TokenDecl)
            {
                tokenDecls.Add(d);
            }
            else if (d is RuleContextListDecl)
            {
                ruleContextListDecls.Add(d);
            }
            else if (d is RuleContextDecl)
            {
                ruleContextDecls.Add(d);
            }
            else if (d is AttributeDecl)
            {
                attributeDecls.Add(d);
            }
        }
示例#6
0
 /** Add decl to struct ctx for rule or alt if labeled */
 public virtual void AddContextDecl(string altLabel, Decl.Decl d)
 {
     CodeBlockForOuterMostAlt alt = d.GetOuterMostAltCodeBlock();
     // if we found code blk and might be alt label, try to add to that label ctx
     if (alt != null && altLabelCtxs != null)
     {
         //System.Console.WriteLine(d.name + " lives in alt " + alt.alt.altNum);
         AltLabelStructDecl altCtx;
         if (altLabel != null && altLabelCtxs.TryGetValue(altLabel, out altCtx))
         {
             // we have an alt ctx
             //System.Console.WriteLine("ctx is " + altCtx.name);
             altCtx.AddDecl(d);
             return;
         }
     }
     ruleCtx.AddDecl(d); // stick in overall rule's ctx
 }