public PrecedenceAltGroup(Source source, Precedence precedence, List<IParseable> nodes) { this.nodes = nodes; this.precedence = precedence; if (nodes.Count == 1) parseGraph = nodes[0]; else parseGraph = new LongestAlt(source, nodes); leftRecursiveNodes = new List<ParseGraphNode>(); foreach (IParseable node in (IEnumerable<IParseable>) nodes) { PatternNode patternNode = node as PatternNode; if (patternNode != null) { ConcretePattern pattern = patternNode.Pattern as ConcretePattern; if (pattern != null) { if (pattern.RecursionBehaviour == RecursionBehaviour.LeftRecursive) leftRecursiveNodes.Add(new PatternNode(source, pattern, true)); } } } if (leftRecursiveNodes.Count == 0) leftRecursiveParseGraph = null; else if (leftRecursiveNodes.Count == 1) leftRecursiveParseGraph = leftRecursiveNodes[0]; else leftRecursiveParseGraph = new AltNode(source, leftRecursiveNodes, true); }
private void AddNode(TreeIter parent, IParseable node) { if (node is ParseGraphNode) AddNode(parent, (ParseGraphNode) node); else if (node is Alt) AddNode(parent, (Alt) node); else throw new Exception("Unsupported grammar node type " + node.GetType() + " in viewer"); }
/// <summary> /// Adds a child IParseable element. /// The base implementation of this function adds component /// to the Children enumeration. /// Any override of this function should call the base call, and /// not add component to Children. /// </summary> /// <param name="child">Child to add to this IParseable instance.</param> public virtual void AddChild(IParseable component) { _children.Add(component); }
public void AddChild(IParseable component) { }
/// <summary> /// Adds a child to this component. /// </summary> /// <param name="child">Child to add.</param> public void AddChild(IParseable child) { }
public void AddChild(IParseable child) { Assert.IsInstanceOfType(child, typeof(MockSupport)); _children.Add(child); }
public void AddChild(IParseable child) { _children.Add(child); }
private void Implement() { implementation = Alt.Make(Source, alts, simple); Updated(); }
protected Template.Builder AddField(IParseable handler, int mask) => builder.Add(handler, mask);