ruby_parser 3.7.2 → 3.7.3
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.txt +7 -0
- data/lib/ruby20_parser.rb +1 -1
- data/lib/ruby20_parser.y +1 -1
- data/lib/ruby21_parser.rb +1 -1
- data/lib/ruby21_parser.y +1 -1
- data/lib/ruby22_parser.rb +1 -1
- data/lib/ruby22_parser.y +1 -1
- data/lib/ruby_lexer.rex.rb +60 -60
- data/lib/ruby_parser.yy +1 -1
- data/lib/ruby_parser_extras.rb +2 -1
- data/test/test_ruby_lexer.rb +6 -1
- data/test/test_ruby_parser.rb +2 -4
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef8af426d7a1b607b85816376d68a3290e7eede7
|
4
|
+
data.tar.gz: 6043e7719f66eb68c3c662f2a7691507e7795739
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bbb2a13f6653513ae12a04c5077cd096d5388423cedef965eeef5054835395c1949e6c3437e7a4727cca83002751870e9a8f38eec0408cde2c9b6b2bc3d472e
|
7
|
+
data.tar.gz: 00765f72bbdd63c304e4eac7c93504e81c35957d7686cf940ba5fcd8ce3b5440ba9290901f2f3ebfe56d42f46f0397916d962e84546b318079a65606826d9173
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/lib/ruby20_parser.rb
CHANGED
data/lib/ruby20_parser.y
CHANGED
data/lib/ruby21_parser.rb
CHANGED
data/lib/ruby21_parser.y
CHANGED
data/lib/ruby22_parser.rb
CHANGED
data/lib/ruby22_parser.y
CHANGED
data/lib/ruby_lexer.rex.rb
CHANGED
@@ -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.
|
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
|
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.
|
85
|
+
when ss.match?(/\!/) then
|
86
86
|
case
|
87
|
-
when in_arg_state? && (
|
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.
|
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
|
96
|
+
when ss.skip(/\.\d/) then
|
97
97
|
action { rb_compile_error "no .<digit> floating literal anymore put 0 before dot" }
|
98
|
-
when
|
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.
|
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.
|
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
|
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.
|
141
|
+
when ss.match?(/[+\d]/) then
|
142
142
|
case
|
143
|
-
when
|
143
|
+
when ss.skip(/#{NUM_BAD}/o) then
|
144
144
|
action { rb_compile_error "Invalid numeric format" }
|
145
|
-
when
|
145
|
+
when ss.skip(/#{INT_DEC}/o) then
|
146
146
|
action { int_with_base 10 }
|
147
|
-
when
|
147
|
+
when ss.skip(/#{INT_HEX}/o) then
|
148
148
|
action { int_with_base 16 }
|
149
|
-
when
|
149
|
+
when ss.skip(/#{INT_BIN}/o) then
|
150
150
|
action { int_with_base 2 }
|
151
|
-
when
|
151
|
+
when ss.skip(/#{INT_OCT_BAD}/o) then
|
152
152
|
action { rb_compile_error "Illegal octal digit." }
|
153
|
-
when
|
153
|
+
when ss.skip(/#{INT_OCT}/o) then
|
154
154
|
action { int_with_base 8 }
|
155
|
-
when
|
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
|
159
|
+
when ss.skip(/#{INT_DEC2}/o) then
|
160
160
|
action { int_with_base 10 }
|
161
|
-
when
|
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.
|
168
|
+
when ss.match?(/\|/) then
|
169
169
|
case
|
170
|
-
when
|
170
|
+
when ss.skip(/\|\|\=/) then
|
171
171
|
action { result :expr_beg, :tOP_ASGN, "||" }
|
172
|
-
when
|
172
|
+
when ss.skip(/\|\|/) then
|
173
173
|
action { result :expr_beg, :tOROP, "||" }
|
174
|
-
when
|
174
|
+
when ss.skip(/\|\=/) then
|
175
175
|
action { result :expr_beg, :tOP_ASGN, "|" }
|
176
|
-
when
|
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.
|
181
|
+
when ss.match?(/\*/) then
|
182
182
|
case
|
183
|
-
when
|
183
|
+
when ss.skip(/\*\*=/) then
|
184
184
|
action { result :expr_beg, :tOP_ASGN, "**" }
|
185
|
-
when
|
185
|
+
when ss.skip(/\*\*/) then
|
186
186
|
action { result(:arg_state, space_vs_beginning(:tDSTAR, :tDSTAR, :tPOW), "**") }
|
187
|
-
when
|
187
|
+
when ss.skip(/\*\=/) then
|
188
188
|
action { result(:expr_beg, :tOP_ASGN, "*") }
|
189
|
-
when
|
189
|
+
when ss.skip(/\*/) then
|
190
190
|
action { result(:arg_state, space_vs_beginning(:tSTAR, :tSTAR, :tSTAR2), "*") }
|
191
191
|
end # group /\*/
|
192
|
-
when ss.
|
192
|
+
when ss.match?(/</) then
|
193
193
|
case
|
194
|
-
when
|
194
|
+
when ss.skip(/\<\=\>/) then
|
195
195
|
action { result :arg_state, :tCMP, "<=>" }
|
196
|
-
when
|
196
|
+
when ss.skip(/\<\=/) then
|
197
197
|
action { result :arg_state, :tLEQ, "<=" }
|
198
|
-
when
|
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
|
202
|
+
when ss.skip(/\</) then
|
203
203
|
action { result :arg_state, :tLT, "<" }
|
204
204
|
end # group /</
|
205
|
-
when ss.
|
205
|
+
when ss.match?(/>/) then
|
206
206
|
case
|
207
|
-
when
|
207
|
+
when ss.skip(/\>\=/) then
|
208
208
|
action { result :arg_state, :tGEQ, ">=" }
|
209
|
-
when
|
209
|
+
when ss.skip(/\>\>=/) then
|
210
210
|
action { result :arg_state, :tOP_ASGN, ">>" }
|
211
|
-
when
|
211
|
+
when ss.skip(/\>\>/) then
|
212
212
|
action { result :arg_state, :tRSHFT, ">>" }
|
213
|
-
when
|
213
|
+
when ss.skip(/\>/) then
|
214
214
|
action { result :arg_state, :tGT, ">" }
|
215
215
|
end # group />/
|
216
|
-
when ss.
|
216
|
+
when ss.match?(/\`/) then
|
217
217
|
case
|
218
|
-
when expr_fname? && (
|
218
|
+
when expr_fname? && (ss.skip(/\`/)) then
|
219
219
|
action { result(:expr_end, :tBACK_REF2, "`") }
|
220
|
-
when expr_dot? && (
|
220
|
+
when expr_dot? && (ss.skip(/\`/)) then
|
221
221
|
action { result((command_state ? :expr_cmdarg : :expr_arg), :tBACK_REF2, "`") }
|
222
|
-
when
|
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.
|
227
|
+
when ss.match?(/&/) then
|
228
228
|
case
|
229
|
-
when
|
229
|
+
when ss.skip(/\&\&\=/) then
|
230
230
|
action { result(:expr_beg, :tOP_ASGN, "&&") }
|
231
|
-
when
|
231
|
+
when ss.skip(/\&\&/) then
|
232
232
|
action { result(:expr_beg, :tANDOP, "&&") }
|
233
|
-
when
|
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.
|
240
|
+
when ss.match?(/\^/) then
|
241
241
|
case
|
242
|
-
when
|
242
|
+
when ss.skip(/\^=/) then
|
243
243
|
action { result(:expr_beg, :tOP_ASGN, "^") }
|
244
|
-
when
|
244
|
+
when ss.skip(/\^/) then
|
245
245
|
action { result(:arg_state, :tCARET, "^") }
|
246
246
|
end # group /\^/
|
247
|
-
when
|
247
|
+
when ss.skip(/\;/) then
|
248
248
|
action { self.command_start = true; result(:expr_beg, :tSEMI, ";") }
|
249
|
-
when ss.
|
249
|
+
when ss.match?(/~/) then
|
250
250
|
case
|
251
|
-
when in_arg_state? && (
|
251
|
+
when in_arg_state? && (ss.skip(/\~@/)) then
|
252
252
|
action { result(:arg_state, :tTILDE, "~") }
|
253
|
-
when
|
253
|
+
when ss.skip(/\~/) then
|
254
254
|
action { result(:arg_state, :tTILDE, "~") }
|
255
255
|
end # group /~/
|
256
|
-
when ss.
|
256
|
+
when ss.match?(/\\/) then
|
257
257
|
case
|
258
|
-
when
|
258
|
+
when ss.skip(/\\\r?\n/) then
|
259
259
|
action { self.lineno += 1; self.space_seen = true; next }
|
260
|
-
when
|
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.
|
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
|
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" }
|
data/lib/ruby_parser.yy
CHANGED
data/lib/ruby_parser_extras.rb
CHANGED
@@ -91,7 +91,7 @@ class RPStringScanner < StringScanner
|
|
91
91
|
end
|
92
92
|
|
93
93
|
module RubyParserStuff
|
94
|
-
VERSION = "3.7.
|
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
|
|
data/test/test_ruby_lexer.rb
CHANGED
@@ -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
|
-
|
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
|
data/test/test_ruby_parser.rb
CHANGED
@@ -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.
|
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:
|
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
|