Beispiel #1
0
        public object Parse(string Text, ref int Index, int LastIndex, Node.Node Storage = null)
        {
            if (!IsParseOk(this, Text, ref Index, LastIndex))
            {
                return(null);
            }

            if (string.IsNullOrEmpty(Text))
            {
                return(NoOp);
            }

            while (Index < LastIndex)
            {
                object Node = null;

                ConsumeWhitespace(Text, ref Index);

                if (Index >= LastIndex)
                {
                    break;
                }

                for (int i = 0; i < ExpressionParsers.Count; i++)
                {
                    Node = ExpressionParsers[i](this, Text, ref Index, LastIndex);

                    if (Node == null)
                    {
                        continue;
                    }

                    if (Storage == null)
                    {
                        return(Node);
                    }
                    else if (Node == NoOp)
                    {
                        break;
                    }
                    else
                    {
                        Storage.Add(Node);
                        break;
                    }
                }

                if (Node == null)
                {
                    return(null);
                }
                else if (Node == Continue || Node == Break)
                {
                    break;
                }
            }

            return(Storage);
        }
Beispiel #2
0
 public object Parse(string Text, int Index, Node.Node Storage = null)
 {
     return(Parse(Text, ref Index, Text.Length > 1 ? Text.Length : 1, Storage));
 }