public TemporaryTerminal(ParserNode node, Location loc, TemporaryGroup parent, Location from, Location to, string content) : base(node, loc, parent) { this.From = from; this.To = to; this.Content = content; }
TemporaryGroup ReconstructTree() { TemporaryGroup g = this; while (g.Parent != null) { g = g.ExitChild(); } return(g); }
//private ParsedNode OldRecreateChilds() //{ // ParsedNode node = null; // for (var n = this.Child; n != null; n = n.Prev) // node = n.Recreate(node); // var loc = node.Location; // var prepends = new List<ParsedNode>(); // foreach (ParsedNode item in this.OldGroup.Childs) // { // if (item.Location < loc && item.Location < this.ReparsingFrom) // prepends.Add(item); // else // break; // } // for (int i = prepends.Count - 1; i >= 0; i--) // node = prepends[i].UpdateNext(node); // return node; //} protected override bool TryReconstructImpl(ParserNode node, Location loc, out TemporaryGroup reconstructedRoot) { if (loc >= this.ReparsingTo) // reuse right { var it = this.OldGroup.Childs.GetEnumerator(); while (it.MoveNext()) { var oldChild = it.Current; if (oldChild.Location == loc && (oldChild as ParsingTreeNode).GrammarNode == node) { // reconstruct all the rest of the tree reconstructedRoot = this.ReconstructTree(); return(true); } } } reconstructedRoot = null; return(false); }
public TemporaryReparsingGroup(IParsingTreeNode oldNode, ParserNode node, Location fromLoc, Location toLoc, TemporaryGroup parent, TemporaryChildNode child) : base(node, oldNode.Location, parent, child) { this.OldGroup = oldNode as IParsingTreeGroup; this.ReparsingFrom = fromLoc; this.ReparsingTo = toLoc; if (this.OldGroup == null) { throw new ReparsingFailException(); } }
protected virtual bool TryReconstructImpl(ParserNode node, Location loc, out TemporaryGroup reconstructedRoot) { reconstructedRoot = null; return(false); }
public bool TryReconstruct(ParserNode nextNode, Location location, out TemporaryGroup reconstructedTree) { return(this.TryReconstructImpl(nextNode, location, out reconstructedTree)); }
public TemporaryGroup(ParserNode node, Location loc, TemporaryGroup parent, TemporaryChildNode child) : base(node, loc, parent) { this.Child = child; }
public TemporaryNode(ParserNode node, Location loc, TemporaryGroup parent) : base(node, loc) { this.Parent = parent; }