Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
ExpressionListNode.cs
Go to the documentation of this file.
1 #region License
2 /* **********************************************************************************
3  * Copyright (c) Roman Ivantsov
4  * This source code is subject to terms and conditions of the MIT License
5  * for Irony. A copy of the license can be found in the License.txt file
6  * at the root of this distribution.
7  * By using this source code in any fashion, you are agreeing to be bound by the terms of the
8  * MIT License.
9  * You must not remove this notice from this software.
10  * **********************************************************************************/
11 #endregion
12 
13 using System;
14 using System.Collections.Generic;
15 using System.Linq;
16 using System.Text;
17 using Irony.Interpreter;
18 using Irony.Parsing;
19 
20 namespace Irony.Interpreter.Ast {
21 
22  //A node representing expression list - for example, list of argument expressions in function call
23  public class ExpressionListNode : AstNode {
24 
25  public override void Init(ParsingContext context, ParseTreeNode treeNode) {
26  base.Init(context, treeNode);
27  foreach (var child in treeNode.ChildNodes) {
28  AddChild("expr", child);
29  }
30  AsString = "Expression list";
31  }
32 
33  public override void EvaluateNode(EvaluationContext context, AstMode mode) {
34  var result = new ValuesList();
35  foreach (var expr in ChildNodes) {
36  expr.Evaluate(context, AstMode.Read);
37  result.Add(context.Data.Pop());
38  }
39  //Push list on the stack
40  context.Data.Push(result);
41  }
42 
43  }//class
44 
45 }//namespace
override void Init(ParsingContext context, ParseTreeNode treeNode)
override void EvaluateNode(EvaluationContext context, AstMode mode)