Class: Code::Parser::If
Instance Method Summary collapse
- #begin_keyword ⇒ Object
- #body ⇒ Object
- #closing_curly_bracket ⇒ Object
- #code ⇒ Object
- #do_keyword ⇒ Object
- #else_keyword ⇒ Object
- #elsif_keyword ⇒ Object
- #elsunless_keyword ⇒ Object
- #end_keyword ⇒ Object
- #if_class ⇒ Object
- #if_keyword ⇒ Object
- #opening_curly_bracket ⇒ Object
- #root ⇒ Object
- #statement ⇒ Object
- #unless_keyword ⇒ Object
- #whitespace ⇒ Object
- #whitespace? ⇒ Boolean
Instance Method Details
#begin_keyword ⇒ Object
30 31 32 |
# File 'lib/code/parser/if.rb', line 30 def begin_keyword str("begin") end |
#body ⇒ Object
66 67 68 69 70 71 72 73 74 75 |
# File 'lib/code/parser/if.rb', line 66 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
38 39 40 |
# File 'lib/code/parser/if.rb', line 38 def closing_curly_bracket str("{") end |
#code ⇒ Object
18 19 20 |
# File 'lib/code/parser/if.rb', line 18 def code Code end |
#do_keyword ⇒ Object
26 27 28 |
# File 'lib/code/parser/if.rb', line 26 def do_keyword str("do") end |
#else_keyword ⇒ Object
58 59 60 |
# File 'lib/code/parser/if.rb', line 58 def else_keyword str("else") end |
#elsif_keyword ⇒ Object
50 51 52 |
# File 'lib/code/parser/if.rb', line 50 def elsif_keyword str("elsif") end |
#elsunless_keyword ⇒ Object
54 55 56 |
# File 'lib/code/parser/if.rb', line 54 def elsunless_keyword str("elsunless") end |
#end_keyword ⇒ Object
62 63 64 |
# File 'lib/code/parser/if.rb', line 62 def end_keyword str("end") end |
#if_class ⇒ Object
10 11 12 |
# File 'lib/code/parser/if.rb', line 10 def if_class If end |
#if_keyword ⇒ Object
42 43 44 |
# File 'lib/code/parser/if.rb', line 42 def if_keyword str("if") end |
#opening_curly_bracket ⇒ Object
34 35 36 |
# File 'lib/code/parser/if.rb', line 34 def opening_curly_bracket str("{") end |
#root ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/code/parser/if.rb', line 77 def root ( (if_keyword | unless_keyword).aka(:first_operator) << whitespace << statement.aka(:first_statement) << body.aka(:first_body) << ( ( (elsif_keyword | elsunless_keyword).aka( :operator ) << whitespace << statement.aka(:statement) << body.aka(:body) ) | ( else_keyword << whitespace << (if_keyword | unless_keyword).aka(:operator) << whitespace << statement.aka(:statement) << body.aka(:body) ) | (else_keyword.aka(:operator) << body.aka(:body)) ).repeat(1).aka(:elses).maybe << end_keyword.maybe ).aka(:if) | statement end |
#statement ⇒ Object
6 7 8 |
# File 'lib/code/parser/if.rb', line 6 def statement IfModifier end |
#unless_keyword ⇒ Object
46 47 48 |
# File 'lib/code/parser/if.rb', line 46 def unless_keyword str("unless") end |
#whitespace ⇒ Object
14 15 16 |
# File 'lib/code/parser/if.rb', line 14 def whitespace Whitespace end |
#whitespace? ⇒ Boolean
22 23 24 |
# File 'lib/code/parser/if.rb', line 22 def whitespace? whitespace.maybe end |