/// <summary> /// Pop current root; back to adding to old root /// </summary> /// <param name="s"></param> public override void traceOut(string s) // throws TokenStreamException { if (inputState.guessing > 0) { return; } mostRecentParseTreeRoot = (ParseTreeRule) currentParseTreeRoot.Pop(); }
/// <summary> /// Create a rule node, add to current tree, and make it current root /// </summary> /// <param name="s"></param> public override void traceIn(string s) // throws TokenStreamException { if (inputState.guessing > 0) { return; } ParseTreeRule subRoot = new ParseTreeRule(s); if ( currentParseTreeRoot.Count > 0 ) { ParseTreeRule oldRoot = (ParseTreeRule) currentParseTreeRoot.Peek(); oldRoot.addChild(subRoot); } currentParseTreeRoot.Push(subRoot); numberOfDerivationSteps++; }