ruby_parser 3.7.2 → 3.7.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9edd031402c94b8200a41a8e85633a758d95bd95
4
- data.tar.gz: b622f9ac782cf040145cda6102d1240e2f0e16c8
3
+ metadata.gz: ef8af426d7a1b607b85816376d68a3290e7eede7
4
+ data.tar.gz: 6043e7719f66eb68c3c662f2a7691507e7795739
5
5
  SHA512:
6
- metadata.gz: 7fd64cce655c49b9f32d1d8ea3e598705e1cac840641521fa9db9014cbb700d67f8227e263edcddcebe59acb62c97701d19993f8c3dccdab315ab144cec476a1
7
- data.tar.gz: 7e3ef8e4c7660a49c7328ea15641377a28bd6bac724c3a98e85a9444d735eaac8d655d0cdec04801d8e72f1a10d69d67e2967bbd7f9bf1ce3687b6fdb716d6d3
6
+ metadata.gz: 0bbb2a13f6653513ae12a04c5077cd096d5388423cedef965eeef5054835395c1949e6c3437e7a4727cca83002751870e9a8f38eec0408cde2c9b6b2bc3d472e
7
+ data.tar.gz: 00765f72bbdd63c304e4eac7c93504e81c35957d7686cf940ba5fcd8ce3b5440ba9290901f2f3ebfe56d42f46f0397916d962e84546b318079a65606826d9173
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,3 +1,10 @@
1
+ === 3.7.3 / 2016-01-21
2
+
3
+ * 2 bug fixes:
4
+
5
+ * Fixed parsing kwargs in defs with no parens. (presidentbeef)
6
+ * defs should have a nil node if body is empty.
7
+
1
8
  === 3.7.2 / 2015-10-26
2
9
 
3
10
  * 1 bug fix:
@@ -5058,7 +5058,7 @@ end
5058
5058
  def _reduce_330(val, _values, result)
5059
5059
  self.in_single += 1
5060
5060
  self.env.extend
5061
- lexer.lex_state = :expr_end # force for args
5061
+ lexer.lex_state = :expr_endfn # force for args
5062
5062
  result = lexer.lineno
5063
5063
 
5064
5064
  result
@@ -1168,7 +1168,7 @@ rule
1168
1168
  {
1169
1169
  self.in_single += 1
1170
1170
  self.env.extend
1171
- lexer.lex_state = :expr_end # force for args
1171
+ lexer.lex_state = :expr_endfn # force for args
1172
1172
  result = lexer.lineno
1173
1173
  }
1174
1174
  f_arglist bodystmt kEND
@@ -5110,7 +5110,7 @@ end
5110
5110
  def _reduce_329(val, _values, result)
5111
5111
  self.in_single += 1
5112
5112
  self.env.extend
5113
- lexer.lex_state = :expr_end # force for args
5113
+ lexer.lex_state = :expr_endfn # force for args
5114
5114
  result = lexer.lineno
5115
5115
 
5116
5116
  result
@@ -1167,7 +1167,7 @@ rule
1167
1167
  {
1168
1168
  self.in_single += 1
1169
1169
  self.env.extend
1170
- lexer.lex_state = :expr_end # force for args
1170
+ lexer.lex_state = :expr_endfn # force for args
1171
1171
  result = lexer.lineno
1172
1172
  }
1173
1173
  f_arglist bodystmt kEND
@@ -5140,7 +5140,7 @@ end
5140
5140
  def _reduce_329(val, _values, result)
5141
5141
  self.in_single += 1
5142
5142
  self.env.extend
5143
- lexer.lex_state = :expr_end # force for args
5143
+ lexer.lex_state = :expr_endfn # force for args
5144
5144
  result = lexer.lineno
5145
5145
 
5146
5146
  result
@@ -1168,7 +1168,7 @@ rule
1168
1168
  {
1169
1169
  self.in_single += 1
1170
1170
  self.env.extend
1171
- lexer.lex_state = :expr_end # force for args
1171
+ lexer.lex_state = :expr_endfn # force for args
1172
1172
  result = lexer.lineno
1173
1173
  }
1174
1174
  f_arglist bodystmt kEND
@@ -1,7 +1,7 @@
1
1
  # encoding: UTF-8
2
2
  #--
3
3
  # This file is automatically generated. Do not modify it.
4
- # Generated by: oedipus_lex version 2.4.0.
4
+ # Generated by: oedipus_lex version 2.4.1.
5
5
  # Source: lib/ruby_lexer.rex
6
6
  #++
7
7
 
@@ -76,33 +76,33 @@ class RubyLexer
76
76
  case state
77
77
  when nil then
78
78
  case
79
- when text = ss.scan(/[\ \t\r\f\v]/) then
79
+ when ss.skip(/[\ \t\r\f\v]/) then
80
80
  action { self.space_seen = true; next }
81
81
  when text = ss.scan(/\n|\#/) then
82
82
  process_newline_or_comment text
83
83
  when text = ss.scan(/[\]\)\}]/) then
84
84
  process_bracing text
85
- when ss.check(/\!/) then
85
+ when ss.match?(/\!/) then
86
86
  case
87
- when in_arg_state? && (text = ss.scan(/\!\@/)) then
87
+ when in_arg_state? && (ss.skip(/\!\@/)) then
88
88
  action { result :expr_arg, :tUBANG, "!@" }
89
89
  when text = ss.scan(/\![=~]?/) then
90
90
  action { result :arg_state, TOKENS[text], text }
91
91
  end # group /\!/
92
- when ss.check(/\./) then
92
+ when ss.match?(/\./) then
93
93
  case
94
94
  when text = ss.scan(/\.\.\.?/) then
95
95
  action { result :expr_beg, TOKENS[text], text }
96
- when text = ss.scan(/\.\d/) then
96
+ when ss.skip(/\.\d/) then
97
97
  action { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
98
- when text = ss.scan(/\./) then
98
+ when ss.skip(/\./) then
99
99
  action { result :expr_dot, :tDOT, "." }
100
100
  end # group /\./
101
101
  when text = ss.scan(/\(/) then
102
102
  process_paren text
103
103
  when text = ss.scan(/\,/) then
104
104
  action { result :expr_beg, TOKENS[text], text }
105
- when ss.check(/=/) then
105
+ when ss.match?(/=/) then
106
106
  case
107
107
  when text = ss.scan(/\=\=\=|\=\=|\=~|\=>|\=(?!begin\b)/) then
108
108
  action { result arg_state, TOKENS[text], text }
@@ -121,7 +121,7 @@ class RubyLexer
121
121
  action { rb_compile_error "`#{text}` is not allowed as a variable name" }
122
122
  when text = ss.scan(/\@\@?#{IDENT_CHAR}+/o) then
123
123
  process_ivar text
124
- when ss.check(/:/) then
124
+ when ss.match?(/:/) then
125
125
  case
126
126
  when not_end? && (text = ss.scan(/:([a-zA-Z_]#{IDENT_CHAR}*(?:[?]|[!](?!=)|=(?==>)|=(?![=>]))?)/o)) then
127
127
  process_symbol text
@@ -134,135 +134,135 @@ class RubyLexer
134
134
  when text = ss.scan(/\:/) then
135
135
  process_colon1 text
136
136
  end # group /:/
137
- when text = ss.scan(/->/) then
137
+ when ss.skip(/->/) then
138
138
  action { result :expr_endfn, :tLAMBDA, nil }
139
139
  when text = ss.scan(/[+-]/) then
140
140
  process_plus_minus text
141
- when ss.check(/[+\d]/) then
141
+ when ss.match?(/[+\d]/) then
142
142
  case
143
- when text = ss.scan(/#{NUM_BAD}/o) then
143
+ when ss.skip(/#{NUM_BAD}/o) then
144
144
  action { rb_compile_error "Invalid numeric format" }
145
- when text = ss.scan(/#{INT_DEC}/o) then
145
+ when ss.skip(/#{INT_DEC}/o) then
146
146
  action { int_with_base 10 }
147
- when text = ss.scan(/#{INT_HEX}/o) then
147
+ when ss.skip(/#{INT_HEX}/o) then
148
148
  action { int_with_base 16 }
149
- when text = ss.scan(/#{INT_BIN}/o) then
149
+ when ss.skip(/#{INT_BIN}/o) then
150
150
  action { int_with_base 2 }
151
- when text = ss.scan(/#{INT_OCT_BAD}/o) then
151
+ when ss.skip(/#{INT_OCT_BAD}/o) then
152
152
  action { rb_compile_error "Illegal octal digit." }
153
- when text = ss.scan(/#{INT_OCT}/o) then
153
+ when ss.skip(/#{INT_OCT}/o) then
154
154
  action { int_with_base 8 }
155
- when text = ss.scan(/#{FLOAT_BAD}/o) then
155
+ when ss.skip(/#{FLOAT_BAD}/o) then
156
156
  action { rb_compile_error "Trailing '_' in number." }
157
157
  when text = ss.scan(/#{FLOAT}/o) then
158
158
  process_float text
159
- when text = ss.scan(/#{INT_DEC2}/o) then
159
+ when ss.skip(/#{INT_DEC2}/o) then
160
160
  action { int_with_base 10 }
161
- when text = ss.scan(/[0-9]/) then
161
+ when ss.skip(/[0-9]/) then
162
162
  action { rb_compile_error "Bad number format" }
163
163
  end # group /[+\d]/
164
164
  when text = ss.scan(/\[/) then
165
165
  process_square_bracket text
166
166
  when was_label? && (text = ss.scan(/\'#{SSTRING}\':?/o)) then
167
167
  process_label_or_string text
168
- when ss.check(/\|/) then
168
+ when ss.match?(/\|/) then
169
169
  case
170
- when text = ss.scan(/\|\|\=/) then
170
+ when ss.skip(/\|\|\=/) then
171
171
  action { result :expr_beg, :tOP_ASGN, "||" }
172
- when text = ss.scan(/\|\|/) then
172
+ when ss.skip(/\|\|/) then
173
173
  action { result :expr_beg, :tOROP, "||" }
174
- when text = ss.scan(/\|\=/) then
174
+ when ss.skip(/\|\=/) then
175
175
  action { result :expr_beg, :tOP_ASGN, "|" }
176
- when text = ss.scan(/\|/) then
176
+ when ss.skip(/\|/) then
177
177
  action { result :arg_state, :tPIPE, "|" }
178
178
  end # group /\|/
179
179
  when text = ss.scan(/\{/) then
180
180
  process_curly_brace text
181
- when ss.check(/\*/) then
181
+ when ss.match?(/\*/) then
182
182
  case
183
- when text = ss.scan(/\*\*=/) then
183
+ when ss.skip(/\*\*=/) then
184
184
  action { result :expr_beg, :tOP_ASGN, "**" }
185
- when text = ss.scan(/\*\*/) then
185
+ when ss.skip(/\*\*/) then
186
186
  action { result(:arg_state, space_vs_beginning(:tDSTAR, :tDSTAR, :tPOW), "**") }
187
- when text = ss.scan(/\*\=/) then
187
+ when ss.skip(/\*\=/) then
188
188
  action { result(:expr_beg, :tOP_ASGN, "*") }
189
- when text = ss.scan(/\*/) then
189
+ when ss.skip(/\*/) then
190
190
  action { result(:arg_state, space_vs_beginning(:tSTAR, :tSTAR, :tSTAR2), "*") }
191
191
  end # group /\*/
192
- when ss.check(/</) then
192
+ when ss.match?(/</) then
193
193
  case
194
- when text = ss.scan(/\<\=\>/) then
194
+ when ss.skip(/\<\=\>/) then
195
195
  action { result :arg_state, :tCMP, "<=>" }
196
- when text = ss.scan(/\<\=/) then
196
+ when ss.skip(/\<\=/) then
197
197
  action { result :arg_state, :tLEQ, "<=" }
198
- when text = ss.scan(/\<\<\=/) then
198
+ when ss.skip(/\<\<\=/) then
199
199
  action { result :arg_state, :tOP_ASGN, "<<" }
200
200
  when text = ss.scan(/\<\</) then
201
201
  process_lchevron text
202
- when text = ss.scan(/\</) then
202
+ when ss.skip(/\</) then
203
203
  action { result :arg_state, :tLT, "<" }
204
204
  end # group /</
205
- when ss.check(/>/) then
205
+ when ss.match?(/>/) then
206
206
  case
207
- when text = ss.scan(/\>\=/) then
207
+ when ss.skip(/\>\=/) then
208
208
  action { result :arg_state, :tGEQ, ">=" }
209
- when text = ss.scan(/\>\>=/) then
209
+ when ss.skip(/\>\>=/) then
210
210
  action { result :arg_state, :tOP_ASGN, ">>" }
211
- when text = ss.scan(/\>\>/) then
211
+ when ss.skip(/\>\>/) then
212
212
  action { result :arg_state, :tRSHFT, ">>" }
213
- when text = ss.scan(/\>/) then
213
+ when ss.skip(/\>/) then
214
214
  action { result :arg_state, :tGT, ">" }
215
215
  end # group />/
216
- when ss.check(/\`/) then
216
+ when ss.match?(/\`/) then
217
217
  case
218
- when expr_fname? && (text = ss.scan(/\`/)) then
218
+ when expr_fname? && (ss.skip(/\`/)) then
219
219
  action { result(:expr_end, :tBACK_REF2, "`") }
220
- when expr_dot? && (text = ss.scan(/\`/)) then
220
+ when expr_dot? && (ss.skip(/\`/)) then
221
221
  action { result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`") }
222
- when text = ss.scan(/\`/) then
222
+ when ss.skip(/\`/) then
223
223
  action { string STR_XQUOTE, '`'; result(nil, :tXSTRING_BEG, "`") }
224
224
  end # group /\`/
225
225
  when text = ss.scan(/\?/) then
226
226
  process_questionmark text
227
- when ss.check(/&/) then
227
+ when ss.match?(/&/) then
228
228
  case
229
- when text = ss.scan(/\&\&\=/) then
229
+ when ss.skip(/\&\&\=/) then
230
230
  action { result(:expr_beg, :tOP_ASGN, "&&") }
231
- when text = ss.scan(/\&\&/) then
231
+ when ss.skip(/\&\&/) then
232
232
  action { result(:expr_beg, :tANDOP, "&&") }
233
- when text = ss.scan(/\&\=/) then
233
+ when ss.skip(/\&\=/) then
234
234
  action { result(:expr_beg, :tOP_ASGN, "&" ) }
235
235
  when text = ss.scan(/\&/) then
236
236
  process_amper text
237
237
  end # group /&/
238
238
  when text = ss.scan(/\//) then
239
239
  process_slash text
240
- when ss.check(/\^/) then
240
+ when ss.match?(/\^/) then
241
241
  case
242
- when text = ss.scan(/\^=/) then
242
+ when ss.skip(/\^=/) then
243
243
  action { result(:expr_beg, :tOP_ASGN, "^") }
244
- when text = ss.scan(/\^/) then
244
+ when ss.skip(/\^/) then
245
245
  action { result(:arg_state, :tCARET, "^") }
246
246
  end # group /\^/
247
- when text = ss.scan(/\;/) then
247
+ when ss.skip(/\;/) then
248
248
  action { self.command_start = true; result(:expr_beg, :tSEMI, ";") }
249
- when ss.check(/~/) then
249
+ when ss.match?(/~/) then
250
250
  case
251
- when in_arg_state? && (text = ss.scan(/\~@/)) then
251
+ when in_arg_state? && (ss.skip(/\~@/)) then
252
252
  action { result(:arg_state, :tTILDE, "~") }
253
- when text = ss.scan(/\~/) then
253
+ when ss.skip(/\~/) then
254
254
  action { result(:arg_state, :tTILDE, "~") }
255
255
  end # group /~/
256
- when ss.check(/\\/) then
256
+ when ss.match?(/\\/) then
257
257
  case
258
- when text = ss.scan(/\\\r?\n/) then
258
+ when ss.skip(/\\\r?\n/) then
259
259
  action { self.lineno += 1; self.space_seen = true; next }
260
- when text = ss.scan(/\\/) then
260
+ when ss.skip(/\\/) then
261
261
  action { rb_compile_error "bare backslash only allowed before newline" }
262
262
  end # group /\\/
263
263
  when text = ss.scan(/\%/) then
264
264
  process_percent text
265
- when ss.check(/\$/) then
265
+ when ss.match?(/\$/) then
266
266
  case
267
267
  when text = ss.scan(/\$_\w+/) then
268
268
  process_gvar text
@@ -289,7 +289,7 @@ class RubyLexer
289
289
  process_underscore text
290
290
  when text = ss.scan(/#{IDENT}/o) then
291
291
  process_token text
292
- when text = ss.scan(/\004|\032|\000|\Z/) then
292
+ when ss.skip(/\004|\032|\000|\Z/) then
293
293
  action { [RubyLexer::EOF, RubyLexer::EOF] }
294
294
  when text = ss.scan(/./) then
295
295
  action { rb_compile_error "Invalid char #{text.inspect} in expression" }
@@ -1203,7 +1203,7 @@ rule
1203
1203
  {
1204
1204
  self.in_single += 1
1205
1205
  self.env.extend
1206
- lexer.lex_state = :expr_end # force for args
1206
+ lexer.lex_state = :expr_endfn # force for args
1207
1207
  result = lexer.lineno
1208
1208
  }
1209
1209
  f_arglist bodystmt kEND
@@ -91,7 +91,7 @@ class RPStringScanner < StringScanner
91
91
  end
92
92
 
93
93
  module RubyParserStuff
94
- VERSION = "3.7.2" unless constants.include? "VERSION" # SIGH
94
+ VERSION = "3.7.3" unless constants.include? "VERSION" # SIGH
95
95
 
96
96
  attr_accessor :lexer, :in_def, :in_single, :file
97
97
  attr_reader :env, :comments
@@ -645,6 +645,7 @@ module RubyParserStuff
645
645
 
646
646
  def new_defs val
647
647
  recv, name, args, body = val[1], val[4], val[6], val[7]
648
+ body ||= s(:nil)
648
649
 
649
650
  result = s(:defs, recv, name.to_sym, args)
650
651
 
@@ -86,7 +86,12 @@ class TestRubyLexer < Minitest::Test
86
86
  act_value = act_value.first if Array === act_value
87
87
 
88
88
  assert_equal token, act_token, msg
89
- assert_equal value, act_value, msg
89
+ case value
90
+ when Float then
91
+ assert_in_epsilon value, act_value, 0.001, msg
92
+ else
93
+ assert_equal value, act_value, msg
94
+ end
90
95
  assert_equal state, @lex.lex_state, msg if state
91
96
  assert_equal paren, @lex.paren_nest, msg if paren
92
97
  assert_equal brace, @lex.brace_nest, msg if brace
@@ -269,7 +269,7 @@ module TestRubyParserShared
269
269
 
270
270
  def test_defs_comments
271
271
  rb = "# blah 1\n# blah 2\n\ndef self.blah\nend"
272
- pt = s(:defs, s(:self), :blah, s(:args))
272
+ pt = s(:defs, s(:self), :blah, s(:args), s(:nil))
273
273
 
274
274
  assert_parse rb, pt
275
275
  assert_equal "# blah 1\n# blah 2\n\n", result.comments
@@ -1330,7 +1330,7 @@ module TestRubyParserShared
1330
1330
 
1331
1331
  def test_defns_reserved
1332
1332
  rb = "def self.return; end"
1333
- pt = s(:defs, s(:self), :return, s(:args))
1333
+ pt = s(:defs, s(:self), :return, s(:args), s(:nil))
1334
1334
 
1335
1335
  assert_parse rb, pt
1336
1336
  end
@@ -2171,8 +2171,6 @@ end
2171
2171
 
2172
2172
  module TestRubyParserShared20to22
2173
2173
  def test_defs_kwarg
2174
- skip "not yet"
2175
-
2176
2174
  rb = "def self.a b: 1\nend"
2177
2175
  pt = s(:defs, s(:self), :a, s(:args, s(:kwarg, :b, s(:lit, 1))), s(:nil))
2178
2176
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.2
4
+ version: 3.7.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Davis
@@ -29,7 +29,7 @@ cert_chain:
29
29
  qx3h45R1CAsObX0SQDIT+rRbQrtKz1GHIZTOFYvEJjUY1XmRTZupD3CJ8Q7sDqSy
30
30
  NLq5jm1fq6Y9Uolu3RJbmycf
31
31
  -----END CERTIFICATE-----
32
- date: 2015-10-26 00:00:00.000000000 Z
32
+ date: 2016-01-22 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: sexp_processor
metadata.gz.sig CHANGED
Binary file