-
-
Notifications
You must be signed in to change notification settings - Fork 444
/
Copy pathstatement.dm
95 lines (83 loc) · 2.18 KB
/
statement.dm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
* Statement
* An object representing a single instruction run by an interpreter.
*/
/datum/node/statement
/datum/node/statement/New(datum/token/token)
. = ..()
src.token = token
/*
* FunctionDefinition
* Defines a function.
*/
/datum/node/statement/FunctionDefinition
var/func_name
var/list/parameters = new
var/datum/node/BlockDefinition/FunctionBlock/block
/*
* VariableAssignment
* Sets a variable in an accessible scope to the given value if one exists, otherwise initializes a new local variable to the given value.
*
* Notes:
* If a variable with the same name exists in a higher block, the value will be assigned to it. If not,
* a new variable is created in the current block. To force creation of a new variable, use <VariableDeclaration>.
*
* See Also:
* - <VariableDeclaration>
*/
/datum/node/statement/VariableAssignment
var/datum/node/identifier/object
var/datum/node/identifier/var_name
var/datum/node/expression/value
/*
* VariableDeclaration
* Intializes a local variable to a null value.
*
* See Also:
* - <VariableAssignment>
*/
/datum/node/statement/VariableDeclaration
var/datum/node/identifier/object
var/datum/node/identifier/var_name
/**
* IfStatement
*/
/datum/node/statement/IfStatement
var/skip = 0
var/datum/node/BlockDefinition/block
var/datum/node/BlockDefinition/else_block //can be null
var/datum/node/expression/cond
var/datum/node/statement/else_if
/datum/node/statement/IfStatement/ElseIf
/**
* WhileLoop
* Loops while a given condition is TRUE.
*/
/datum/node/statement/WhileLoop
var/datum/node/BlockDefinition/block
var/datum/node/expression/cond
/*
* ForLoop
* Loops while test is true, initializing a variable, increasing the variable
*/
/datum/node/statement/ForLoop
var/datum/node/BlockDefinition/block
var/datum/node/expression/test
var/datum/node/expression/init
var/datum/node/expression/increment
/*
* BreakStatement
* Ends a loop.
*/
/datum/node/statement/BreakStatement
/*
* ContinueStatement
* Skips to the next iteration of a loop.
*/
/datum/node/statement/ContinueStatement
/*
* ReturnStatement
* Ends the function and returns a value.
*/
/datum/node/statement/ReturnStatement
var/datum/node/expression/value