Class: Code::Parser::Call
Instance Method Summary collapse
- #ampersand ⇒ Object
- #argument ⇒ Object
- #arguments ⇒ Object
- #asterisk ⇒ Object
- #begin_keyword ⇒ Object
- #block ⇒ Object
- #closing_curly_bracket ⇒ Object
- #closing_parenthesis ⇒ Object
- #code ⇒ Object
- #code_present ⇒ Object
- #colon ⇒ Object
- #comma ⇒ Object
- #do_keyword ⇒ Object
- #end_keyword ⇒ Object
- #equal ⇒ Object
- #keyword_argument ⇒ Object
- #keyword_parameter ⇒ Object
- #name ⇒ Object
- #opening_curly_bracket ⇒ Object
- #opening_parenthesis ⇒ Object
- #parameter ⇒ Object
- #parameters ⇒ Object
- #pipe ⇒ Object
- #prefix ⇒ Object
- #regular_argument ⇒ Object
- #regular_parameter ⇒ Object
- #root ⇒ Object
- #spread_operator ⇒ Object
- #whitespace ⇒ Object
- #whitespace? ⇒ Boolean
Instance Method Details
#ampersand ⇒ Object
74 75 76 |
# File 'lib/code/parser/call.rb', line 74 def ampersand str("&") end |
#argument ⇒ Object
90 91 92 |
# File 'lib/code/parser/call.rb', line 90 def argument keyword_argument | regular_argument end |
#arguments ⇒ Object
94 95 96 97 98 99 100 |
# File 'lib/code/parser/call.rb', line 94 def arguments opening_parenthesis.ignore << whitespace? << ( whitespace? << argument << (whitespace? << comma << whitespace?).maybe ).repeat << whitespace? << closing_parenthesis.ignore.maybe end |
#asterisk ⇒ Object
70 71 72 |
# File 'lib/code/parser/call.rb', line 70 def asterisk str("*") end |
#begin_keyword ⇒ Object
62 63 64 |
# File 'lib/code/parser/call.rb', line 62 def begin_keyword str("do") end |
#block ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/code/parser/call.rb', line 130 def block ( (do_keyword | begin_keyword).ignore << whitespace << parameters.aka(:parameters).maybe << whitespace? << code.aka(:body) << (whitespace? << end_keyword).maybe.ignore ) | ( opening_curly_bracket.ignore << whitespace? << parameters.aka(:parameters).maybe << whitespace? << code.aka(:body) << (whitespace? << closing_curly_bracket).maybe.ignore ) end |
#closing_curly_bracket ⇒ Object
46 47 48 |
# File 'lib/code/parser/call.rb', line 46 def closing_curly_bracket str("}") end |
#closing_parenthesis ⇒ Object
54 55 56 |
# File 'lib/code/parser/call.rb', line 54 def closing_parenthesis str(")") end |
#code ⇒ Object
18 19 20 |
# File 'lib/code/parser/call.rb', line 18 def code Code end |
#code_present ⇒ Object
22 23 24 |
# File 'lib/code/parser/call.rb', line 22 def code_present Code.new.present end |
#colon ⇒ Object
26 27 28 |
# File 'lib/code/parser/call.rb', line 26 def colon str(":") end |
#comma ⇒ Object
30 31 32 |
# File 'lib/code/parser/call.rb', line 30 def comma str(",") end |
#do_keyword ⇒ Object
58 59 60 |
# File 'lib/code/parser/call.rb', line 58 def do_keyword str("do") end |
#end_keyword ⇒ Object
66 67 68 |
# File 'lib/code/parser/call.rb', line 66 def end_keyword str("end") end |
#equal ⇒ Object
38 39 40 |
# File 'lib/code/parser/call.rb', line 38 def equal str("=") end |
#keyword_argument ⇒ Object
82 83 84 |
# File 'lib/code/parser/call.rb', line 82 def keyword_argument name.aka(:name) << whitespace? << colon << code.aka(:value) end |
#keyword_parameter ⇒ Object
108 109 110 111 |
# File 'lib/code/parser/call.rb', line 108 def keyword_parameter name.aka(:name) << whitespace? << colon.aka(:keyword) << code_present.aka(:default).maybe end |
#name ⇒ Object
6 7 8 |
# File 'lib/code/parser/call.rb', line 6 def name Name end |
#opening_curly_bracket ⇒ Object
42 43 44 |
# File 'lib/code/parser/call.rb', line 42 def opening_curly_bracket str("{") end |
#opening_parenthesis ⇒ Object
50 51 52 |
# File 'lib/code/parser/call.rb', line 50 def opening_parenthesis str("(") end |
#parameter ⇒ Object
118 119 120 |
# File 'lib/code/parser/call.rb', line 118 def parameter keyword_parameter | regular_parameter end |
#parameters ⇒ Object
122 123 124 125 126 127 128 |
# File 'lib/code/parser/call.rb', line 122 def parameters pipe.ignore << whitespace? << ( whitespace? << parameter << (whitespace? << comma << whitespace?).maybe ).repeat << (whitespace? << pipe.ignore).maybe end |
#pipe ⇒ Object
34 35 36 |
# File 'lib/code/parser/call.rb', line 34 def pipe str("|") end |
#prefix ⇒ Object
102 103 104 105 106 |
# File 'lib/code/parser/call.rb', line 102 def prefix (asterisk << asterisk).aka(:keyword_splat) | asterisk.aka(:regular_splat) | ampersand.aka(:block) | spread_operator.aka(:spread) end |
#regular_argument ⇒ Object
86 87 88 |
# File 'lib/code/parser/call.rb', line 86 def regular_argument code_present.aka(:value) end |
#regular_parameter ⇒ Object
113 114 115 116 |
# File 'lib/code/parser/call.rb', line 113 def regular_parameter ((prefix.maybe << name.aka(:name)) | prefix) << whitespace? << (equal << whitespace? << code_present.aka(:default)).maybe end |
#root ⇒ Object
144 145 146 147 148 149 |
# File 'lib/code/parser/call.rb', line 144 def root ( name.aka(:name) << (whitespace? << arguments.aka(:arguments)).maybe << (whitespace? << block.aka(:block)).maybe ).aka(:call) end |
#spread_operator ⇒ Object
78 79 80 |
# File 'lib/code/parser/call.rb', line 78 def spread_operator str("...") | str("..") | str(".") end |
#whitespace ⇒ Object
10 11 12 |
# File 'lib/code/parser/call.rb', line 10 def whitespace Whitespace end |
#whitespace? ⇒ Boolean
14 15 16 |
# File 'lib/code/parser/call.rb', line 14 def whitespace? whitespace.maybe end |