opal 0.3.2 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. data/README.md +85 -127
  2. data/bin/opal +3 -3
  3. data/lib/core.rb +114 -0
  4. data/{gems/core/lib → lib}/core/array.rb +68 -187
  5. data/{gems/core/lib → lib}/core/basic_object.rb +22 -5
  6. data/lib/core/class.rb +38 -0
  7. data/{gems/core/lib → lib}/core/dir.rb +1 -1
  8. data/lib/core/enumerable.rb +33 -0
  9. data/{gems/core/lib → lib}/core/error.rb +1 -4
  10. data/{gems/core/lib → lib}/core/false_class.rb +0 -0
  11. data/{gems/core/lib → lib}/core/file.rb +11 -3
  12. data/{gems/core/lib → lib}/core/hash.rb +12 -0
  13. data/{gems/core/lib → lib}/core/kernel.rb +114 -86
  14. data/lib/core/match_data.rb +33 -0
  15. data/lib/core/module.rb +97 -0
  16. data/{gems/core/lib → lib}/core/nil_class.rb +0 -0
  17. data/{gems/core/lib → lib}/core/numeric.rb +5 -0
  18. data/{gems/core/lib → lib}/core/object.rb +0 -0
  19. data/{gems/core/lib → lib}/core/proc.rb +13 -3
  20. data/{gems/core/lib → lib}/core/range.rb +10 -0
  21. data/{gems/core/lib → lib}/core/regexp.rb +33 -1
  22. data/{gems/core/lib → lib}/core/string.rb +25 -10
  23. data/{gems/core/lib → lib}/core/symbol.rb +3 -3
  24. data/{gems/core/lib → lib}/core/top_self.rb +0 -0
  25. data/{gems/core/lib → lib}/core/true_class.rb +0 -0
  26. data/lib/dev.rb +169 -0
  27. data/{gems/ospec/lib → lib}/ospec.rb +1 -0
  28. data/lib/ospec/autorun.rb +8 -0
  29. data/{gems/ospec/lib → lib}/ospec/dsl.rb +2 -2
  30. data/{gems/ospec/lib → lib}/ospec/example.rb +0 -0
  31. data/{gems/ospec/lib → lib}/ospec/example/before_and_after_hooks.rb +0 -0
  32. data/{gems/ospec/lib → lib}/ospec/example/errors.rb +0 -0
  33. data/{gems/ospec/lib → lib}/ospec/example/example_group.rb +0 -0
  34. data/{gems/ospec/lib → lib}/ospec/example/example_group_factory.rb +0 -3
  35. data/{gems/ospec/lib → lib}/ospec/example/example_group_hierarchy.rb +4 -3
  36. data/{gems/ospec/lib → lib}/ospec/example/example_group_methods.rb +1 -1
  37. data/{gems/ospec/lib → lib}/ospec/example/example_group_proxy.rb +3 -2
  38. data/{gems/ospec/lib → lib}/ospec/example/example_methods.rb +1 -1
  39. data/{gems/ospec/lib → lib}/ospec/example/example_proxy.rb +7 -7
  40. data/{gems/ospec/lib → lib}/ospec/expectations.rb +0 -0
  41. data/{gems/ospec/lib → lib}/ospec/expectations/errors.rb +0 -0
  42. data/{gems/ospec/lib → lib}/ospec/expectations/fail_with.rb +4 -3
  43. data/{gems/ospec/lib → lib}/ospec/expectations/handler.rb +6 -0
  44. data/lib/ospec/helpers/scratch.rb +18 -0
  45. data/{gems/ospec/lib → lib}/ospec/matchers.rb +2 -2
  46. data/{gems/ospec/lib → lib}/ospec/matchers/be.rb +0 -0
  47. data/{gems/ospec/lib → lib}/ospec/matchers/generated_descriptions.rb +0 -0
  48. data/{gems/ospec/lib → lib}/ospec/matchers/operator_matcher.rb +2 -0
  49. data/lib/ospec/matchers/raise_error.rb +38 -0
  50. data/lib/ospec/runner.rb +90 -0
  51. data/{gems/ospec/lib → lib}/ospec/runner/example_group_runner.rb +10 -13
  52. data/lib/ospec/runner/formatter/html_formatter.rb +139 -0
  53. data/{gems/ospec/lib → lib}/ospec/runner/formatter/terminal_formatter.rb +0 -0
  54. data/{gems/ospec/lib → lib}/ospec/runner/options.rb +1 -3
  55. data/{gems/ospec/lib → lib}/ospec/runner/reporter.rb +0 -9
  56. data/lib/racc/parser.rb +165 -0
  57. data/lib/strscan.rb +52 -0
  58. data/{lib → opal_lib}/opal.rb +2 -0
  59. data/opal_lib/opal/build_methods.rb +51 -0
  60. data/opal_lib/opal/builder.rb +164 -0
  61. data/opal_lib/opal/bundle.rb +70 -0
  62. data/opal_lib/opal/command.rb +68 -0
  63. data/{lib → opal_lib}/opal/context.rb +21 -9
  64. data/{lib → opal_lib}/opal/context/console.rb +0 -2
  65. data/opal_lib/opal/context/file_system.rb +34 -0
  66. data/{lib → opal_lib}/opal/context/loader.rb +26 -8
  67. data/opal_lib/opal/gem.rb +84 -0
  68. data/{lib → opal_lib}/opal/rake/builder_task.rb +2 -2
  69. data/opal_lib/opal/rake/spec_task.rb +32 -0
  70. data/{lib → opal_lib}/opal/ruby/nodes.rb +730 -109
  71. data/{lib → opal_lib}/opal/ruby/parser.rb +90 -23
  72. data/opal_lib/opal/ruby/ruby_parser.rb +4862 -0
  73. data/opal_lib/opal/ruby/ruby_parser.y +1454 -0
  74. data/opal_lib/opal/version.rb +4 -0
  75. data/runtime/class.js +359 -0
  76. data/runtime/debug.js +84 -0
  77. data/runtime/fs.js +199 -0
  78. data/runtime/init.js +558 -0
  79. data/runtime/loader.js +351 -0
  80. data/runtime/module.js +109 -0
  81. data/runtime/post.js +10 -0
  82. data/runtime/pre.js +7 -0
  83. data/runtime/runtime.js +351 -0
  84. metadata +88 -175
  85. data/.gitignore +0 -7
  86. data/Changelog +0 -31
  87. data/LICENSE +0 -75
  88. data/Rakefile +0 -86
  89. data/gems/core/README.md +0 -14
  90. data/gems/core/Rakefile +0 -8
  91. data/gems/core/core.gemspec +0 -13
  92. data/gems/core/lib/core.rb +0 -34
  93. data/gems/core/lib/core/class.rb +0 -31
  94. data/gems/core/lib/core/module.rb +0 -100
  95. data/gems/core/lib/core/vm.rb +0 -16
  96. data/gems/core/spec/core/array/append_spec.rb +0 -30
  97. data/gems/core/spec/core/array/assoc_spec.rb +0 -29
  98. data/gems/core/spec/core/array/at_spec.rb +0 -37
  99. data/gems/core/spec/core/array/clear_spec.rb +0 -22
  100. data/gems/core/spec/core/array/collect_bang_spec.rb +0 -27
  101. data/gems/core/spec/core/array/collect_spec.rb +0 -27
  102. data/gems/core/spec/core/array/compact_spec.rb +0 -41
  103. data/gems/core/spec/core/array/concat_spec.rb +0 -15
  104. data/gems/core/spec/core/array/constructor_spec.rb +0 -14
  105. data/gems/core/spec/core/array/each_spec.rb +0 -9
  106. data/gems/core/spec/core/array/element_reference_spec.rb +0 -4
  107. data/gems/core/spec/core/array/first_spec.rb +0 -35
  108. data/gems/core/spec/core/array/include_spec.rb +0 -9
  109. data/gems/core/spec/core/array/join_spec.rb +0 -6
  110. data/gems/core/spec/core/array/last_spec.rb +0 -51
  111. data/gems/core/spec/core/array/length_spec.rb +0 -6
  112. data/gems/core/spec/core/array/map_spec.rb +0 -33
  113. data/gems/core/spec/core/array/reverse_spec.rb +0 -6
  114. data/gems/core/spec/core/builtin_constants/builtin_constants_spec.rb +0 -7
  115. data/gems/core/spec/core/false/and_spec.rb +0 -10
  116. data/gems/core/spec/core/false/inspect_spec.rb +0 -6
  117. data/gems/core/spec/core/false/or_spec.rb +0 -10
  118. data/gems/core/spec/core/false/to_s_spec.rb +0 -6
  119. data/gems/core/spec/core/false/xor_spec.rb +0 -10
  120. data/gems/core/spec/core/file/join_spec.rb +0 -19
  121. data/gems/core/spec/core/hash/assoc_spec.rb +0 -32
  122. data/gems/core/spec/core/kernel/instance_eval_spec.rb +0 -0
  123. data/gems/core/spec/core/kernel/loop_spec.rb +0 -24
  124. data/gems/core/spec/core/kernel/raise_spec.rb +0 -0
  125. data/gems/core/spec/core/module/attr_accessor_spec.rb +0 -28
  126. data/gems/core/spec/core/number/lt_spec.rb +0 -12
  127. data/gems/core/spec/core/string/sub_spec.rb +0 -24
  128. data/gems/core/spec/core/true/and_spec.rb +0 -10
  129. data/gems/core/spec/core/true/inspect_spec.rb +0 -6
  130. data/gems/core/spec/core/true/or_spec.rb +0 -10
  131. data/gems/core/spec/core/true/to_s_spec.rb +0 -6
  132. data/gems/core/spec/core/true/xor_spec.rb +0 -10
  133. data/gems/core/spec/language/and_spec.rb +0 -61
  134. data/gems/core/spec/language/array_spec.rb +0 -68
  135. data/gems/core/spec/language/block_spec.rb +0 -38
  136. data/gems/core/spec/language/break_spec.rb +0 -36
  137. data/gems/core/spec/language/case_spec.rb +0 -103
  138. data/gems/core/spec/language/def_spec.rb +0 -21
  139. data/gems/core/spec/language/eigenclass_spec.rb +0 -60
  140. data/gems/core/spec/language/file_spec.rb +0 -13
  141. data/gems/core/spec/language/fixtures/block.rb +0 -21
  142. data/gems/core/spec/language/fixtures/super.rb +0 -293
  143. data/gems/core/spec/language/hash_spec.rb +0 -29
  144. data/gems/core/spec/language/if_spec.rb +0 -54
  145. data/gems/core/spec/language/loop_spec.rb +0 -11
  146. data/gems/core/spec/language/metaclass_spec.rb +0 -21
  147. data/gems/core/spec/language/method_spec.rb +0 -124
  148. data/gems/core/spec/language/next_spec.rb +0 -25
  149. data/gems/core/spec/language/or_spec.rb +0 -34
  150. data/gems/core/spec/language/redo_spec.rb +0 -24
  151. data/gems/core/spec/language/regexp_spec.rb +0 -26
  152. data/gems/core/spec/language/rescue_spec.rb +0 -20
  153. data/gems/core/spec/language/return_spec.rb +0 -47
  154. data/gems/core/spec/language/string_spec.rb +0 -25
  155. data/gems/core/spec/language/super_spec.rb +0 -32
  156. data/gems/core/spec/language/until_spec.rb +0 -157
  157. data/gems/core/spec/language/variables_spec.rb +0 -155
  158. data/gems/core/spec/language/while_spec.rb +0 -163
  159. data/gems/core/spec/spec_helper.rb +0 -5
  160. data/gems/core_fs/README.md +0 -19
  161. data/gems/dev/Rakefile +0 -5
  162. data/gems/dev/lib/dev.js +0 -99
  163. data/gems/dev/lib/dev/generator.js +0 -1264
  164. data/gems/dev/lib/dev/parser.js +0 -979
  165. data/gems/dev/lib/dev/ruby_parser.js +0 -1088
  166. data/gems/dev/lib/dev/ruby_parser.y +0 -1267
  167. data/gems/dev/lib/dev/string_scanner.js +0 -38
  168. data/gems/dev/tools/racc2js/README.md +0 -39
  169. data/gems/dev/tools/racc2js/math_parser.js +0 -222
  170. data/gems/dev/tools/racc2js/math_parser.rb +0 -133
  171. data/gems/dev/tools/racc2js/math_parser.y +0 -28
  172. data/gems/dev/tools/racc2js/parser.js +0 -218
  173. data/gems/dev/tools/racc2js/racc2js.rb +0 -153
  174. data/gems/json/README.md +0 -4
  175. data/gems/json/json.gemspec +0 -14
  176. data/gems/json/lib/json.rb +0 -64
  177. data/gems/json/lib/json/ext.rb +0 -51
  178. data/gems/json/lib/json/json2.js +0 -481
  179. data/gems/ospec/README.md +0 -0
  180. data/gems/ospec/lib/ospec/autorun.rb +0 -3
  181. data/gems/ospec/lib/ospec/runner.rb +0 -40
  182. data/gems/ospec/lib/ospec/runner/formatter/html_formatter.rb +0 -91
  183. data/gems/ospec/ospec.gemspec +0 -0
  184. data/gems/rquery/README.md +0 -9
  185. data/gems/rquery/lib/rquery.rb +0 -10
  186. data/gems/rquery/lib/rquery/ajax.rb +0 -4
  187. data/gems/rquery/lib/rquery/css.rb +0 -96
  188. data/gems/rquery/lib/rquery/document.rb +0 -25
  189. data/gems/rquery/lib/rquery/element.rb +0 -292
  190. data/gems/rquery/lib/rquery/event.rb +0 -108
  191. data/gems/rquery/lib/rquery/jquery.js +0 -8177
  192. data/gems/rquery/lib/rquery/request.rb +0 -138
  193. data/gems/rquery/lib/rquery/response.rb +0 -49
  194. data/gems/rquery/rquery.gemspec +0 -16
  195. data/lib/opal.js +0 -1597
  196. data/lib/opal/builder.rb +0 -117
  197. data/lib/opal/bundle.rb +0 -131
  198. data/lib/opal/command.rb +0 -11
  199. data/lib/opal/context/file_system.rb +0 -19
  200. data/lib/opal/gem.rb +0 -153
  201. data/lib/opal/ruby/ruby_parser.rb +0 -5170
  202. data/lib/opal/ruby/ruby_parser.y +0 -1298
  203. data/opal.gemspec +0 -15
@@ -1,1298 +0,0 @@
1
- class Opal::RubyParser
2
-
3
- token CLASS MODULE DEF UNDEF BEGIN RESCUE ENSURE END IF UNLESS
4
- THEN ELSIF ELSE CASE WHEN WHILE UNTIL FOR BREAK NEXT
5
- REDO RETRY IN DO DO_COND DO_BLOCK RETURN YIELD SUPER
6
- SELF NIL TRUE FALSE AND OR NOT IF_MOD UNLESS_MOD WHILE_MOD
7
- UNTIL_MOD RESCUE_MOD ALIAS DEFINED klBEGIN klEND LINE
8
- FILE IDENTIFIER FID GVAR IVAR CONSTANT CVAR NTH_REF
9
- BACK_REF STRING_CONTENT INTEGER FLOAT REGEXP_END '+@'
10
- '-@' '-@NUM' '**' '<=>' '==' '===' '!=' '>=' '<=' '&&'
11
- '||' '=~' '!~' '.' '..' '...' '[]' '[]=' '<<' '>>'
12
- '::' '::@' OP_ASGN '=>' PAREN_BEG '(' ')' tLPAREN_ARG
13
- ARRAY_BEG ']' tLBRACE tLBRACE_ARG SPLAT '*' '&@' '&'
14
- '~' '%' '/' '+' '-' '<' '>' '|' '!' '^'
15
- '{@' '}' BACK_REF2 SYMBOL_BEG STRING_BEG XSTRING_BEG REGEXP_BEG
16
- WORDS_BEG tAWORDS_BEG STRING_DBEG STRING_DVAR STRING_END STRING
17
- SYMBOL '\\n' '?' ':' ',' SPACE ';' BLOCK_GIVEN
18
-
19
- prechigh
20
- right '!' '~' '+@'
21
- right '**'
22
- right '-@NUM' '-@'
23
- left '*' '/' '%'
24
- left '+' '-'
25
- left '<<' '>>'
26
- left '&'
27
- left '|' '^'
28
- left '>' '>=' '<' '<='
29
- nonassoc '<=>' '==' '===' '!=' '=~' '!~'
30
- left '&&'
31
- left '||'
32
- nonassoc '..' '...'
33
- right '?' ':'
34
- left RESCUE_MOD
35
- right '=' OP_ASGN
36
- nonassoc DEFINED
37
- right NOT
38
- left OR AND
39
- nonassoc IF_MOD UNLESS_MOD WHILE_MOD UNTIL_MOD
40
- nonassoc tLBRACE_ARG
41
- nonassoc LOWEST
42
- preclow
43
-
44
- rule
45
-
46
- target:
47
- compstmt
48
- {
49
- result = val[0]
50
- }
51
-
52
- bodystmt:
53
- compstmt opt_rescue opt_else opt_ensure
54
- {
55
- result = BodyStatementsNode.new val[0], val[1], val[2], val[3]
56
- }
57
-
58
- compstmt:
59
- stmts opt_terms
60
- {
61
- result = val[0]
62
- }
63
-
64
- stmts:
65
- none
66
- {
67
- result = StatementsNode.new []
68
- }
69
- | stmt
70
- {
71
- result = StatementsNode.new [val[0]]
72
- }
73
- | stmts terms stmt
74
- {
75
- val[0] << val[2]
76
- result = val[0]
77
- }
78
-
79
- stmt: ALIAS fitem fitem
80
- | ALIAS GVAR GVAR
81
- | ALIAS GVAR BACK_REF
82
- | ALIAS GVAR NTH_REF
83
- | UNDEF undef_list
84
- | stmt IF_MOD expr_value
85
- {
86
- result = IfModNode.new val[1], val[2], val[0]
87
- }
88
- | stmt UNLESS_MOD expr_value
89
- {
90
- result = IfModNode.new val[1], val[2], val[0]
91
- }
92
- | stmt WHILE_MOD expr_value
93
- | stmt UNTIL_MOD expr_value
94
- | stmt RESCUE_MOD stmt
95
- | klBEGIN '{@' compstmt '}'
96
- | klEND '{@' compstmt '}'
97
- | lhs '=' command_call
98
- {
99
- result = AssignNode.new val[0], val[2], val[1]
100
- }
101
- | mlhs '=' command_call
102
- | var_lhs OP_ASGN command_call
103
- {
104
- result = OpAsgnNode.new val[1], val[0], val[2]
105
- }
106
- | primary_value '[@' aref_args ']' OP_ASGN command_call
107
- | primary_value '.' IDENTIFIER OP_ASGN command_call
108
- | primary_value '.' CONSTANT OP_ASGN command_call
109
- | primary_value '::' IDENTIFIER OP_ASGN command_call
110
- | backref OP_ASGN command_call
111
- | lhs '=' mrhs
112
- | mlhs '=' arg_value
113
- | mlhs '=' mrhs
114
- | expr
115
-
116
- expr: command_call
117
- | expr AND expr
118
- {
119
- result = "result = [val[1], val[0], val[2]];"
120
- }
121
- | expr OR expr
122
- {
123
- result = "result = [val[1], val[0], val[2]];"
124
- }
125
- | NOT expr
126
- {
127
- result = "result = ['unary', '!', val[1]];"
128
- }
129
- | '!' command_call
130
- {
131
- result = "result = ['unary', '!', val[1]];"
132
- }
133
- | arg
134
-
135
- expr_value: expr
136
-
137
- command_call: command
138
- | block_command
139
- | RETURN call_args
140
- {
141
- result = ReturnNode.new val[0], val[1]
142
- }
143
- | BREAK call_args
144
- {
145
- result = "result = ['break', val[1]];"
146
- }
147
- | NEXT call_args
148
- {
149
- result = "result = ['next', val[1]];"
150
- }
151
-
152
- block_command: block_call
153
- | block_call '.' operation2 command_args
154
- | block_call '::' operation2 command_args
155
-
156
- cmd_brace_block: tLBRACE_ARG opt_block_var compstmt '}'
157
-
158
- command:
159
- operation command_args =LOWEST
160
- {
161
- result = CallNode.new nil, val[0], val[1]
162
- }
163
- | operation command_args cmd_brace_block
164
- | primary_value '.' operation2 command_args =LOWEST
165
- {
166
- result = CallNode.new val[0], val[2], val[3]
167
- }
168
- | primary_value '.' operation2 command_args cmd_brace_block
169
- | primary_value '::' operation2 command_args =LOWEST
170
- {
171
- result = "result = ['call', val[0], val[2], val[3]];"
172
- }
173
- | primary_value '::' operation2 command_args cmd_brace_block
174
- | SUPER command_args
175
- {
176
- result = "result = ['super', val[1]];"
177
- }
178
- | YIELD command_args
179
- {
180
- result = YieldNode.new val[0], val[1]
181
- }
182
-
183
- mlhs: mlhs_basic
184
- | PAREN_BEG mlhs_entry ')'
185
-
186
- mlhs_entry: mlhs_basic
187
- | PAREN_BEG mlhs_entry ')'
188
-
189
- mlhs_basic: mlhs_head
190
- | mlhs_head mlhs_item
191
- | mlhs_head SPLAT mlhs_node
192
- | mlhs_head SPLAT
193
- | SPLAT mlhs_node
194
- | SPLAT
195
-
196
- mlhs_item: mlhs_node
197
- | PAREN_BEG mlhs_entry ')'
198
-
199
- mlhs_head: mlhs_item ','
200
- | mlhs_head mlhs_item ','
201
-
202
- mlhs_node: variable
203
- | primary_value '[@' aref_args ']'
204
- | primary_value '.' IDENTIFIER
205
- | primary_value '::' IDENTIFIER
206
- | primary_value '.' CONSTANT
207
- | primary_value '::' CONSTANT
208
- | '::@' CONSTANT
209
- | backref
210
-
211
- lhs:
212
- variable
213
- | primary_value '[@' aref_args ']'
214
- {
215
- # result = "result = ['aref', val[0], val[2]];"
216
- result = "result = new this.ArefNode(val[0], val[2]);"
217
- result = ArefNode.new val[0], val[2]
218
- }
219
- | primary_value '.' IDENTIFIER
220
- {
221
- result = CallNode.new val[0], val[2], [[]]
222
- }
223
- | primary_value '::' IDENTIFIER
224
- | primary_value '.' CONSTANT
225
- | primary_value '::' CONSTANT
226
- | '::@' CONSTANT
227
- | backref
228
-
229
- cname:
230
- CONSTANT
231
-
232
- cpath:
233
- '::@' cname
234
- {
235
- result = "result = ['::', val[1]];"
236
- }
237
- | cname
238
- {
239
- result = [nil, val[0]]
240
- }
241
- | primary_value '::' cname
242
- {
243
- result = "result = [val[0], val[2]];"
244
- }
245
-
246
- fname: IDENTIFIER
247
- | CONSTANT
248
- | FID
249
- | op
250
- | reswords
251
-
252
- fitem: fname
253
- | symbol
254
-
255
- undef_list: fitem
256
- | undef_list ',' fitem
257
-
258
- op: '|' | '^' | '&' | '<=>' | '==' | '==='
259
- | '=~' | '>' | '>=' | '<' | '<=' | '<<'
260
- | '>>' | '+' | '-' | '*' | SPLAT | '/'
261
- | '%' | '**' | '~' | '+@' | '-@' | '[]'
262
- | '[]=' | BACK_REF2
263
-
264
- reswords: LINE | FILE | klBEGIN | klEND | ALIAS | AND
265
- | BEGIN | BREAK | CASE | CLASS | DEF | DEFINED
266
- | DO | ELSE | ELSIF | END | ENSURE | FALSE
267
- | FOR | IN | MODULE | NEXT | NIL | NOT
268
- | OR | REDO | RESCUE | RETRY | RETURN | SELF
269
- | SUPER | THEN | TRUE | UNDEF | WHEN | YIELD
270
- | IF_MOD | UNLESS_MOD | WHILE_MOD | UNTIL_MOD | RESCUE_MOD
271
- | BLOCK_GIVEN
272
-
273
- arg:
274
- lhs '=' arg
275
- {
276
- result = AssignNode.new val[0], val[2], val[1]
277
- }
278
- | lhs '=' arg RESCUE_MOD arg
279
- | var_lhs OP_ASGN arg
280
- {
281
- result = OpAsgnNode.new val[1], val[0], val[2]
282
- }
283
- | primary_value '[@' aref_args ']' OP_ASGN arg
284
- | primary_value '.' IDENTIFIER OP_ASGN arg
285
- | primary_value '.' CONSTANT OP_ASGN arg
286
- | primary_value '::' IDENTIFIER OP_ASGN arg
287
- | primary_value '::' CONSTANT OP_ASGN arg
288
- | '::@' CONSTANT OP_ASGN arg
289
- | backref OP_ASGN arg
290
- | arg '..' arg
291
- {
292
- result = "result = ['range', val[1], val[0], val[2]];"
293
- }
294
- | arg '...' arg
295
- {
296
- result = "result = ['range', val[1], val[0], val[2]];"
297
- }
298
- | arg '+' arg
299
- {
300
- result = CallNode.new val[0], val[1], [[val[2]]]
301
- }
302
- | arg '-' arg
303
- {
304
- result = CallNode.new val[0], val[1], [[val[2]]]
305
- }
306
- | arg '*' arg
307
- {
308
- result = CallNode.new val[0], val[1], [[val[2]]]
309
- }
310
- | arg '/' arg
311
- {
312
- result = CallNode.new val[0], val[1], [[val[2]]]
313
- }
314
- | arg '%' arg
315
- {
316
- result = CallNode.new val[0], val[1], [[val[2]]]
317
- }
318
- | arg '**' arg
319
- {
320
- result = CallNode.new val[0], val[1], [[val[2]]]
321
- }
322
- | '-@NUM' INTEGER '**' arg
323
- | '-@NUM' FLOAT '**' arg
324
- | '+@' arg
325
- {
326
- result = CallNode.new val[1], val[0], []
327
- }
328
- | '-@' arg
329
- {
330
- result = CallNode.new val[1], val[0], []
331
- }
332
- | arg '|' arg
333
- {
334
- result = CallNode.new val[0], val[1], [[val[2]]]
335
- }
336
- | arg '^' arg
337
- {
338
- result = CallNode.new val[0], val[1], [[val[2]]]
339
- }
340
- | arg '&' arg
341
- {
342
- result = CallNode.new val[0], val[1], [[val[2]]]
343
- }
344
- | arg '<=>' arg
345
- {
346
- result = CallNode.new val[0], val[1], [[val[2]]]
347
- }
348
- | arg '>' arg
349
- {
350
- result = CallNode.new val[0], val[1], [[val[2]]]
351
- }
352
- | arg '>=' arg
353
- {
354
- result = CallNode.new val[0], val[1], [[val[2]]]
355
- }
356
- | arg '<' arg
357
- {
358
- result = CallNode.new val[0], val[1], [[val[2]]]
359
- }
360
- | arg '<=' arg
361
- {
362
- result = CallNode.new val[0], val[1], [[val[2]]]
363
- }
364
- | arg '==' arg
365
- {
366
- result = CallNode.new val[0], val[1], [[val[2]]]
367
- }
368
- | arg '===' arg
369
- {
370
- result = CallNode.new val[0], val[1], [[val[2]]]
371
- }
372
- | arg '!=' arg
373
- {
374
- result = CallNode.new val[0], val[1], [[val[2]]]
375
- }
376
- | arg '=~' arg
377
- {
378
- result = CallNode.new val[0], val[1], [[val[2]]]
379
- }
380
- | arg '!~' arg
381
- {
382
- result = CallNode.new val[0], val[1], [[val[2]]]
383
- }
384
- | '!' arg
385
- {
386
- result = CallNode.new val[1], val[0], []
387
- }
388
- | '~' arg
389
- {
390
- result = CallNode.new val[1], val[0], []
391
- }
392
- | arg '<<' arg
393
- {
394
- result = CallNode.new val[0], val[1], [[val[2]]]
395
- }
396
- | arg '>>' arg
397
- {
398
- result = CallNode.new val[0], val[1], [[val[2]]]
399
- }
400
- | arg '&&' arg
401
- {
402
- result = AndNode.new val[1], val[0], val[2]
403
- }
404
- | arg '||' arg
405
- {
406
- result = OrNode.new val[1], val[0], val[2]
407
- }
408
- | DEFINED opt_nl arg
409
- | arg '?' arg ':' arg
410
- {
411
- result = "result = ['ternary', val[0], val[2], val[4]];"
412
- }
413
- | primary
414
-
415
- arg_value: arg
416
-
417
- aref_args:
418
- none
419
- {
420
- result = [[], nil]
421
- }
422
- | command opt_nl
423
- | args trailer
424
- {
425
- result = [val[0], nil]
426
- }
427
- | args ',' SPLAT arg opt_nl
428
- {
429
- result = [val[0], val[3]]
430
- }
431
- | assocs trailer
432
- | SPLAT arg opt_nl
433
- {
434
- result = [[], val[1]]
435
- }
436
-
437
- paren_args:
438
- '(' none ')'
439
- {
440
- result = [[]]
441
- }
442
- | '(' call_args opt_nl ')'
443
- {
444
- result = val[1]
445
- }
446
- | '(' block_call opt_nl ')'
447
- | '(' args ',' block_call opt_nl ')'
448
-
449
- opt_paren_args: none
450
- {
451
- result = []
452
- }
453
- | paren_args
454
-
455
- call_args:
456
- command
457
- {
458
- result = [[val[0]], nil, nil, nil]
459
- }
460
- | args opt_block_arg
461
- {
462
- result = [val[0], nil, nil, val[1]]
463
- }
464
- | args ',' SPLAT arg_value opt_block_arg
465
- {
466
- result = [val[0], val[3], nil, val[4]]
467
- }
468
- | assocs opt_block_arg
469
- {
470
- result = [nil, nil, val[0], val[1]]
471
- }
472
- | assocs ',' SPLAT arg_value opt_block_arg
473
- {
474
- result = [nil, val[3], val[0], val[4]]
475
- }
476
- | args ',' assocs opt_block_arg
477
- {
478
- result = [val[0], nil, val[2], val[3]]
479
- }
480
- | args ',' assocs ',' SPLAT arg opt_block_arg
481
- {
482
- result = [val[0], val[5], val[2], val[6]]
483
- }
484
- | SPLAT arg_value opt_block_arg
485
- {
486
- result = [nil, val[1], nil, val[2]]
487
- }
488
- | block_arg
489
- {
490
- result = [nil, nil, nil, val[0]]
491
- }
492
-
493
- call_args2: arg_value ',' args opt_block_arg
494
- | arg_value ',' block_arg
495
- | arg_value ',' SPLAT arg_value opt_block_arg
496
- | arg_value ',' args ',' SPLAT arg_value opt_block_arg
497
- | assocs opt_block_arg
498
- | assocs ',' SPLAT arg_value opt_block_arg
499
- | arg_value ',' assocs opt_block_arg
500
- | arg_value ',' args ',' assocs opt_block_arg
501
- | arg_value ',' assocs ',' SPLAT arg_value opt_block_arg
502
- | arg_value ',' args ',' assocs ',' SPLAT arg_value opt_block_arg
503
- | SPLAT arg_value opt_block_arg
504
- | block_arg
505
-
506
- command_args:
507
- {
508
- cmdarg_push 1
509
- }
510
- open_args
511
- {
512
- cmdarg_pop
513
- result = val[1]
514
- }
515
-
516
- open_args:
517
- call_args
518
- | tLPAREN_ARG ')'
519
- {
520
- result = [[]]
521
- }
522
- | tLPAREN_ARG call_args2 ')'
523
- {
524
- result = val[1]
525
- }
526
-
527
- block_arg:
528
- '&@' arg_value
529
- {
530
- result = val[1]
531
- }
532
-
533
- opt_block_arg:
534
- ',' block_arg
535
- {
536
- result = val[1]
537
- }
538
- | none_block_pass
539
- {
540
- result = nil
541
- }
542
-
543
- args: arg_value
544
- {
545
- result = [val[0]]
546
- }
547
- | args ',' arg_value
548
- {
549
- result = val[0] << val[2]
550
- }
551
-
552
- mrhs: args ',' arg_value
553
- | args ',' SPLAT arg_value
554
- | SPLAT arg_value
555
-
556
- primary: literal
557
- | strings
558
- | xstring
559
- | regexp
560
- | words
561
- | awords
562
- | var_ref
563
- | backref
564
- | FID
565
- | BEGIN bodystmt END
566
- {
567
- result = BeginNode.new val[0], val[1], val[2]
568
- }
569
- | tLPAREN_ARG expr opt_nl ')'
570
- | PAREN_BEG compstmt ')'
571
- {
572
- result = ParenNode.new val[0], val[1], val[2]
573
- }
574
- | primary_value '::' CONSTANT
575
- {
576
- result = Colon2Node.new val[0], val[2]
577
- }
578
- | '::@' CONSTANT
579
- {
580
- result = Colon3Node.new val[1]
581
- }
582
- | primary_value '[@' aref_args ']'
583
- {
584
- result = CallNode.new val[0], { :line => val[0].line, :value => '[]' }, val[2]
585
- }
586
- | '[' aref_args ']'
587
- {
588
- result = ArrayNode.new val[1], val[0], val[2]
589
- }
590
- | '{' assoc_list '}'
591
- {
592
- result = HashNode.new val[1], val[0], val[2]
593
- }
594
- | RETURN
595
- {
596
- result = ReturnNode.new val[0], [nil]
597
- }
598
- | YIELD '(' call_args ')'
599
- {
600
- result = "result = new this.YieldNode(val[0], val[2]);"
601
- }
602
- | YIELD '(' ')'
603
- {
604
- result = "result = new this.YieldNode(val[0], [[]]);"
605
- }
606
- | YIELD
607
- {
608
- result = YieldNode.new val[0], []
609
- }
610
- | DEFINED opt_nl '(' expr ')'
611
- | operation brace_block
612
- {
613
- result = CallNode.new nil, val[0], [[]]
614
- result.block = val[1]
615
- }
616
- | method_call
617
- | method_call brace_block
618
- {
619
- result = val[0];
620
- result.block = val[1]
621
- }
622
- | IF expr_value then compstmt if_tail END
623
- {
624
- result = IfNode.new val[0], val[1], val[3], val[4], val[5]
625
- }
626
- | UNLESS expr_value then compstmt opt_else END
627
- {
628
- result = "result = ['unless', val[1], val[3], val[4]];"
629
- }
630
- | WHILE
631
- {
632
- result = "this.cond_push(1);"
633
- }
634
- expr_value do
635
- {
636
- result = "this.cond_pop();"
637
- }
638
- compstmt END
639
- {
640
- result = "result = ['while', val[0], val[2], val[5]];"
641
- }
642
- | UNTIL
643
- {
644
- result = "this.cond_push(1);"
645
- }
646
- expr_value do
647
- {
648
- result = "this.cond_pop();"
649
- }
650
- compstmt END
651
- {
652
- result = "result = ['while', val[0], val[2], val[5]];"
653
- }
654
- | CASE expr_value opt_terms case_body END
655
- {
656
- result = "result = ['case', val[1], val[3]];"
657
- }
658
- | CASE opt_terms case_body END
659
- {
660
- result = "result = ['case', null, val[2]];"
661
- }
662
- | CASE opt_terms ELSE compstmt END
663
- | FOR block_var IN
664
- {
665
- result = "this.cond_push(1);"
666
- }
667
- expr_value do
668
- {
669
- result = "this.cond_pop();"
670
- }
671
- compstmt END
672
- | CLASS cpath superclass bodystmt END
673
- {
674
- result = ClassNode.new val[0], val[1], val[2], val[3], val[4]
675
- }
676
- | CLASS '<<' expr term bodystmt END
677
- {
678
- result = "result = ['class_shift', val[2], val[4]];"
679
- }
680
- | MODULE cpath bodystmt END
681
- {
682
- result = ModuleNode.new val[0], val[1], val[2], val[3]
683
- }
684
- | DEF fname f_arglist bodystmt END
685
- {
686
- result = DefNode.new val[0], nil, val[1], val[2], val[3], val[4]
687
- }
688
- | DEF singleton dot_or_colon fname f_arglist bodystmt END
689
- {
690
- result = DefNode.new val[0], val[1], val[3], val[4], val[5], val[6]
691
- }
692
- | BREAK
693
- {
694
- result = "result = ['break', null];"
695
- }
696
- | NEXT
697
- {
698
- result = "result = ['next', null];"
699
- }
700
- | REDO
701
- | RETRY
702
-
703
- primary_value: primary
704
-
705
- then: term
706
- | ':'
707
- | THEN
708
- | term THEN
709
-
710
- do: term
711
- | ':'
712
- | DO_COND
713
-
714
- if_tail:
715
- opt_else
716
- {
717
- result = val[0]
718
- }
719
- | ELSIF expr_value then compstmt if_tail
720
- {
721
- result = [[val[0], val[1], val[3]]].concat val[4]
722
- }
723
-
724
- opt_else:
725
- none
726
- {
727
- result = []
728
- }
729
- | ELSE compstmt
730
- {
731
- result = [[val[0], val[1]]]
732
- }
733
-
734
- block_var:
735
- block_var_args
736
- {
737
- result = [val[0], nil]
738
- }
739
-
740
- block_var_args:
741
- f_arg ',' f_block_optarg ',' f_rest_arg opt_f_block_arg
742
- {
743
- result = [val[0], val[2], val[4], val[5]]
744
- }
745
- | f_arg ',' f_block_optarg opt_f_block_arg
746
- {
747
- result = [val[0], val[2], nil, val[3]]
748
- }
749
- | f_arg ',' f_rest_arg opt_f_block_arg
750
- {
751
- result = [val[0], nil, val[2], val[3]]
752
- }
753
- | f_arg opt_f_block_arg
754
- {
755
- result = [val[0], nil, nil, val[1]]
756
- }
757
- | f_block_optarg ',' f_rest_arg opt_f_block_arg
758
- {
759
- result = [nil, val[0], val[2], val[3]]
760
- }
761
- | f_block_optarg opt_f_block_arg
762
- {
763
- result = [nil, val[0], nil, val[1]]
764
- }
765
- | f_rest_arg opt_f_block_arg
766
- {
767
- result = [nil, nil, val[0], val[1]]
768
- }
769
- | f_block_arg
770
- {
771
- result = [nil, nil, nil, val[0]]
772
- }
773
-
774
- f_block_optarg:
775
- f_block_opt
776
- {
777
- result = [val[0]]
778
- }
779
- | f_block_optarg ',' f_block_opt
780
- {
781
- val[0] << val[2]
782
- result = val[0]
783
- }
784
-
785
- f_block_opt:
786
- IDENTIFIER '=' primary_value
787
- {
788
- result = [val[0], val[2]]
789
- }
790
-
791
- opt_block_var:
792
- none
793
- {
794
- result = [nil]
795
- }
796
- | '|' '|'
797
- {
798
- result = [nil]
799
- }
800
- | '||'
801
- {
802
- result = [nil]
803
- }
804
- | '|' block_var '|'
805
- {
806
- result = val[1]
807
- }
808
-
809
- do_block: DO_BLOCK
810
- {
811
- # result = "print('doing half command');"
812
- }
813
- opt_block_var compstmt END
814
- {
815
- result = BlockNode.new val[0], val[2], val[3], val[4]
816
- }
817
-
818
- block_call: command do_block
819
- {
820
- result = val[0]
821
- val[0].block = val[1]
822
- }
823
- | block_call '.' operation2 opt_paren_args
824
- | block_call '::' operation2 opt_paren_args
825
-
826
- method_call:
827
- operation paren_args
828
- {
829
- result = CallNode.new nil, val[0], val[1]
830
- }
831
- | primary_value '.' operation2 opt_paren_args
832
- {
833
- result = CallNode.new val[0], val[2], val[3]
834
- }
835
- | primary_value '::' operation2 paren_args
836
- | primary_value '::' operation3
837
- | SUPER paren_args
838
- {
839
- result = "result = ['super', val[1]];"
840
- }
841
- | SUPER
842
- {
843
- result = "result = ['super', [[]]];"
844
- }
845
-
846
- brace_block:
847
- '{@' opt_block_var compstmt '}'
848
- {
849
- result = BlockNode.new val[0], val[1], val[2], val[3]
850
- }
851
- | DO opt_block_var compstmt END
852
- {
853
- result = BlockNode.new val[0], val[1], val[2], val[3]
854
- }
855
-
856
- case_body: WHEN when_args then compstmt cases
857
- {
858
- result =
859
- "result = [['when', val[1], val[3]]].concat(val[4]);"
860
- }
861
-
862
- when_args: args
863
- {
864
- result = "result = val[0];"
865
- }
866
- | args ',' SPLAT arg_value
867
- {
868
- result = "result = val[0];"
869
- }
870
- | SPLAT arg_value
871
- {
872
- result = "result = [];"
873
- }
874
-
875
- cases: opt_else
876
- | case_body
877
-
878
- opt_rescue:
879
- RESCUE exc_list exc_var then compstmt opt_rescue
880
- {
881
- result = [[val[0], val[1], val[2], val[4]]]
882
- result.concat val[5]
883
- }
884
- |
885
- {
886
- result = []
887
- }
888
-
889
- exc_list: arg_value
890
- | mrhs
891
- | none
892
-
893
- exc_var: '=>' lhs
894
- {
895
- result = val[1]
896
- }
897
- | none
898
- {
899
- result = nil
900
- }
901
-
902
- opt_ensure: ENSURE compstmt
903
- | none
904
-
905
- literal: numeric
906
- | symbol
907
- | dsym
908
-
909
- strings: string
910
-
911
- string: string1
912
- | string string1
913
-
914
- string1: STRING_BEG string_contents STRING_END
915
- {
916
- result = StringNode.new val[1], val[2]
917
- }
918
- | STRING
919
-
920
- xstring:
921
- XSTRING_BEG xstring_contents STRING_END
922
- {
923
- result = XStringNode.new val[0], val[1], val[2]
924
- }
925
-
926
- regexp: REGEXP_BEG xstring_contents REGEXP_END
927
- {
928
- result = "result = ['regexp', val[1], val[2]];"
929
- }
930
-
931
- words: WORDS_BEG SPACE STRING_END
932
- | WORDS_BEG word_list STRING_END
933
-
934
- word_list: none
935
- | word_list word SPACE
936
- word: string_content
937
- | word string_content
938
-
939
- awords: tAWORDS_BEG SPACE STRING_END
940
- | tAWORDS_BEG qword_list STRING_END
941
-
942
- qword_list: none
943
- | qword_list STRING_CONTENT SPACE
944
-
945
- string_contents: none
946
- {
947
- result = []
948
- }
949
- | string_contents string_content
950
- {
951
- result = val[0] << val[1]
952
- }
953
-
954
- xstring_contents: none
955
- {
956
- result = []
957
- }
958
- | xstring_contents string_content
959
- {
960
- result = val[0].concat [val[1]]
961
- }
962
-
963
- string_content: STRING_CONTENT
964
- {
965
- result = ['string_content', val[0]]
966
- }
967
- | STRING_DVAR string_dvar
968
- {
969
- result = ['string_dvar', val[1]]
970
- }
971
- | STRING_DBEG
972
- {
973
- cond_push 0
974
- cmdarg_push 0
975
- }
976
- compstmt '}'
977
- {
978
- cond_lexpop
979
- cmdarg_lexpop
980
- result = ['string_dbegin', val[2]]
981
- }
982
-
983
- string_dvar: GVAR
984
- | IVAR
985
- | CVAR
986
- | backref
987
-
988
-
989
- symbol:
990
- SYMBOL_BEG sym
991
- {
992
- result = SymbolNode.new val[1]
993
- }
994
- | SYMBOL
995
-
996
- sym: fname
997
- | IVAR
998
- | GVAR
999
- | CVAR
1000
-
1001
- dsym:
1002
- SYMBOL_BEG xstring_contents STRING_END
1003
- {
1004
- result = "result = ['dsym', val[1]];"
1005
- }
1006
-
1007
- numeric:
1008
- INTEGER
1009
- {
1010
- result = NumericNode.new val[0]
1011
- }
1012
- | FLOAT
1013
- {
1014
- result = NumericNode.new val[0]
1015
- }
1016
- | '-@NUM' INTEGER =LOWEST
1017
- | '-@NUM' FLOAT =LOWEST
1018
-
1019
- variable:
1020
- IDENTIFIER
1021
- {
1022
- result = IdentifierNode.new val[0]
1023
- }
1024
- | IVAR
1025
- {
1026
- result = IvarNode.new val[0]
1027
- }
1028
- | GVAR
1029
- {
1030
- result = GvarNode.new val[0];
1031
- }
1032
- | CONSTANT
1033
- {
1034
- result = ConstantNode.new val[0]
1035
- }
1036
- | CVAR
1037
- {
1038
- result = "result = ['cvar', val[0]];"
1039
- }
1040
- | NIL
1041
- {
1042
- result = NilNode.new val[0]
1043
- }
1044
- | SELF
1045
- {
1046
- result = SelfNode.new val[0]
1047
- }
1048
- | TRUE
1049
- {
1050
- result = TrueNode.new val[0]
1051
- }
1052
- | FALSE
1053
- {
1054
- result = FalseNode.new val[0]
1055
- }
1056
- | FILE
1057
- {
1058
- result = FileNode.new val[0]
1059
- }
1060
- | LINE
1061
- {
1062
- result = LineNode.new val[0]
1063
- }
1064
- | BLOCK_GIVEN
1065
- {
1066
- result = BlockGivenNode.new val[0]
1067
- }
1068
-
1069
- var_ref: variable
1070
-
1071
- var_lhs: variable
1072
-
1073
- backref: NTH_REF
1074
- | BACK_REF
1075
-
1076
- superclass:
1077
- term
1078
- {
1079
- result = nil
1080
- }
1081
- | '<' expr_value term
1082
- {
1083
- result = val[1]
1084
- }
1085
- | error term
1086
- {
1087
- result = nil
1088
- }
1089
-
1090
- f_arglist:
1091
- '(' f_args opt_nl ')'
1092
- {
1093
- result = val[1]
1094
- }
1095
- | f_args term
1096
- {
1097
- result = val[0]
1098
- }
1099
-
1100
- f_args:
1101
- f_arg ',' f_optarg ',' f_rest_arg opt_f_block_arg
1102
- {
1103
- result = [val[0], val[2], val[4], val[5]]
1104
- }
1105
- | f_arg ',' f_optarg opt_f_block_arg
1106
- {
1107
- result = [val[0], val[2], nil, val[3]]
1108
- }
1109
- | f_arg ',' f_rest_arg opt_f_block_arg
1110
- {
1111
- result = [val[0], nil, val[2], val[3]]
1112
- }
1113
- | f_arg opt_f_block_arg
1114
- {
1115
- result = [val[0], nil, nil, val[1]]
1116
- }
1117
- | f_optarg ',' f_rest_arg opt_f_block_arg
1118
- {
1119
- rsult = [nil, val[0], val[2], val[3]]
1120
- }
1121
- | f_optarg opt_f_block_arg
1122
- {
1123
- result = [nil, val[0], nil, val[1]]
1124
- }
1125
- | f_rest_arg opt_f_block_arg
1126
- {
1127
- result = [nil, nil, val[0], val[1]]
1128
- }
1129
- | f_block_arg
1130
- {
1131
- result = [nil, nil, nil, val[0]]
1132
- }
1133
- |
1134
- {
1135
- result = [nil, nil, nil, nil]
1136
- }
1137
-
1138
- f_norm_arg:
1139
- CONSTANT
1140
- {
1141
- result = "this.yyerror(
1142
- 'formal argument cannot be a constant');"
1143
- }
1144
- | IVAR
1145
- {
1146
- result = "this.yyerror(
1147
- 'formal argument cannot be an instance variable');"
1148
- }
1149
- | CVAR
1150
- {
1151
- result = "this.yyerror(
1152
- 'formal argument cannot be a class variable');"
1153
- }
1154
- | GVAR
1155
- {
1156
- result = "this.yyerror(
1157
- 'formal argument cannot be a global variable');"
1158
- }
1159
- | IDENTIFIER
1160
-
1161
- f_arg:
1162
- f_norm_arg
1163
- {
1164
- result = [val[0]]
1165
- }
1166
- | f_arg ',' f_norm_arg
1167
- {
1168
- val[0] << val[2]
1169
- result = val[0]
1170
- }
1171
-
1172
- f_opt:
1173
- IDENTIFIER '=' arg_value
1174
- {
1175
- result = [val[0], val[2]]
1176
- }
1177
-
1178
- f_optarg:
1179
- f_opt
1180
- {
1181
- result = [val[0]]
1182
- }
1183
- | f_optarg ',' f_opt
1184
- {
1185
- result = val[0]
1186
- val[0] << val[2]
1187
- }
1188
-
1189
- restarg_mark:
1190
- '*'
1191
- | SPLAT
1192
-
1193
- f_rest_arg:
1194
- restarg_mark IDENTIFIER
1195
- {
1196
- result = val[1]
1197
- }
1198
- | restarg_mark
1199
- {
1200
- result = val[0]
1201
- }
1202
-
1203
- blkarg_mark:
1204
- '&'
1205
- | '&@'
1206
-
1207
- f_block_arg:
1208
- blkarg_mark IDENTIFIER
1209
- {
1210
- result = val[1]
1211
- }
1212
-
1213
- opt_f_block_arg:
1214
- ',' f_block_arg
1215
- {
1216
- result = val[1]
1217
- }
1218
- |
1219
- {
1220
- result = nil
1221
- }
1222
-
1223
- singleton: var_ref
1224
- {
1225
- result = val[0]
1226
- }
1227
- | '(' expr opt_nl ')'
1228
- {
1229
- result = val[1]
1230
- }
1231
-
1232
- assoc_list: none
1233
- {
1234
- result = []
1235
- }
1236
- | assocs trailer
1237
- {
1238
- result = val[0]
1239
- }
1240
- | args trailer
1241
- {
1242
- result = "this.yyerror('unsupported assoc list type');"
1243
- }
1244
-
1245
- assocs: assoc
1246
- {
1247
- result = [val[0]]
1248
- }
1249
- | assocs ',' assoc
1250
- {
1251
- result = val[0] << val[2]
1252
- }
1253
-
1254
- assoc: arg_value '=>' arg_value
1255
- {
1256
- result = [val[0], val[2]]
1257
- }
1258
-
1259
- operation: IDENTIFIER
1260
- | CONSTANT
1261
- | FID
1262
-
1263
- operation2: IDENTIFIER
1264
- | CONSTANT
1265
- | FID
1266
- | op
1267
-
1268
- operation3: IDENTIFIER
1269
- | FID
1270
- | op
1271
-
1272
- dot_or_colon: '.'
1273
- | '::'
1274
-
1275
- opt_terms:
1276
- | terms
1277
-
1278
- opt_nl:
1279
- | '\\n'
1280
-
1281
- trailer:
1282
- | '\\n'
1283
- | ','
1284
-
1285
- term: ';'
1286
- | '\\n'
1287
-
1288
- terms: term
1289
- | terms ';'
1290
-
1291
- none:
1292
-
1293
- none_block_pass:
1294
-
1295
- end
1296
-
1297
- ---- inner
1298
-