parser 2.4.0.2 → 2.5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -6
- data/CHANGELOG.md +35 -1
- data/Gemfile +2 -0
- data/README.md +1 -2
- data/Rakefile +2 -1
- data/bin/ruby-parse +2 -1
- data/bin/ruby-rewrite +2 -1
- data/lib/gauntlet_parser.rb +2 -0
- data/lib/parser.rb +16 -17
- data/lib/parser/all.rb +2 -0
- data/lib/parser/ast/node.rb +2 -0
- data/lib/parser/ast/processor.rb +2 -0
- data/lib/parser/base.rb +6 -12
- data/lib/parser/builders/default.rb +28 -47
- data/lib/parser/clobbering_error.rb +2 -0
- data/lib/parser/context.rb +42 -0
- data/lib/parser/current.rb +4 -20
- data/lib/parser/deprecation.rb +13 -0
- data/lib/parser/diagnostic.rb +3 -3
- data/lib/parser/diagnostic/engine.rb +2 -0
- data/lib/parser/lexer.rl +122 -60
- data/lib/parser/lexer/dedenter.rb +2 -0
- data/lib/parser/lexer/explanation.rb +2 -0
- data/lib/parser/lexer/literal.rb +4 -9
- data/lib/parser/lexer/stack_state.rb +4 -1
- data/lib/parser/macruby.y +32 -17
- data/lib/parser/messages.rb +14 -0
- data/lib/parser/meta.rb +2 -0
- data/lib/parser/rewriter.rb +30 -44
- data/lib/parser/ruby18.y +20 -13
- data/lib/parser/ruby19.y +32 -17
- data/lib/parser/ruby20.y +33 -18
- data/lib/parser/ruby21.y +32 -17
- data/lib/parser/ruby22.y +32 -17
- data/lib/parser/ruby23.y +32 -17
- data/lib/parser/ruby24.y +63 -46
- data/lib/parser/ruby25.y +72 -48
- data/lib/parser/rubymotion.y +33 -18
- data/lib/parser/runner.rb +4 -7
- data/lib/parser/runner/ruby_parse.rb +10 -0
- data/lib/parser/runner/ruby_rewrite.rb +2 -0
- data/lib/parser/source/buffer.rb +19 -24
- data/lib/parser/source/comment.rb +2 -0
- data/lib/parser/source/comment/associator.rb +2 -0
- data/lib/parser/source/map.rb +2 -0
- data/lib/parser/source/map/collection.rb +2 -0
- data/lib/parser/source/map/condition.rb +2 -0
- data/lib/parser/source/map/constant.rb +2 -0
- data/lib/parser/source/map/definition.rb +2 -0
- data/lib/parser/source/map/for.rb +2 -0
- data/lib/parser/source/map/heredoc.rb +2 -0
- data/lib/parser/source/map/keyword.rb +2 -0
- data/lib/parser/source/map/objc_kwarg.rb +2 -0
- data/lib/parser/source/map/operator.rb +2 -0
- data/lib/parser/source/map/rescue_body.rb +2 -0
- data/lib/parser/source/map/send.rb +2 -0
- data/lib/parser/source/map/ternary.rb +2 -0
- data/lib/parser/source/map/variable.rb +2 -0
- data/lib/parser/source/range.rb +81 -13
- data/lib/parser/source/rewriter.rb +48 -10
- data/lib/parser/source/rewriter/action.rb +2 -0
- data/lib/parser/source/tree_rewriter.rb +301 -0
- data/lib/parser/source/tree_rewriter/action.rb +133 -0
- data/lib/parser/static_environment.rb +2 -0
- data/lib/parser/syntax_error.rb +2 -0
- data/lib/parser/tree_rewriter.rb +133 -0
- data/lib/parser/version.rb +3 -1
- data/parser.gemspec +4 -1
- data/test/bug_163/fixtures/input.rb +2 -0
- data/test/bug_163/fixtures/output.rb +2 -0
- data/test/bug_163/rewriter.rb +2 -0
- data/test/helper.rb +7 -7
- data/test/parse_helper.rb +57 -10
- data/test/racc_coverage_helper.rb +2 -0
- data/test/test_base.rb +2 -0
- data/test/test_current.rb +2 -4
- data/test/test_diagnostic.rb +3 -1
- data/test/test_diagnostic_engine.rb +2 -0
- data/test/test_encoding.rb +61 -49
- data/test/test_lexer.rb +164 -77
- data/test/test_lexer_stack_state.rb +2 -0
- data/test/test_parse_helper.rb +8 -8
- data/test/test_parser.rb +613 -51
- data/test/test_runner_rewrite.rb +47 -0
- data/test/test_source_buffer.rb +22 -10
- data/test/test_source_comment.rb +2 -0
- data/test/test_source_comment_associator.rb +2 -0
- data/test/test_source_map.rb +2 -0
- data/test/test_source_range.rb +92 -45
- data/test/test_source_rewriter.rb +3 -1
- data/test/test_source_rewriter_action.rb +2 -0
- data/test/test_source_tree_rewriter.rb +177 -0
- data/test/test_static_environment.rb +2 -0
- data/test/using_tree_rewriter/fixtures/input.rb +3 -0
- data/test/using_tree_rewriter/fixtures/output.rb +3 -0
- data/test/using_tree_rewriter/using_tree_rewriter.rb +9 -0
- metadata +21 -10
- data/lib/parser/compatibility/ruby1_8.rb +0 -20
- data/lib/parser/compatibility/ruby1_9.rb +0 -32
- data/test/bug_163/test_runner_rewrite.rb +0 -35
data/lib/parser/ruby25.y
CHANGED
@@ -283,9 +283,14 @@ rule
|
|
283
283
|
nil, val[3], nil)
|
284
284
|
}
|
285
285
|
|
286
|
-
cmd_brace_block: tLBRACE_ARG
|
286
|
+
cmd_brace_block: tLBRACE_ARG
|
287
287
|
{
|
288
|
-
|
288
|
+
@context.push(:block)
|
289
|
+
}
|
290
|
+
brace_body tRCURLY
|
291
|
+
{
|
292
|
+
result = [ val[0], *val[2], val[3] ]
|
293
|
+
@context.pop
|
289
294
|
}
|
290
295
|
|
291
296
|
fcall: operation
|
@@ -342,7 +347,7 @@ rule
|
|
342
347
|
result = @builder.keyword_cmd(:yield, val[0],
|
343
348
|
nil, val[1], nil)
|
344
349
|
}
|
345
|
-
|
|
350
|
+
| k_return call_args
|
346
351
|
{
|
347
352
|
result = @builder.keyword_cmd(:return, val[0],
|
348
353
|
nil, val[1], nil)
|
@@ -841,12 +846,11 @@ rule
|
|
841
846
|
}
|
842
847
|
|
843
848
|
command_args: {
|
844
|
-
result = @lexer.cmdarg.dup
|
845
849
|
@lexer.cmdarg.push(true)
|
846
850
|
}
|
847
851
|
call_args
|
848
852
|
{
|
849
|
-
@lexer.cmdarg
|
853
|
+
@lexer.cmdarg.pop
|
850
854
|
|
851
855
|
result = val[1]
|
852
856
|
}
|
@@ -969,7 +973,7 @@ rule
|
|
969
973
|
{
|
970
974
|
result = @builder.associate(val[0], val[1], val[2])
|
971
975
|
}
|
972
|
-
|
|
976
|
+
| k_return
|
973
977
|
{
|
974
978
|
result = @builder.keyword_cmd(:return, val[0])
|
975
979
|
}
|
@@ -1095,10 +1099,11 @@ rule
|
|
1095
1099
|
{
|
1096
1100
|
@static_env.extend_static
|
1097
1101
|
@lexer.push_cmdarg
|
1102
|
+
@context.push(:class)
|
1098
1103
|
}
|
1099
1104
|
bodystmt kEND
|
1100
1105
|
{
|
1101
|
-
if
|
1106
|
+
if @context.indirectly_in_def?
|
1102
1107
|
diagnostic :error, :class_in_def, nil, val[0]
|
1103
1108
|
end
|
1104
1109
|
|
@@ -1109,14 +1114,13 @@ rule
|
|
1109
1114
|
|
1110
1115
|
@lexer.pop_cmdarg
|
1111
1116
|
@static_env.unextend
|
1117
|
+
@context.pop
|
1112
1118
|
}
|
1113
1119
|
| kCLASS tLSHFT expr term
|
1114
1120
|
{
|
1115
|
-
result = @def_level
|
1116
|
-
@def_level = 0
|
1117
|
-
|
1118
1121
|
@static_env.extend_static
|
1119
1122
|
@lexer.push_cmdarg
|
1123
|
+
@context.push(:sclass)
|
1120
1124
|
}
|
1121
1125
|
bodystmt kEND
|
1122
1126
|
{
|
@@ -1125,8 +1129,7 @@ rule
|
|
1125
1129
|
|
1126
1130
|
@lexer.pop_cmdarg
|
1127
1131
|
@static_env.unextend
|
1128
|
-
|
1129
|
-
@def_level = val[4]
|
1132
|
+
@context.pop
|
1130
1133
|
}
|
1131
1134
|
| kMODULE cpath
|
1132
1135
|
{
|
@@ -1135,7 +1138,7 @@ rule
|
|
1135
1138
|
}
|
1136
1139
|
bodystmt kEND
|
1137
1140
|
{
|
1138
|
-
if
|
1141
|
+
if @context.indirectly_in_def?
|
1139
1142
|
diagnostic :error, :module_in_def, nil, val[0]
|
1140
1143
|
end
|
1141
1144
|
|
@@ -1147,9 +1150,9 @@ rule
|
|
1147
1150
|
}
|
1148
1151
|
| kDEF fname
|
1149
1152
|
{
|
1150
|
-
@def_level += 1
|
1151
1153
|
@static_env.extend_static
|
1152
1154
|
@lexer.push_cmdarg
|
1155
|
+
@context.push(:def)
|
1153
1156
|
}
|
1154
1157
|
f_arglist bodystmt kEND
|
1155
1158
|
{
|
@@ -1158,7 +1161,7 @@ rule
|
|
1158
1161
|
|
1159
1162
|
@lexer.pop_cmdarg
|
1160
1163
|
@static_env.unextend
|
1161
|
-
@
|
1164
|
+
@context.pop
|
1162
1165
|
}
|
1163
1166
|
| kDEF singleton dot_or_colon
|
1164
1167
|
{
|
@@ -1166,9 +1169,9 @@ rule
|
|
1166
1169
|
}
|
1167
1170
|
fname
|
1168
1171
|
{
|
1169
|
-
@def_level += 1
|
1170
1172
|
@static_env.extend_static
|
1171
1173
|
@lexer.push_cmdarg
|
1174
|
+
@context.push(:defs)
|
1172
1175
|
}
|
1173
1176
|
f_arglist bodystmt kEND
|
1174
1177
|
{
|
@@ -1177,7 +1180,7 @@ rule
|
|
1177
1180
|
|
1178
1181
|
@lexer.pop_cmdarg
|
1179
1182
|
@static_env.unextend
|
1180
|
-
@
|
1183
|
+
@context.pop
|
1181
1184
|
}
|
1182
1185
|
| kBREAK
|
1183
1186
|
{
|
@@ -1198,6 +1201,13 @@ rule
|
|
1198
1201
|
|
1199
1202
|
primary_value: primary
|
1200
1203
|
|
1204
|
+
k_return: kRETURN
|
1205
|
+
{
|
1206
|
+
if @context.in_class?
|
1207
|
+
diagnostic :error, :invalid_return, nil, val[0]
|
1208
|
+
end
|
1209
|
+
}
|
1210
|
+
|
1201
1211
|
then: term
|
1202
1212
|
| kTHEN
|
1203
1213
|
| term kTHEN
|
@@ -1454,13 +1464,11 @@ opt_block_args_tail:
|
|
1454
1464
|
}
|
1455
1465
|
f_larglist
|
1456
1466
|
{
|
1457
|
-
|
1458
|
-
@lexer.cmdarg.clear
|
1467
|
+
@lexer.cmdarg.push(false)
|
1459
1468
|
}
|
1460
1469
|
lambda_body
|
1461
1470
|
{
|
1462
|
-
@lexer.cmdarg
|
1463
|
-
@lexer.cmdarg.lexpop
|
1471
|
+
@lexer.cmdarg.pop
|
1464
1472
|
|
1465
1473
|
result = [ val[1], val[3] ]
|
1466
1474
|
|
@@ -1476,18 +1484,33 @@ opt_block_args_tail:
|
|
1476
1484
|
result = @builder.args(nil, val[0], nil)
|
1477
1485
|
}
|
1478
1486
|
|
1479
|
-
lambda_body: tLAMBEG
|
1487
|
+
lambda_body: tLAMBEG
|
1488
|
+
{
|
1489
|
+
@context.push(:lambda)
|
1490
|
+
}
|
1491
|
+
compstmt tRCURLY
|
1492
|
+
{
|
1493
|
+
result = [ val[0], val[2], val[3] ]
|
1494
|
+
@context.pop
|
1495
|
+
}
|
1496
|
+
| kDO_LAMBDA
|
1480
1497
|
{
|
1481
|
-
|
1498
|
+
@context.push(:lambda)
|
1482
1499
|
}
|
1483
|
-
|
1500
|
+
compstmt kEND
|
1484
1501
|
{
|
1485
|
-
result = [ val[0], val[
|
1502
|
+
result = [ val[0], val[2], val[3] ]
|
1503
|
+
@context.pop
|
1486
1504
|
}
|
1487
1505
|
|
1488
|
-
do_block: kDO_BLOCK
|
1506
|
+
do_block: kDO_BLOCK
|
1507
|
+
{
|
1508
|
+
@context.push(:block)
|
1509
|
+
}
|
1510
|
+
do_body kEND
|
1489
1511
|
{
|
1490
|
-
result = [ val[0], *val[
|
1512
|
+
result = [ val[0], *val[2], val[3] ]
|
1513
|
+
@context.pop
|
1491
1514
|
}
|
1492
1515
|
|
1493
1516
|
block_call: command do_block
|
@@ -1571,29 +1594,33 @@ opt_block_args_tail:
|
|
1571
1594
|
result = @builder.index(val[0], val[1], val[2], val[3])
|
1572
1595
|
}
|
1573
1596
|
|
1574
|
-
brace_block: tLCURLY
|
1597
|
+
brace_block: tLCURLY
|
1575
1598
|
{
|
1576
|
-
|
1599
|
+
@context.push(:block)
|
1577
1600
|
}
|
1578
|
-
|
1601
|
+
brace_body tRCURLY
|
1579
1602
|
{
|
1580
|
-
result = [ val[0], *val[
|
1603
|
+
result = [ val[0], *val[2], val[3] ]
|
1604
|
+
@context.pop
|
1605
|
+
}
|
1606
|
+
| kDO
|
1607
|
+
{
|
1608
|
+
@context.push(:block)
|
1609
|
+
}
|
1610
|
+
do_body kEND
|
1611
|
+
{
|
1612
|
+
result = [ val[0], *val[2], val[3] ]
|
1613
|
+
@context.pop
|
1581
1614
|
}
|
1582
1615
|
|
1583
1616
|
brace_body: {
|
1584
1617
|
@static_env.extend_dynamic
|
1585
1618
|
}
|
1586
|
-
{
|
1587
|
-
result = @lexer.cmdarg.dup
|
1588
|
-
@lexer.cmdarg.clear
|
1589
|
-
}
|
1590
1619
|
opt_block_param compstmt
|
1591
1620
|
{
|
1592
|
-
result = [ val[
|
1621
|
+
result = [ val[1], val[2] ]
|
1593
1622
|
|
1594
1623
|
@static_env.unextend
|
1595
|
-
@lexer.cmdarg = val[1]
|
1596
|
-
@lexer.cmdarg.pop
|
1597
1624
|
}
|
1598
1625
|
|
1599
1626
|
do_body: {
|
@@ -1609,7 +1636,6 @@ opt_block_args_tail:
|
|
1609
1636
|
|
1610
1637
|
@static_env.unextend
|
1611
1638
|
@lexer.cmdarg = val[1]
|
1612
|
-
@lexer.cmdarg.pop
|
1613
1639
|
}
|
1614
1640
|
|
1615
1641
|
case_body: kWHEN args then compstmt cases
|
@@ -1814,7 +1840,7 @@ regexp_contents: # nothing
|
|
1814
1840
|
compstmt tSTRING_DEND
|
1815
1841
|
{
|
1816
1842
|
@lexer.cond.lexpop
|
1817
|
-
@lexer.cmdarg.
|
1843
|
+
@lexer.cmdarg.pop
|
1818
1844
|
|
1819
1845
|
result = @builder.begin(val[0], val[2], val[3])
|
1820
1846
|
}
|
@@ -1836,13 +1862,13 @@ regexp_contents: # nothing
|
|
1836
1862
|
|
1837
1863
|
symbol: tSYMBOL
|
1838
1864
|
{
|
1839
|
-
@lexer.state = :
|
1865
|
+
@lexer.state = :expr_end
|
1840
1866
|
result = @builder.symbol(val[0])
|
1841
1867
|
}
|
1842
1868
|
|
1843
1869
|
dsym: tSYMBEG xstring_contents tSTRING_END
|
1844
1870
|
{
|
1845
|
-
@lexer.state = :
|
1871
|
+
@lexer.state = :expr_end
|
1846
1872
|
result = @builder.symbol_compose(val[0], val[1], val[2])
|
1847
1873
|
}
|
1848
1874
|
|
@@ -1862,22 +1888,22 @@ regexp_contents: # nothing
|
|
1862
1888
|
|
1863
1889
|
simple_numeric: tINTEGER
|
1864
1890
|
{
|
1865
|
-
@lexer.state = :
|
1891
|
+
@lexer.state = :expr_end
|
1866
1892
|
result = @builder.integer(val[0])
|
1867
1893
|
}
|
1868
1894
|
| tFLOAT
|
1869
1895
|
{
|
1870
|
-
@lexer.state = :
|
1896
|
+
@lexer.state = :expr_end
|
1871
1897
|
result = @builder.float(val[0])
|
1872
1898
|
}
|
1873
1899
|
| tRATIONAL
|
1874
1900
|
{
|
1875
|
-
@lexer.state = :
|
1901
|
+
@lexer.state = :expr_end
|
1876
1902
|
result = @builder.rational(val[0])
|
1877
1903
|
}
|
1878
1904
|
| tIMAGINARY
|
1879
1905
|
{
|
1880
|
-
@lexer.state = :
|
1906
|
+
@lexer.state = :expr_end
|
1881
1907
|
result = @builder.complex(val[0])
|
1882
1908
|
}
|
1883
1909
|
|
@@ -2349,8 +2375,6 @@ end
|
|
2349
2375
|
|
2350
2376
|
require 'parser'
|
2351
2377
|
|
2352
|
-
Parser.check_for_encoding_support
|
2353
|
-
|
2354
2378
|
---- inner
|
2355
2379
|
|
2356
2380
|
def version
|
data/lib/parser/rubymotion.y
CHANGED
@@ -141,7 +141,7 @@ rule
|
|
141
141
|
}
|
142
142
|
| klBEGIN tLCURLY compstmt tRCURLY
|
143
143
|
{
|
144
|
-
if
|
144
|
+
if @context.indirectly_in_def?
|
145
145
|
diagnostic :error, :begin_in_method, nil, val[0]
|
146
146
|
end
|
147
147
|
|
@@ -265,12 +265,14 @@ rule
|
|
265
265
|
cmd_brace_block: tLBRACE_ARG
|
266
266
|
{
|
267
267
|
@static_env.extend_dynamic
|
268
|
+
@context.push(:block)
|
268
269
|
}
|
269
270
|
opt_block_param compstmt tRCURLY
|
270
271
|
{
|
271
272
|
result = [ val[0], val[2], val[3], val[4] ]
|
272
273
|
|
273
274
|
@static_env.unextend
|
275
|
+
@context.pop
|
274
276
|
}
|
275
277
|
|
276
278
|
command: operation command_args =tLOWEST
|
@@ -1098,10 +1100,11 @@ rule
|
|
1098
1100
|
{
|
1099
1101
|
@static_env.extend_static
|
1100
1102
|
@lexer.push_cmdarg
|
1103
|
+
@context.push(:class)
|
1101
1104
|
}
|
1102
1105
|
bodystmt kEND
|
1103
1106
|
{
|
1104
|
-
if
|
1107
|
+
if @context.indirectly_in_def?
|
1105
1108
|
diagnostic :error, :class_in_def, nil, val[0]
|
1106
1109
|
end
|
1107
1110
|
|
@@ -1112,14 +1115,13 @@ rule
|
|
1112
1115
|
|
1113
1116
|
@lexer.pop_cmdarg
|
1114
1117
|
@static_env.unextend
|
1118
|
+
@context.pop
|
1115
1119
|
}
|
1116
1120
|
| kCLASS tLSHFT expr term
|
1117
1121
|
{
|
1118
|
-
result = @def_level
|
1119
|
-
@def_level = 0
|
1120
|
-
|
1121
1122
|
@static_env.extend_static
|
1122
1123
|
@lexer.push_cmdarg
|
1124
|
+
@context.push(:sclass)
|
1123
1125
|
}
|
1124
1126
|
bodystmt kEND
|
1125
1127
|
{
|
@@ -1128,8 +1130,7 @@ rule
|
|
1128
1130
|
|
1129
1131
|
@lexer.pop_cmdarg
|
1130
1132
|
@static_env.unextend
|
1131
|
-
|
1132
|
-
@def_level = val[4]
|
1133
|
+
@context.pop
|
1133
1134
|
}
|
1134
1135
|
| kMODULE cpath
|
1135
1136
|
{
|
@@ -1138,7 +1139,7 @@ rule
|
|
1138
1139
|
}
|
1139
1140
|
bodystmt kEND
|
1140
1141
|
{
|
1141
|
-
if
|
1142
|
+
if @context.indirectly_in_def?
|
1142
1143
|
diagnostic :error, :module_in_def, nil, val[0]
|
1143
1144
|
end
|
1144
1145
|
|
@@ -1150,9 +1151,9 @@ rule
|
|
1150
1151
|
}
|
1151
1152
|
| kDEF fname
|
1152
1153
|
{
|
1153
|
-
@def_level += 1
|
1154
1154
|
@static_env.extend_static
|
1155
1155
|
@lexer.push_cmdarg
|
1156
|
+
@context.push(:def)
|
1156
1157
|
}
|
1157
1158
|
f_arglist bodystmt kEND
|
1158
1159
|
{
|
@@ -1161,7 +1162,7 @@ rule
|
|
1161
1162
|
|
1162
1163
|
@lexer.pop_cmdarg
|
1163
1164
|
@static_env.unextend
|
1164
|
-
@
|
1165
|
+
@context.pop
|
1165
1166
|
}
|
1166
1167
|
| kDEF singleton dot_or_colon
|
1167
1168
|
{
|
@@ -1169,9 +1170,9 @@ rule
|
|
1169
1170
|
}
|
1170
1171
|
fname
|
1171
1172
|
{
|
1172
|
-
@def_level += 1
|
1173
1173
|
@static_env.extend_static
|
1174
1174
|
@lexer.push_cmdarg
|
1175
|
+
@context.push(:defs)
|
1175
1176
|
}
|
1176
1177
|
f_arglist bodystmt kEND
|
1177
1178
|
{
|
@@ -1180,7 +1181,7 @@ rule
|
|
1180
1181
|
|
1181
1182
|
@lexer.pop_cmdarg
|
1182
1183
|
@static_env.unextend
|
1183
|
-
@
|
1184
|
+
@context.pop
|
1184
1185
|
}
|
1185
1186
|
| kBREAK
|
1186
1187
|
{
|
@@ -1444,24 +1445,36 @@ rule
|
|
1444
1445
|
result = @builder.args(nil, val[0].concat(val[1]), nil)
|
1445
1446
|
}
|
1446
1447
|
|
1447
|
-
lambda_body: tLAMBEG
|
1448
|
+
lambda_body: tLAMBEG
|
1449
|
+
{
|
1450
|
+
@context.push(:lambda)
|
1451
|
+
}
|
1452
|
+
compstmt tRCURLY
|
1448
1453
|
{
|
1449
|
-
result = [ val[0], val[
|
1454
|
+
result = [ val[0], val[2], val[3] ]
|
1455
|
+
@context.pop
|
1450
1456
|
}
|
1451
|
-
| kDO_LAMBDA
|
1457
|
+
| kDO_LAMBDA
|
1452
1458
|
{
|
1453
|
-
|
1459
|
+
@context.push(:lambda)
|
1460
|
+
}
|
1461
|
+
compstmt kEND
|
1462
|
+
{
|
1463
|
+
result = [ val[0], val[2], val[3] ]
|
1464
|
+
@context.pop
|
1454
1465
|
}
|
1455
1466
|
|
1456
1467
|
do_block: kDO_BLOCK
|
1457
1468
|
{
|
1458
1469
|
@static_env.extend_dynamic
|
1470
|
+
@context.push(:block)
|
1459
1471
|
}
|
1460
1472
|
opt_block_param compstmt kEND
|
1461
1473
|
{
|
1462
1474
|
result = [ val[0], val[2], val[3], val[4] ]
|
1463
1475
|
|
1464
1476
|
@static_env.unextend
|
1477
|
+
@context.pop
|
1465
1478
|
}
|
1466
1479
|
|
1467
1480
|
block_call: command do_block
|
@@ -1535,22 +1548,26 @@ rule
|
|
1535
1548
|
brace_block: tLCURLY
|
1536
1549
|
{
|
1537
1550
|
@static_env.extend_dynamic
|
1551
|
+
@context.push(:block)
|
1538
1552
|
}
|
1539
1553
|
opt_block_param compstmt tRCURLY
|
1540
1554
|
{
|
1541
1555
|
result = [ val[0], val[2], val[3], val[4] ]
|
1542
1556
|
|
1543
1557
|
@static_env.unextend
|
1558
|
+
@context.pop
|
1544
1559
|
}
|
1545
1560
|
| kDO
|
1546
1561
|
{
|
1547
1562
|
@static_env.extend_dynamic
|
1563
|
+
@context.push(:block)
|
1548
1564
|
}
|
1549
1565
|
opt_block_param compstmt kEND
|
1550
1566
|
{
|
1551
1567
|
result = [ val[0], val[2], val[3], val[4] ]
|
1552
1568
|
|
1553
1569
|
@static_env.unextend
|
1570
|
+
@context.pop
|
1554
1571
|
}
|
1555
1572
|
|
1556
1573
|
case_body: kWHEN args then compstmt cases
|
@@ -2154,8 +2171,6 @@ end
|
|
2154
2171
|
|
2155
2172
|
require 'parser'
|
2156
2173
|
|
2157
|
-
Parser.check_for_encoding_support
|
2158
|
-
|
2159
2174
|
---- inner
|
2160
2175
|
|
2161
2176
|
def version
|