Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
LiteralValueNode.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Irony.Parsing;
6 using Irony.Interpreter;
7 
8 namespace Irony.Interpreter.Ast {
9  public class LiteralValueNode : AstNode {
10  public object Value;
11 
12  public override void Init(ParsingContext context, ParseTreeNode treeNode) {
13  base.Init(context, treeNode);
14  Value = treeNode.Token.Value;
15  AsString = Value == null ? "null" : Value.ToString();
16  if (Value is string)
17  AsString = "\"" + AsString + "\"";
18  }
19 
20  public override void EvaluateNode(EvaluationContext context, AstMode mode) {
21  switch (mode) {
22  case AstMode.Read:
23  context.Data.Push(Value);
24  break;
25  case AstMode.Write:
26  context.ThrowError(Resources.ErrAssignLiteralValue);
27  break;
28  }
29  }
30 
31  }//class
32 }
static string ErrAssignLiteralValue
Looks up a localized string similar to Invalide operation, attempt to assign constant or literal valu...
override void EvaluateNode(EvaluationContext context, AstMode mode)
override void Init(ParsingContext context, ParseTreeNode treeNode)