Exemplo n.º 1
0
 /// <summary>
 /// Parses a Param-List by Recursion
 /// </summary>
 /// <param name="m_Params">Start-Node of the Params-List</param>
 /// <param name="ListIn">Null</param>
 /// <returns></returns>
 static LinkedList <CmdDecl> ParseParams(Context Context, LinkedList <Tokenizer.Token> .Enumerator m_Params, LinkedList <CmdDecl> ListIn)
 {
     if (ListIn == null)
     {
         ListIn = new LinkedList <CmdDecl>();
     }
     //this tree starts with the first BaseType
     while (m_Params.MoveNext())
     {
         if (m_Params.Current.GetNodeType().Equals(typeof(Tokenizer.RuleBaseType)))
         {
             CmdDecl _Decl = new CmdDecl();
             _Decl.TryParse(Context, m_Params.Current);
             ListIn.AddLast(_Decl);
             ParseParams(Context, m_Params.Current.GetEnumerator(), ListIn);
         }
         else if (m_Params.Current.GetNodeType().Equals(typeof(Tokenizer.RuleMultiple)) ||
                  m_Params.Current.GetNodeType().Equals(typeof(Tokenizer.RuleSeparator)))
         {
             //more Params - go deeper into the tree
             ListIn = ParseParams(Context, m_Params.Current.GetEnumerator(), ListIn);
             // TODO else Param is missing
         }
     }
     return(ListIn);
 }
Exemplo n.º 2
0
            static LinkedList <CmdDecl> ParseLocals(Context Context, Tokenizer.Token m_Params, LinkedList <CmdDecl> ListIn)
            {
                if (ListIn == null)
                {
                    ListIn = new LinkedList <CmdDecl>();
                }

                LinkedList <Tokenizer.Token> .Enumerator Params = m_Params.GetEnumerator();
                while (Params.MoveNext())
                {
                    if (Params.Current.GetTopNodeType().Equals(typeof(Tokenizer.RuleDecl)))
                    {
                        CmdDecl x = new CmdDecl();
                        if (x.TryParse(Context, Params.Current))
                        {
                            ListIn.AddLast(x);
                        }
                        //more Params - go deeper into the tree
                        //Todo

                        /* LinkedList<Tokenizer.Token>.Enumerator ParamsNext = Params.Current.GetEnumerator();
                         * if (ParamsNext.MoveNext()) {    //Todo ??
                         *   ListIn = ParseLocals(Context, ParamsNext.Current, ListIn);
                         * }*/
                        // TODO else Param is missing
                    }
                    //Console.WriteLine(Params.Current.GetValue(false));
                }
                return(ListIn);
            }