예제 #1
0
파일: Lexer.cs 프로젝트: cwellsx/GOLDEngine
        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);
            }
        }
예제 #2
0
파일: Token.cs 프로젝트: cwellsx/GOLDEngine
 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;
 }
예제 #3
0
 internal Terminal(Symbol Parent, string Text, Position sysPosition)
     : base(Parent, sysPosition, true)
 {
     m_Text = Text;
 }