예제 #1
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;
 }
예제 #2
0
 internal Production(Symbol Head, short TableIndex, SymbolList Handle)
 {
     m_Head = Head;
     m_Handle = Handle;
     m_TableIndex = TableIndex;
 }
예제 #3
0
파일: Token.cs 프로젝트: cwellsx/GOLDEngine
 internal void TrimReduction(Symbol newSymbol)
 {
     m_Parent = newSymbol;
 }
예제 #4
0
파일: Lexer.cs 프로젝트: cwellsx/GOLDEngine
        Terminal CreateTerminal(Symbol symbol, int Count)
        {
            //Return Count characters from the lookahead buffer. DO NOT CONSUME
            //This is used to create the text stored in a token. It is disgarded
            //separately. Because of the design of the DFA algorithm, count should
            //never exceed the buffer length. The If-Statement below is fault-tolerate
            //programming, but not necessary.

            if (Count > m_buffer.Length)
            {
                Count = m_buffer.Length;
            }

            string text = m_buffer.ToString(0, Count);
            return new Terminal(symbol, text, m_SysPosition);
        }
예제 #5
0
 /// <summary>
 /// Applications can use this method to create a 'virtual' terminal,
 /// which they can then push into the parser.
 /// </summary>
 public static Terminal CreateVirtual(Symbol Parent, string Text)
 {
     return new Terminal(Parent, Text);
 }
예제 #6
0
 private Terminal(Symbol Parent, string Text)
     : base(Parent, null, true)
 {
     m_Text = Text;
 }
예제 #7
0
 internal Terminal(Symbol Parent, string Text, Position sysPosition)
     : base(Parent, sysPosition, true)
 {
     m_Text = Text;
 }