racc 1.4.13 → 1.4.14

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: 63f4e66898f77de945b0df3b04bab131f7c55aed
4
- data.tar.gz: 900f1d9ce77c84ea450b5d5f679795c0e0a2cef2
3
+ metadata.gz: bc823e3d2f74302a78716da88054a9c139fef28c
4
+ data.tar.gz: 846089f41620044090f7f1f8c0ffc8c8d2b048a4
5
5
  SHA512:
6
- metadata.gz: 07b41103a1d046166af2d748cacc21a6830d5a70b77a91c9dbf8cbc15469fa83d3367ba6cff6057bb63314cecca05fc18cda889839b5e37416ac29aa8b18131a
7
- data.tar.gz: 1edf22c34ccd8cc533a66d513809f07133124dcf0b778f5c0cd8037ec510d4562dd3df4de6c22bc8fd1cd7b8bfccee0f8b7e406dc9e46f3686be5275d334370f
6
+ metadata.gz: 9c4d722765b8ba6d9dccfb917d611a0f08787a39376ec89711269c578355a1fee56fe7bc94539f679279311be73ac1048f8b8287d15baa224ebb9aa86ef989a5
7
+ data.tar.gz: e48b9d8d038fe05a2f8073613fc2d674eef9ea2b4ba8060d6a6f5dc059f38cd5260604f42a6505d2aa509822bb1e177c203625b307d58f74725400ecaeca883e
@@ -61,6 +61,7 @@ test/assets/conf.y
61
61
  test/assets/digraph.y
62
62
  test/assets/echk.y
63
63
  test/assets/err.y
64
+ test/assets/error_recovery.y
64
65
  test/assets/expect.y
65
66
  test/assets/firstline.y
66
67
  test/assets/ichk.y
@@ -30,7 +30,7 @@ import org.jruby.runtime.builtin.IRubyObject;
30
30
  import org.jruby.runtime.load.Library;
31
31
 
32
32
  public class Cparse implements Library {
33
- public static final String RACC_VERSION = "1.4.13"; // TODO: parse from Cparse.c
33
+ public static final String RACC_VERSION = "1.4.14"; // TODO: parse from Cparse.c
34
34
 
35
35
  public enum TokenType {
36
36
  DEFAULT(-1),
@@ -17,7 +17,7 @@
17
17
  Important Constants
18
18
  ----------------------------------------------------------------------- */
19
19
 
20
- #define RACC_VERSION "1.4.13"
20
+ #define RACC_VERSION "1.4.14"
21
21
 
22
22
  #define DEFAULT_TOKEN -1
23
23
  #define ERROR_TOKEN 1
@@ -10,7 +10,7 @@
10
10
  #
11
11
 
12
12
  module Racc
13
- VERSION = '1.4.13'
13
+ VERSION = '1.4.14'
14
14
  Version = VERSION
15
15
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
16
16
  end
@@ -1,7 +1,7 @@
1
1
  module Racc
2
2
  PARSER_TEXT = <<'__end_of_file__'
3
3
  #
4
- # $Id: f015c335c3b92ed58b32b8fb00163be48783f689 $
4
+ # $Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $
5
5
  #
6
6
  # Copyright (c) 1999-2006 Minero Aoki
7
7
  #
@@ -189,10 +189,10 @@ module Racc
189
189
  class Parser
190
190
 
191
191
  Racc_Runtime_Version = ::Racc::VERSION
192
- Racc_Runtime_Revision = '$Id: f015c335c3b92ed58b32b8fb00163be48783f689 $'
192
+ Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
193
193
 
194
194
  Racc_Runtime_Core_Version_R = ::Racc::VERSION
195
- Racc_Runtime_Core_Revision_R = '$Id: f015c335c3b92ed58b32b8fb00163be48783f689 $'.split[1]
195
+ Racc_Runtime_Core_Revision_R = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'.split[1]
196
196
  begin
197
197
  if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
198
198
  require 'racc/cparse-jruby.jar'
@@ -398,7 +398,7 @@ puts $!.backtrace
398
398
  # shift
399
399
  #
400
400
  if @racc_error_status > 0
401
- @racc_error_status -= 1 unless @racc_t == 1 # error token
401
+ @racc_error_status -= 1 unless @racc_t <= 1 # error token or EOF
402
402
  end
403
403
  @racc_vstack.push @racc_val
404
404
  @racc_state.push act
@@ -447,6 +447,8 @@ puts $!.backtrace
447
447
  end
448
448
  when 3
449
449
  if @racc_t == 0 # is $
450
+ # We're at EOF, and another error occurred immediately after
451
+ # attempting auto-recovery
450
452
  throw :racc_end_parse, nil
451
453
  end
452
454
  @racc_read_next = true
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id: f015c335c3b92ed58b32b8fb00163be48783f689 $
2
+ # $Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -187,10 +187,10 @@ module Racc
187
187
  class Parser
188
188
 
189
189
  Racc_Runtime_Version = ::Racc::VERSION
190
- Racc_Runtime_Revision = '$Id: f015c335c3b92ed58b32b8fb00163be48783f689 $'
190
+ Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
191
191
 
192
192
  Racc_Runtime_Core_Version_R = ::Racc::VERSION
193
- Racc_Runtime_Core_Revision_R = '$Id: f015c335c3b92ed58b32b8fb00163be48783f689 $'.split[1]
193
+ Racc_Runtime_Core_Revision_R = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'.split[1]
194
194
  begin
195
195
  if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
196
196
  require 'racc/cparse-jruby.jar'
@@ -396,7 +396,7 @@ puts $!.backtrace
396
396
  # shift
397
397
  #
398
398
  if @racc_error_status > 0
399
- @racc_error_status -= 1 unless @racc_t == 1 # error token
399
+ @racc_error_status -= 1 unless @racc_t <= 1 # error token or EOF
400
400
  end
401
401
  @racc_vstack.push @racc_val
402
402
  @racc_state.push act
@@ -445,6 +445,8 @@ puts $!.backtrace
445
445
  end
446
446
  when 3
447
447
  if @racc_t == 0 # is $
448
+ # We're at EOF, and another error occurred immediately after
449
+ # attempting auto-recovery
448
450
  throw :racc_end_parse, nil
449
451
  end
450
452
  @racc_read_next = true
@@ -0,0 +1,35 @@
1
+ # Regression test case for the bug discussed here:
2
+ # https://github.com/whitequark/parser/issues/93
3
+ # In short, a Racc-generated parser could go into an infinite loop when
4
+ # attempting error recovery at EOF
5
+
6
+ class InfiniteLoop
7
+
8
+ rule
9
+
10
+ stmts: stmt
11
+ | error stmt
12
+
13
+ stmt: '%' stmt
14
+
15
+ end
16
+
17
+ ---- inner
18
+
19
+ def parse
20
+ @errors = []
21
+ do_parse
22
+ end
23
+
24
+ def next_token
25
+ nil
26
+ end
27
+
28
+ def on_error(error_token, error_value, value_stack)
29
+ # oh my, an error
30
+ @errors << [error_token, error_value]
31
+ end
32
+
33
+ ---- footer
34
+
35
+ InfiniteLoop.new.parse
@@ -3,6 +3,7 @@ require 'minitest/autorun'
3
3
  require 'racc/static'
4
4
  require 'fileutils'
5
5
  require 'tempfile'
6
+ require 'timeout'
6
7
 
7
8
  module Racc
8
9
  class TestCase < MiniTest::Unit::TestCase
@@ -151,5 +151,14 @@ module Racc
151
151
  assert_compile 'unterm.y'
152
152
  }
153
153
  end
154
+
155
+ # Regression test for a problem where error recovery at EOF would cause
156
+ # a Racc-generated parser to go into an infinite loop (on some grammars)
157
+ def test_error_recovery_y
158
+ assert_compile 'error_recovery.y'
159
+ Timeout.timeout(10) do
160
+ assert_exec 'error_recovery.y'
161
+ end
162
+ end
154
163
  end
155
164
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.13
4
+ version: 1.4.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-16 00:00:00.000000000 Z
11
+ date: 2015-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -155,6 +155,7 @@ files:
155
155
  - test/assets/digraph.y
156
156
  - test/assets/echk.y
157
157
  - test/assets/err.y
158
+ - test/assets/error_recovery.y
158
159
  - test/assets/expect.y
159
160
  - test/assets/firstline.y
160
161
  - test/assets/ichk.y