Beispiel #1
0
 public AstNode(
     AstNodeType type, Token token)
 {
     this.type = type;
     this.token = token;
     this.children = null;
 }
Beispiel #2
0
 //@begin(ctor)
 public AstNode(
     AstNodeType type, IEnumerable<AstNode> children)
 {
     this.type = type;
     this.token = null;
     this.children = new List<AstNode>();
     this.children.AddRange(children);
 }
Beispiel #3
0
 public TokenStream(IEnumerable<Token> enumerable)
 {
     this.enumerator = enumerable.GetEnumerator();
     Next();
     if (hasMoreTokens)
     {
         current = this.enumerator.Current;
     }
 }
Beispiel #4
0
 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.");
     }
 }