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 +4 -4
- data/Manifest.txt +1 -0
- data/ext/racc/com/headius/racc/Cparse.java +1 -1
- data/ext/racc/cparse.c +1 -1
- data/lib/racc/info.rb +1 -1
- data/lib/racc/parser-text.rb +6 -4
- data/lib/racc/parser.rb +6 -4
- data/test/assets/error_recovery.y +35 -0
- data/test/helper.rb +1 -0
- data/test/test_racc_command.rb +9 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc823e3d2f74302a78716da88054a9c139fef28c
|
4
|
+
data.tar.gz: 846089f41620044090f7f1f8c0ffc8c8d2b048a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c4d722765b8ba6d9dccfb917d611a0f08787a39376ec89711269c578355a1fee56fe7bc94539f679279311be73ac1048f8b8287d15baa224ebb9aa86ef989a5
|
7
|
+
data.tar.gz: e48b9d8d038fe05a2f8073613fc2d674eef9ea2b4ba8060d6a6f5dc059f38cd5260604f42a6505d2aa509822bb1e177c203625b307d58f74725400ecaeca883e
|
data/Manifest.txt
CHANGED
@@ -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.
|
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),
|
data/ext/racc/cparse.c
CHANGED
data/lib/racc/info.rb
CHANGED
data/lib/racc/parser-text.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Racc
|
2
2
|
PARSER_TEXT = <<'__end_of_file__'
|
3
3
|
#
|
4
|
-
# $Id:
|
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:
|
192
|
+
Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
|
193
193
|
|
194
194
|
Racc_Runtime_Core_Version_R = ::Racc::VERSION
|
195
|
-
Racc_Runtime_Core_Revision_R = '$Id:
|
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
|
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
|
data/lib/racc/parser.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
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:
|
190
|
+
Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
|
191
191
|
|
192
192
|
Racc_Runtime_Core_Version_R = ::Racc::VERSION
|
193
|
-
Racc_Runtime_Core_Revision_R = '$Id:
|
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
|
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
|
data/test/helper.rb
CHANGED
data/test/test_racc_command.rb
CHANGED
@@ -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.
|
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-
|
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
|