ruby_parser 3.6.6 → 3.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 09754494e04948801beb28a7a2f32a8e53ba20c5
4
- data.tar.gz: d24103e108f923b0f0665b3bf9e367f1618f9b73
3
+ metadata.gz: 41b49f3089bda3758931dcacdbfacfe188099d40
4
+ data.tar.gz: 16bdfbd9b6b350aadee20337abdc30145df20b01
5
5
  SHA512:
6
- metadata.gz: f0c22a3e4dd845e6df193ccef9cd23cb9b461070b2964a11413b6e8c30d3851d69a8cee31e472fb48d9a3e5b0ac42d0adbd6ccf1456260d7f87d8ef526588147
7
- data.tar.gz: 43f5cfddfe50a2c212536d002f99b7bef6bca40c9e92493bca0a1caea8a8ed2847eb66be041661d7f1ab171980a75b9d33609bf24e4e7f74babcb95e86ac6c78
6
+ metadata.gz: 54e6bf7dd57d961e29c7378f9779cc0b62d2f3e9f3d8c940605b78306fa6a27bc4bd37d49da2e96e1ca15c324b0d51fc03f861d12ffe8e919b491d9a5e2fcdac
7
+ data.tar.gz: 31a135b14a05303a46d8f5f227900139bf255ce297f1c1b23fcef382edd2362e77468aa5562588d516a9e8098be0be1bbfd43716e957b6b19e24bcaaf7def85c
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.autotest CHANGED
@@ -15,6 +15,11 @@ Autotest.add_hook :initialize do |at|
15
15
  at.add_exception "lib/ruby18_parser.rb"
16
16
  at.add_exception "lib/ruby19_parser.rb"
17
17
  at.add_exception "lib/ruby20_parser.rb"
18
+ at.add_exception "lib/ruby21_parser.rb"
19
+ at.add_exception "lib/ruby22_parser.rb"
20
+ at.add_exception "lib/ruby20_parser.y"
21
+ at.add_exception "lib/ruby21_parser.y"
22
+ at.add_exception "lib/ruby22_parser.y"
18
23
  at.add_exception "lib/ruby_lexer.rex.rb"
19
24
 
20
25
  Dir["gauntlet*"].each do |f|
@@ -25,7 +30,12 @@ Autotest.add_hook :initialize do |at|
25
30
  at.testlib = "minitest/autorun"
26
31
 
27
32
  at.add_mapping(/^lib\/.*\.y$/) do |f, _|
28
- g = File.basename(f, ".y").gsub("_", "_?").gsub(/1[89]|2[01]/, '')
33
+ g = File.basename(f, ".y").gsub("_", "_?").gsub(/1[89]|2[012]/, '')
34
+ at.files_matching %r%^test/.*#{g}.rb$%
35
+ end
36
+
37
+ at.add_mapping(/^lib\/.*\.yy$/) do |f, _|
38
+ g = File.basename(f, ".yy").gsub("_", "_?").gsub(/1[89]|2[012]/, '')
29
39
  at.files_matching %r%^test/.*#{g}.rb$%
30
40
  end
31
41
 
@@ -46,7 +56,7 @@ Autotest.add_hook :initialize do |at|
46
56
  at.extra_class_map[klass] = "test/test_ruby_parser_extras.rb"
47
57
  end
48
58
 
49
- %w(TestRuby18Parser TestRuby19Parser TestRuby20Parser TestRuby21Parser TestParseTree).each do |klass| # HACK
59
+ %w(TestRuby18Parser TestRuby19Parser TestRuby20Parser TestRuby21Parser TestRuby22Parser TestParseTree).each do |klass| # HACK
50
60
  at.extra_class_map[klass] = "test/test_ruby_parser.rb"
51
61
  end
52
62
  end
data/History.txt CHANGED
@@ -1,3 +1,21 @@
1
+ === 3.7.0 / 2015-05-28
2
+
3
+ * 2 major enhancements:
4
+
5
+ * Added preliminary support for ruby 2.2 syntax.
6
+ * Now writing all 2.x parsers from one source, generating racc files.
7
+
8
+ * 1 minor enhancement:
9
+
10
+ * Added RubyLexer#process_label and hooked it up to "x": and 'x': productions.
11
+
12
+ * 4 bug fixes:
13
+
14
+ * Fixed handling of block_args to be consistent across all parse versions.
15
+ * Fixed lexing of label assoc args w/ newlines in between k/v. (jeremyf)
16
+ * Fixed lexing of x?'':y for ruby22 (not a label). (presidentbeef)
17
+ * clear and restore cmdarg stack around def args and body.
18
+
1
19
  === 3.6.6 / 2015-04-13
2
20
 
3
21
  * 1 minor enhancement:
data/Manifest.txt CHANGED
@@ -14,10 +14,13 @@ lib/ruby20_parser.rb
14
14
  lib/ruby20_parser.y
15
15
  lib/ruby21_parser.rb
16
16
  lib/ruby21_parser.y
17
+ lib/ruby22_parser.rb
18
+ lib/ruby22_parser.y
17
19
  lib/ruby_lexer.rb
18
20
  lib/ruby_lexer.rex
19
21
  lib/ruby_lexer.rex.rb
20
22
  lib/ruby_parser.rb
23
+ lib/ruby_parser.yy
21
24
  lib/ruby_parser_extras.rb
22
25
  test/test_ruby_lexer.rb
23
26
  test/test_ruby_parser.rb
data/Rakefile CHANGED
@@ -22,21 +22,38 @@ Hoe.spec "ruby_parser" do
22
22
  dependency "rake", "< 11", :developer
23
23
  dependency "oedipus_lex", "~> 2.1", :developer
24
24
 
25
- if plugin? :perforce then
25
+ if plugin? :perforce then # generated files
26
26
  self.perforce_ignore << "lib/ruby18_parser.rb"
27
27
  self.perforce_ignore << "lib/ruby19_parser.rb"
28
28
  self.perforce_ignore << "lib/ruby20_parser.rb"
29
+ self.perforce_ignore << "lib/ruby20_parser.y"
29
30
  self.perforce_ignore << "lib/ruby21_parser.rb"
31
+ self.perforce_ignore << "lib/ruby21_parser.y"
32
+ self.perforce_ignore << "lib/ruby22_parser.rb"
33
+ self.perforce_ignore << "lib/ruby22_parser.y"
30
34
  self.perforce_ignore << "lib/ruby_lexer.rex.rb"
31
35
  end
32
36
 
33
37
  self.racc_flags << " -t" if plugin?(:racc) && ENV["DEBUG"]
34
38
  end
35
39
 
40
+ file "lib/ruby20_parser.y" => "lib/ruby_parser.yy" do |t|
41
+ sh "unifdef -tk -DRUBY20 -URUBY21 -URUBY22 -UDEAD #{t.source} > #{t.name} || true"
42
+ end
43
+
44
+ file "lib/ruby21_parser.y" => "lib/ruby_parser.yy" do |t|
45
+ sh "unifdef -tk -URUBY20 -DRUBY21 -URUBY22 -UDEAD #{t.source} > #{t.name} || true"
46
+ end
47
+
48
+ file "lib/ruby22_parser.y" => "lib/ruby_parser.yy" do |t|
49
+ sh "unifdef -tk -URUBY20 -URUBY21 -DRUBY22 -UDEAD #{t.source} > #{t.name} || true"
50
+ end
51
+
36
52
  file "lib/ruby18_parser.rb" => "lib/ruby18_parser.y"
37
53
  file "lib/ruby19_parser.rb" => "lib/ruby19_parser.y"
38
54
  file "lib/ruby20_parser.rb" => "lib/ruby20_parser.y"
39
55
  file "lib/ruby21_parser.rb" => "lib/ruby21_parser.y"
56
+ file "lib/ruby22_parser.rb" => "lib/ruby22_parser.y"
40
57
  file "lib/ruby_lexer.rex.rb" => "lib/ruby_lexer.rex"
41
58
 
42
59
  task :clean do
@@ -44,6 +61,7 @@ task :clean do
44
61
  Dir["diff.diff"] + # not all diffs. bit me too many times
45
62
  Dir["coverage.info"] +
46
63
  Dir["coverage"] +
64
+ Dir["lib/ruby2*_parser.y"] +
47
65
  Dir["lib/*.output"])
48
66
  end
49
67
 
@@ -75,18 +93,24 @@ task :isolate => :phony
75
93
  # 4) run `bison -r all parse.tmp.y`
76
94
  # 5) mv parse.tmp.output parseXX.output
77
95
 
78
- %w[18 19 20 21].each do |v|
96
+ # possibly new instructions:
97
+ #
98
+ # 1) check out the XX version of ruby
99
+ # 2) YFLAGS="-r all" make parse.c
100
+ # 3) mv y.output parseXX.output
101
+
102
+ %w[18 19 20 21 22].each do |v|
79
103
  task "compare#{v}" do
80
104
  sh "./yack.rb lib/ruby#{v}_parser.output > racc#{v}.txt"
81
105
  sh "./yack.rb parse#{v}.output > yacc#{v}.txt"
82
- sh "diff -du yacc#{v}.txt racc#{v}.txt || true"
106
+ sh "diff -du racc#{v}.txt yacc#{v}.txt || true"
83
107
  puts
84
- sh "diff -du yacc#{v}.txt racc#{v}.txt | wc -l"
108
+ sh "diff -du racc#{v}.txt yacc#{v}.txt | wc -l"
85
109
  end
86
110
  end
87
111
 
88
112
  task :debug => :isolate do
89
- ENV["V"] ||= "21"
113
+ ENV["V"] ||= "22"
90
114
  Rake.application[:parser].invoke # this way we can have DEBUG set
91
115
  Rake.application[:lexer].invoke # this way we can have DEBUG set
92
116
 
@@ -103,13 +127,16 @@ task :debug => :isolate do
103
127
  Ruby20Parser.new
104
128
  when "21" then
105
129
  Ruby21Parser.new
130
+ when "22" then
131
+ Ruby22Parser.new
106
132
  else
107
133
  raise "Unsupported version #{ENV["V"]}"
108
134
  end
109
135
 
110
136
  time = (ENV["RP_TIMEOUT"] || 10).to_i
111
137
 
112
- file = ENV["F"] || ENV["FILE"]
138
+ n = ENV["BUG"]
139
+ file = (n && "bug#{n}.rb") || ENV["F"] || ENV["FILE"]
113
140
 
114
141
  ruby = if file then
115
142
  File.read(file)
data/lib/ruby18_parser.rb CHANGED
@@ -2428,7 +2428,7 @@ racc_reduce_table = [
2428
2428
  2, 240, :_reduce_352,
2429
2429
  1, 240, :_reduce_353,
2430
2430
  2, 240, :_reduce_354,
2431
- 1, 168, :_reduce_none,
2431
+ 1, 168, :_reduce_355,
2432
2432
  2, 168, :_reduce_356,
2433
2433
  1, 168, :_reduce_357,
2434
2434
  3, 168, :_reduce_358,
@@ -3167,7 +3167,7 @@ def _reduce_22(val, _values, result)
3167
3167
  if (in_def || in_single > 0) then
3168
3168
  yyerror "END in method; use at_exit"
3169
3169
  end
3170
- result = new_iter s(:postexe), nil, val[2]
3170
+ result = new_iter s(:postexe), 0, val[2]
3171
3171
 
3172
3172
  result
3173
3173
  end
@@ -4874,17 +4874,20 @@ def _reduce_354(val, _values, result)
4874
4874
  result
4875
4875
  end
4876
4876
 
4877
- # reduce 355 omitted
4877
+ def _reduce_355(val, _values, result)
4878
+ result = 0
4879
+ result
4880
+ end
4878
4881
 
4879
4882
  def _reduce_356(val, _values, result)
4880
- result = 0
4883
+ result = s(:args)
4881
4884
  self.lexer.command_start = true
4882
4885
 
4883
4886
  result
4884
4887
  end
4885
4888
 
4886
4889
  def _reduce_357(val, _values, result)
4887
- result = 0
4890
+ result = s(:args)
4888
4891
  self.lexer.command_start = true
4889
4892
 
4890
4893
  result
data/lib/ruby18_parser.y CHANGED
@@ -135,7 +135,7 @@ rule
135
135
  if (in_def || in_single > 0) then
136
136
  yyerror "END in method; use at_exit"
137
137
  end
138
- result = new_iter s(:postexe), nil, val[2]
138
+ result = new_iter s(:postexe), 0, val[2]
139
139
  }
140
140
  | lhs tEQL command_call
141
141
  {
@@ -1271,15 +1271,15 @@ rule
1271
1271
  }
1272
1272
  ;
1273
1273
 
1274
- opt_block_var: none
1274
+ opt_block_var: none { result = 0 }
1275
1275
  | tPIPE tPIPE
1276
1276
  {
1277
- result = 0
1277
+ result = s(:args)
1278
1278
  self.lexer.command_start = true
1279
1279
  }
1280
1280
  | tOROP
1281
1281
  {
1282
- result = 0
1282
+ result = s(:args)
1283
1283
  self.lexer.command_start = true
1284
1284
  }
1285
1285
  | tPIPE block_var tPIPE
data/lib/ruby19_parser.rb CHANGED
@@ -2466,7 +2466,7 @@ racc_reduce_table = [
2466
2466
  2, 265, :_reduce_379,
2467
2467
  4, 265, :_reduce_380,
2468
2468
  1, 265, :_reduce_381,
2469
- 1, 178, :_reduce_none,
2469
+ 1, 178, :_reduce_382,
2470
2470
  1, 178, :_reduce_none,
2471
2471
  3, 271, :_reduce_384,
2472
2472
  1, 271, :_reduce_385,
@@ -3297,7 +3297,7 @@ def _reduce_28(val, _values, result)
3297
3297
  if (self.in_def || self.in_single > 0) then
3298
3298
  yyerror "END in method; use at_exit"
3299
3299
  end
3300
- result = new_iter s(:postexe), nil, val[2]
3300
+ result = new_iter s(:postexe), 0, val[2]
3301
3301
 
3302
3302
  result
3303
3303
  end
@@ -4759,20 +4759,22 @@ def _reduce_321(val, _values, result)
4759
4759
  end
4760
4760
 
4761
4761
  def _reduce_322(val, _values, result)
4762
- result = self.in_def
4762
+ result = [self.in_def, self.lexer.cmdarg.stack.dup]
4763
4763
 
4764
4764
  self.comments.push self.lexer.comments
4765
4765
  self.in_def = true
4766
4766
  self.env.extend
4767
+ lexer.cmdarg.stack.replace [false]
4767
4768
 
4768
4769
  result
4769
4770
  end
4770
4771
 
4771
4772
  def _reduce_323(val, _values, result)
4772
- in_def = val[2]
4773
+ in_def, cmdarg = val[2]
4773
4774
 
4774
4775
  result = new_defn val
4775
4776
 
4777
+ lexer.cmdarg.stack.replace cmdarg
4776
4778
  self.env.unextend
4777
4779
  self.in_def = in_def
4778
4780
  self.lexer.comments # we don't care about comments in the body
@@ -5073,19 +5075,21 @@ def _reduce_381(val, _values, result)
5073
5075
  result
5074
5076
  end
5075
5077
 
5076
- # reduce 382 omitted
5078
+ def _reduce_382(val, _values, result)
5079
+ result = 0
5080
+ result
5081
+ end
5077
5082
 
5078
5083
  # reduce 383 omitted
5079
5084
 
5080
5085
  def _reduce_384(val, _values, result)
5081
5086
  result = args val
5082
- result = 0 if result == s(:args)
5083
5087
 
5084
5088
  result
5085
5089
  end
5086
5090
 
5087
5091
  def _reduce_385(val, _values, result)
5088
- result = 0
5092
+ result = s(:args)
5089
5093
  self.lexer.command_start = true
5090
5094
 
5091
5095
  result
@@ -5138,8 +5142,6 @@ def _reduce_394(val, _values, result)
5138
5142
  lpar, args, body = val
5139
5143
  lexer.lpar_beg = lpar
5140
5144
 
5141
- args = 0 if args == s(:args)
5142
-
5143
5145
  call = new_call nil, :lambda
5144
5146
  result = new_iter call, args, body
5145
5147
 
@@ -5154,6 +5156,7 @@ end
5154
5156
 
5155
5157
  def _reduce_396(val, _values, result)
5156
5158
  result = val[0]
5159
+ result = 0 if result == s(:args)
5157
5160
 
5158
5161
  result
5159
5162
  end
data/lib/ruby19_parser.y CHANGED
@@ -152,7 +152,7 @@ rule
152
152
  if (self.in_def || self.in_single > 0) then
153
153
  yyerror "END in method; use at_exit"
154
154
  end
155
- result = new_iter s(:postexe), nil, val[2]
155
+ result = new_iter s(:postexe), 0, val[2]
156
156
  }
157
157
  | command_asgn
158
158
  | mlhs tEQL command_call
@@ -1104,18 +1104,20 @@ rule
1104
1104
  }
1105
1105
  | kDEF fname
1106
1106
  {
1107
- result = self.in_def
1107
+ result = [self.in_def, self.lexer.cmdarg.stack.dup]
1108
1108
 
1109
1109
  self.comments.push self.lexer.comments
1110
1110
  self.in_def = true
1111
1111
  self.env.extend
1112
+ lexer.cmdarg.stack.replace [false]
1112
1113
  }
1113
1114
  f_arglist bodystmt kEND
1114
1115
  {
1115
- in_def = val[2]
1116
+ in_def, cmdarg = val[2]
1116
1117
 
1117
1118
  result = new_defn val
1118
1119
 
1120
+ lexer.cmdarg.stack.replace cmdarg
1119
1121
  self.env.unextend
1120
1122
  self.in_def = in_def
1121
1123
  self.lexer.comments # we don't care about comments in the body
@@ -1330,17 +1332,16 @@ rule
1330
1332
  result = args val
1331
1333
  }
1332
1334
 
1333
- opt_block_param: none
1335
+ opt_block_param: none { result = 0 }
1334
1336
  | block_param_def
1335
1337
 
1336
1338
  block_param_def: tPIPE opt_bv_decl tPIPE
1337
1339
  {
1338
1340
  result = args val
1339
- result = 0 if result == s(:args)
1340
1341
  }
1341
1342
  | tOROP
1342
1343
  {
1343
- result = 0
1344
+ result = s(:args)
1344
1345
  self.lexer.command_start = true
1345
1346
  }
1346
1347
  | tPIPE block_param opt_bv_decl tPIPE
@@ -1380,8 +1381,6 @@ rule
1380
1381
  lpar, args, body = val
1381
1382
  lexer.lpar_beg = lpar
1382
1383
 
1383
- args = 0 if args == s(:args)
1384
-
1385
1384
  call = new_call nil, :lambda
1386
1385
  result = new_iter call, args, body
1387
1386
  }
@@ -1393,6 +1392,7 @@ rule
1393
1392
  | f_args
1394
1393
  {
1395
1394
  result = val[0]
1395
+ result = 0 if result == s(:args)
1396
1396
  }
1397
1397
 
1398
1398
  lambda_body: tLAMBEG compstmt tRCURLY
data/lib/ruby20_parser.rb CHANGED
@@ -74,52 +74,52 @@ clist = [
74
74
  '173,199,203,204,183,172,186,190,192,184,177,574,573,705,193,200,195',
75
75
  '194,187,197,182,170,189,188,116,117,118,119,120,169,176,167,168,164',
76
76
  '165,166,124,126,123,687,125,704,952,239,557,556,555,899,558,158,159',
77
- '701,154,136,137,138,145,142,144,253,254,139,140,-265,903,905,161,162',
77
+ '701,154,136,137,138,145,142,144,253,254,139,140,-265,903,905,160,161',
78
78
  '146,147,717,906,557,556,555,236,558,242,219,238,237,234,235,151,150',
79
- '704,135,157,153,152,148,149,143,141,133,156,134,909,911,163,91,913,1004',
79
+ '704,135,157,153,152,148,149,143,141,133,156,134,909,911,162,91,913,1004',
80
80
  '915,915,-514,219,219,713,1005,92,717,-514,557,556,555,921,558,1003,155',
81
- '694,-514,923,693,160,174,185,175,198,171,191,181,180,201,202,196,179',
81
+ '694,-514,923,693,163,174,185,175,198,171,191,181,180,201,202,196,179',
82
82
  '178,173,199,203,204,183,172,186,190,192,184,177,713,925,687,193,200',
83
83
  '195,194,187,197,182,170,189,188,116,117,118,119,120,169,176,167,168',
84
84
  '164,165,166,124,126,532,219,125,867,868,239,676,869,107,108,-85,158',
85
- '159,219,154,136,137,138,145,142,144,253,254,139,140,219,219,219,161',
86
- '162,146,147,717,239,557,556,555,236,558,242,239,238,237,234,235,151',
87
- '150,935,135,157,153,152,148,149,143,141,133,156,134,936,219,163,91,939',
85
+ '159,219,154,136,137,138,145,142,144,253,254,139,140,219,219,219,160',
86
+ '161,146,147,717,239,557,556,555,236,558,242,239,238,237,234,235,151',
87
+ '150,935,135,157,153,152,148,149,143,141,133,156,134,936,219,162,91,939',
88
88
  '743,-268,239,211,239,646,713,742,92,717,212,557,556,555,270,558,744',
89
- '155,635,210,634,219,160,174,185,175,198,171,191,181,180,201,202,196',
89
+ '155,635,210,634,219,163,174,185,175,198,171,191,181,180,201,202,196',
90
90
  '179,178,173,199,203,204,183,172,186,190,192,184,177,713,630,949,193',
91
91
  '200,195,194,187,197,182,170,189,188,116,117,118,119,120,169,176,167',
92
92
  '168,164,165,166,124,126,396,395,125,-265,397,628,-290,621,956,957,618',
93
93
  '158,159,-290,154,136,137,138,145,142,144,959,-290,139,140,-289,-289',
94
- '743,161,162,146,147,-289,-289,955,960,615,-595,-595,611,589,-289,-289',
94
+ '743,160,161,146,147,-289,-289,955,960,615,-595,-595,611,589,-289,-289',
95
95
  '744,588,151,150,399,135,157,153,152,148,149,143,141,133,156,134,743',
96
- '-336,163,586,-281,-290,584,955,-336,502,587,-281,-290,543,542,976,744',
97
- '-336,536,585,-281,-290,155,978,979,239,528,160,174,185,175,198,171,191',
96
+ '-336,162,586,-281,-290,584,955,-336,502,587,-281,-290,543,542,976,744',
97
+ '-336,536,585,-281,-290,155,978,979,239,528,163,174,185,175,198,171,191',
98
98
  '181,180,201,202,196,179,178,173,199,203,204,183,172,186,190,192,184',
99
99
  '177,983,527,523,193,200,195,194,187,197,182,170,189,188,116,117,118',
100
100
  '119,120,169,176,167,168,164,165,166,124,126,704,988,125,990,992,994',
101
101
  '517,994,270,219,273,158,159,518,154,136,137,138,145,142,144,1001,516',
102
- '139,140,-289,529,519,161,162,146,147,-289,530,512,511,219,-595,1006',
102
+ '139,140,-289,529,519,160,161,146,147,-289,530,512,511,219,-595,1006',
103
103
  '-70,1007,-289,452,915,915,151,150,915,135,157,153,152,148,149,143,141',
104
- '133,156,134,1012,502,163,976,500,497,270,487,218,456,455,453,410,405',
105
- '389,-595,-594,693,386,383,380,356,155,219,316,976,315,160,174,185,175',
104
+ '133,156,134,1012,502,162,976,500,497,270,487,218,456,455,453,410,405',
105
+ '389,-595,-594,693,386,383,380,356,155,219,316,976,315,163,174,185,175',
106
106
  '198,171,191,181,180,201,202,196,179,178,173,199,203,204,183,172,186',
107
107
  '190,192,184,177,1035,1036,1037,193,200,195,194,187,197,182,170,189,188',
108
108
  '1038,994,994,994,219,169,176,167,168,164,165,166,124,126,258,214,125',
109
109
  '209,208,915,976,207,109,994,,158,159,,154,136,137,138,145,142,144,,',
110
- '139,140,,,,161,162,146,147,,,,,,,,,,,,,,151,150,,135,157,153,152,148',
111
- '149,143,141,133,156,134,,,163,91,,,,,,,,,,92,,,,,,,,,155,,,,,160,174',
110
+ '139,140,,,,160,161,146,147,,,,,,,,,,,,,,151,150,,135,157,153,152,148',
111
+ '149,143,141,133,156,134,,,162,91,,,,,,,,,,92,,,,,,,,,155,,,,,163,174',
112
112
  '185,175,198,171,191,181,180,201,202,196,179,178,173,199,203,204,183',
113
113
  '172,186,190,192,184,177,,,,193,200,195,194,187,197,182,170,189,188,',
114
114
  ',,,,169,176,167,168,164,165,166,124,126,,,125,,,,,,,,,158,159,,154,136',
115
- '137,138,145,142,144,,,139,140,,,,161,162,146,147,,,,,,,,,,,,,,151,150',
116
- ',135,157,153,152,148,149,143,141,133,156,134,,,163,91,,,,,,,,,,92,,',
117
- ',,,,,,155,,,,,160,174,185,175,198,171,191,181,180,201,202,196,179,178',
115
+ '137,138,145,142,144,,,139,140,,,,160,161,146,147,,,,,,,,,,,,,,151,150',
116
+ ',135,157,153,152,148,149,143,141,133,156,134,,,162,91,,,,,,,,,,92,,',
117
+ ',,,,,,155,,,,,163,174,185,175,198,171,191,181,180,201,202,196,179,178',
118
118
  '173,199,203,204,183,172,186,190,192,184,177,,,,193,200,195,365,364,366',
119
119
  '363,170,189,188,,,,,,169,176,167,168,360,361,362,358,126,97,96,359,',
120
- '99,,,,,,,158,159,,154,136,137,138,145,142,144,,,139,140,,,,161,162,146',
120
+ '99,,,,,,,158,159,,154,136,137,138,145,142,144,,,139,140,,,,160,161,146',
121
121
  '147,,,,,,372,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156',
122
- '134,,,163,,,,,,,,,,,,291,72,73,74,12,60,,,155,66,67,,,160,70,,68,69',
122
+ '134,,,162,,,,,,,,,,,,291,72,73,74,12,60,,,155,66,67,,,163,70,,68,69',
123
123
  '71,33,34,75,76,,,,,,32,31,30,101,100,102,103,,,22,,,,,647,11,48,,13',
124
124
  '105,104,106,95,59,97,96,98,,99,107,108,,93,94,,45,46,44,239,243,248',
125
125
  '249,250,245,247,255,256,251,252,,232,233,,,253,254,,43,,,36,,,61,62',
@@ -818,49 +818,49 @@ clist = [
818
818
  '-425,-425,-425,-425,-425,-425,-425,-425,-425,,,-425,-425,-425,,,-425',
819
819
  ',270,-425,,,-425,-425,,-425,,-425,,-425,,-425,-425,-425,-425,-425,-425',
820
820
  '-425,,-425,-425,-425,,,,,,424,428,,,425,,,-425,-425,,-425,,-425,158',
821
- '159,,154,136,137,138,145,142,144,,,139,140,,,,161,162,146,147,,,,,,270',
822
- ',,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134,,798,163',
823
- '557,556,555,799,558,,,,,485,428,,,486,566,,,,,155,,,158,159,160,154',
824
- '136,137,138,145,142,144,,,139,140,562,,,161,162,146,147,,,571,570,574',
825
- '573,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134,,,163',
826
- ',,,,,,,,567,736,435,,,737,,,,,,155,,,158,159,160,154,136,137,138,145',
827
- '142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135,157',
828
- '153,152,148,149,143,141,133,156,134,,,163,,,,,,,,,,485,428,,,486,,,',
829
- ',,155,,,158,159,160,154,136,137,138,145,142,144,,,139,140,,,,161,162',
821
+ '159,,154,136,137,138,145,142,144,,,139,140,,,,160,161,146,147,,,,,,270',
822
+ ',,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134,,798,162',
823
+ '557,556,555,799,558,,,,,485,428,,,486,566,,,,,155,,,158,159,163,154',
824
+ '136,137,138,145,142,144,,,139,140,562,,,160,161,146,147,,,571,570,574',
825
+ '573,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134,,,162',
826
+ ',,,,,,,,567,736,435,,,737,,,,,,155,,,158,159,163,154,136,137,138,145',
827
+ '142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135,157',
828
+ '153,152,148,149,143,141,133,156,134,,,162,,,,,,,,,,485,428,,,486,,,',
829
+ ',,155,,,158,159,163,154,136,137,138,145,142,144,,,139,140,,,,160,161',
830
830
  '146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133',
831
- '156,134,,,163,,,,,,,,,,734,428,,,735,,,,,,155,,,158,159,160,154,136',
832
- '137,138,145,142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151',
833
- '150,,135,157,153,152,148,149,143,141,133,156,134,,,163,,,,,,,,,,1028',
834
- '428,,,1029,,,,,,155,,,158,159,160,154,136,137,138,145,142,144,,,139',
835
- '140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148',
836
- '149,143,141,133,156,134,,,163,,,,,,,,,,852,435,,,853,,,,,,155,,,158',
837
- '159,160,154,136,137,138,145,142,144,,,139,140,,,,161,162,146,147,,,',
831
+ '156,134,,,162,,,,,,,,,,734,428,,,735,,,,,,155,,,158,159,163,154,136',
832
+ '137,138,145,142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151',
833
+ '150,,135,157,153,152,148,149,143,141,133,156,134,,,162,,,,,,,,,,1028',
834
+ '428,,,1029,,,,,,155,,,158,159,163,154,136,137,138,145,142,144,,,139',
835
+ '140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148',
836
+ '149,143,141,133,156,134,,,162,,,,,,,,,,852,435,,,853,,,,,,155,,,158',
837
+ '159,163,154,136,137,138,145,142,144,,,139,140,,,,160,161,146,147,,,',
838
838
  ',,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134,,',
839
- '163,,,,,,,,,,1030,435,,,1031,,,,,,155,,,158,159,160,154,136,137,138',
840
- '145,142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135',
841
- '157,153,152,148,149,143,141,133,156,134,,,163,,,,,,,,,,1000,435,,,999',
842
- ',,,,,155,,,158,159,160,154,136,137,138,145,142,144,,,139,140,,,,161',
843
- '162,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141',
844
- '133,156,134,,,163,,,,,,,,,,651,435,,,652,,,,,,155,,,158,159,160,154',
845
- '136,137,138,145,142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,',
846
- ',151,150,,135,157,153,152,148,149,143,141,133,156,134,,,163,,,,,,,,',
847
- ',649,428,,,650,,,,,,155,,,158,159,160,154,136,137,138,145,142,144,,',
848
- '139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152',
849
- '148,149,143,141,133,156,134,,,163,,,,,,,,,,680,428,,,681,,,,,,155,,',
850
- '158,159,160,154,136,137,138,145,142,144,,,139,140,,,,161,162,146,147',
839
+ '162,,,,,,,,,,1030,435,,,1031,,,,,,155,,,158,159,163,154,136,137,138',
840
+ '145,142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135',
841
+ '157,153,152,148,149,143,141,133,156,134,,,162,,,,,,,,,,1000,435,,,999',
842
+ ',,,,,155,,,158,159,163,154,136,137,138,145,142,144,,,139,140,,,,160',
843
+ '161,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141',
844
+ '133,156,134,,,162,,,,,,,,,,651,435,,,652,,,,,,155,,,158,159,163,154',
845
+ '136,137,138,145,142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,',
846
+ ',151,150,,135,157,153,152,148,149,143,141,133,156,134,,,162,,,,,,,,',
847
+ ',649,428,,,650,,,,,,155,,,158,159,163,154,136,137,138,145,142,144,,',
848
+ '139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152',
849
+ '148,149,143,141,133,156,134,,,162,,,,,,,,,,680,428,,,681,,,,,,155,,',
850
+ '158,159,163,154,136,137,138,145,142,144,,,139,140,,,,160,161,146,147',
851
851
  ',,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141,133,156,134',
852
- ',,163,,,,,,,,,,649,428,,,650,,,,,,155,,,158,159,160,154,136,137,138',
853
- '145,142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135',
854
- '157,153,152,148,149,143,141,133,156,134,,,163,,,,,,,,,,431,435,,,430',
855
- ',,,,,155,,,158,159,160,154,136,137,138,145,142,144,,,139,140,,,,161',
856
- '162,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141',
857
- '133,156,134,,,163,,,,,,,,,,651,435,,,652,,,,,,155,,,158,159,160,154',
858
- '136,137,138,145,142,144,,,139,140,,,,161,162,146,147,,,,,,270,,,,,,',
859
- ',151,150,,135,157,153,152,148,149,143,141,133,156,134,,,163,,,,,,,,',
860
- ',683,435,,,684,,,,,,155,,,158,159,160,154,136,137,138,145,142,144,,',
861
- '139,140,,,,161,162,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152',
862
- '148,149,143,141,133,156,134,,560,163,557,556,555,564,558,560,,557,556',
863
- '555,564,558,,,566,,,,,155,,566,,798,160,557,556,555,799,558,,,,,,,562',
852
+ ',,162,,,,,,,,,,649,428,,,650,,,,,,155,,,158,159,163,154,136,137,138',
853
+ '145,142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135',
854
+ '157,153,152,148,149,143,141,133,156,134,,,162,,,,,,,,,,431,435,,,430',
855
+ ',,,,,155,,,158,159,163,154,136,137,138,145,142,144,,,139,140,,,,160',
856
+ '161,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152,148,149,143,141',
857
+ '133,156,134,,,162,,,,,,,,,,651,435,,,652,,,,,,155,,,158,159,163,154',
858
+ '136,137,138,145,142,144,,,139,140,,,,160,161,146,147,,,,,,270,,,,,,',
859
+ ',151,150,,135,157,153,152,148,149,143,141,133,156,134,,,162,,,,,,,,',
860
+ ',683,435,,,684,,,,,,155,,,158,159,163,154,136,137,138,145,142,144,,',
861
+ '139,140,,,,160,161,146,147,,,,,,270,,,,,,,,151,150,,135,157,153,152',
862
+ '148,149,143,141,133,156,134,,560,162,557,556,555,564,558,560,,557,556',
863
+ '555,564,558,,,566,,,,,155,,566,,798,163,557,556,555,799,558,,,,,,,562',
864
864
  ',,566,,,,562,752,571,570,574,573,,,,571,570,574,573,,,,,798,562,557',
865
865
  '556,555,799,558,,,,571,570,574,573,,,566,,,,798,567,557,556,555,799',
866
866
  '558,,567,,,,,,,,566,,562,560,,557,556,555,564,558,567,571,570,574,573',
@@ -2637,7 +2637,7 @@ racc_reduce_table = [
2637
2637
  2, 279, :_reduce_390,
2638
2638
  4, 279, :_reduce_391,
2639
2639
  1, 279, :_reduce_392,
2640
- 1, 184, :_reduce_none,
2640
+ 1, 184, :_reduce_393,
2641
2641
  1, 184, :_reduce_none,
2642
2642
  3, 283, :_reduce_395,
2643
2643
  1, 283, :_reduce_396,
@@ -3532,7 +3532,7 @@ def _reduce_28(val, _values, result)
3532
3532
  debug20 3
3533
3533
  yyerror "END in method; use at_exit"
3534
3534
  end
3535
- result = new_iter s(:postexe), nil, val[2]
3535
+ result = new_iter s(:postexe), 0, val[2]
3536
3536
 
3537
3537
  result
3538
3538
  end
@@ -4381,6 +4381,7 @@ end
4381
4381
 
4382
4382
  def _reduce_217(val, _values, result)
4383
4383
  result = new_call(new_call(s(:lit, val[1]), :"**", argl(val[3])), :"-@")
4384
+ ## TODO: why is this 2.0 only?
4384
4385
  debug20 12, val, result
4385
4386
 
4386
4387
  result
@@ -5022,20 +5023,24 @@ def _reduce_326(val, _values, result)
5022
5023
  end
5023
5024
 
5024
5025
  def _reduce_327(val, _values, result)
5025
- result = self.in_def
5026
+ result = [self.in_def, self.lexer.cmdarg.stack.dup]
5026
5027
 
5027
5028
  self.comments.push self.lexer.comments
5028
5029
  self.in_def = true
5029
5030
  self.env.extend
5031
+ # TODO: local->cmdargs = cmdarg_stack;
5032
+ # TODO: port local_push_gen and local_pop_gen
5033
+ lexer.cmdarg.stack.replace [false]
5030
5034
 
5031
5035
  result
5032
5036
  end
5033
5037
 
5034
5038
  def _reduce_328(val, _values, result)
5035
- in_def = val[2]
5039
+ in_def, cmdarg = val[2]
5036
5040
 
5037
5041
  result = new_defn val
5038
5042
 
5043
+ lexer.cmdarg.stack.replace cmdarg
5039
5044
  self.env.unextend
5040
5045
  self.in_def = in_def
5041
5046
  self.lexer.comments # we don't care about comments in the body
@@ -5371,20 +5376,22 @@ def _reduce_392(val, _values, result)
5371
5376
  result
5372
5377
  end
5373
5378
 
5374
- # reduce 393 omitted
5379
+ def _reduce_393(val, _values, result)
5380
+ result = 0
5381
+ result
5382
+ end
5375
5383
 
5376
5384
  # reduce 394 omitted
5377
5385
 
5378
5386
  def _reduce_395(val, _values, result)
5379
5387
  result = args val
5380
- result = 0 if result == s(:args)
5381
5388
 
5382
5389
  result
5383
5390
  end
5384
5391
 
5385
5392
  def _reduce_396(val, _values, result)
5386
- result = 0
5387
5393
  self.lexer.command_start = true
5394
+ result = s(:args)
5388
5395
 
5389
5396
  result
5390
5397
  end
@@ -5438,8 +5445,6 @@ def _reduce_405(val, _values, result)
5438
5445
  lpar, args, body = val
5439
5446
  lexer.lpar_beg = lpar
5440
5447
 
5441
- args = 0 if args == s(:args)
5442
-
5443
5448
  call = new_call nil, :lambda
5444
5449
  result = new_iter call, args, body
5445
5450
  self.env.unextend
@@ -5455,6 +5460,7 @@ end
5455
5460
 
5456
5461
  def _reduce_407(val, _values, result)
5457
5462
  result = val[0]
5463
+ result = 0 if result == s(:args)
5458
5464
 
5459
5465
  result
5460
5466
  end
@@ -5497,8 +5503,8 @@ end
5497
5503
 
5498
5504
  def _reduce_413(val, _values, result)
5499
5505
  # TODO:
5500
- # if (nd_type($1) == NODE_YIELD) {
5501
- # compile_error(PARSER_ARG "block given to yield");
5506
+ ## if (nd_type($1) == NODE_YIELD) {
5507
+ ## compile_error(PARSER_ARG "block given to yield");
5502
5508
 
5503
5509
  syntax_error "Both block arg and actual block given." if
5504
5510
  val[0].block_pass?
@@ -5951,7 +5957,9 @@ def _reduce_484(val, _values, result)
5951
5957
  lexer.brace_nest,
5952
5958
  lexer.string_nest, # TODO: remove
5953
5959
  lexer.cond.store,
5954
- lexer.cmdarg.store]
5960
+ lexer.cmdarg.store,
5961
+ lexer.lex_state,
5962
+ ]
5955
5963
 
5956
5964
  lexer.lex_strterm = nil
5957
5965
  lexer.brace_nest = 0
@@ -5966,7 +5974,7 @@ def _reduce_485(val, _values, result)
5966
5974
  # TODO: tRCURLY -> tSTRING_DEND
5967
5975
  _, memo, stmt, _ = val
5968
5976
 
5969
- lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg = memo
5977
+ lex_strterm, brace_nest, string_nest, oldcond, oldcmdarg, oldlex_state = memo
5970
5978
 
5971
5979
  lexer.lex_strterm = lex_strterm
5972
5980
  lexer.brace_nest = brace_nest
@@ -5975,6 +5983,8 @@ def _reduce_485(val, _values, result)
5975
5983
  lexer.cond.restore oldcond
5976
5984
  lexer.cmdarg.restore oldcmdarg
5977
5985
 
5986
+ lexer.lex_state = oldlex_state
5987
+
5978
5988
  case stmt
5979
5989
  when Sexp then
5980
5990
  case stmt[0]
@@ -6185,11 +6195,15 @@ def _reduce_523(val, _values, result)
6185
6195
  result = val[1]
6186
6196
  self.lexer.lex_state = :expr_beg
6187
6197
  self.lexer.command_start = true
6198
+ # TODO:
6199
+ # $<num>$ = parser->parser_in_kwarg;
6200
+ # parser->parser_in_kwarg = 1;
6188
6201
 
6189
6202
  result
6190
6203
  end
6191
6204
 
6192
6205
  def _reduce_524(val, _values, result)
6206
+ # TODO: parser->parser_in_kwarg = $<num>1;
6193
6207
  result = val[0]
6194
6208
  self.lexer.lex_state = :expr_beg
6195
6209
  self.lexer.command_start = true