Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
            TemporaryGroup ReconstructTree()
            {
                TemporaryGroup g = this;

                while (g.Parent != null)
                {
                    g = g.ExitChild();
                }

                return(g);
            }
Exemplo n.º 3
0
            //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);
            }
Exemplo n.º 4
0
            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();
                }
            }
Exemplo n.º 5
0
 protected virtual bool TryReconstructImpl(ParserNode node, Location loc, out TemporaryGroup reconstructedRoot)
 {
     reconstructedRoot = null;
     return(false);
 }
Exemplo n.º 6
0
 public bool TryReconstruct(ParserNode nextNode, Location location, out TemporaryGroup reconstructedTree)
 {
     return(this.TryReconstructImpl(nextNode, location, out reconstructedTree));
 }
Exemplo n.º 7
0
 public TemporaryGroup(ParserNode node, Location loc, TemporaryGroup parent, TemporaryChildNode child)
     : base(node, loc, parent)
 {
     this.Child = child;
 }
Exemplo n.º 8
0
 public TemporaryNode(ParserNode node, Location loc, TemporaryGroup parent)
     : base(node, loc)
 {
     this.Parent = parent;
 }