Paradox Game Engine
v1.0.0 beta06
Main Page
Related Pages
Packages
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Events
Macros
Pages
IdentifierNode.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
System.Xml;
18
using
Irony.Parsing;
19
using
Irony.Interpreter;
20
21
namespace
Irony.Interpreter.Ast {
22
23
public
class
IdentifierNode
:
AstNode
{
24
public
string
Symbol
;
25
26
public
IdentifierNode
() { }
27
28
public
override
void
Init
(
ParsingContext
context,
ParseTreeNode
treeNode) {
29
base.Init(context, treeNode);
30
Symbol
= treeNode.Token.ValueString;
31
AsString = Symbol;
32
}
33
34
35
public
override
void
EvaluateNode
(
EvaluationContext
context,
AstMode
mode) {
36
switch
(mode) {
37
case
AstMode.Read:
38
object
value;
39
if
(context.
TryGetValue
(
Symbol
, out value))
40
context.
Data
.
Push
(value);
41
else
42
context.ThrowError(
Resources.ErrVarNotDefined
,
Symbol
);
43
break
;
44
case
AstMode.Write:
45
context.SetValue(
Symbol
, context.Data.Pop());
46
break
;
47
}
48
}
49
50
}
//class
51
}
//namespace
Irony.Interpreter.Ast.IdentifierNode.IdentifierNode
IdentifierNode()
Definition:
IdentifierNode.cs:26
Irony.Resources.ErrVarNotDefined
static string ErrVarNotDefined
Looks up a localized string similar to Variable {0} not defined..
Definition:
Resources.Designer.cs:705
Irony.Parsing.ParsingContext
Definition:
ParsingContext.cs:47
SiliconStudio.Shaders.Parser.System
A system file.
Irony.Interpreter.Ast.IdentifierNode
Definition:
IdentifierNode.cs:23
Irony.Interpreter.EvaluationContext
Definition:
EvaluationContext.cs:38
Irony.Parsing.Symbol
Definition:
SymbolTable.cs:9
Irony.Parsing.ParseTreeNode
Definition:
ParseTree.cs:32
Irony.Interpreter.Ast.IdentifierNode.EvaluateNode
override void EvaluateNode(EvaluationContext context, AstMode mode)
Definition:
IdentifierNode.cs:35
Irony.Interpreter.DataStack.Push
void Push(object item)
Definition:
DataStack.cs:54
Irony.Interpreter.Ast.AstMode
AstMode
Definition:
AstInterfaces.cs:25
Irony.Interpreter.Ast.IdentifierNode.Symbol
string Symbol
Definition:
IdentifierNode.cs:24
Irony.Interpreter.Ast.AstNode
Definition:
AstNode.cs:36
Irony.Interpreter.Ast.IdentifierNode.Init
override void Init(ParsingContext context, ParseTreeNode treeNode)
Definition:
IdentifierNode.cs:28
Irony.Interpreter.EvaluationContext.Data
DataStack Data
Definition:
EvaluationContext.cs:43
Irony.Interpreter.EvaluationContext.TryGetValue
bool TryGetValue(string name, out object value)
Definition:
EvaluationContext.cs:82
sources
common
shaders
Irony
Interpreter
Ast
PrimitiveNodes
IdentifierNode.cs
Generated on Sat Dec 20 2014 21:51:21 for Paradox Game Engine by
1.8.7