Class: Code::Parser::While

Inherits:
Language show all
Defined in:
lib/code/parser/while.rb

Instance Method Summary collapse

Methods inherited from Language

<<, >>, absent, aka, #any, ignore, #inspect, maybe, parse, #parse, repeat, #str, then, #to_s, |

Instance Method Details

#codeObject



12
13
14
# File 'lib/code/parser/while.rb', line 12

def code
  ::Code::Parser::Code
end

#end_keywordObject



24
25
26
# File 'lib/code/parser/while.rb', line 24

def end_keyword
  str("end")
end

#rootObject



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

#statementObject



4
5
6
# File 'lib/code/parser/while.rb', line 4

def statement
  ::Code::Parser::If
end

#until_keywordObject



20
21
22
# File 'lib/code/parser/while.rb', line 20

def until_keyword
  str("until")
end

#while_keywordObject



16
17
18
# File 'lib/code/parser/while.rb', line 16

def while_keyword
  str("while")
end

#whitespaceObject



8
9
10
# File 'lib/code/parser/while.rb', line 8

def whitespace
  ::Code::Parser::Whitespace
end