Beispiel #1
0
 public NodeBinOp(BinOp type, AstNode left, AstNode right)
     : base("Binary Operation", NodeType.Operation)
 {
     Type = type;
     AddChild (left);
     AddChild (right);
 }
Beispiel #2
0
 public NodeIf(AstNode predicate, AstNode body, AstNode elseBody = null)
     : base("If Statement", NodeType.Statement)
 {
     AddChild (predicate);
     AddChild (body);
     AddChild (elseBody ?? new AstNode ());
 }
Beispiel #3
0
 public NodeFuncCall(AstNode left, AstNode args)
     : base("Function Call", NodeType.Function)
 {
     AddChild (left);
     AddChild (args);
 }
Beispiel #4
0
 public void AddChild(AstNode node)
 {
     Children.Add (node);
 }
Beispiel #5
0
 void DumpAst(AstNode node, int depth = 0)
 {
     Console.WriteLine ("{0}* {1}", "".PadLeft (depth * 2, ' '), node.Name);
     foreach (var child in node.Children)
         DumpAst (child, depth + 1);
 }
Beispiel #6
0
 public NodeUnOp(UnOp type, AstNode val)
     : base("Unary Operation", NodeType.Operation)
 {
     Type = type;
     AddChild (val);
 }