Пример #1
0
 public AstNode(
     AstNodeType type, Token token)
 {
     this.type = type;
     this.token = token;
     this.children = null;
 }
Пример #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);
 }
Пример #3
0
 public TokenStream(IEnumerable<Token> enumerable)
 {
     this.enumerator = enumerable.GetEnumerator();
     Next();
     if (hasMoreTokens)
     {
         current = this.enumerator.Current;
     }
 }
Пример #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.");
     }
 }