rkelly-remix 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. data/.gemtest +0 -0
  2. data/CHANGELOG.rdoc +9 -0
  3. data/Manifest.txt +203 -0
  4. data/README.rdoc +58 -0
  5. data/Rakefile +39 -0
  6. data/lib/parser.y +871 -0
  7. data/lib/rkelly/char_pos.rb +35 -0
  8. data/lib/rkelly/char_range.rb +31 -0
  9. data/lib/rkelly/constants.rb +3 -0
  10. data/lib/rkelly/generated_parser.rb +3217 -0
  11. data/lib/rkelly/js/array.rb +15 -0
  12. data/lib/rkelly/js/base.rb +91 -0
  13. data/lib/rkelly/js/boolean.rb +21 -0
  14. data/lib/rkelly/js/function.rb +39 -0
  15. data/lib/rkelly/js/function_prototype.rb +15 -0
  16. data/lib/rkelly/js/global_object.rb +52 -0
  17. data/lib/rkelly/js/math.rb +10 -0
  18. data/lib/rkelly/js/nan.rb +18 -0
  19. data/lib/rkelly/js/number.rb +22 -0
  20. data/lib/rkelly/js/object.rb +30 -0
  21. data/lib/rkelly/js/object_prototype.rb +14 -0
  22. data/lib/rkelly/js/property.rb +20 -0
  23. data/lib/rkelly/js/scope.rb +6 -0
  24. data/lib/rkelly/js/string.rb +21 -0
  25. data/lib/rkelly/js.rb +14 -0
  26. data/lib/rkelly/lexeme.rb +18 -0
  27. data/lib/rkelly/nodes/binary_node.rb +18 -0
  28. data/lib/rkelly/nodes/bracket_accessor_node.rb +11 -0
  29. data/lib/rkelly/nodes/case_clause_node.rb +11 -0
  30. data/lib/rkelly/nodes/comma_node.rb +11 -0
  31. data/lib/rkelly/nodes/conditional_node.rb +11 -0
  32. data/lib/rkelly/nodes/dot_accessor_node.rb +11 -0
  33. data/lib/rkelly/nodes/for_in_node.rb +12 -0
  34. data/lib/rkelly/nodes/for_node.rb +13 -0
  35. data/lib/rkelly/nodes/function_call_node.rb +16 -0
  36. data/lib/rkelly/nodes/function_decl_node.rb +6 -0
  37. data/lib/rkelly/nodes/function_expr_node.rb +12 -0
  38. data/lib/rkelly/nodes/if_node.rb +12 -0
  39. data/lib/rkelly/nodes/label_node.rb +11 -0
  40. data/lib/rkelly/nodes/new_expr_node.rb +11 -0
  41. data/lib/rkelly/nodes/node.rb +94 -0
  42. data/lib/rkelly/nodes/not_strict_equal_node.rb +6 -0
  43. data/lib/rkelly/nodes/op_equal_node.rb +16 -0
  44. data/lib/rkelly/nodes/postfix_node.rb +11 -0
  45. data/lib/rkelly/nodes/prefix_node.rb +6 -0
  46. data/lib/rkelly/nodes/property_node.rb +13 -0
  47. data/lib/rkelly/nodes/resolve_node.rb +19 -0
  48. data/lib/rkelly/nodes/strict_equal_node.rb +6 -0
  49. data/lib/rkelly/nodes/try_node.rb +13 -0
  50. data/lib/rkelly/nodes/var_decl_node.rb +15 -0
  51. data/lib/rkelly/nodes.rb +25 -0
  52. data/lib/rkelly/parser.rb +89 -0
  53. data/lib/rkelly/runtime/ruby_function.rb +13 -0
  54. data/lib/rkelly/runtime/scope_chain.rb +57 -0
  55. data/lib/rkelly/runtime.rb +36 -0
  56. data/lib/rkelly/syntax_error.rb +4 -0
  57. data/lib/rkelly/token.rb +24 -0
  58. data/lib/rkelly/tokenizer.rb +193 -0
  59. data/lib/rkelly/visitable.rb +16 -0
  60. data/lib/rkelly/visitors/dot_visitor.rb +228 -0
  61. data/lib/rkelly/visitors/ecma_visitor.rb +322 -0
  62. data/lib/rkelly/visitors/enumerable_visitor.rb +18 -0
  63. data/lib/rkelly/visitors/evaluation_visitor.rb +419 -0
  64. data/lib/rkelly/visitors/function_visitor.rb +46 -0
  65. data/lib/rkelly/visitors/pointcut_visitor.rb +31 -0
  66. data/lib/rkelly/visitors/real_sexp_visitor.rb +16 -0
  67. data/lib/rkelly/visitors/sexp_visitor.rb +373 -0
  68. data/lib/rkelly/visitors/visitor.rb +136 -0
  69. data/lib/rkelly/visitors.rb +4 -0
  70. data/lib/rkelly.rb +14 -0
  71. data/test/ecma_script_test_case.rb +21 -0
  72. data/test/execute_test_case.rb +16 -0
  73. data/test/execution_contexts/test_10_1_3-1.rb +32 -0
  74. data/test/expressions/test_11_3_1.rb +64 -0
  75. data/test/expressions/test_11_3_2.rb +64 -0
  76. data/test/expressions/test_11_4_2.rb +13 -0
  77. data/test/expressions/test_11_4_3.rb +52 -0
  78. data/test/expressions/test_11_4_4.rb +68 -0
  79. data/test/expressions/test_11_4_5.rb +69 -0
  80. data/test/expressions/test_11_4_6.rb +88 -0
  81. data/test/expressions/test_11_4_8.rb +28 -0
  82. data/test/expressions/test_11_4_9.rb +103 -0
  83. data/test/expressions/test_11_5_1.rb +51 -0
  84. data/test/expressions/test_11_5_2.rb +80 -0
  85. data/test/expressions/test_11_5_3.rb +88 -0
  86. data/test/expressions/test_11_6_1-1.rb +19 -0
  87. data/test/expressions/test_11_9_1.rb +19 -0
  88. data/test/function/test_15_3_1_1-1.rb +34 -0
  89. data/test/global_object/test_15_1_1_1.rb +29 -0
  90. data/test/global_object/test_15_1_1_2.rb +17 -0
  91. data/test/global_object/test_15_1_1_3.rb +9 -0
  92. data/test/helper.rb +5 -0
  93. data/test/node_test_case.rb +11 -0
  94. data/test/object/test_15_2_1_1.rb +257 -0
  95. data/test/object/test_15_2_1_2.rb +21 -0
  96. data/test/object/test_15_2_2_1.rb +52 -0
  97. data/test/statements/test_12_5-1.rb +27 -0
  98. data/test/test_add_node.rb +8 -0
  99. data/test/test_arguments_node.rb +8 -0
  100. data/test/test_array_node.rb +9 -0
  101. data/test/test_assign_expr_node.rb +8 -0
  102. data/test/test_automatic_semicolon_insertion.rb +137 -0
  103. data/test/test_bit_and_node.rb +8 -0
  104. data/test/test_bit_or_node.rb +8 -0
  105. data/test/test_bit_x_or_node.rb +8 -0
  106. data/test/test_bitwise_not_node.rb +8 -0
  107. data/test/test_block_node.rb +14 -0
  108. data/test/test_bracket_accessor_node.rb +16 -0
  109. data/test/test_break_node.rb +11 -0
  110. data/test/test_case_block_node.rb +11 -0
  111. data/test/test_case_clause_node.rb +15 -0
  112. data/test/test_char_pos.rb +39 -0
  113. data/test/test_char_range.rb +29 -0
  114. data/test/test_comma_node.rb +13 -0
  115. data/test/test_comments.rb +45 -0
  116. data/test/test_conditional_node.rb +17 -0
  117. data/test/test_const_statement_node.rb +14 -0
  118. data/test/test_continue_node.rb +11 -0
  119. data/test/test_delete_node.rb +8 -0
  120. data/test/test_divide_node.rb +8 -0
  121. data/test/test_do_while_node.rb +13 -0
  122. data/test/test_dot_accessor_node.rb +9 -0
  123. data/test/test_ecma_visitor.rb +210 -0
  124. data/test/test_element_node.rb +8 -0
  125. data/test/test_empty_statement_node.rb +8 -0
  126. data/test/test_equal_node.rb +8 -0
  127. data/test/test_evaluation_visitor.rb +66 -0
  128. data/test/test_expression_statement_node.rb +10 -0
  129. data/test/test_false_node.rb +8 -0
  130. data/test/test_for_in_node.rb +17 -0
  131. data/test/test_for_node.rb +24 -0
  132. data/test/test_function_body_node.rb +8 -0
  133. data/test/test_function_call_node.rb +10 -0
  134. data/test/test_function_decl_node.rb +16 -0
  135. data/test/test_function_expr_node.rb +16 -0
  136. data/test/test_function_visitor.rb +26 -0
  137. data/test/test_getter_property_node.rb +10 -0
  138. data/test/test_global_object.rb +49 -0
  139. data/test/test_greater_node.rb +8 -0
  140. data/test/test_greater_or_equal_node.rb +8 -0
  141. data/test/test_if_node.rb +17 -0
  142. data/test/test_in_node.rb +8 -0
  143. data/test/test_instance_of_node.rb +8 -0
  144. data/test/test_label_node.rb +13 -0
  145. data/test/test_left_shift_node.rb +8 -0
  146. data/test/test_less_node.rb +8 -0
  147. data/test/test_less_or_equal_node.rb +8 -0
  148. data/test/test_line_number.rb +81 -0
  149. data/test/test_logical_and_node.rb +8 -0
  150. data/test/test_logical_not_node.rb +8 -0
  151. data/test/test_logical_or_node.rb +8 -0
  152. data/test/test_modulus_node.rb +8 -0
  153. data/test/test_multiply_node.rb +8 -0
  154. data/test/test_new_expr_node.rb +9 -0
  155. data/test/test_not_equal_node.rb +8 -0
  156. data/test/test_not_strict_equal_node.rb +8 -0
  157. data/test/test_null_node.rb +8 -0
  158. data/test/test_number_node.rb +8 -0
  159. data/test/test_object_literal_node.rb +9 -0
  160. data/test/test_op_and_equal_node.rb +10 -0
  161. data/test/test_op_divide_equal_node.rb +10 -0
  162. data/test/test_op_equal_node.rb +10 -0
  163. data/test/test_op_l_shift_equal_node.rb +10 -0
  164. data/test/test_op_minus_equal_node.rb +10 -0
  165. data/test/test_op_mod_equal_node.rb +10 -0
  166. data/test/test_op_multiply_equal_node.rb +10 -0
  167. data/test/test_op_or_equal_node.rb +10 -0
  168. data/test/test_op_plus_equal_node.rb +10 -0
  169. data/test/test_op_r_shift_equal_node.rb +10 -0
  170. data/test/test_op_u_r_shift_equal_node.rb +10 -0
  171. data/test/test_op_x_or_equal_node.rb +10 -0
  172. data/test/test_parameter_node.rb +8 -0
  173. data/test/test_parser.rb +1361 -0
  174. data/test/test_pointcut_visitor.rb +34 -0
  175. data/test/test_postfix_node.rb +8 -0
  176. data/test/test_prefix_node.rb +8 -0
  177. data/test/test_property_node.rb +8 -0
  178. data/test/test_regexp_node.rb +8 -0
  179. data/test/test_resolve_node.rb +22 -0
  180. data/test/test_return_node.rb +11 -0
  181. data/test/test_right_shift_node.rb +8 -0
  182. data/test/test_rkelly.rb +19 -0
  183. data/test/test_runtime.rb +12 -0
  184. data/test/test_scope_chain.rb +50 -0
  185. data/test/test_setter_property_node.rb +10 -0
  186. data/test/test_source_elements.rb +9 -0
  187. data/test/test_strict_equal_node.rb +8 -0
  188. data/test/test_string_node.rb +8 -0
  189. data/test/test_subtract_node.rb +8 -0
  190. data/test/test_switch_node.rb +12 -0
  191. data/test/test_this_node.rb +8 -0
  192. data/test/test_throw_node.rb +7 -0
  193. data/test/test_tokenizer.rb +209 -0
  194. data/test/test_true_node.rb +8 -0
  195. data/test/test_try_node.rb +59 -0
  196. data/test/test_type_of_node.rb +8 -0
  197. data/test/test_unary_minus_node.rb +8 -0
  198. data/test/test_unary_plus_node.rb +8 -0
  199. data/test/test_unsigned_right_shift_node.rb +8 -0
  200. data/test/test_var_decl_node.rb +21 -0
  201. data/test/test_var_statement_node.rb +14 -0
  202. data/test/test_void_node.rb +8 -0
  203. data/test/test_while_node.rb +15 -0
  204. data/test/test_with_node.rb +8 -0
  205. metadata +432 -0
data/lib/parser.y ADDED
@@ -0,0 +1,871 @@
1
+ /* vim: set filetype=racc : */
2
+
3
+ class RKelly::GeneratedParser
4
+
5
+ /* Literals */
6
+ token NULL TRUE FALSE
7
+
8
+ /* keywords */
9
+ token BREAK CASE CATCH CONST CONTINUE DEBUGGER DEFAULT DELETE DO ELSE ENUM
10
+ token FINALLY FOR FUNCTION IF IN INSTANCEOF NEW RETURN SWITCH THIS THROW TRY
11
+ token TYPEOF VAR VOID WHILE WITH
12
+
13
+ /* punctuators */
14
+ token EQEQ NE /* == and != */
15
+ token STREQ STRNEQ /* === and !== */
16
+ token LE GE /* < and > */
17
+ token OR AND /* || and && */
18
+ token PLUSPLUS MINUSMINUS /* ++ and -- */
19
+ token LSHIFT /* << */
20
+ token RSHIFT URSHIFT /* >> and >>> */
21
+ token PLUSEQUAL MINUSEQUAL /* += and -= */
22
+ token MULTEQUAL DIVEQUAL /* *= and /= */
23
+ token LSHIFTEQUAL /* <<= */
24
+ token RSHIFTEQUAL URSHIFTEQUAL /* >>= and >>>= */
25
+ token ANDEQUAL MODEQUAL /* &= and %= */
26
+ token XOREQUAL OREQUAL /* ^= and |= */
27
+
28
+ /* Terminal types */
29
+ token REGEXP
30
+ token NUMBER
31
+ token STRING
32
+ token IDENT
33
+
34
+ token AUTOPLUSPLUS AUTOMINUSMINUS IF_WITHOUT_ELSE
35
+
36
+ prechigh
37
+ nonassoc ELSE
38
+ nonassoc IF_WITHOUT_ELSE
39
+ preclow
40
+
41
+ rule
42
+ SourceElements:
43
+ /* nothing */ { result = SourceElementsNode.new([]) }
44
+ | SourceElementList { result = SourceElementsNode.new([val].flatten) }
45
+
46
+ SourceElementList:
47
+ SourceElement
48
+ | SourceElementList SourceElement { result = val.flatten }
49
+ ;
50
+
51
+ SourceElement:
52
+ FunctionDeclaration
53
+ | Statement
54
+ ;
55
+
56
+ Statement:
57
+ Block
58
+ | VariableStatement
59
+ | ConstStatement
60
+ | EmptyStatement
61
+ | ExprStatement
62
+ | IfStatement
63
+ | IterationStatement
64
+ | ContinueStatement
65
+ | BreakStatement
66
+ | ReturnStatement
67
+ | WithStatement
68
+ | SwitchStatement
69
+ | LabelledStatement
70
+ | ThrowStatement
71
+ | TryStatement
72
+ | DebuggerStatement
73
+ ;
74
+
75
+ Literal:
76
+ NULL { result = NullNode.new(val.first) }
77
+ | TRUE { result = TrueNode.new(val.first) }
78
+ | FALSE { result = FalseNode.new(val.first) }
79
+ | NUMBER { result = NumberNode.new(val.first) }
80
+ | STRING { result = StringNode.new(val.first) }
81
+ | REGEXP { result = RegexpNode.new(val.first) }
82
+ ;
83
+
84
+ Property:
85
+ IDENT ':' AssignmentExpr {
86
+ result = PropertyNode.new(val[0], val[2])
87
+ }
88
+ | STRING ':' AssignmentExpr { result = PropertyNode.new(val.first, val.last) }
89
+ | NUMBER ':' AssignmentExpr { result = PropertyNode.new(val.first, val.last) }
90
+ | IDENT IDENT '(' ')' FunctionBody {
91
+ klass = property_class_for(val.first)
92
+ yyabort unless klass
93
+ result = klass.new(val[1], FunctionExprNode.new(nil, val[4]))
94
+ }
95
+ | IDENT IDENT '(' FormalParameterList ')' FunctionBody {
96
+ klass = property_class_for(val.first)
97
+ yyabort unless klass
98
+ result = klass.new(val[1], FunctionExprNode.new(nil, val[5], val[3]))
99
+ }
100
+ ;
101
+
102
+ PropertyList:
103
+ Property { result = val }
104
+ | PropertyList ',' Property { result = [val.first, val.last].flatten }
105
+ ;
106
+
107
+ PrimaryExpr:
108
+ PrimaryExprNoBrace
109
+ | '{' '}' { result = ObjectLiteralNode.new([]) }
110
+ | '{' PropertyList '}' { result = ObjectLiteralNode.new(val[1]) }
111
+ | '{' PropertyList ',' '}' { result = ObjectLiteralNode.new(val[1]) }
112
+ ;
113
+
114
+ PrimaryExprNoBrace:
115
+ THIS { result = ThisNode.new(val.first) }
116
+ | Literal
117
+ | ArrayLiteral
118
+ | IDENT { result = ResolveNode.new(val.first) }
119
+ | '(' Expr ')' { result = ParentheticalNode.new(val[1]) }
120
+ ;
121
+
122
+ ArrayLiteral:
123
+ '[' ElisionOpt ']' { result = ArrayNode.new([] + [nil] * val[1]) }
124
+ | '[' ElementList ']' { result = ArrayNode.new(val[1]) }
125
+ | '[' ElementList ',' ElisionOpt ']' {
126
+ result = ArrayNode.new(val[1] + [nil] * val[3])
127
+ }
128
+ ;
129
+
130
+ ElementList:
131
+ ElisionOpt AssignmentExpr {
132
+ result = [nil] * val[0] + [ElementNode.new(val[1])]
133
+ }
134
+ | ElementList ',' ElisionOpt AssignmentExpr {
135
+ result = [val[0], [nil] * val[2], ElementNode.new(val[3])].flatten
136
+ }
137
+ ;
138
+
139
+ ElisionOpt:
140
+ /* nothing */ { result = 0 }
141
+ | Elision
142
+ ;
143
+
144
+ Elision:
145
+ ',' { result = 1 }
146
+ | Elision ',' { result = val.first + 1 }
147
+ ;
148
+
149
+ MemberExpr:
150
+ PrimaryExpr
151
+ | FunctionExpr
152
+ | MemberExpr '[' Expr ']' { result = BracketAccessorNode.new(val[0], val[2]) }
153
+ | MemberExpr '.' IDENT { result = DotAccessorNode.new(val[0], val[2]) }
154
+ | NEW MemberExpr Arguments { result = NewExprNode.new(val[1], val[2]) }
155
+ ;
156
+
157
+ MemberExprNoBF:
158
+ PrimaryExprNoBrace
159
+ | MemberExprNoBF '[' Expr ']' {
160
+ result = BracketAccessorNode.new(val[0], val[2])
161
+ }
162
+ | MemberExprNoBF '.' IDENT { result = DotAccessorNode.new(val[0], val[2]) }
163
+ | NEW MemberExpr Arguments { result = NewExprNode.new(val[1], val[2]) }
164
+ ;
165
+
166
+ NewExpr:
167
+ MemberExpr
168
+ | NEW NewExpr { result = NewExprNode.new(val[1], ArgumentsNode.new([])) }
169
+ ;
170
+
171
+ NewExprNoBF:
172
+ MemberExprNoBF
173
+ | NEW NewExpr { result = NewExprNode.new(val[1], ArgumentsNode.new([])) }
174
+ ;
175
+
176
+ CallExpr:
177
+ MemberExpr Arguments { result = FunctionCallNode.new(val[0], val[1]) }
178
+ | CallExpr Arguments { result = FunctionCallNode.new(val[0], val[1]) }
179
+ | CallExpr '[' Expr ']' { result = BracketAccessorNode.new(val[0], val[2]) }
180
+ | CallExpr '.' IDENT { result = DotAccessorNode.new(val[0], val[2]) }
181
+ ;
182
+
183
+ CallExprNoBF:
184
+ VOID '(' MemberExpr ')' { result = FunctionCallNode.new(ResolveNode.new(val[0]), val[2]) }
185
+ | MemberExprNoBF Arguments { result = FunctionCallNode.new(val[0], val[1]) }
186
+ | CallExprNoBF Arguments { result = FunctionCallNode.new(val[0], val[1]) }
187
+ | CallExprNoBF '[' Expr ']' { result = BracketAccessorNode.new(val[0], val[2]) }
188
+ | CallExprNoBF '.' IDENT { result = DotAccessorNode.new(val[0], val[2]) }
189
+ ;
190
+
191
+ Arguments:
192
+ '(' ')' { result = ArgumentsNode.new([]) }
193
+ | '(' ArgumentList ')' { result = ArgumentsNode.new(val[1]); }
194
+ ;
195
+
196
+ ArgumentList:
197
+ AssignmentExpr { result = val }
198
+ | ArgumentList ',' AssignmentExpr { result = [val[0], val[2]].flatten }
199
+ ;
200
+
201
+ LeftHandSideExpr:
202
+ NewExpr
203
+ | CallExpr
204
+ ;
205
+
206
+ LeftHandSideExprNoBF:
207
+ NewExprNoBF
208
+ | CallExprNoBF
209
+ ;
210
+
211
+ PostfixExpr:
212
+ LeftHandSideExpr
213
+ | LeftHandSideExpr PLUSPLUS { result = PostfixNode.new(val[0], '++') }
214
+ | LeftHandSideExpr MINUSMINUS { result = PostfixNode.new(val[0], '--') }
215
+ ;
216
+
217
+ PostfixExprNoBF:
218
+ LeftHandSideExprNoBF
219
+ | LeftHandSideExprNoBF PLUSPLUS { result = PostfixNode.new(val[0], '++') }
220
+ | LeftHandSideExprNoBF MINUSMINUS { result = PostfixNode.new(val[0], '--') }
221
+ ;
222
+
223
+ UnaryExprCommon:
224
+ DELETE UnaryExpr { result = DeleteNode.new(val[1]) }
225
+ | VOID UnaryExpr { result = VoidNode.new(val[1]) }
226
+ | TYPEOF UnaryExpr { result = TypeOfNode.new(val[1]) }
227
+ | PLUSPLUS UnaryExpr { result = PrefixNode.new(val[1], '++') }
228
+ /* FIXME: Not sure when this can ever happen
229
+ | AUTOPLUSPLUS UnaryExpr { result = makePrefixNode($2, OpPlusPlus); } */
230
+ | MINUSMINUS UnaryExpr { result = PrefixNode.new(val[1], '--') }
231
+ /* FIXME: Not sure when this can ever happen
232
+ | AUTOMINUSMINUS UnaryExpr { result = makePrefixNode($2, OpMinusMinus); } */
233
+ | '+' UnaryExpr { result = UnaryPlusNode.new(val[1]) }
234
+ | '-' UnaryExpr { result = UnaryMinusNode.new(val[1]) }
235
+ | '~' UnaryExpr { result = BitwiseNotNode.new(val[1]) }
236
+ | '!' UnaryExpr { result = LogicalNotNode.new(val[1]) }
237
+ ;
238
+
239
+ UnaryExpr:
240
+ PostfixExpr
241
+ | UnaryExprCommon
242
+ ;
243
+
244
+ UnaryExprNoBF:
245
+ PostfixExprNoBF
246
+ | UnaryExprCommon
247
+ ;
248
+
249
+ MultiplicativeExpr:
250
+ UnaryExpr
251
+ | MultiplicativeExpr '*' UnaryExpr { result = MultiplyNode.new(val[0],val[2])}
252
+ | MultiplicativeExpr '/' UnaryExpr { result = DivideNode.new(val[0], val[2]) }
253
+ | MultiplicativeExpr '%' UnaryExpr { result = ModulusNode.new(val[0], val[2])}
254
+ ;
255
+
256
+ MultiplicativeExprNoBF:
257
+ UnaryExprNoBF
258
+ | MultiplicativeExprNoBF '*' UnaryExpr { result = MultiplyNode.new(val[0], val[2]) }
259
+ | MultiplicativeExprNoBF '/' UnaryExpr { result = DivideNode.new(val[0],val[2]) }
260
+ | MultiplicativeExprNoBF '%' UnaryExpr { result = ModulusNode.new(val[0], val[2]) }
261
+ ;
262
+
263
+ AdditiveExpr:
264
+ MultiplicativeExpr
265
+ | AdditiveExpr '+' MultiplicativeExpr { result = AddNode.new(val[0], val[2]) }
266
+ | AdditiveExpr '-' MultiplicativeExpr { result = SubtractNode.new(val[0], val[2]) }
267
+ ;
268
+
269
+ AdditiveExprNoBF:
270
+ MultiplicativeExprNoBF
271
+ | AdditiveExprNoBF '+' MultiplicativeExpr { result = AddNode.new(val[0], val[2]) }
272
+ | AdditiveExprNoBF '-' MultiplicativeExpr { result = SubtractNode.new(val[0], val[2]) }
273
+ ;
274
+
275
+ ShiftExpr:
276
+ AdditiveExpr
277
+ | ShiftExpr LSHIFT AdditiveExpr { result = LeftShiftNode.new(val[0], val[2]) }
278
+ | ShiftExpr RSHIFT AdditiveExpr { result = RightShiftNode.new(val[0], val[2]) }
279
+ | ShiftExpr URSHIFT AdditiveExpr { result = UnsignedRightShiftNode.new(val[0], val[2]) }
280
+ ;
281
+
282
+ ShiftExprNoBF:
283
+ AdditiveExprNoBF
284
+ | ShiftExprNoBF LSHIFT AdditiveExpr { result = LeftShiftNode.new(val[0], val[2]) }
285
+ | ShiftExprNoBF RSHIFT AdditiveExpr { result = RightShiftNode.new(val[0], val[2]) }
286
+ | ShiftExprNoBF URSHIFT AdditiveExpr { result = UnsignedRightShiftNode.new(val[0], val[2]) }
287
+ ;
288
+
289
+ RelationalExpr:
290
+ ShiftExpr
291
+ | RelationalExpr '<' ShiftExpr { result = LessNode.new(val[0], val[2])}
292
+ | RelationalExpr '>' ShiftExpr { result = GreaterNode.new(val[0], val[2]) }
293
+ | RelationalExpr LE ShiftExpr { result = LessOrEqualNode.new(val[0], val[2]) }
294
+ | RelationalExpr GE ShiftExpr { result = GreaterOrEqualNode.new(val[0], val[2]) }
295
+ | RelationalExpr INSTANCEOF ShiftExpr { result = InstanceOfNode.new(val[0], val[2]) }
296
+ | RelationalExpr IN ShiftExpr { result = InNode.new(val[0], val[2]) }
297
+ ;
298
+
299
+ RelationalExprNoIn:
300
+ ShiftExpr
301
+ | RelationalExprNoIn '<' ShiftExpr { result = LessNode.new(val[0], val[2])}
302
+ | RelationalExprNoIn '>' ShiftExpr { result = GreaterNode.new(val[0], val[2]) }
303
+ | RelationalExprNoIn LE ShiftExpr { result = LessOrEqualNode.new(val[0], val[2]) }
304
+ | RelationalExprNoIn GE ShiftExpr { result = GreaterOrEqualNode.new(val[0], val[2]) }
305
+ | RelationalExprNoIn INSTANCEOF ShiftExpr
306
+ { result = InstanceOfNode.new(val[0], val[2]) }
307
+ ;
308
+
309
+ RelationalExprNoBF:
310
+ ShiftExprNoBF
311
+ | RelationalExprNoBF '<' ShiftExpr { result = LessNode.new(val[0], val[2]) }
312
+ | RelationalExprNoBF '>' ShiftExpr { result = GreaterNode.new(val[0], val[2]) }
313
+ | RelationalExprNoBF LE ShiftExpr { result = LessOrEqualNode.new(val[0], val[2]) }
314
+ | RelationalExprNoBF GE ShiftExpr { result = GreaterOrEqualNode.new(val[0], val[2]) }
315
+ | RelationalExprNoBF INSTANCEOF ShiftExpr
316
+ { result = InstanceOfNode.new(val[0], val[2]) }
317
+ | RelationalExprNoBF IN ShiftExpr { result = InNode.new(val[0], val[2]) }
318
+ ;
319
+
320
+ EqualityExpr:
321
+ RelationalExpr
322
+ | EqualityExpr EQEQ RelationalExpr { result = EqualNode.new(val[0], val[2]) }
323
+ | EqualityExpr NE RelationalExpr { result = NotEqualNode.new(val[0], val[2]) }
324
+ | EqualityExpr STREQ RelationalExpr { result = StrictEqualNode.new(val[0], val[2]) }
325
+ | EqualityExpr STRNEQ RelationalExpr { result = NotStrictEqualNode.new(val[0], val[2]) }
326
+ ;
327
+
328
+ EqualityExprNoIn:
329
+ RelationalExprNoIn
330
+ | EqualityExprNoIn EQEQ RelationalExprNoIn
331
+ { result = EqualNode.new(val[0], val[2]) }
332
+ | EqualityExprNoIn NE RelationalExprNoIn
333
+ { result = NotEqualNode.new(val[0], val[2]) }
334
+ | EqualityExprNoIn STREQ RelationalExprNoIn
335
+ { result = StrictEqualNode.new(val[0], val[2]) }
336
+ | EqualityExprNoIn STRNEQ RelationalExprNoIn
337
+ { result = NotStrictEqualNode.new(val[0], val[2]) }
338
+ ;
339
+
340
+ EqualityExprNoBF:
341
+ RelationalExprNoBF
342
+ | EqualityExprNoBF EQEQ RelationalExpr
343
+ { result = EqualNode.new(val[0], val[2]) }
344
+ | EqualityExprNoBF NE RelationalExpr { result = NotEqualNode.new(val[0], val[2]) }
345
+ | EqualityExprNoBF STREQ RelationalExpr
346
+ { result = StrictEqualNode.new(val[0], val[2]) }
347
+ | EqualityExprNoBF STRNEQ RelationalExpr
348
+ { result = NotStrictEqualNode.new(val[0], val[2]) }
349
+ ;
350
+
351
+ BitwiseANDExpr:
352
+ EqualityExpr
353
+ | BitwiseANDExpr '&' EqualityExpr { result = BitAndNode.new(val[0], val[2]) }
354
+ ;
355
+
356
+ BitwiseANDExprNoIn:
357
+ EqualityExprNoIn
358
+ | BitwiseANDExprNoIn '&' EqualityExprNoIn
359
+ { result = BitAndNode.new(val[0], val[2]) }
360
+ ;
361
+
362
+ BitwiseANDExprNoBF:
363
+ EqualityExprNoBF
364
+ | BitwiseANDExprNoBF '&' EqualityExpr { result = BitAndNode.new(val[0], val[2]) }
365
+ ;
366
+
367
+ BitwiseXORExpr:
368
+ BitwiseANDExpr
369
+ | BitwiseXORExpr '^' BitwiseANDExpr { result = BitXOrNode.new(val[0], val[2]) }
370
+ ;
371
+
372
+ BitwiseXORExprNoIn:
373
+ BitwiseANDExprNoIn
374
+ | BitwiseXORExprNoIn '^' BitwiseANDExprNoIn
375
+ { result = BitXOrNode.new(val[0], val[2]) }
376
+ ;
377
+
378
+ BitwiseXORExprNoBF:
379
+ BitwiseANDExprNoBF
380
+ | BitwiseXORExprNoBF '^' BitwiseANDExpr
381
+ { result = BitXOrNode.new(val[0], val[2]) }
382
+ ;
383
+
384
+ BitwiseORExpr:
385
+ BitwiseXORExpr
386
+ | BitwiseORExpr '|' BitwiseXORExpr { result = BitOrNode.new(val[0], val[2]) }
387
+ ;
388
+
389
+ BitwiseORExprNoIn:
390
+ BitwiseXORExprNoIn
391
+ | BitwiseORExprNoIn '|' BitwiseXORExprNoIn
392
+ { result = BitOrNode.new(val[0], val[2]) }
393
+ ;
394
+
395
+ BitwiseORExprNoBF:
396
+ BitwiseXORExprNoBF
397
+ | BitwiseORExprNoBF '|' BitwiseXORExpr
398
+ { result = BitOrNode.new(val[0], val[2]) }
399
+ ;
400
+
401
+ LogicalANDExpr:
402
+ BitwiseORExpr
403
+ | LogicalANDExpr AND BitwiseORExpr { result = LogicalAndNode.new(val[0], val[2]) }
404
+ ;
405
+
406
+ LogicalANDExprNoIn:
407
+ BitwiseORExprNoIn
408
+ | LogicalANDExprNoIn AND BitwiseORExprNoIn
409
+ { result = LogicalAndNode.new(val[0], val[2]) }
410
+ ;
411
+
412
+ LogicalANDExprNoBF:
413
+ BitwiseORExprNoBF
414
+ | LogicalANDExprNoBF AND BitwiseORExpr
415
+ { result = LogicalAndNode.new(val[0], val[2]) }
416
+ ;
417
+
418
+ LogicalORExpr:
419
+ LogicalANDExpr
420
+ | LogicalORExpr OR LogicalANDExpr { result = LogicalOrNode.new(val[0], val[2]) }
421
+ ;
422
+
423
+ LogicalORExprNoIn:
424
+ LogicalANDExprNoIn
425
+ | LogicalORExprNoIn OR LogicalANDExprNoIn
426
+ { result = LogicalOrNode.new(val[0], val[2]) }
427
+ ;
428
+
429
+ LogicalORExprNoBF:
430
+ LogicalANDExprNoBF
431
+ | LogicalORExprNoBF OR LogicalANDExpr { result = LogicalOrNode.new(val[0], val[2]) }
432
+ ;
433
+
434
+ ConditionalExpr:
435
+ LogicalORExpr
436
+ | LogicalORExpr '?' AssignmentExpr ':' AssignmentExpr {
437
+ result = ConditionalNode.new(val[0], val[2], val[4])
438
+ }
439
+ ;
440
+
441
+ ConditionalExprNoIn:
442
+ LogicalORExprNoIn
443
+ | LogicalORExprNoIn '?' AssignmentExprNoIn ':' AssignmentExprNoIn {
444
+ result = ConditionalNode.new(val[0], val[2], val[4])
445
+ }
446
+ ;
447
+
448
+ ConditionalExprNoBF:
449
+ LogicalORExprNoBF
450
+ | LogicalORExprNoBF '?' AssignmentExpr ':' AssignmentExpr {
451
+ result = ConditionalNode.new(val[0], val[2], val[4])
452
+ }
453
+ ;
454
+
455
+ AssignmentExpr:
456
+ ConditionalExpr
457
+ | LeftHandSideExpr AssignmentOperator AssignmentExpr {
458
+ result = val[1].new(val.first, val.last)
459
+ }
460
+ ;
461
+
462
+ AssignmentExprNoIn:
463
+ ConditionalExprNoIn
464
+ | LeftHandSideExpr AssignmentOperator AssignmentExprNoIn {
465
+ result = val[1].new(val.first, val.last)
466
+ }
467
+ ;
468
+
469
+ AssignmentExprNoBF:
470
+ ConditionalExprNoBF
471
+ | LeftHandSideExprNoBF AssignmentOperator AssignmentExpr {
472
+ result = val[1].new(val.first, val.last)
473
+ }
474
+ ;
475
+
476
+ AssignmentOperator:
477
+ '=' { result = OpEqualNode }
478
+ | PLUSEQUAL { result = OpPlusEqualNode }
479
+ | MINUSEQUAL { result = OpMinusEqualNode }
480
+ | MULTEQUAL { result = OpMultiplyEqualNode }
481
+ | DIVEQUAL { result = OpDivideEqualNode }
482
+ | LSHIFTEQUAL { result = OpLShiftEqualNode }
483
+ | RSHIFTEQUAL { result = OpRShiftEqualNode }
484
+ | URSHIFTEQUAL { result = OpURShiftEqualNode }
485
+ | ANDEQUAL { result = OpAndEqualNode }
486
+ | XOREQUAL { result = OpXOrEqualNode }
487
+ | OREQUAL { result = OpOrEqualNode }
488
+ | MODEQUAL { result = OpModEqualNode }
489
+ ;
490
+
491
+ Expr:
492
+ AssignmentExpr
493
+ | Expr ',' AssignmentExpr { result = CommaNode.new(val[0], val[2]) }
494
+ ;
495
+
496
+ ExprNoIn:
497
+ AssignmentExprNoIn
498
+ | ExprNoIn ',' AssignmentExprNoIn { result = CommaNode.new(val[0], val[2]) }
499
+ ;
500
+
501
+ ExprNoBF:
502
+ AssignmentExprNoBF
503
+ | ExprNoBF ',' AssignmentExpr { result = CommaNode.new(val[0], val[2]) }
504
+ ;
505
+
506
+
507
+ Block:
508
+ '{' SourceElements '}' {
509
+ result = BlockNode.new(val[1])
510
+ debug(result)
511
+ }
512
+ ;
513
+
514
+ VariableStatement:
515
+ VAR VariableDeclarationList ';' {
516
+ result = VarStatementNode.new(val[1])
517
+ debug(result)
518
+ }
519
+ | VAR VariableDeclarationList error {
520
+ result = VarStatementNode.new(val[1])
521
+ debug(result)
522
+ yyabort unless allow_auto_semi?(val.last)
523
+ }
524
+ ;
525
+
526
+ VariableDeclarationList:
527
+ VariableDeclaration { result = val }
528
+ | VariableDeclarationList ',' VariableDeclaration {
529
+ result = [val.first, val.last].flatten
530
+ }
531
+ ;
532
+
533
+ VariableDeclarationListNoIn:
534
+ VariableDeclarationNoIn { result = val }
535
+ | VariableDeclarationListNoIn ',' VariableDeclarationNoIn {
536
+ result = [val.first, val.last].flatten
537
+ }
538
+ ;
539
+
540
+ VariableDeclaration:
541
+ IDENT { result = VarDeclNode.new(val.first, nil) }
542
+ | IDENT Initializer { result = VarDeclNode.new(val.first, val[1]) }
543
+ ;
544
+
545
+ VariableDeclarationNoIn:
546
+ IDENT { result = VarDeclNode.new(val[0],nil) }
547
+ | IDENT InitializerNoIn { result = VarDeclNode.new(val[0], val[1]) }
548
+ ;
549
+
550
+ ConstStatement:
551
+ CONST ConstDeclarationList ';' {
552
+ result = ConstStatementNode.new(val[1])
553
+ debug(result)
554
+ }
555
+ | CONST ConstDeclarationList error {
556
+ result = ConstStatementNode.new(val[1])
557
+ debug(result)
558
+ yyerror unless allow_auto_semi?(val.last)
559
+ }
560
+ ;
561
+
562
+ ConstDeclarationList:
563
+ ConstDeclaration { result = val }
564
+ | ConstDeclarationList ',' ConstDeclaration {
565
+ result = [val.first, val.last].flatten
566
+ }
567
+ ;
568
+
569
+ ConstDeclaration:
570
+ IDENT { result = VarDeclNode.new(val[0], nil, true) }
571
+ | IDENT Initializer { result = VarDeclNode.new(val[0], val[1], true) }
572
+ ;
573
+
574
+ Initializer:
575
+ '=' AssignmentExpr { result = AssignExprNode.new(val[1]) }
576
+ ;
577
+
578
+ InitializerNoIn:
579
+ '=' AssignmentExprNoIn { result = AssignExprNode.new(val[1]) }
580
+ ;
581
+
582
+ EmptyStatement:
583
+ ';' { result = EmptyStatementNode.new(val[0]) }
584
+ ;
585
+
586
+ ExprStatement:
587
+ ExprNoBF ';' {
588
+ result = ExpressionStatementNode.new(val.first)
589
+ debug(result)
590
+ }
591
+ | ExprNoBF error {
592
+ result = ExpressionStatementNode.new(val.first)
593
+ debug(result)
594
+ raise RKelly::SyntaxError unless allow_auto_semi?(val.last)
595
+ }
596
+ ;
597
+
598
+ IfStatement:
599
+ IF '(' Expr ')' Statement =IF_WITHOUT_ELSE {
600
+ result = IfNode.new(val[2], val[4])
601
+ debug(result)
602
+ }
603
+ | IF '(' Expr ')' Statement ELSE Statement {
604
+ result = IfNode.new(val[2], val[4], val[6])
605
+ debug(result)
606
+ }
607
+ ;
608
+
609
+ IterationStatement:
610
+ DO Statement WHILE '(' Expr ')' ';' {
611
+ result = DoWhileNode.new(val[1], val[4])
612
+ debug(result)
613
+ }
614
+ | DO Statement WHILE '(' Expr ')' error {
615
+ result = DoWhileNode.new(val[1], val[4])
616
+ debug(result)
617
+ } /* Always performs automatic semicolon insertion. */
618
+ | WHILE '(' Expr ')' Statement {
619
+ result = WhileNode.new(val[2], val[4])
620
+ debug(result)
621
+ }
622
+ | FOR '(' ExprNoInOpt ';' ExprOpt ';' ExprOpt ')' Statement {
623
+ result = ForNode.new(val[2], val[4], val[6], val[8])
624
+ debug(result)
625
+ }
626
+ | FOR '(' VAR VariableDeclarationListNoIn ';' ExprOpt ';' ExprOpt ')' Statement
627
+ {
628
+ result = ForNode.new(VarStatementNode.new(val[3]), val[5], val[7], val[9])
629
+ debug(result)
630
+ }
631
+ | FOR '(' LeftHandSideExpr IN Expr ')' Statement {
632
+ #yyabort if (!n.isLocation())
633
+ result = ForInNode.new(val[2], val[4], val[6])
634
+ debug(result);
635
+ }
636
+ | FOR '(' VAR IDENT IN Expr ')' Statement {
637
+ result = ForInNode.new(
638
+ VarDeclNode.new(val[3], nil), val[5], val[7])
639
+ debug(result)
640
+ }
641
+ | FOR '(' VAR IDENT InitializerNoIn IN Expr ')' Statement {
642
+ result = ForInNode.new(
643
+ VarDeclNode.new(val[3], val[4]), val[6], val[8]
644
+ )
645
+ debug(result)
646
+ }
647
+ ;
648
+
649
+ ExprOpt:
650
+ /* nothing */ { result = nil }
651
+ | Expr
652
+ ;
653
+
654
+ ExprNoInOpt:
655
+ /* nothing */ { result = nil }
656
+ | ExprNoIn
657
+ ;
658
+
659
+ ContinueStatement:
660
+ CONTINUE ';' {
661
+ result = ContinueNode.new(nil)
662
+ debug(result)
663
+ }
664
+ | CONTINUE error {
665
+ result = ContinueNode.new(nil)
666
+ debug(result)
667
+ yyabort unless allow_auto_semi?(val[1])
668
+ }
669
+ | CONTINUE IDENT ';' {
670
+ result = ContinueNode.new(val[1])
671
+ debug(result)
672
+ }
673
+ | CONTINUE IDENT error {
674
+ result = ContinueNode.new(val[1])
675
+ debug(result)
676
+ yyabort unless allow_auto_semi?(val[2])
677
+ }
678
+ ;
679
+
680
+ BreakStatement:
681
+ BREAK ';' {
682
+ result = BreakNode.new(nil)
683
+ debug(result)
684
+ }
685
+ | BREAK error {
686
+ result = BreakNode.new(nil)
687
+ debug(result)
688
+ yyabort unless allow_auto_semi?(val[1])
689
+ }
690
+ | BREAK IDENT ';' {
691
+ result = BreakNode.new(val[1])
692
+ debug(result)
693
+ }
694
+ | BREAK IDENT error {
695
+ result = BreakNode.new(val[1])
696
+ debug(result)
697
+ yyabort unless allow_auto_semi?(val[2])
698
+ }
699
+ ;
700
+
701
+ ReturnStatement:
702
+ RETURN ';' {
703
+ result = ReturnNode.new(nil)
704
+ debug(result)
705
+ }
706
+ | RETURN error {
707
+ result = ReturnNode.new(nil)
708
+ debug(result)
709
+ yyabort unless allow_auto_semi?(val[1])
710
+ }
711
+ | RETURN Expr ';' {
712
+ result = ReturnNode.new(val[1])
713
+ debug(result)
714
+ }
715
+ | RETURN Expr error {
716
+ result = ReturnNode.new(val[1])
717
+ debug(result)
718
+ yyabort unless allow_auto_semi?(val[2])
719
+ }
720
+ ;
721
+
722
+ WithStatement:
723
+ WITH '(' Expr ')' Statement {
724
+ result = WithNode.new(val[2], val[4])
725
+ debug(result)
726
+ }
727
+ ;
728
+
729
+ SwitchStatement:
730
+ SWITCH '(' Expr ')' CaseBlock {
731
+ result = SwitchNode.new(val[2], val[4])
732
+ debug(result)
733
+ }
734
+ ;
735
+
736
+ CaseBlock:
737
+ '{' CaseClausesOpt '}' { result = CaseBlockNode.new(val[1]) }
738
+ | '{' CaseClausesOpt DefaultClause CaseClausesOpt '}' {
739
+ result = CaseBlockNode.new([val[1], val[2], val[3]].flatten)
740
+ }
741
+ ;
742
+
743
+ CaseClausesOpt:
744
+ /* nothing */ { result = [] }
745
+ | CaseClauses
746
+ ;
747
+
748
+ CaseClauses:
749
+ CaseClause { result = val }
750
+ | CaseClauses CaseClause { result = val.flatten }
751
+ ;
752
+
753
+ CaseClause:
754
+ CASE Expr ':' SourceElements {
755
+ result = CaseClauseNode.new(val[1], val[3])
756
+ }
757
+ ;
758
+
759
+ DefaultClause:
760
+ DEFAULT ':' SourceElements {
761
+ result = CaseClauseNode.new(nil, val[2])
762
+ }
763
+ ;
764
+
765
+ LabelledStatement:
766
+ IDENT ':' Statement { result = LabelNode.new(val[0], val[2]) }
767
+ ;
768
+
769
+ ThrowStatement:
770
+ THROW Expr ';' {
771
+ result = ThrowNode.new(val[1])
772
+ debug(result)
773
+ }
774
+ | THROW Expr error {
775
+ result = ThrowNode.new(val[1])
776
+ debug(result)
777
+ yyabort unless allow_auto_semi?(val[2])
778
+ }
779
+ ;
780
+
781
+ TryStatement:
782
+ TRY Block FINALLY Block {
783
+ result = TryNode.new(val[1], nil, nil, val[3])
784
+ debug(result)
785
+ }
786
+ | TRY Block CATCH '(' IDENT ')' Block {
787
+ result = TryNode.new(val[1], val[4], val[6])
788
+ debug(result)
789
+ }
790
+ | TRY Block CATCH '(' IDENT ')' Block FINALLY Block {
791
+ result = TryNode.new(val[1], val[4], val[6], val[8])
792
+ debug(result)
793
+ }
794
+ ;
795
+
796
+ DebuggerStatement:
797
+ DEBUGGER ';' {
798
+ result = EmptyStatementNode.new(val[0])
799
+ debug(result)
800
+ }
801
+ | DEBUGGER error {
802
+ result = EmptyStatementNode.new(val[0])
803
+ debug(result)
804
+ yyabort unless allow_auto_semi?(val[1])
805
+ }
806
+ ;
807
+
808
+ FunctionDeclaration:
809
+ FUNCTION IDENT '(' ')' FunctionBody {
810
+ result = FunctionDeclNode.new(val[1], val[4])
811
+ debug(val[5])
812
+ }
813
+ | FUNCTION IDENT '(' FormalParameterList ')' FunctionBody {
814
+ result = FunctionDeclNode.new(val[1], val[5], val[3])
815
+ debug(val[6])
816
+ }
817
+ ;
818
+
819
+ FunctionExpr:
820
+ FUNCTION '(' ')' FunctionBody {
821
+ result = FunctionExprNode.new(val[0], val[3])
822
+ debug(val[4])
823
+ }
824
+ | FUNCTION '(' FormalParameterList ')' FunctionBody {
825
+ result = FunctionExprNode.new(val[0], val[4], val[2])
826
+ debug(val[5])
827
+ }
828
+ | FUNCTION IDENT '(' ')' FunctionBody {
829
+ result = FunctionExprNode.new(val[1], val[4])
830
+ debug(val[5])
831
+ }
832
+ | FUNCTION IDENT '(' FormalParameterList ')' FunctionBody {
833
+ result = FunctionExprNode.new(val[1], val[5], val[3])
834
+ debug(val[6])
835
+ }
836
+ ;
837
+
838
+ FormalParameterList:
839
+ IDENT { result = [ParameterNode.new(val[0])] }
840
+ | FormalParameterList ',' IDENT {
841
+ result = [val.first, ParameterNode.new(val.last)].flatten
842
+ }
843
+ ;
844
+
845
+ FunctionBody:
846
+ '{' SourceElements '}' { result = FunctionBodyNode.new(val[1]) }
847
+ ;
848
+ end
849
+
850
+ ---- header
851
+ require "rkelly/nodes"
852
+
853
+ ---- inner
854
+ include RKelly::Nodes
855
+
856
+ def allow_auto_semi?(error_token)
857
+ error_token == false || error_token == '}' || @terminator
858
+ end
859
+
860
+ def property_class_for(ident)
861
+ case ident
862
+ when 'get'
863
+ GetterPropertyNode
864
+ when 'set'
865
+ SetterPropertyNode
866
+ end
867
+ end
868
+
869
+ def debug(*args)
870
+ logger.debug(*args) if logger
871
+ end