예제 #1
0
        public INode Parse(ITokenEnumerator input, bool autoDisposing)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }
            if (OnParsePrepare() == false)
            {
                return(null);
            }

            Stack <int>   tempstack = new Stack <int>();
            Stack <INode> tempnodes = new Stack <INode>();

            m_handler.Reset();

            input.MoveNext();
            INode result = OnParse(input, tempstack, tempnodes);

            tempstack.Clear();
            tempnodes.Clear();

            if (autoDisposing)
            {
                input.Dispose();
            }

            OnParseCleanup(m_handler.FailCount > 0);
            return(result);
        }
예제 #2
0
        public virtual bool MoveNext()
        {
loop:
            if (!source.MoveNext())
            {
                return(false);
            }

            Token current = source.Current;

            if (ignoreEOL && current.type == TokenType.EOL)
            {
                goto loop;
            }

            this.current = current;
            return(true);
        }