racc 1.4.14 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +5 -5
  2. data/COPYING +22 -515
  3. data/README.ja.rdoc +3 -4
  4. data/README.rdoc +6 -8
  5. data/Rakefile +32 -53
  6. data/bin/racc +39 -27
  7. data/ext/racc/com/headius/racc/Cparse.java +66 -23
  8. data/ext/racc/{cparse.c → cparse/cparse.c} +82 -47
  9. data/ext/racc/{extconf.rb → cparse/extconf.rb} +2 -1
  10. data/lib/racc/compat.rb +5 -4
  11. data/lib/racc/debugflags.rb +5 -4
  12. data/lib/racc/exception.rb +5 -4
  13. data/lib/racc/grammar.rb +25 -22
  14. data/lib/racc/grammarfileparser.rb +10 -8
  15. data/lib/racc/info.rb +6 -5
  16. data/lib/racc/iset.rb +6 -5
  17. data/lib/racc/logfilegenerator.rb +6 -5
  18. data/lib/racc/parser-text.rb +20 -23
  19. data/lib/racc/parser.rb +20 -23
  20. data/lib/racc/parserfilegenerator.rb +10 -10
  21. data/lib/racc/sourcetext.rb +5 -4
  22. data/lib/racc/state.rb +13 -12
  23. data/lib/racc/statetransitiontable.rb +7 -6
  24. data/rdoc/ja/command.ja.html +1 -1
  25. data/sample/array.y +1 -1
  26. data/sample/array2.y +1 -1
  27. data/sample/calc-ja.y +2 -2
  28. data/sample/calc.y +2 -2
  29. data/sample/conflict.y +1 -1
  30. data/sample/hash.y +1 -1
  31. data/sample/lalr.y +1 -1
  32. data/sample/lists.y +1 -1
  33. data/sample/syntax.y +1 -1
  34. data/sample/yyerr.y +1 -1
  35. data/test/assets/cadenza.y +170 -0
  36. data/test/assets/cast.y +926 -0
  37. data/test/assets/csspool.y +729 -0
  38. data/test/assets/edtf.y +583 -0
  39. data/test/assets/huia.y +318 -0
  40. data/test/assets/intp.y +4 -4
  41. data/test/assets/journey.y +47 -0
  42. data/test/assets/liquor.y +313 -0
  43. data/test/assets/machete.y +423 -0
  44. data/test/assets/macruby.y +2197 -0
  45. data/test/assets/mailp.y +27 -27
  46. data/test/assets/mediacloth.y +599 -0
  47. data/test/assets/mof.y +649 -0
  48. data/test/assets/namae.y +302 -0
  49. data/test/assets/nasl.y +626 -0
  50. data/test/assets/nokogiri-css.y +255 -0
  51. data/test/assets/nullbug2.y +2 -2
  52. data/test/assets/opal.y +1807 -0
  53. data/test/assets/php_serialization.y +98 -0
  54. data/test/assets/recv.y +20 -20
  55. data/test/assets/riml.y +665 -0
  56. data/test/assets/ruby18.y +1943 -0
  57. data/test/assets/ruby19.y +2174 -0
  58. data/test/assets/ruby20.y +2350 -0
  59. data/test/assets/ruby21.y +2359 -0
  60. data/test/assets/ruby22.y +2381 -0
  61. data/test/assets/syntax.y +1 -1
  62. data/test/assets/tp_plus.y +622 -0
  63. data/test/assets/twowaysql.y +278 -0
  64. data/test/helper.rb +68 -41
  65. data/test/regress/cadenza +796 -0
  66. data/test/regress/cast +3428 -0
  67. data/test/regress/csspool +2314 -0
  68. data/test/regress/edtf +1794 -0
  69. data/test/regress/huia +1392 -0
  70. data/test/regress/journey +222 -0
  71. data/test/regress/liquor +885 -0
  72. data/test/regress/machete +833 -0
  73. data/test/regress/mediacloth +1463 -0
  74. data/test/regress/mof +1368 -0
  75. data/test/regress/namae +634 -0
  76. data/test/regress/nasl +2058 -0
  77. data/test/regress/nokogiri-css +836 -0
  78. data/test/regress/opal +6431 -0
  79. data/test/regress/php_serialization +336 -0
  80. data/test/regress/riml +3283 -0
  81. data/test/regress/ruby18 +6344 -0
  82. data/test/regress/ruby22 +7460 -0
  83. data/test/regress/tp_plus +1933 -0
  84. data/test/regress/twowaysql +556 -0
  85. data/test/test_chk_y.rb +1 -0
  86. data/test/test_racc_command.rb +177 -2
  87. data/test/test_scan_y.rb +1 -0
  88. data/test/testscanner.rb +1 -1
  89. metadata +59 -83
  90. data/DEPENDS +0 -4
  91. data/Manifest.txt +0 -102
  92. data/bin/racc2y +0 -195
  93. data/bin/y2racc +0 -339
  94. data/ext/racc/depend +0 -1
  95. data/fastcache/extconf.rb +0 -2
  96. data/fastcache/fastcache.c +0 -185
  97. data/misc/dist.sh +0 -31
  98. data/setup.rb +0 -1587
  99. data/tasks/doc.rb +0 -12
  100. data/tasks/email.rb +0 -55
@@ -76,10 +76,9 @@
76
76
  == ライセンス
77
77
 
78
78
  このパッケージに付属するファイルの著作権は青木峰郎が保持します。
79
- ライセンスは GNU Lesser General Public License (LGPL) version 2
80
- です。ただしユーザが書いた規則ファイルや、Racc がそこから生成し
81
- た Ruby スクリプトはその対象外です。好きなライセンスで配布して
82
- ください。
79
+ ライセンスは Ruby ライセンスです。ただしユーザが書いた規則
80
+ ファイルや、Racc がそこから生成した Ruby スクリプトはその対象
81
+ 外です。好きなライセンスで配布してください。
83
82
 
84
83
 
85
84
  == バグなど
@@ -16,8 +16,6 @@
16
16
  == Requirement
17
17
 
18
18
  * Ruby 1.8.x or later.
19
- (*) make and C compiler.
20
-
21
19
 
22
20
  == Installation
23
21
 
@@ -36,9 +34,9 @@
36
34
 
37
35
  You can install Racc into your favorite directory by giving
38
36
  options to setup.rb. e.g.
39
-
37
+
40
38
  $ ruby setup.rb config --prefix=/usr
41
-
39
+
42
40
  For details, try "ruby setup.rb --help".
43
41
 
44
42
 
@@ -68,10 +66,10 @@
68
66
 
69
67
  == License
70
68
 
71
- Racc is distributed under the terms of the GNU Lesser General
72
- Public License version 2. Note that you do NOT need to follow
73
- LGPL for your own parser (racc outputs). You can provide those
74
- files under any licenses you want.
69
+ Racc is distributed under the same terms of ruby.
70
+ (see the file COPYING). Note that you do NOT need to follow
71
+ ruby license for your own parser (racc outputs).
72
+ You can distribute those files under any licenses you want.
75
73
 
76
74
 
77
75
  == Bug Reports
data/Rakefile CHANGED
@@ -1,51 +1,36 @@
1
1
  # -*- ruby -*-
2
2
 
3
- require 'rubygems'
4
- require 'hoe'
3
+ require "bundler/gem_tasks"
5
4
 
6
- gem 'rake-compiler', '>= 0.4.1'
5
+ require 'rdoc/task'
7
6
 
8
- Hoe.plugin :debugging, :doofus, :git, :isolate, :gemspec
7
+ RDoc::Task.new(:docs) do |rd|
8
+ spec = Gem::Specification.load("racc.gemspec")
9
+ rd.main = "README.en.rdoc"
10
+ rd.rdoc_files.include(spec.files.find_all { |file_name|
11
+ file_name =~ /^(bin|lib|ext)/ || file_name !~ /\//
12
+ })
9
13
 
10
- def java?
11
- /java/ === RUBY_PLATFORM
12
- end
13
- def jruby?
14
- Object.const_defined?(:RUBY_ENGINE) and 'jruby' == RUBY_ENGINE
15
- end
14
+ title = "#{spec.name}-#{spec.version} Documentation"
16
15
 
17
- HOE = Hoe.spec 'racc' do
18
- developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
19
- license "MIT"
20
-
21
- self.extra_rdoc_files = Dir['*.rdoc']
22
- self.history_file = 'ChangeLog'
23
- self.readme_file = 'README.rdoc'
16
+ rd.options << "-t #{title}"
17
+ end
24
18
 
25
- dependency 'rake-compiler', '>= 0.4.1', :developer
26
- dependency 'minitest', '~> 4.7', :developer # stick to stdlib's version
19
+ require 'rake/testtask'
27
20
 
28
- if java?
29
- self.spec_extras[:platform] = 'java'
30
- else
31
- self.spec_extras[:extensions] = %w[ext/racc/extconf.rb]
21
+ Rake::TestTask.new(:test) do |t|
22
+ t.test_files = FileList["test/**/test_*.rb"]
23
+ if RUBY_VERSION >= "2.6"
24
+ t.ruby_opts = %w[--enable-frozen-string-literal --debug=frozen-string-literal]
32
25
  end
33
-
34
- self.clean_globs << "lib/#{self.name}/*.{so,bundle,dll,jar}" # from hoe/compiler
35
-
36
26
  end
27
+ gem 'rake-compiler', '>= 0.4.1'
37
28
 
38
- def add_file_to_gem relative_path
39
- target_path = File.join gem_build_path, relative_path
40
- target_dir = File.dirname(target_path)
41
- mkdir_p target_dir unless File.directory?(target_dir)
42
- rm_f target_path
43
- safe_ln relative_path, target_path
44
- HOE.spec.files += [relative_path]
29
+ def java?
30
+ /java/ === RUBY_PLATFORM
45
31
  end
46
-
47
- def gem_build_path
48
- File.join 'pkg', HOE.spec.full_name
32
+ def jruby?
33
+ Object.const_defined?(:RUBY_ENGINE) and 'jruby' == RUBY_ENGINE
49
34
  end
50
35
 
51
36
  file 'lib/racc/parser-text.rb' => ['lib/racc/parser.rb'] do |t|
@@ -62,20 +47,10 @@ end
62
47
  }
63
48
  end
64
49
 
65
- unless jruby?
66
- # MRI
67
- require "rake/extensiontask"
68
- Rake::ExtensionTask.new "cparse", HOE.spec do |ext|
69
- ext.lib_dir = File.join 'lib', 'racc'
70
- ext.ext_dir = File.join 'ext', 'racc'
71
- end
72
-
73
- task :compile => 'lib/racc/parser-text.rb'
74
- #
75
- else
50
+ if jruby?
76
51
  # JRUBY
77
52
  require "rake/javaextensiontask"
78
- Rake::JavaExtensionTask.new("cparse", HOE.spec) do |ext|
53
+ Rake::JavaExtensionTask.new("cparse") do |ext|
79
54
  jruby_home = RbConfig::CONFIG['prefix']
80
55
  ext.lib_dir = File.join 'lib', 'racc'
81
56
  ext.ext_dir = File.join 'ext', 'racc'
@@ -88,13 +63,17 @@ else
88
63
  end
89
64
 
90
65
  task :compile => ['lib/racc/parser-text.rb']
91
-
92
- task gem_build_path => [:compile] do
93
- add_file_to_gem 'lib/racc/cparse-jruby.jar'
66
+ else
67
+ # MRI
68
+ require "rake/extensiontask"
69
+ Rake::ExtensionTask.new "cparse" do |ext|
70
+ ext.lib_dir = File.join 'lib', 'racc'
71
+ ext.ext_dir = File.join 'ext', 'racc', 'cparse'
94
72
  end
95
73
 
74
+ task :compile => 'lib/racc/parser-text.rb'
96
75
  end
97
76
 
98
- task :test => :compile
77
+ task :build => "lib/racc/parser-text.rb"
99
78
 
100
- Hoe.add_include_dirs('.:lib/racc')
79
+ task :test => :compile
data/bin/racc CHANGED
@@ -1,14 +1,12 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # $Id$
3
+ #
4
4
  #
5
5
  # Copyright (c) 1999-2006 Minero Aoki
6
6
  #
7
7
  # This program is free software.
8
- # You can distribute/modify this program under the terms of
9
- # the GNU LGPL, Lesser General Public License version 2.1.
10
- # For details of LGPL, see the file "COPYING".
11
- #
8
+ # You can distribute/modify this program under the same terms of ruby.
9
+ # see the file "COPYING".
12
10
 
13
11
  require 'racc/static'
14
12
  require 'optparse'
@@ -53,7 +51,7 @@ def main
53
51
  logfilename = path
54
52
  }
55
53
  parser.on('-e', '--executable [RUBYPATH]', 'Makes executable parser.') {|path|
56
- executable = true
54
+ make_executable = true
57
55
  rubypath = (path == 'ruby' ? nil : path)
58
56
  }
59
57
  parser.on('-E', '--embedded', "Embeds Racc runtime in output.") {
@@ -73,10 +71,6 @@ def main
73
71
  'Uses CLASSNAME instead of Racc::Parser.') {|name|
74
72
  superclass = name
75
73
  }
76
- parser.on('--runtime=FEATURE',
77
- "Uses FEATURE instead of 'racc/parser'") {|feat|
78
- runtime = feature
79
- }
80
74
  parser.on('-C', '--check-only', 'Checks syntax and quit immediately.') {|fl|
81
75
  check_only = fl
82
76
  }
@@ -90,24 +84,21 @@ def main
90
84
  debug_flags = Racc::DebugFlags.parse_option_string(flags)
91
85
  }
92
86
  #parser.on('--no-extensions', 'Run Racc without any Ruby extension.') {
93
- # Racc.const_set :Racc_No_Extentions, true
87
+ # Racc.const_set :Racc_No_Extensions, true
94
88
  #}
95
89
  parser.on('--version', 'Prints version and quit.') {
96
90
  puts "racc version #{Racc::Version}"
97
91
  exit 0
98
92
  }
99
93
  parser.on('--runtime-version', 'Prints runtime version and quit.') {
100
- printf "racc runtime version %s (rev. %s); %s\n",
94
+ printf "racc runtime version %s; %s\n",
101
95
  Racc::Parser::Racc_Runtime_Version,
102
- Racc::Parser::Racc_Runtime_Revision,
103
96
  if Racc::Parser.racc_runtime_type == 'ruby'
104
- sprintf('ruby core version %s (rev. %s)',
105
- Racc::Parser::Racc_Runtime_Core_Version_R,
106
- Racc::Parser::Racc_Runtime_Core_Revision_R)
97
+ sprintf('ruby core version %s',
98
+ Racc::Parser::Racc_Runtime_Core_Version_R)
107
99
  else
108
- sprintf('c core version %s (rev. %s)',
109
- Racc::Parser::Racc_Runtime_Core_Version_C,
110
- Racc::Parser::Racc_Runtime_Core_Revision_C)
100
+ sprintf('c core version %s',
101
+ Racc::Parser::Racc_Runtime_Core_Version_C)
111
102
  end
112
103
  exit 0
113
104
  }
@@ -189,8 +180,12 @@ def main
189
180
  log_useless states.grammar
190
181
  log_conflict states
191
182
  else
192
- report_useless states.grammar
193
- report_conflict states
183
+ has_useless = report_useless states.grammar
184
+ has_conflicts = report_conflict states
185
+ if has_useless || has_conflicts
186
+ preamble = make_logfile ? 'C' : 'Turn on logging with "-v" and c'
187
+ $stderr.puts %Q{#{preamble}heck ".output" file for details}
188
+ end
194
189
  end
195
190
 
196
191
  profiler.report
@@ -206,13 +201,29 @@ def make_filename(path, suffix)
206
201
  path.sub(/(?:\..*?)?\z/, suffix)
207
202
  end
208
203
 
204
+ LIST_LIMIT = 10
205
+ def report_list(enum, label)
206
+ c = enum.count
207
+ if c > 0
208
+ $stderr.puts "#{c} #{label}:"
209
+ enum.first(LIST_LIMIT).each do |item|
210
+ $stderr.puts " #{yield item}"
211
+ end
212
+ $stderr.puts " ..." if c > LIST_LIMIT
213
+ end
214
+ end
215
+
216
+ # @return [Boolean] if anything was reported
209
217
  def report_conflict(states)
210
218
  if states.should_report_srconflict?
219
+ reported = true
211
220
  $stderr.puts "#{states.n_srconflicts} shift/reduce conflicts"
212
221
  end
213
222
  if states.rrconflict_exist?
223
+ reported = true
214
224
  $stderr.puts "#{states.n_rrconflicts} reduce/reduce conflicts"
215
225
  end
226
+ reported
216
227
  end
217
228
 
218
229
  def log_conflict(states)
@@ -227,16 +238,17 @@ def log_conflict(states)
227
238
  }
228
239
  end
229
240
 
241
+ # @return [Boolean] if anything was reported
230
242
  def report_useless(grammar)
231
- if grammar.useless_nonterminal_exist?
232
- $stderr.puts "#{grammar.n_useless_nonterminals} useless nonterminals"
233
- end
234
- if grammar.useless_rule_exist?
235
- $stderr.puts "#{grammar.n_useless_rules} useless rules"
236
- end
243
+ reported = report_list(grammar.each_useless_nonterminal, 'useless nonterminals', &:to_s)
244
+
245
+ reported ||= report_list(grammar.each_useless_rule, 'useless rules') { |r| "##{r.ident} (#{r.target})" }
246
+
237
247
  if grammar.start.useless?
238
248
  $stderr.puts 'fatal: start symbol does not derive any sentence'
249
+ reported = true
239
250
  end
251
+ reported
240
252
  end
241
253
 
242
254
  def log_useless(grammar)
@@ -1,3 +1,17 @@
1
+ /*
2
+ Cparse.java -- Racc Runtime Core for JRuby
3
+
4
+ Copyright (c) 2016 Charles Oliver Nutter <headius@headius.com>
5
+
6
+ Ported from and distributed under the same licence as cparse.c
7
+
8
+ cparse.c -- Racc Runtime Core
9
+
10
+ Copyright (c) 1999-2006 Minero Aoki
11
+
12
+ This library is free software.
13
+ You can distribute/modify this program under the same terms of ruby.
14
+ */
1
15
  package com.headius.racc;
2
16
 
3
17
  import org.jruby.Ruby;
@@ -7,6 +21,7 @@ import org.jruby.RubyClass;
7
21
  import org.jruby.RubyContinuation;
8
22
  import org.jruby.RubyFixnum;
9
23
  import org.jruby.RubyHash;
24
+ import org.jruby.RubyKernel;
10
25
  import org.jruby.RubyModule;
11
26
  import org.jruby.RubyNumeric;
12
27
  import org.jruby.RubyObject;
@@ -24,13 +39,14 @@ import org.jruby.runtime.CallSite;
24
39
  import org.jruby.runtime.Helpers;
25
40
  import org.jruby.runtime.MethodIndex;
26
41
  import org.jruby.runtime.ObjectAllocator;
42
+ import org.jruby.runtime.Signature;
27
43
  import org.jruby.runtime.ThreadContext;
28
44
  import org.jruby.runtime.Visibility;
29
45
  import org.jruby.runtime.builtin.IRubyObject;
30
46
  import org.jruby.runtime.load.Library;
31
47
 
32
48
  public class Cparse implements Library {
33
- public static final String RACC_VERSION = "1.4.14"; // TODO: parse from Cparse.c
49
+ public static final String RACC_VERSION = "1.4.15"; // TODO: parse from Cparse.c
34
50
 
35
51
  public enum TokenType {
36
52
  DEFAULT(-1),
@@ -233,10 +249,6 @@ public class Cparse implements Library {
233
249
  shift(context, act, tok, val);
234
250
  }
235
251
 
236
- private int REDUCE(ThreadContext context, int act) {
237
- return reduce(context, act);
238
- }
239
-
240
252
  public void parse_main(ThreadContext context, IRubyObject tok, IRubyObject val, boolean resume) {
241
253
  Ruby runtime = context.runtime;
242
254
 
@@ -267,7 +279,7 @@ public class Cparse implements Library {
267
279
  i = assert_integer(tmp);
268
280
 
269
281
  D_printf("read_next=%d\n", read_next);
270
- if (read_next && (this.t != vFINAL_TOKEN)) {
282
+ if (read_next && (!this.t.equals(vFINAL_TOKEN))) {
271
283
  if (this.lex_is_iterator) {
272
284
  D_puts("resuming...");
273
285
  if (this.fin != 0) throw runtime.newArgumentError("token given after EOF");
@@ -354,7 +366,21 @@ public class Cparse implements Library {
354
366
  }
355
367
  else if (act < 0 && act > -(this.reduce_n)) {
356
368
  D_puts("reduce");
357
- REDUCE(context, act);
369
+ { // macro REDUCE
370
+ switch (reduce(context, act)) {
371
+ case 0: /* normal */
372
+ break;
373
+ case 1: /* yyerror */
374
+ branch = USER_YYERROR;
375
+ continue BRANCH;
376
+ case 2: /* yyaccept */
377
+ D_puts("u accept");
378
+ branch = ACCEPT;
379
+ continue BRANCH;
380
+ default:
381
+ break;
382
+ }
383
+ }
358
384
  }
359
385
  else if (act == -(this.reduce_n)) {
360
386
  branch = ERROR; continue BRANCH;
@@ -367,6 +393,7 @@ public class Cparse implements Library {
367
393
  throw runtime.newRaiseException(RaccBug, "[Cparse Bug] unknown act value " + act);
368
394
  }
369
395
 
396
+ // fall through
370
397
  case ERROR_RECOVERED:
371
398
 
372
399
  if (this.debug) {
@@ -389,9 +416,10 @@ public class Cparse implements Library {
389
416
  call_onerror.call(context, this.parser, this.parser, this.t, val, this.vstack);
390
417
  }
391
418
 
419
+ // fall through
392
420
  case USER_YYERROR:
393
421
  if (this.errstatus == 3) {
394
- if (this.t == vFINAL_TOKEN) {
422
+ if (this.t.equals(vFINAL_TOKEN)) {
395
423
  this.retval = runtime.getFalse();
396
424
  this.fin = CP_FIN_EOT;
397
425
  return;
@@ -464,7 +492,21 @@ public class Cparse implements Library {
464
492
  }
465
493
  else if (act < 0 && act > -(this.reduce_n)) {
466
494
  D_puts("e reduce");
467
- REDUCE(context, act);
495
+ { // macro REDUCE
496
+ switch (reduce(context, act)) {
497
+ case 0: /* normal */
498
+ break;
499
+ case 1: /* yyerror */
500
+ branch = USER_YYERROR;
501
+ continue BRANCH;
502
+ case 2: /* yyaccept */
503
+ D_puts("u accept");
504
+ branch = ACCEPT;
505
+ continue BRANCH;
506
+ default:
507
+ break;
508
+ }
509
+ }
468
510
  }
469
511
  else if (act == this.shift_n) {
470
512
  D_puts("e accept");
@@ -489,17 +531,18 @@ public class Cparse implements Library {
489
531
  }
490
532
 
491
533
  private int reduce(ThreadContext context, int act) {
492
- IRubyObject code;
493
534
  ruleno = -act * 3;
494
535
  IRubyObject tag = context.runtime.newSymbol("racc_jump");
495
- RubyContinuation rbContinuation = new RubyContinuation(context.runtime, context.runtime.newSymbol("racc_jump"));
496
- try {
497
- context.pushCatch(rbContinuation.getContinuation());
498
- code = reduce0(context);
499
- errstatus = assert_integer(parser.getInstanceVariable(ID_ERRSTATUS));
500
- } finally {
501
- context.popCatch();
502
- }
536
+ IRubyObject code = RubyKernel.rbCatch19(context, this,
537
+ tag,
538
+ CallBlock19.newCallClosure(this, getMetaClass(), Signature.NO_ARGUMENTS,
539
+ new BlockCallback() {
540
+ @Override
541
+ public IRubyObject call(ThreadContext context, IRubyObject[] args, Block block) {
542
+ return reduce0(context);
543
+ }
544
+ }, context));
545
+ errstatus = assert_integer(parser.getInstanceVariable(ID_ERRSTATUS));
503
546
  return assert_integer(code);
504
547
  }
505
548
 
@@ -527,13 +570,13 @@ public class Cparse implements Library {
527
570
  /* call action */
528
571
  if (len == 0) {
529
572
  tmp = context.nil;
530
- if (mid != sym_noreduce)
573
+ if (!mid.equals(sym_noreduce))
531
574
  tmp_v = runtime.newArray();
532
575
  if (this.debug)
533
576
  tmp_t = runtime.newArray();
534
577
  }
535
578
  else {
536
- if (mid != sym_noreduce) {
579
+ if (!mid.equals(sym_noreduce)) {
537
580
  tmp_v = GET_TAIL(context, this.vstack, len);
538
581
  tmp = ((RubyArray)tmp_v).entry(0);
539
582
  }
@@ -547,7 +590,7 @@ public class Cparse implements Library {
547
590
  }
548
591
  CUT_TAIL(context, this.state, len);
549
592
  }
550
- if (mid != sym_noreduce) {
593
+ if (!mid.equals(sym_noreduce)) {
551
594
  if (this.use_result_var) {
552
595
  tmp = Helpers.invoke(context, this.parser, mid.toString(), tmp_v, this.vstack, tmp);
553
596
  }
@@ -590,7 +633,7 @@ public class Cparse implements Library {
590
633
  D_puts("(goto) check[i] == nil");
591
634
  branch = NOTFOUND; continue BRANCH;
592
635
  }
593
- if (tmp != runtime.newFixnum(k1)) {
636
+ if (!tmp.equals(runtime.newFixnum(k1))) {
594
637
  D_puts("(goto) check[i] != table[i]");
595
638
  branch = NOTFOUND; continue BRANCH;
596
639
  }
@@ -759,7 +802,7 @@ public class Cparse implements Library {
759
802
  }
760
803
  }, context));
761
804
  } catch (LexerUnroll maybeOurs) {
762
- if (maybeOurs == lexerUnroll) {
805
+ if (maybeOurs.equals(lexerUnroll)) {
763
806
  return;
764
807
  }
765
808
  }