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