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/ruby19.y
CHANGED
@@ -280,12 +280,14 @@ rule
|
|
280
280
|
cmd_brace_block: tLBRACE_ARG
|
281
281
|
{
|
282
282
|
@static_env.extend_dynamic
|
283
|
+
@context.push(:block)
|
283
284
|
}
|
284
285
|
opt_block_param compstmt tRCURLY
|
285
286
|
{
|
286
287
|
result = [ val[0], val[2], val[3], val[4] ]
|
287
288
|
|
288
289
|
@static_env.unextend
|
290
|
+
@context.pop
|
289
291
|
}
|
290
292
|
|
291
293
|
command: operation command_args =tLOWEST
|
@@ -1089,10 +1091,11 @@ rule
|
|
1089
1091
|
{
|
1090
1092
|
@static_env.extend_static
|
1091
1093
|
@lexer.push_cmdarg
|
1094
|
+
@context.push(:class)
|
1092
1095
|
}
|
1093
1096
|
bodystmt kEND
|
1094
1097
|
{
|
1095
|
-
if
|
1098
|
+
if @context.indirectly_in_def?
|
1096
1099
|
diagnostic :error, :class_in_def, nil, val[0]
|
1097
1100
|
end
|
1098
1101
|
|
@@ -1103,14 +1106,13 @@ rule
|
|
1103
1106
|
|
1104
1107
|
@lexer.pop_cmdarg
|
1105
1108
|
@static_env.unextend
|
1109
|
+
@context.pop
|
1106
1110
|
}
|
1107
1111
|
| kCLASS tLSHFT expr term
|
1108
1112
|
{
|
1109
|
-
result = @def_level
|
1110
|
-
@def_level = 0
|
1111
|
-
|
1112
1113
|
@static_env.extend_static
|
1113
1114
|
@lexer.push_cmdarg
|
1115
|
+
@context.push(:sclass)
|
1114
1116
|
}
|
1115
1117
|
bodystmt kEND
|
1116
1118
|
{
|
@@ -1119,8 +1121,7 @@ rule
|
|
1119
1121
|
|
1120
1122
|
@lexer.pop_cmdarg
|
1121
1123
|
@static_env.unextend
|
1122
|
-
|
1123
|
-
@def_level = val[4]
|
1124
|
+
@context.pop
|
1124
1125
|
}
|
1125
1126
|
| kMODULE cpath
|
1126
1127
|
{
|
@@ -1129,7 +1130,7 @@ rule
|
|
1129
1130
|
}
|
1130
1131
|
bodystmt kEND
|
1131
1132
|
{
|
1132
|
-
if
|
1133
|
+
if @context.indirectly_in_def?
|
1133
1134
|
diagnostic :error, :module_in_def, nil, val[0]
|
1134
1135
|
end
|
1135
1136
|
|
@@ -1141,9 +1142,9 @@ rule
|
|
1141
1142
|
}
|
1142
1143
|
| kDEF fname
|
1143
1144
|
{
|
1144
|
-
@def_level += 1
|
1145
1145
|
@static_env.extend_static
|
1146
1146
|
@lexer.push_cmdarg
|
1147
|
+
@context.push(:def)
|
1147
1148
|
}
|
1148
1149
|
f_arglist bodystmt kEND
|
1149
1150
|
{
|
@@ -1152,7 +1153,7 @@ rule
|
|
1152
1153
|
|
1153
1154
|
@lexer.pop_cmdarg
|
1154
1155
|
@static_env.unextend
|
1155
|
-
@
|
1156
|
+
@context.pop
|
1156
1157
|
}
|
1157
1158
|
| kDEF singleton dot_or_colon
|
1158
1159
|
{
|
@@ -1160,9 +1161,9 @@ rule
|
|
1160
1161
|
}
|
1161
1162
|
fname
|
1162
1163
|
{
|
1163
|
-
@def_level += 1
|
1164
1164
|
@static_env.extend_static
|
1165
1165
|
@lexer.push_cmdarg
|
1166
|
+
@context.push(:defs)
|
1166
1167
|
}
|
1167
1168
|
f_arglist bodystmt kEND
|
1168
1169
|
{
|
@@ -1171,7 +1172,7 @@ rule
|
|
1171
1172
|
|
1172
1173
|
@lexer.pop_cmdarg
|
1173
1174
|
@static_env.unextend
|
1174
|
-
@
|
1175
|
+
@context.pop
|
1175
1176
|
}
|
1176
1177
|
| kBREAK
|
1177
1178
|
{
|
@@ -1448,24 +1449,36 @@ rule
|
|
1448
1449
|
result = @builder.args(nil, val[0], nil)
|
1449
1450
|
}
|
1450
1451
|
|
1451
|
-
lambda_body: tLAMBEG
|
1452
|
+
lambda_body: tLAMBEG
|
1453
|
+
{
|
1454
|
+
@context.push(:lambda)
|
1455
|
+
}
|
1456
|
+
compstmt tRCURLY
|
1452
1457
|
{
|
1453
|
-
result = [ val[0], val[
|
1458
|
+
result = [ val[0], val[2], val[3] ]
|
1459
|
+
@context.pop
|
1454
1460
|
}
|
1455
|
-
| kDO_LAMBDA
|
1461
|
+
| kDO_LAMBDA
|
1456
1462
|
{
|
1457
|
-
|
1463
|
+
@context.push(:lambda)
|
1464
|
+
}
|
1465
|
+
compstmt kEND
|
1466
|
+
{
|
1467
|
+
result = [ val[0], val[2], val[3] ]
|
1468
|
+
@context.pop
|
1458
1469
|
}
|
1459
1470
|
|
1460
1471
|
do_block: kDO_BLOCK
|
1461
1472
|
{
|
1462
1473
|
@static_env.extend_dynamic
|
1474
|
+
@context.push(:block)
|
1463
1475
|
}
|
1464
1476
|
opt_block_param compstmt kEND
|
1465
1477
|
{
|
1466
1478
|
result = [ val[0], val[2], val[3], val[4] ]
|
1467
1479
|
|
1468
1480
|
@static_env.unextend
|
1481
|
+
@context.pop
|
1469
1482
|
}
|
1470
1483
|
|
1471
1484
|
block_call: command do_block
|
@@ -1539,22 +1552,26 @@ rule
|
|
1539
1552
|
brace_block: tLCURLY
|
1540
1553
|
{
|
1541
1554
|
@static_env.extend_dynamic
|
1555
|
+
@context.push(:block)
|
1542
1556
|
}
|
1543
1557
|
opt_block_param compstmt tRCURLY
|
1544
1558
|
{
|
1545
1559
|
result = [ val[0], val[2], val[3], val[4] ]
|
1546
1560
|
|
1547
1561
|
@static_env.unextend
|
1562
|
+
@context.pop
|
1548
1563
|
}
|
1549
1564
|
| kDO
|
1550
1565
|
{
|
1551
1566
|
@static_env.extend_dynamic
|
1567
|
+
@context.push(:block)
|
1552
1568
|
}
|
1553
1569
|
opt_block_param compstmt kEND
|
1554
1570
|
{
|
1555
1571
|
result = [ val[0], val[2], val[3], val[4] ]
|
1556
1572
|
|
1557
1573
|
@static_env.unextend
|
1574
|
+
@context.pop
|
1558
1575
|
}
|
1559
1576
|
|
1560
1577
|
case_body: kWHEN args then compstmt cases
|
@@ -2147,8 +2164,6 @@ end
|
|
2147
2164
|
|
2148
2165
|
require 'parser'
|
2149
2166
|
|
2150
|
-
Parser.check_for_encoding_support
|
2151
|
-
|
2152
2167
|
---- inner
|
2153
2168
|
|
2154
2169
|
def version
|
data/lib/parser/ruby20.y
CHANGED
@@ -116,7 +116,7 @@ rule
|
|
116
116
|
stmt_or_begin: stmt
|
117
117
|
| klBEGIN tLCURLY top_compstmt tRCURLY
|
118
118
|
{
|
119
|
-
if
|
119
|
+
if @context.indirectly_in_def?
|
120
120
|
diagnostic :error, :begin_in_method, nil, val[0]
|
121
121
|
end
|
122
122
|
|
@@ -287,12 +287,14 @@ rule
|
|
287
287
|
cmd_brace_block: tLBRACE_ARG
|
288
288
|
{
|
289
289
|
@static_env.extend_dynamic
|
290
|
+
@context.push(:block)
|
290
291
|
}
|
291
292
|
opt_block_param compstmt tRCURLY
|
292
293
|
{
|
293
294
|
result = [ val[0], val[2], val[3], val[4] ]
|
294
295
|
|
295
296
|
@static_env.unextend
|
297
|
+
@context.pop
|
296
298
|
}
|
297
299
|
|
298
300
|
fcall: operation
|
@@ -1119,10 +1121,11 @@ rule
|
|
1119
1121
|
{
|
1120
1122
|
@static_env.extend_static
|
1121
1123
|
@lexer.push_cmdarg
|
1124
|
+
@context.push(:class)
|
1122
1125
|
}
|
1123
1126
|
bodystmt kEND
|
1124
1127
|
{
|
1125
|
-
if
|
1128
|
+
if @context.indirectly_in_def?
|
1126
1129
|
diagnostic :error, :class_in_def, nil, val[0]
|
1127
1130
|
end
|
1128
1131
|
|
@@ -1133,14 +1136,13 @@ rule
|
|
1133
1136
|
|
1134
1137
|
@lexer.pop_cmdarg
|
1135
1138
|
@static_env.unextend
|
1139
|
+
@context.pop
|
1136
1140
|
}
|
1137
1141
|
| kCLASS tLSHFT expr term
|
1138
1142
|
{
|
1139
|
-
result = @def_level
|
1140
|
-
@def_level = 0
|
1141
|
-
|
1142
1143
|
@static_env.extend_static
|
1143
1144
|
@lexer.push_cmdarg
|
1145
|
+
@context.push(:sclass)
|
1144
1146
|
}
|
1145
1147
|
bodystmt kEND
|
1146
1148
|
{
|
@@ -1149,8 +1151,7 @@ rule
|
|
1149
1151
|
|
1150
1152
|
@lexer.pop_cmdarg
|
1151
1153
|
@static_env.unextend
|
1152
|
-
|
1153
|
-
@def_level = val[4]
|
1154
|
+
@context.pop
|
1154
1155
|
}
|
1155
1156
|
| kMODULE cpath
|
1156
1157
|
{
|
@@ -1159,7 +1160,7 @@ rule
|
|
1159
1160
|
}
|
1160
1161
|
bodystmt kEND
|
1161
1162
|
{
|
1162
|
-
if
|
1163
|
+
if @context.indirectly_in_def?
|
1163
1164
|
diagnostic :error, :module_in_def, nil, val[0]
|
1164
1165
|
end
|
1165
1166
|
|
@@ -1171,9 +1172,9 @@ rule
|
|
1171
1172
|
}
|
1172
1173
|
| kDEF fname
|
1173
1174
|
{
|
1174
|
-
@def_level += 1
|
1175
1175
|
@static_env.extend_static
|
1176
1176
|
@lexer.push_cmdarg
|
1177
|
+
@context.push(:def)
|
1177
1178
|
}
|
1178
1179
|
f_arglist bodystmt kEND
|
1179
1180
|
{
|
@@ -1182,7 +1183,7 @@ rule
|
|
1182
1183
|
|
1183
1184
|
@lexer.pop_cmdarg
|
1184
1185
|
@static_env.unextend
|
1185
|
-
@
|
1186
|
+
@context.pop
|
1186
1187
|
}
|
1187
1188
|
| kDEF singleton dot_or_colon
|
1188
1189
|
{
|
@@ -1190,9 +1191,9 @@ rule
|
|
1190
1191
|
}
|
1191
1192
|
fname
|
1192
1193
|
{
|
1193
|
-
@def_level += 1
|
1194
1194
|
@static_env.extend_static
|
1195
1195
|
@lexer.push_cmdarg
|
1196
|
+
@context.push(:defs)
|
1196
1197
|
}
|
1197
1198
|
f_arglist bodystmt kEND
|
1198
1199
|
{
|
@@ -1201,7 +1202,7 @@ rule
|
|
1201
1202
|
|
1202
1203
|
@lexer.pop_cmdarg
|
1203
1204
|
@static_env.unextend
|
1204
|
-
@
|
1205
|
+
@context.pop
|
1205
1206
|
}
|
1206
1207
|
| kBREAK
|
1207
1208
|
{
|
@@ -1502,24 +1503,36 @@ opt_block_args_tail:
|
|
1502
1503
|
result = @builder.args(nil, val[0], nil)
|
1503
1504
|
}
|
1504
1505
|
|
1505
|
-
lambda_body: tLAMBEG
|
1506
|
+
lambda_body: tLAMBEG
|
1507
|
+
{
|
1508
|
+
@context.push(:lambda)
|
1509
|
+
}
|
1510
|
+
compstmt tRCURLY
|
1506
1511
|
{
|
1507
|
-
result = [ val[0], val[
|
1512
|
+
result = [ val[0], val[2], val[3] ]
|
1513
|
+
@context.pop
|
1508
1514
|
}
|
1509
|
-
| kDO_LAMBDA
|
1515
|
+
| kDO_LAMBDA
|
1510
1516
|
{
|
1511
|
-
|
1517
|
+
@context.push(:lambda)
|
1518
|
+
}
|
1519
|
+
compstmt kEND
|
1520
|
+
{
|
1521
|
+
result = [ val[0], val[2], val[3] ]
|
1522
|
+
@context.pop
|
1512
1523
|
}
|
1513
1524
|
|
1514
1525
|
do_block: kDO_BLOCK
|
1515
1526
|
{
|
1516
1527
|
@static_env.extend_dynamic
|
1528
|
+
@context.push(:block)
|
1517
1529
|
}
|
1518
1530
|
opt_block_param compstmt kEND
|
1519
1531
|
{
|
1520
1532
|
result = [ val[0], val[2], val[3], val[4] ]
|
1521
1533
|
|
1522
1534
|
@static_env.unextend
|
1535
|
+
@context.pop
|
1523
1536
|
}
|
1524
1537
|
|
1525
1538
|
block_call: command do_block
|
@@ -1606,22 +1619,26 @@ opt_block_args_tail:
|
|
1606
1619
|
brace_block: tLCURLY
|
1607
1620
|
{
|
1608
1621
|
@static_env.extend_dynamic
|
1622
|
+
@context.push(:block)
|
1609
1623
|
}
|
1610
1624
|
opt_block_param compstmt tRCURLY
|
1611
1625
|
{
|
1612
1626
|
result = [ val[0], val[2], val[3], val[4] ]
|
1613
1627
|
|
1614
1628
|
@static_env.unextend
|
1629
|
+
@context.pop
|
1615
1630
|
}
|
1616
1631
|
| kDO
|
1617
1632
|
{
|
1618
1633
|
@static_env.extend_dynamic
|
1634
|
+
@context.push(:block)
|
1619
1635
|
}
|
1620
1636
|
opt_block_param compstmt kEND
|
1621
1637
|
{
|
1622
1638
|
result = [ val[0], val[2], val[3], val[4] ]
|
1623
1639
|
|
1624
1640
|
@static_env.unextend
|
1641
|
+
@context.pop
|
1625
1642
|
}
|
1626
1643
|
|
1627
1644
|
case_body: kWHEN args then compstmt cases
|
@@ -2325,8 +2342,6 @@ end
|
|
2325
2342
|
|
2326
2343
|
require 'parser'
|
2327
2344
|
|
2328
|
-
Parser.check_for_encoding_support
|
2329
|
-
|
2330
2345
|
---- inner
|
2331
2346
|
|
2332
2347
|
def version
|
data/lib/parser/ruby21.y
CHANGED
@@ -279,12 +279,14 @@ rule
|
|
279
279
|
cmd_brace_block: tLBRACE_ARG
|
280
280
|
{
|
281
281
|
@static_env.extend_dynamic
|
282
|
+
@context.push(:block)
|
282
283
|
}
|
283
284
|
opt_block_param compstmt tRCURLY
|
284
285
|
{
|
285
286
|
result = [ val[0], val[2], val[3], val[4] ]
|
286
287
|
|
287
288
|
@static_env.unextend
|
289
|
+
@context.pop
|
288
290
|
}
|
289
291
|
|
290
292
|
fcall: operation
|
@@ -1109,10 +1111,11 @@ rule
|
|
1109
1111
|
{
|
1110
1112
|
@static_env.extend_static
|
1111
1113
|
@lexer.push_cmdarg
|
1114
|
+
@context.push(:class)
|
1112
1115
|
}
|
1113
1116
|
bodystmt kEND
|
1114
1117
|
{
|
1115
|
-
if
|
1118
|
+
if @context.indirectly_in_def?
|
1116
1119
|
diagnostic :error, :class_in_def, nil, val[0]
|
1117
1120
|
end
|
1118
1121
|
|
@@ -1123,14 +1126,13 @@ rule
|
|
1123
1126
|
|
1124
1127
|
@lexer.pop_cmdarg
|
1125
1128
|
@static_env.unextend
|
1129
|
+
@context.pop
|
1126
1130
|
}
|
1127
1131
|
| kCLASS tLSHFT expr term
|
1128
1132
|
{
|
1129
|
-
result = @def_level
|
1130
|
-
@def_level = 0
|
1131
|
-
|
1132
1133
|
@static_env.extend_static
|
1133
1134
|
@lexer.push_cmdarg
|
1135
|
+
@context.push(:sclass)
|
1134
1136
|
}
|
1135
1137
|
bodystmt kEND
|
1136
1138
|
{
|
@@ -1139,8 +1141,7 @@ rule
|
|
1139
1141
|
|
1140
1142
|
@lexer.pop_cmdarg
|
1141
1143
|
@static_env.unextend
|
1142
|
-
|
1143
|
-
@def_level = val[4]
|
1144
|
+
@context.pop
|
1144
1145
|
}
|
1145
1146
|
| kMODULE cpath
|
1146
1147
|
{
|
@@ -1149,7 +1150,7 @@ rule
|
|
1149
1150
|
}
|
1150
1151
|
bodystmt kEND
|
1151
1152
|
{
|
1152
|
-
if
|
1153
|
+
if @context.indirectly_in_def?
|
1153
1154
|
diagnostic :error, :module_in_def, nil, val[0]
|
1154
1155
|
end
|
1155
1156
|
|
@@ -1161,9 +1162,9 @@ rule
|
|
1161
1162
|
}
|
1162
1163
|
| kDEF fname
|
1163
1164
|
{
|
1164
|
-
@def_level += 1
|
1165
1165
|
@static_env.extend_static
|
1166
1166
|
@lexer.push_cmdarg
|
1167
|
+
@context.push(:def)
|
1167
1168
|
}
|
1168
1169
|
f_arglist bodystmt kEND
|
1169
1170
|
{
|
@@ -1172,7 +1173,7 @@ rule
|
|
1172
1173
|
|
1173
1174
|
@lexer.pop_cmdarg
|
1174
1175
|
@static_env.unextend
|
1175
|
-
@
|
1176
|
+
@context.pop
|
1176
1177
|
}
|
1177
1178
|
| kDEF singleton dot_or_colon
|
1178
1179
|
{
|
@@ -1180,9 +1181,9 @@ rule
|
|
1180
1181
|
}
|
1181
1182
|
fname
|
1182
1183
|
{
|
1183
|
-
@def_level += 1
|
1184
1184
|
@static_env.extend_static
|
1185
1185
|
@lexer.push_cmdarg
|
1186
|
+
@context.push(:defs)
|
1186
1187
|
}
|
1187
1188
|
f_arglist bodystmt kEND
|
1188
1189
|
{
|
@@ -1191,7 +1192,7 @@ rule
|
|
1191
1192
|
|
1192
1193
|
@lexer.pop_cmdarg
|
1193
1194
|
@static_env.unextend
|
1194
|
-
@
|
1195
|
+
@context.pop
|
1195
1196
|
}
|
1196
1197
|
| kBREAK
|
1197
1198
|
{
|
@@ -1490,24 +1491,36 @@ opt_block_args_tail:
|
|
1490
1491
|
result = @builder.args(nil, val[0], nil)
|
1491
1492
|
}
|
1492
1493
|
|
1493
|
-
lambda_body: tLAMBEG
|
1494
|
+
lambda_body: tLAMBEG
|
1495
|
+
{
|
1496
|
+
@context.push(:lambda)
|
1497
|
+
}
|
1498
|
+
compstmt tRCURLY
|
1494
1499
|
{
|
1495
|
-
result = [ val[0], val[
|
1500
|
+
result = [ val[0], val[2], val[3] ]
|
1501
|
+
@context.pop
|
1496
1502
|
}
|
1497
|
-
| kDO_LAMBDA
|
1503
|
+
| kDO_LAMBDA
|
1498
1504
|
{
|
1499
|
-
|
1505
|
+
@context.push(:lambda)
|
1506
|
+
}
|
1507
|
+
compstmt kEND
|
1508
|
+
{
|
1509
|
+
result = [ val[0], val[2], val[3] ]
|
1510
|
+
@context.pop
|
1500
1511
|
}
|
1501
1512
|
|
1502
1513
|
do_block: kDO_BLOCK
|
1503
1514
|
{
|
1504
1515
|
@static_env.extend_dynamic
|
1516
|
+
@context.push(:block)
|
1505
1517
|
}
|
1506
1518
|
opt_block_param compstmt kEND
|
1507
1519
|
{
|
1508
1520
|
result = [ val[0], val[2], val[3], val[4] ]
|
1509
1521
|
|
1510
1522
|
@static_env.unextend
|
1523
|
+
@context.pop
|
1511
1524
|
}
|
1512
1525
|
|
1513
1526
|
block_call: command do_block
|
@@ -1594,22 +1607,26 @@ opt_block_args_tail:
|
|
1594
1607
|
brace_block: tLCURLY
|
1595
1608
|
{
|
1596
1609
|
@static_env.extend_dynamic
|
1610
|
+
@context.push(:block)
|
1597
1611
|
}
|
1598
1612
|
opt_block_param compstmt tRCURLY
|
1599
1613
|
{
|
1600
1614
|
result = [ val[0], val[2], val[3], val[4] ]
|
1601
1615
|
|
1602
1616
|
@static_env.unextend
|
1617
|
+
@context.pop
|
1603
1618
|
}
|
1604
1619
|
| kDO
|
1605
1620
|
{
|
1606
1621
|
@static_env.extend_dynamic
|
1622
|
+
@context.push(:block)
|
1607
1623
|
}
|
1608
1624
|
opt_block_param compstmt kEND
|
1609
1625
|
{
|
1610
1626
|
result = [ val[0], val[2], val[3], val[4] ]
|
1611
1627
|
|
1612
1628
|
@static_env.unextend
|
1629
|
+
@context.pop
|
1613
1630
|
}
|
1614
1631
|
|
1615
1632
|
case_body: kWHEN args then compstmt cases
|
@@ -2329,8 +2346,6 @@ end
|
|
2329
2346
|
|
2330
2347
|
require 'parser'
|
2331
2348
|
|
2332
|
-
Parser.check_for_encoding_support
|
2333
|
-
|
2334
2349
|
---- inner
|
2335
2350
|
|
2336
2351
|
def version
|