Example #1
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;
 }
Example #2
0
 internal Production(Symbol Head, short TableIndex, SymbolList Handle)
 {
     m_Head = Head;
     m_Handle = Handle;
     m_TableIndex = TableIndex;
 }
Example #3
0
 internal void TrimReduction(Symbol newSymbol)
 {
     m_Parent = newSymbol;
 }
Example #4
0
        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);
        }
Example #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);
 }
Example #6
0
 private Terminal(Symbol Parent, string Text)
     : base(Parent, null, true)
 {
     m_Text = Text;
 }
Example #7
0
 internal Terminal(Symbol Parent, string Text, Position sysPosition)
     : base(Parent, sysPosition, true)
 {
     m_Text = Text;
 }