public AstNode( AstNodeType type, Token token) { this.type = type; this.token = token; this.children = null; }
//@begin(ctor) public AstNode( AstNodeType type, IEnumerable<AstNode> children) { this.type = type; this.token = null; this.children = new List<AstNode>(); this.children.AddRange(children); }
public TokenStream(IEnumerable<Token> enumerable) { this.enumerator = enumerable.GetEnumerator(); Next(); if (hasMoreTokens) { current = this.enumerator.Current; } }
public void Next() { if (hasMoreTokens) { hasMoreTokens = this.enumerator.MoveNext(); if (hasMoreTokens) { current = this.enumerator.Current; } else { current = null; } } else { throw new InvalidOperationException("Read past end of stream."); } }