parser 2.5.1.0 → 2.5.1.2
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
- data/CHANGELOG.md +19 -1
- data/README.md +1 -1
- data/doc/AST_FORMAT.md +19 -2
- data/lib/parser/ast/processor.rb +1 -0
- data/lib/parser/builders/default.rb +12 -2
- data/lib/parser/lexer/stack_state.rb +4 -0
- data/lib/parser/lexer.rb +1780 -1761
- data/lib/parser/lexer.rl +8 -2
- data/lib/parser/ruby24.rb +14 -1
- data/lib/parser/ruby24.y +14 -1
- data/lib/parser/ruby25.rb +220 -206
- data/lib/parser/ruby25.y +15 -2
- data/lib/parser/ruby26.rb +892 -865
- data/lib/parser/ruby26.y +22 -1
- data/lib/parser/source/buffer.rb +1 -1
- data/lib/parser/source/comment/associator.rb +3 -3
- data/lib/parser/source/comment.rb +4 -4
- data/lib/parser/source/map.rb +1 -1
- data/lib/parser/source/range.rb +1 -1
- data/lib/parser/source/tree_rewriter.rb +2 -2
- data/lib/parser/version.rb +1 -1
- data/test/parse_helper.rb +1 -1
- data/test/test_parser.rb +72 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 999565504b59c7ad12546445a92d20f6ff6235ed29d76c8c52eb73513c23d9e7
|
|
4
|
+
data.tar.gz: e04475df2071b10e772259cc6697875067432121122541a5ef5a5092eeee4e1f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ef4a0c50b91ba31b62c2274a6d442589fa277e0a606811800e9590ae73e7f6236d80fbc01c1d180adf2d64532d87dc99fcfa4953a28fa272dcce2fb195e8b224
|
|
7
|
+
data.tar.gz: 88e285335392b9269787035fe5dccc073758157496bcade661be8acbb912ec134e86fa75e8a2e3fbc0a62f7fa8a38c9f581cbecd9059bbddfe03812f958002cd
|
data/CHANGELOG.md
CHANGED
|
@@ -1,9 +1,27 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
-
Not released (2018-
|
|
4
|
+
Not released (2018-07-10)
|
|
5
5
|
-------------------------
|
|
6
6
|
|
|
7
|
+
Bugs fixed:
|
|
8
|
+
* lexer.rl: Partially revert 5ba072d and properly handle 'm = -> *args do end'. (Ilya Bylich)
|
|
9
|
+
|
|
10
|
+
v2.5.1.1 (2018-07-10)
|
|
11
|
+
---------------------
|
|
12
|
+
|
|
13
|
+
Features implemented:
|
|
14
|
+
* ruby26.y: Endless ranges support. (Ilya Bylich)
|
|
15
|
+
|
|
16
|
+
Bugs fixed:
|
|
17
|
+
* lexer.rl: Fix parsing of 'm = -> *args do end'. (Ilya Bylich)
|
|
18
|
+
* AST::Processor: Properly recurse into "kwsplat" nodes (Nelson Elhage)
|
|
19
|
+
* ruby24, ruby25, ruby26: Fix cmdargs after command_args followed by tLBRACE_ARG. This commit tracks upstream commit ruby/ruby@f168dbd. (Ilya Bylich)
|
|
20
|
+
* lexer.rl: Fix parsing of `let (:a) { m do; end }`. (Ilya Bylich)
|
|
21
|
+
|
|
22
|
+
v2.5.1.0 (2018-04-12)
|
|
23
|
+
---------------------
|
|
24
|
+
|
|
7
25
|
API modifications:
|
|
8
26
|
* Parser::Current: bump latest 2.2 branch to 2.2.10. (Ilya Bylich)
|
|
9
27
|
|
data/README.md
CHANGED
|
@@ -217,7 +217,7 @@ at some point.
|
|
|
217
217
|
Sometimes it is necessary to modify the format of AST nodes that are already being emitted
|
|
218
218
|
in a way that would break existing applications. To avoid such breakage, applications
|
|
219
219
|
must opt-in to these modifications; without explicit opt-in, Parser will continue to emit
|
|
220
|
-
the old AST node format. The most recent set of opt-ins is
|
|
220
|
+
the old AST node format. The most recent set of opt-ins is specified in
|
|
221
221
|
the [usage section](#usage) of this README.
|
|
222
222
|
|
|
223
223
|
## Compatibility with Ruby MRI
|
data/doc/AST_FORMAT.md
CHANGED
|
@@ -322,6 +322,23 @@ Format:
|
|
|
322
322
|
~~~~~ expression
|
|
323
323
|
~~~
|
|
324
324
|
|
|
325
|
+
|
|
326
|
+
### Endless (2.6)
|
|
327
|
+
|
|
328
|
+
Format:
|
|
329
|
+
|
|
330
|
+
~~~
|
|
331
|
+
(irange (int 1) nil)
|
|
332
|
+
"1.."
|
|
333
|
+
~~ operator
|
|
334
|
+
~~~ expression
|
|
335
|
+
|
|
336
|
+
(erange (int 1) nil)
|
|
337
|
+
"1..."
|
|
338
|
+
~~~ operator
|
|
339
|
+
~~~~ expression
|
|
340
|
+
~~~
|
|
341
|
+
|
|
325
342
|
## Access
|
|
326
343
|
|
|
327
344
|
### Self
|
|
@@ -1293,8 +1310,8 @@ Format:
|
|
|
1293
1310
|
~~~~~~ keyword
|
|
1294
1311
|
~~~~ begin
|
|
1295
1312
|
~~~~ else
|
|
1296
|
-
|
|
1297
|
-
|
|
1313
|
+
~~~ end
|
|
1314
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ expression
|
|
1298
1315
|
|
|
1299
1316
|
"unless cond; iftrue; else; iffalse; end"
|
|
1300
1317
|
~~~~~~ keyword
|
data/lib/parser/ast/processor.rb
CHANGED
|
@@ -16,6 +16,7 @@ module Parser
|
|
|
16
16
|
alias on_regexp process_regular_node
|
|
17
17
|
alias on_xstr process_regular_node
|
|
18
18
|
alias on_splat process_regular_node
|
|
19
|
+
alias on_kwsplat process_regular_node
|
|
19
20
|
alias on_array process_regular_node
|
|
20
21
|
alias on_pair process_regular_node
|
|
21
22
|
alias on_hash process_regular_node
|
|
@@ -400,12 +400,12 @@ module Parser
|
|
|
400
400
|
|
|
401
401
|
def range_inclusive(lhs, dot2_t, rhs)
|
|
402
402
|
n(:irange, [ lhs, rhs ],
|
|
403
|
-
|
|
403
|
+
range_map(lhs, dot2_t, rhs))
|
|
404
404
|
end
|
|
405
405
|
|
|
406
406
|
def range_exclusive(lhs, dot3_t, rhs)
|
|
407
407
|
n(:erange, [ lhs, rhs ],
|
|
408
|
-
|
|
408
|
+
range_map(lhs, dot3_t, rhs))
|
|
409
409
|
end
|
|
410
410
|
|
|
411
411
|
#
|
|
@@ -1388,6 +1388,16 @@ module Parser
|
|
|
1388
1388
|
Source::Map::Operator.new(loc(op_t), expr_l)
|
|
1389
1389
|
end
|
|
1390
1390
|
|
|
1391
|
+
def range_map(start_e, op_t, end_e)
|
|
1392
|
+
if end_e
|
|
1393
|
+
expr_l = join_exprs(start_e, end_e)
|
|
1394
|
+
else
|
|
1395
|
+
expr_l = start_e.loc.expression.join(loc(op_t))
|
|
1396
|
+
end
|
|
1397
|
+
|
|
1398
|
+
Source::Map::Operator.new(loc(op_t), expr_l)
|
|
1399
|
+
end
|
|
1400
|
+
|
|
1391
1401
|
def arg_prefix_map(op_t, name_t=nil)
|
|
1392
1402
|
if name_t.nil?
|
|
1393
1403
|
expr_l = loc(op_t)
|