Esempio n. 1
0
        public void ConsumeBuffer(int CharCount)
        {
            //Consume/Remove the characters from the front of the buffer.

            if (CharCount <= m_buffer.Length)
            {
                // Count Carriage Returns and increment the internal column and line
                // numbers. This is done for the Developer and is not necessary for the
                // DFA algorithm.
                for (int n = 0; n <= CharCount - 1; n++)
                {
                    switch (m_buffer[n])
                    {
                        case '\n':
                            m_SysPosition = m_SysPosition.NextLine;
                            break;
                        case '\r':
                            break;
                        //Ignore, LF is used to inc line to be UNIX friendly
                        default:
                            m_SysPosition = m_SysPosition.NextColumn;
                            break;
                    }
                }

                m_buffer.Remove(0, CharCount);
            }
        }
Esempio n. 2
0
 protected Token(Symbol Parent, Position? position, bool isTerminal)
 {
     if ((Parent.Type != SymbolType.Nonterminal) ^ isTerminal)
     {
         throw new ParserException("Unexpected SymbolType");
     }
     m_Parent = Parent;
     m_Position = position;
 }
Esempio n. 3
0
 internal Terminal(Symbol Parent, string Text, Position sysPosition)
     : base(Parent, sysPosition, true)
 {
     m_Text = Text;
 }