Exemple #1
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);
        }
Exemple #2
0
 public void SetIterator(Lookahead2Enumerator <Token> it)
 {
     this.it = it;
 }