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
96
97
98
99
use crate::*;
#[derive(Clone, Debug, PartialEq, Node)]
pub enum LoopStatement {
Forever(Box<LoopStatementForever>),
Repeat(Box<LoopStatementRepeat>),
While(Box<LoopStatementWhile>),
For(Box<LoopStatementFor>),
DoWhile(Box<LoopStatementDoWhile>),
Foreach(Box<LoopStatementForeach>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementForever {
pub nodes: (Keyword, StatementOrNull),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementRepeat {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementWhile {
pub nodes: (Keyword, Paren<Expression>, StatementOrNull),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementFor {
pub nodes: (
Keyword,
Paren<(
Option<ForInitialization>,
Symbol,
Option<Expression>,
Symbol,
Option<ForStep>,
)>,
StatementOrNull,
),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementDoWhile {
pub nodes: (Keyword, StatementOrNull, Keyword, Paren<Expression>, Symbol),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopStatementForeach {
pub nodes: (
Keyword,
Paren<(PsOrHierarchicalArrayIdentifier, Bracket<LoopVariables>)>,
Statement,
),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub enum ForInitialization {
ListOfVariableAssignments(Box<ListOfVariableAssignments>),
Declaration(Box<ForInitializationDeclaration>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct ForInitializationDeclaration {
pub nodes: (List<Symbol, ForVariableDeclaration>,),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct ForVariableDeclaration {
pub nodes: (
Option<Var>,
DataType,
List<Symbol, (VariableIdentifier, Symbol, Expression)>,
),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct Var {
pub nodes: (Keyword,),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct ForStep {
pub nodes: (List<Symbol, ForStepAssignment>,),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub enum ForStepAssignment {
OperatorAssignment(Box<OperatorAssignment>),
IncOrDecExpression(Box<IncOrDecExpression>),
FunctionSubroutineCall(Box<FunctionSubroutineCall>),
}
#[derive(Clone, Debug, PartialEq, Node)]
pub struct LoopVariables {
pub nodes: (List<Symbol, Option<IndexVariableIdentifier>>,),
}