racc 1.4.8 → 1.4.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +5 -4
- data/ext/racc/cparse.c +1 -1
- data/lib/racc/grammar.rb +2 -2
- data/lib/racc/info.rb +1 -1
- data/lib/racc/logfilegenerator.rb +1 -4
- data/lib/racc/parser-text.rb +17 -20
- data/lib/racc/parser.rb +16 -19
- data/lib/racc/parserfilegenerator.rb +3 -3
- data/lib/racc/statetransitiontable.rb +2 -2
- data/test/helper.rb +7 -4
- data/test/test_racc_command.rb +2 -2
- metadata +38 -15
data/Rakefile
CHANGED
@@ -29,12 +29,13 @@ Hoe.spec 'racc' do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
file 'lib/racc/parser-text.rb' => ['lib/racc/parser.rb'] do |t|
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
source = 'lib/racc/parser.rb'
|
33
|
+
|
34
|
+
open(t.name, 'wb') { |io|
|
35
|
+
io.write(<<-eorb)
|
35
36
|
module Racc
|
36
37
|
PARSER_TEXT = <<'__end_of_file__'
|
37
|
-
|
38
|
+
#{File.read(source)}
|
38
39
|
__end_of_file__
|
39
40
|
end
|
40
41
|
eorb
|
data/ext/racc/cparse.c
CHANGED
data/lib/racc/grammar.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
2
|
+
# $Id: 733f7084ff1dca50994cba55c8a05aba8d82eb31 $
|
3
3
|
#
|
4
4
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
5
|
#
|
@@ -503,7 +503,7 @@ module Racc
|
|
503
503
|
set.update tmp
|
504
504
|
return set
|
505
505
|
end
|
506
|
-
tok =
|
506
|
+
tok = nil
|
507
507
|
set.update_a t.heads
|
508
508
|
t.heads.each do |ptr|
|
509
509
|
tok = ptr.dereference
|
data/lib/racc/info.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
2
|
+
# $Id: a7e9663605afdda065d305b250a9805e3bd3fa70 $
|
3
3
|
#
|
4
4
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
5
|
#
|
@@ -45,7 +45,6 @@ module Racc
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def output_useless(out)
|
48
|
-
used = []
|
49
48
|
@grammar.each do |rl|
|
50
49
|
if rl.useless?
|
51
50
|
out.printf "rule %d (%s) never reduced\n",
|
@@ -90,8 +89,6 @@ module Racc
|
|
90
89
|
end
|
91
90
|
|
92
91
|
def action_out(f, state)
|
93
|
-
r = ''
|
94
|
-
e = ''
|
95
92
|
sr = state.srconf && state.srconf.dup
|
96
93
|
rr = state.rrconf && state.rrconf.dup
|
97
94
|
acts = state.action
|
data/lib/racc/parser-text.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Racc
|
2
2
|
PARSER_TEXT = <<'__end_of_file__'
|
3
|
-
|
4
|
-
# $Id:
|
3
|
+
#
|
4
|
+
# $Id: ad1fffef443194fdfa1052d2eee6850552f94313 $
|
5
5
|
#
|
6
6
|
# Copyright (c) 1999-2006 Minero Aoki
|
7
7
|
#
|
@@ -33,10 +33,10 @@ module Racc
|
|
33
33
|
class Parser
|
34
34
|
|
35
35
|
Racc_Runtime_Version = '1.4.6'
|
36
|
-
Racc_Runtime_Revision = '$Id:
|
36
|
+
Racc_Runtime_Revision = '$Id: ad1fffef443194fdfa1052d2eee6850552f94313 $'
|
37
37
|
|
38
38
|
Racc_Runtime_Core_Version_R = '1.4.6'
|
39
|
-
Racc_Runtime_Core_Revision_R = '$Id:
|
39
|
+
Racc_Runtime_Core_Revision_R = '$Id: ad1fffef443194fdfa1052d2eee6850552f94313 $'.split[1]
|
40
40
|
begin
|
41
41
|
require 'racc/cparse'
|
42
42
|
# Racc_Runtime_Core_Version_C = (defined in extention)
|
@@ -107,13 +107,11 @@ module Racc
|
|
107
107
|
|
108
108
|
def _racc_do_parse_rb(arg, in_debug)
|
109
109
|
action_table, action_check, action_default, action_pointer,
|
110
|
-
|
111
|
-
|
112
|
-
reduce_n, use_result, * = arg
|
110
|
+
_, _, _, _,
|
111
|
+
_, _, token_table, * = arg
|
113
112
|
|
114
113
|
_racc_init_sysvars
|
115
114
|
tok = act = i = nil
|
116
|
-
nerr = 0
|
117
115
|
|
118
116
|
catch(:racc_end_parse) {
|
119
117
|
while true
|
@@ -156,12 +154,10 @@ module Racc
|
|
156
154
|
|
157
155
|
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
158
156
|
action_table, action_check, action_default, action_pointer,
|
159
|
-
|
160
|
-
|
161
|
-
reduce_n, use_result, * = arg
|
157
|
+
_, _, _, _,
|
158
|
+
_, _, token_table, * = arg
|
162
159
|
|
163
160
|
_racc_init_sysvars
|
164
|
-
nerr = 0
|
165
161
|
|
166
162
|
catch(:racc_end_parse) {
|
167
163
|
until i = action_pointer[@racc_state[-1]]
|
@@ -210,10 +206,10 @@ module Racc
|
|
210
206
|
###
|
211
207
|
|
212
208
|
def _racc_evalact(act, arg)
|
213
|
-
action_table, action_check,
|
214
|
-
|
215
|
-
|
216
|
-
reduce_n,
|
209
|
+
action_table, action_check, _, action_pointer,
|
210
|
+
_, _, _, _,
|
211
|
+
_, _, _, shift_n,
|
212
|
+
reduce_n, * = arg
|
217
213
|
nerr = 0 # tmp
|
218
214
|
|
219
215
|
if act > 0 and act < shift_n
|
@@ -305,10 +301,11 @@ module Racc
|
|
305
301
|
end
|
306
302
|
|
307
303
|
def _racc_do_reduce(arg, act)
|
308
|
-
|
309
|
-
goto_table,
|
310
|
-
nt_base,
|
311
|
-
|
304
|
+
_, _, _, _,
|
305
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
306
|
+
nt_base, reduce_table, _, _,
|
307
|
+
_, use_result, * = arg
|
308
|
+
|
312
309
|
state = @racc_state
|
313
310
|
vstack = @racc_vstack
|
314
311
|
tstack = @racc_tstack
|
data/lib/racc/parser.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
2
|
+
# $Id: ad1fffef443194fdfa1052d2eee6850552f94313 $
|
3
3
|
#
|
4
4
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
5
|
#
|
@@ -31,10 +31,10 @@ module Racc
|
|
31
31
|
class Parser
|
32
32
|
|
33
33
|
Racc_Runtime_Version = '1.4.6'
|
34
|
-
Racc_Runtime_Revision = '$Id:
|
34
|
+
Racc_Runtime_Revision = '$Id: ad1fffef443194fdfa1052d2eee6850552f94313 $'
|
35
35
|
|
36
36
|
Racc_Runtime_Core_Version_R = '1.4.6'
|
37
|
-
Racc_Runtime_Core_Revision_R = '$Id:
|
37
|
+
Racc_Runtime_Core_Revision_R = '$Id: ad1fffef443194fdfa1052d2eee6850552f94313 $'.split[1]
|
38
38
|
begin
|
39
39
|
require 'racc/cparse'
|
40
40
|
# Racc_Runtime_Core_Version_C = (defined in extention)
|
@@ -105,13 +105,11 @@ module Racc
|
|
105
105
|
|
106
106
|
def _racc_do_parse_rb(arg, in_debug)
|
107
107
|
action_table, action_check, action_default, action_pointer,
|
108
|
-
|
109
|
-
|
110
|
-
reduce_n, use_result, * = arg
|
108
|
+
_, _, _, _,
|
109
|
+
_, _, token_table, * = arg
|
111
110
|
|
112
111
|
_racc_init_sysvars
|
113
112
|
tok = act = i = nil
|
114
|
-
nerr = 0
|
115
113
|
|
116
114
|
catch(:racc_end_parse) {
|
117
115
|
while true
|
@@ -154,12 +152,10 @@ module Racc
|
|
154
152
|
|
155
153
|
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
156
154
|
action_table, action_check, action_default, action_pointer,
|
157
|
-
|
158
|
-
|
159
|
-
reduce_n, use_result, * = arg
|
155
|
+
_, _, _, _,
|
156
|
+
_, _, token_table, * = arg
|
160
157
|
|
161
158
|
_racc_init_sysvars
|
162
|
-
nerr = 0
|
163
159
|
|
164
160
|
catch(:racc_end_parse) {
|
165
161
|
until i = action_pointer[@racc_state[-1]]
|
@@ -208,10 +204,10 @@ module Racc
|
|
208
204
|
###
|
209
205
|
|
210
206
|
def _racc_evalact(act, arg)
|
211
|
-
action_table, action_check,
|
212
|
-
|
213
|
-
|
214
|
-
reduce_n,
|
207
|
+
action_table, action_check, _, action_pointer,
|
208
|
+
_, _, _, _,
|
209
|
+
_, _, _, shift_n,
|
210
|
+
reduce_n, * = arg
|
215
211
|
nerr = 0 # tmp
|
216
212
|
|
217
213
|
if act > 0 and act < shift_n
|
@@ -303,10 +299,11 @@ module Racc
|
|
303
299
|
end
|
304
300
|
|
305
301
|
def _racc_do_reduce(arg, act)
|
306
|
-
|
307
|
-
goto_table,
|
308
|
-
nt_base,
|
309
|
-
|
302
|
+
_, _, _, _,
|
303
|
+
goto_table, goto_check, goto_default, goto_pointer,
|
304
|
+
nt_base, reduce_table, _, _,
|
305
|
+
_, use_result, * = arg
|
306
|
+
|
310
307
|
state = @racc_state
|
311
308
|
vstack = @racc_vstack
|
312
309
|
tstack = @racc_tstack
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
2
|
+
# $Id: 75aee0ac3cd6429e28eac511d78a717614123a89 $
|
3
3
|
#
|
4
4
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
5
|
#
|
@@ -114,7 +114,7 @@ module Racc
|
|
114
114
|
footer
|
115
115
|
end
|
116
116
|
|
117
|
-
c = ::
|
117
|
+
c = ::RbConfig::CONFIG
|
118
118
|
RUBY_PATH = "#{c['bindir']}/#{c['ruby_install_name']}#{c['EXEEXT']}"
|
119
119
|
|
120
120
|
def shebang(path)
|
@@ -463,7 +463,7 @@ module Racc
|
|
463
463
|
def remove_blank_lines(src)
|
464
464
|
body = src.text.dup
|
465
465
|
line = src.lineno
|
466
|
-
while
|
466
|
+
while body.slice!(/\A[ \t\f]*(?:\n|\r\n|\r)/)
|
467
467
|
line += 1
|
468
468
|
end
|
469
469
|
SourceText.new(body, src.filename, line)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# $Id:
|
2
|
+
# $Id: 4c5f4311663b6d03050953d64d6a0e7905ff2216 $
|
3
3
|
#
|
4
4
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
5
|
#
|
@@ -302,7 +302,7 @@ module Racc
|
|
302
302
|
c.funcall(:alias_method, "_reduce_#{rule.ident}", :_reduce_none)
|
303
303
|
else
|
304
304
|
c.funcall(:define_method, "_racc_action_#{rule.ident}", &rule.action.proc)
|
305
|
-
c.module_eval(
|
305
|
+
c.module_eval(<<-End, __FILE__, __LINE__ + 1)
|
306
306
|
def _reduce_#{rule.ident}(vals, vstack)
|
307
307
|
_racc_action_#{rule.ident}(*vals)
|
308
308
|
end
|
data/test/helper.rb
CHANGED
@@ -2,6 +2,7 @@ $VERBOSE = true
|
|
2
2
|
require 'test/unit'
|
3
3
|
require 'racc/static'
|
4
4
|
require 'fileutils'
|
5
|
+
require 'tempfile'
|
5
6
|
|
6
7
|
module Racc
|
7
8
|
class TestCase < Test::Unit::TestCase
|
@@ -76,12 +77,14 @@ module Racc
|
|
76
77
|
def racc arg
|
77
78
|
ruby "-S #{RACC} #{arg}"
|
78
79
|
end
|
79
|
-
|
80
|
+
|
80
81
|
def ruby arg
|
81
82
|
Dir.chdir(TEST_DIR) do
|
82
|
-
|
83
|
-
|
84
|
-
|
83
|
+
Tempfile.open 'test' do |io|
|
84
|
+
cmd = "#{ENV['_']} -I #{INC} #{arg} 2>#{io.path}"
|
85
|
+
result = system(cmd)
|
86
|
+
assert(result, io.read)
|
87
|
+
end
|
85
88
|
end
|
86
89
|
end
|
87
90
|
end
|
data/test/test_racc_command.rb
CHANGED
@@ -141,13 +141,13 @@ module Racc
|
|
141
141
|
end
|
142
142
|
|
143
143
|
def test_norule_y
|
144
|
-
assert_raises(
|
144
|
+
assert_raises(MiniTest::Assertion) {
|
145
145
|
assert_compile 'norule.y'
|
146
146
|
}
|
147
147
|
end
|
148
148
|
|
149
149
|
def test_unterm_y
|
150
|
-
assert_raises(
|
150
|
+
assert_raises(MiniTest::Assertion) {
|
151
151
|
assert_compile 'unterm.y'
|
152
152
|
}
|
153
153
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,41 +9,56 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement:
|
15
|
+
name: rdoc
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: '3.10'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rdoc
|
27
|
-
requirement: &70145906200460 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
25
|
none: false
|
29
26
|
requirements:
|
30
27
|
- - ~>
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '3.10'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rake-compiler
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.4.1
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.4.1
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: hoe
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
42
52
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
53
|
+
version: '3.0'
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
47
62
|
description: ! "Racc is a LALR(1) parser generator.\n It is written in Ruby itself,
|
48
63
|
and generates Ruby program.\n\n NOTE: Ruby 1.8.x comes with Racc runtime module.
|
49
64
|
\ You\n can run your parsers generated by racc 1.4.x out of the\n box."
|
@@ -59,6 +74,14 @@ extra_rdoc_files:
|
|
59
74
|
- Manifest.txt
|
60
75
|
- README.ja.rdoc
|
61
76
|
- README.rdoc
|
77
|
+
- rdoc/en/NEWS.en.rdoc
|
78
|
+
- rdoc/en/debug.en.rdoc
|
79
|
+
- rdoc/en/grammar.en.rdoc
|
80
|
+
- rdoc/en/parser.en.rdoc
|
81
|
+
- rdoc/ja/NEWS.ja.rdoc
|
82
|
+
- rdoc/ja/debug.ja.rdoc
|
83
|
+
- rdoc/ja/grammar.ja.rdoc
|
84
|
+
- rdoc/ja/parser.ja.rdoc
|
62
85
|
files:
|
63
86
|
- COPYING
|
64
87
|
- ChangeLog
|
@@ -188,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
211
|
version: '0'
|
189
212
|
requirements: []
|
190
213
|
rubyforge_project: racc
|
191
|
-
rubygems_version: 1.8.
|
214
|
+
rubygems_version: 1.8.23
|
192
215
|
signing_key:
|
193
216
|
specification_version: 3
|
194
217
|
summary: Racc is a LALR(1) parser generator
|