parser 0.9.1 → 0.9.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Rakefile +2 -1
- data/TODO.md +20 -0
- data/bin/explain-parse +1 -1
- data/lib/parser/all.rb +1 -0
- data/lib/parser/builders/default.rb +30 -2
- data/lib/parser/lexer/literal.rb +41 -20
- data/lib/parser/lexer/stack_state.rb +4 -0
- data/lib/parser/lexer.rb +2585 -2545
- data/lib/parser/lexer.rl +61 -38
- data/lib/parser/ruby18.rb +3133 -3171
- data/lib/parser/ruby18.y +16 -30
- data/lib/parser/ruby19.rb +3319 -3388
- data/lib/parser/ruby19.y +35 -50
- data/lib/parser/ruby20.rb +6961 -0
- data/lib/parser/ruby20.y +2190 -0
- data/lib/parser.rb +0 -1
- data/parse.y.diff +12201 -0
- data/parser.gemspec +2 -1
- data/test/helper.rb +1 -1
- data/test/parse_helper.rb +2 -2
- data/test/test_lexer.rb +95 -5
- data/test/test_lexer_stack_state.rb +7 -0
- data/test/test_parser.rb +138 -5
- metadata +6 -2
data/lib/parser/ruby18.y
CHANGED
@@ -69,7 +69,7 @@ rule
|
|
69
69
|
result = @builder.compstmt(val[0])
|
70
70
|
}
|
71
71
|
|
72
|
-
stmts:
|
72
|
+
stmts: # nothing
|
73
73
|
{
|
74
74
|
result = []
|
75
75
|
}
|
@@ -140,19 +140,13 @@ rule
|
|
140
140
|
|
141
141
|
result = @builder.begin_body(val[0], [ rescue_body ])
|
142
142
|
}
|
143
|
-
| klBEGIN
|
143
|
+
| klBEGIN tLCURLY compstmt tRCURLY
|
144
144
|
{
|
145
145
|
if in_def?
|
146
146
|
diagnostic(:error, :begin_in_method, val[0])
|
147
147
|
end
|
148
148
|
|
149
|
-
@
|
150
|
-
}
|
151
|
-
tLCURLY compstmt tRCURLY
|
152
|
-
{
|
153
|
-
@static_env.unextend
|
154
|
-
|
155
|
-
result = @builder.preexe(val[0], val[2], val[3], val[4])
|
149
|
+
result = @builder.preexe(val[0], val[1], val[2], val[3])
|
156
150
|
}
|
157
151
|
| klEND tLCURLY compstmt tRCURLY
|
158
152
|
{
|
@@ -797,7 +791,7 @@ rule
|
|
797
791
|
result = [ val[0], val[1] << val[3], val[5] ]
|
798
792
|
}
|
799
793
|
|
800
|
-
opt_paren_args:
|
794
|
+
opt_paren_args: # nothing
|
801
795
|
{
|
802
796
|
result = [ nil, [], nil ]
|
803
797
|
}
|
@@ -1015,9 +1009,6 @@ rule
|
|
1015
1009
|
}
|
1016
1010
|
opt_nl tRPAREN
|
1017
1011
|
{
|
1018
|
-
# TODO better location info here
|
1019
|
-
diagnostic :warning, :grouped_expression, val[0]
|
1020
|
-
|
1021
1012
|
result = @builder.parenthesize(val[0], val[1], val[3])
|
1022
1013
|
}
|
1023
1014
|
| tLPAREN compstmt tRPAREN
|
@@ -1346,7 +1337,7 @@ rule
|
|
1346
1337
|
}
|
1347
1338
|
;
|
1348
1339
|
|
1349
|
-
opt_block_var:
|
1340
|
+
opt_block_var: # nothing
|
1350
1341
|
{
|
1351
1342
|
result = @builder.args(nil, [], nil)
|
1352
1343
|
}
|
@@ -1483,7 +1474,7 @@ rule
|
|
1483
1474
|
val[3], val[4]),
|
1484
1475
|
*val[5] ]
|
1485
1476
|
}
|
1486
|
-
|
|
1477
|
+
| # nothing
|
1487
1478
|
{
|
1488
1479
|
result = []
|
1489
1480
|
}
|
@@ -1545,11 +1536,7 @@ rule
|
|
1545
1536
|
result = @builder.regexp_compose(val[0], val[1], val[2], opts)
|
1546
1537
|
}
|
1547
1538
|
|
1548
|
-
words: tWORDS_BEG
|
1549
|
-
{ # :nocov: TODO: unused with Ragel lexer; remove?
|
1550
|
-
result = @builder.words_compose(val[0], [], val[2])
|
1551
|
-
}
|
1552
|
-
| tWORDS_BEG word_list tSTRING_END
|
1539
|
+
words: tWORDS_BEG word_list tSTRING_END
|
1553
1540
|
{
|
1554
1541
|
result = @builder.words_compose(val[0], val[1], val[2])
|
1555
1542
|
}
|
@@ -1560,20 +1547,19 @@ rule
|
|
1560
1547
|
}
|
1561
1548
|
| word_list word tSPACE
|
1562
1549
|
{
|
1563
|
-
result = val[0] << val[1]
|
1550
|
+
result = val[0] << @builder.word(val[1])
|
1564
1551
|
}
|
1565
1552
|
|
1566
1553
|
word: string_content
|
1554
|
+
{
|
1555
|
+
result = [ val[0] ]
|
1556
|
+
}
|
1567
1557
|
| word string_content
|
1568
|
-
{
|
1569
|
-
|
1558
|
+
{
|
1559
|
+
result = val[0] << val[1]
|
1570
1560
|
}
|
1571
1561
|
|
1572
|
-
qwords: tQWORDS_BEG
|
1573
|
-
{ # :nocov: TODO: unused with Ragel lexer; remove?
|
1574
|
-
result = @builder.words_compose(val[0], [], val[2])
|
1575
|
-
}
|
1576
|
-
| tQWORDS_BEG qword_list tSTRING_END
|
1562
|
+
qwords: tQWORDS_BEG qword_list tSTRING_END
|
1577
1563
|
{
|
1578
1564
|
result = @builder.words_compose(val[0], val[1], val[2])
|
1579
1565
|
}
|
@@ -1596,7 +1582,7 @@ rule
|
|
1596
1582
|
result = val[0] << val[1]
|
1597
1583
|
}
|
1598
1584
|
|
1599
|
-
xstring_contents: # nothing
|
1585
|
+
xstring_contents: # nothing
|
1600
1586
|
{
|
1601
1587
|
result = []
|
1602
1588
|
}
|
@@ -1895,7 +1881,7 @@ xstring_contents: # nothing # TODO: replace with string_contents?
|
|
1895
1881
|
result = val[1]
|
1896
1882
|
}
|
1897
1883
|
|
1898
|
-
assoc_list:
|
1884
|
+
assoc_list: # nothing
|
1899
1885
|
{
|
1900
1886
|
result = []
|
1901
1887
|
}
|