Class: Code::Parser::While
- Defined in:
- lib/code/parser/while.rb
Instance Method Summary collapse
- #begin_keyword ⇒ Object
- #body ⇒ Object
- #closing_curly_bracket ⇒ Object
- #code ⇒ Object
- #do_keyword ⇒ Object
- #end_keyword ⇒ Object
- #loop_keyword ⇒ Object
- #opening_curly_bracket ⇒ Object
- #root ⇒ Object
- #statement ⇒ Object
- #until_keyword ⇒ Object
- #while_keyword ⇒ Object
- #whitespace ⇒ Object
- #whitespace? ⇒ Boolean
Instance Method Details
#begin_keyword ⇒ Object
38 39 40 |
# File 'lib/code/parser/while.rb', line 38 def begin_keyword str("begin") end |
#body ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/code/parser/while.rb', line 54 def body ( (begin_keyword | do_keyword).ignore << whitespace << code << (whitespace? << end_keyword).maybe.ignore ) | ( opening_curly_bracket.ignore << whitespace? << code << (whitespace? << closing_curly_bracket).maybe.ignore ) | (code << (whitespace? << end_keyword).maybe.ignore) end |
#closing_curly_bracket ⇒ Object
50 51 52 |
# File 'lib/code/parser/while.rb', line 50 def closing_curly_bracket str("}") end |
#code ⇒ Object
18 19 20 |
# File 'lib/code/parser/while.rb', line 18 def code Code end |
#do_keyword ⇒ Object
34 35 36 |
# File 'lib/code/parser/while.rb', line 34 def do_keyword str("do") end |
#end_keyword ⇒ Object
30 31 32 |
# File 'lib/code/parser/while.rb', line 30 def end_keyword str("end") end |
#loop_keyword ⇒ Object
42 43 44 |
# File 'lib/code/parser/while.rb', line 42 def loop_keyword str("loop") end |
#opening_curly_bracket ⇒ Object
46 47 48 |
# File 'lib/code/parser/while.rb', line 46 def opening_curly_bracket str("{") end |
#root ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/code/parser/while.rb', line 65 def root ( ( ( (while_keyword | until_keyword).aka(:operator) << whitespace << statement.aka(:statement) ) | (loop_keyword.aka(:operator) << whitespace) ) << body.aka(:body) ).aka(:while) | statement end |
#statement ⇒ Object
6 7 8 |
# File 'lib/code/parser/while.rb', line 6 def statement If end |
#until_keyword ⇒ Object
26 27 28 |
# File 'lib/code/parser/while.rb', line 26 def until_keyword str("until") end |
#while_keyword ⇒ Object
22 23 24 |
# File 'lib/code/parser/while.rb', line 22 def while_keyword str("while") end |
#whitespace ⇒ Object
10 11 12 |
# File 'lib/code/parser/while.rb', line 10 def whitespace Whitespace end |
#whitespace? ⇒ Boolean
14 15 16 |
# File 'lib/code/parser/while.rb', line 14 def whitespace? whitespace.maybe end |