public INode Parse(TextReader stream)
        {
            List <Token> input             = this.Scan(stream);
            IExtendedEnumerator <Token> it = this.Filter(input);

            return(this.Parse(it));
        }
Пример #2
0
 public Lookahead2Enumerator(List <T> input)
 {
     this.next     = default(T);
     this.nextnext = default(T);
     this.it       = new ExtendedEnumerator <T>(input);
     if (this.it.HasNext())
     {
         this.next = this.it.Next();
     }
     if (this.it.HasNext())
     {
         this.nextnext = this.it.Next();
     }
 }
Пример #3
0
        public INode Parse(IExtendedEnumerator <Token> input)
        {
            INode node;

            if (!input.HasNext())
            {
                return(null);
            }
            this.it = new Lookahead2Enumerator <Token>(input);
            try
            {
                node = this.ParseSubExpression();
            }
            catch (Colosoft.Text.Jep.ParseException exception)
            {
                if (this.it.PeekNext() != null)
                {
                    exception.SetPosition(this.it.PeekNext().GetLineNumber(), this.it.PeekNext().GetColumnNumber());
                }
                throw exception;
            }
            if (this.it.PeekNext() != null)
            {
                string str = this.it.PeekNext().ToString();
                if (this.it.PeekNextnext() != null)
                {
                    str = str + ", " + this.it.PeekNextnext();
                }
                Colosoft.Text.Jep.ParseException exception2 = new Colosoft.Text.Jep.ParseException("Tokens still remaining after parse completed", this.it.PeekNext().GetLineNumber(), this.it.PeekNext().GetColumnNumber());
                throw exception2;
            }
            if (this.nodes.Count != 0)
            {
                throw new Colosoft.Text.Jep.ParseException("Only one node should be of stack after parsing, it has " + this.nodes.Count);
            }
            return(node);
        }
        public INode ContinueParse()
        {
            List <Token> list;

Label_0000:
            list = this.Scan();
            if (list == null)
            {
                return(null);
            }
            IExtendedEnumerator <Token> it = this.Filter(list);

            if (!it.MoveNext())
            {
                goto Label_0000;
            }
            INode node = this.Parse(it);

            if (node == null)
            {
                goto Label_0000;
            }
            return(node);
        }
        public INode Parse(IExtendedEnumerator <Token> it)
        {
            ShuntingYard yard = new ShuntingYard(this.jep, this.g);

            return(yard.Parse(it));
        }
 public WSCEnumerator(IExtendedEnumerator <Token> input)
 {
     this.input = input;
     this.Grab();
 }
 public IExtendedEnumerator <Token> Filter(IExtendedEnumerator <Token> tokens)
 {
     return(new WSCEnumerator(tokens));
 }