コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private string[] ParseParameterList(CTokenReader Tokens, bool JustIdentifiers = false)
        {
            //Console.WriteLine("++++++++");
            var Params = new List <string>();

            Tokens.ExpectCurrentAndMoveNextSpace("(");
            while (Tokens.HasMore && Tokens.Current.Raw != ")")
            {
                string Param = "";

                if (JustIdentifiers)
                {
                    Param = Tokens.Current.Raw;
                    Tokens.MoveNextNoSpace();
                    if (Tokens.Current.Raw == ",")
                    {
                        Tokens.ExpectCurrentAndMoveNextNoSpace(",");
                    }
                }
                else
                {
                    int OpenCount = 0;
                    while (Tokens.HasMore)
                    {
                        if (Tokens.Current.Raw == ")")
                        {
                            if (OpenCount <= 0)
                            {
                                break;
                            }
                            else
                            {
                                OpenCount--;
                            }
                        }
                        Param += Tokens.Current.Raw;
                        if (Tokens.Current.Raw == "(")
                        {
                            OpenCount++;
                        }
                        Tokens.MoveNextSpace();
                        if (Tokens.Current.Raw == "," && OpenCount == 0)
                        {
                            Tokens.ExpectCurrentAndMoveNextNoSpace(",");
                            break;
                        }
                    }
                }

                //Console.WriteLine("aa: {0} : {1}", Param, Tokens.Current);
                Params.Add(Param);
            }
            //Console.WriteLine("--------");
            Tokens.ExpectCurrentAndMoveNextSpace(")");
            return(Params.ToArray());
        }
コード例 #2
0
        private string ReadTokensUntilEnd()
        {
            var Out = "";

            while (Tokens.HasMore)
            {
                Out += Tokens.Current.Raw;
                Tokens.ExpectCurrentAndMoveNextSpace();
            }
            return(Out);
        }