Class: Code::Parser::While
Instance Method Summary
collapse
Methods inherited from Language
<<, >>, absent, aka, #any, ignore, #inspect, maybe, parse, #parse, repeat, #str, then, #to_s, |
Instance Method Details
12
13
14
|
# File 'lib/code/parser/while.rb', line 12
def code
::Code::Parser::Code
end
|
#end_keyword ⇒ Object
24
25
26
|
# File 'lib/code/parser/while.rb', line 24
def end_keyword
str("end")
end
|
28
29
30
31
32
33
|
# File 'lib/code/parser/while.rb', line 28
def root
(
(while_keyword | until_keyword).aka(:operator) << whitespace <<
statement.aka(:statement) << code.aka(:body) << end_keyword.maybe
).aka(:while) | statement
end
|
#statement ⇒ Object
4
5
6
|
# File 'lib/code/parser/while.rb', line 4
def statement
::Code::Parser::If
end
|
#until_keyword ⇒ Object
20
21
22
|
# File 'lib/code/parser/while.rb', line 20
def until_keyword
str("until")
end
|
#while_keyword ⇒ Object
16
17
18
|
# File 'lib/code/parser/while.rb', line 16
def while_keyword
str("while")
end
|
#whitespace ⇒ Object
8
9
10
|
# File 'lib/code/parser/while.rb', line 8
def whitespace
::Code::Parser::Whitespace
end
|