racc 1.4.14 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/COPYING +22 -515
- data/README.ja.rdoc +3 -4
- data/README.rdoc +6 -8
- data/Rakefile +32 -53
- data/bin/racc +39 -27
- data/ext/racc/com/headius/racc/Cparse.java +66 -23
- data/ext/racc/{cparse.c → cparse/cparse.c} +82 -47
- data/ext/racc/{extconf.rb → cparse/extconf.rb} +2 -1
- data/lib/racc/compat.rb +5 -4
- data/lib/racc/debugflags.rb +5 -4
- data/lib/racc/exception.rb +5 -4
- data/lib/racc/grammar.rb +25 -22
- data/lib/racc/grammarfileparser.rb +10 -8
- data/lib/racc/info.rb +6 -5
- data/lib/racc/iset.rb +6 -5
- data/lib/racc/logfilegenerator.rb +6 -5
- data/lib/racc/parser-text.rb +20 -23
- data/lib/racc/parser.rb +20 -23
- data/lib/racc/parserfilegenerator.rb +10 -10
- data/lib/racc/sourcetext.rb +5 -4
- data/lib/racc/state.rb +13 -12
- data/lib/racc/statetransitiontable.rb +7 -6
- data/rdoc/ja/command.ja.html +1 -1
- data/sample/array.y +1 -1
- data/sample/array2.y +1 -1
- data/sample/calc-ja.y +2 -2
- data/sample/calc.y +2 -2
- data/sample/conflict.y +1 -1
- data/sample/hash.y +1 -1
- data/sample/lalr.y +1 -1
- data/sample/lists.y +1 -1
- data/sample/syntax.y +1 -1
- data/sample/yyerr.y +1 -1
- data/test/assets/cadenza.y +170 -0
- data/test/assets/cast.y +926 -0
- data/test/assets/csspool.y +729 -0
- data/test/assets/edtf.y +583 -0
- data/test/assets/huia.y +318 -0
- data/test/assets/intp.y +4 -4
- data/test/assets/journey.y +47 -0
- data/test/assets/liquor.y +313 -0
- data/test/assets/machete.y +423 -0
- data/test/assets/macruby.y +2197 -0
- data/test/assets/mailp.y +27 -27
- data/test/assets/mediacloth.y +599 -0
- data/test/assets/mof.y +649 -0
- data/test/assets/namae.y +302 -0
- data/test/assets/nasl.y +626 -0
- data/test/assets/nokogiri-css.y +255 -0
- data/test/assets/nullbug2.y +2 -2
- data/test/assets/opal.y +1807 -0
- data/test/assets/php_serialization.y +98 -0
- data/test/assets/recv.y +20 -20
- data/test/assets/riml.y +665 -0
- data/test/assets/ruby18.y +1943 -0
- data/test/assets/ruby19.y +2174 -0
- data/test/assets/ruby20.y +2350 -0
- data/test/assets/ruby21.y +2359 -0
- data/test/assets/ruby22.y +2381 -0
- data/test/assets/syntax.y +1 -1
- data/test/assets/tp_plus.y +622 -0
- data/test/assets/twowaysql.y +278 -0
- data/test/helper.rb +68 -41
- data/test/regress/cadenza +796 -0
- data/test/regress/cast +3428 -0
- data/test/regress/csspool +2314 -0
- data/test/regress/edtf +1794 -0
- data/test/regress/huia +1392 -0
- data/test/regress/journey +222 -0
- data/test/regress/liquor +885 -0
- data/test/regress/machete +833 -0
- data/test/regress/mediacloth +1463 -0
- data/test/regress/mof +1368 -0
- data/test/regress/namae +634 -0
- data/test/regress/nasl +2058 -0
- data/test/regress/nokogiri-css +836 -0
- data/test/regress/opal +6431 -0
- data/test/regress/php_serialization +336 -0
- data/test/regress/riml +3283 -0
- data/test/regress/ruby18 +6344 -0
- data/test/regress/ruby22 +7460 -0
- data/test/regress/tp_plus +1933 -0
- data/test/regress/twowaysql +556 -0
- data/test/test_chk_y.rb +1 -0
- data/test/test_racc_command.rb +177 -2
- data/test/test_scan_y.rb +1 -0
- data/test/testscanner.rb +1 -1
- metadata +59 -83
- data/DEPENDS +0 -4
- data/Manifest.txt +0 -102
- data/bin/racc2y +0 -195
- data/bin/y2racc +0 -339
- data/ext/racc/depend +0 -1
- data/fastcache/extconf.rb +0 -2
- data/fastcache/fastcache.c +0 -185
- data/misc/dist.sh +0 -31
- data/setup.rb +0 -1587
- data/tasks/doc.rb +0 -12
- data/tasks/email.rb +0 -55
@@ -1,13 +1,14 @@
|
|
1
|
+
#--
|
2
|
+
#
|
1
3
|
#
|
2
|
-
# $Id: 5e1871defa15d288d2252e6a76bb2c4cf2119ed3 $
|
3
4
|
#
|
4
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
6
|
#
|
6
7
|
# This program is free software.
|
7
|
-
# You can distribute/modify this program under the terms of
|
8
|
-
# the
|
9
|
-
# For details of the GNU LGPL, see the file "COPYING".
|
8
|
+
# You can distribute/modify this program under the same terms of ruby.
|
9
|
+
# see the file "COPYING".
|
10
10
|
#
|
11
|
+
#++
|
11
12
|
|
12
13
|
require 'racc'
|
13
14
|
require 'racc/compat'
|
@@ -284,9 +285,9 @@ module Racc
|
|
284
285
|
end
|
285
286
|
label
|
286
287
|
end
|
287
|
-
|
288
|
+
|
288
289
|
def add_user_code(label, src)
|
289
|
-
@result.params.
|
290
|
+
@result.params.public_send(USER_CODE_LABELS[label]).push src
|
290
291
|
end
|
291
292
|
|
292
293
|
end
|
@@ -295,7 +296,7 @@ module Racc
|
|
295
296
|
class GrammarFileScanner
|
296
297
|
|
297
298
|
def initialize(str, filename = '-')
|
298
|
-
@lines = str.split(/\n|\r\n|\r/)
|
299
|
+
@lines = str.b.split(/\n|\r\n|\r/)
|
299
300
|
@filename = filename
|
300
301
|
@lineno = -1
|
301
302
|
@line_head = true
|
@@ -427,7 +428,7 @@ module Racc
|
|
427
428
|
$raccs_print_type = false
|
428
429
|
|
429
430
|
def scan_action
|
430
|
-
buf =
|
431
|
+
buf = String.new
|
431
432
|
nest = 1
|
432
433
|
pre = nil
|
433
434
|
@in_block = 'action'
|
@@ -450,6 +451,7 @@ module Racc
|
|
450
451
|
nest -= 1
|
451
452
|
if nest == 0
|
452
453
|
@in_block = nil
|
454
|
+
buf.sub!(/[ \t\f]+\z/, '')
|
453
455
|
return buf
|
454
456
|
end
|
455
457
|
buf << (pre = ch)
|
data/lib/racc/info.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
+
#--
|
2
|
+
#
|
1
3
|
#
|
2
|
-
# $Id: 22e498362c014749b453953e8d986243c0b8660c $
|
3
4
|
#
|
4
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
6
|
#
|
6
7
|
# This program is free software.
|
7
|
-
# You can distribute/modify this program under the terms of
|
8
|
-
# the
|
9
|
-
# For details of the GNU LGPL, see the file "COPYING".
|
8
|
+
# You can distribute/modify this program under the same terms of ruby.
|
9
|
+
# see the file "COPYING".
|
10
10
|
#
|
11
|
+
#++
|
11
12
|
|
12
13
|
module Racc
|
13
|
-
VERSION = '1.
|
14
|
+
VERSION = '1.5.2'
|
14
15
|
Version = VERSION
|
15
16
|
Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
|
16
17
|
end
|
data/lib/racc/iset.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
|
+
#--
|
2
|
+
#
|
1
3
|
#
|
2
|
-
# $Id: de638608cfd72d3ed9819d87b65a89ee6a57b589 $
|
3
4
|
#
|
4
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
6
|
#
|
6
7
|
# This program is free software.
|
7
|
-
# You can distribute/modify this program under the terms of
|
8
|
-
# the
|
9
|
-
# For details of the GNU LGPL, see the file "COPYING".
|
8
|
+
# You can distribute/modify this program under the same terms of ruby.
|
9
|
+
# see the file "COPYING".
|
10
10
|
#
|
11
|
+
#++
|
11
12
|
|
12
13
|
module Racc
|
13
14
|
|
@@ -85,7 +86,7 @@ module Racc
|
|
85
86
|
def dup
|
86
87
|
ISet.new(@set.dup)
|
87
88
|
end
|
88
|
-
|
89
|
+
|
89
90
|
end # class ISet
|
90
91
|
|
91
92
|
end # module Racc
|
@@ -1,13 +1,14 @@
|
|
1
|
+
#--
|
2
|
+
#
|
1
3
|
#
|
2
|
-
# $Id: a7e9663605afdda065d305b250a9805e3bd3fa70 $
|
3
4
|
#
|
4
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
6
|
#
|
6
7
|
# This program is free software.
|
7
|
-
# You can distribute/modify this program under the terms of
|
8
|
-
# the
|
9
|
-
# For details of the GNU LGPL, see the file "COPYING".
|
8
|
+
# You can distribute/modify this program under the same terms of ruby.
|
9
|
+
# see the file "COPYING".
|
10
10
|
#
|
11
|
+
#++
|
11
12
|
|
12
13
|
module Racc
|
13
14
|
|
@@ -132,7 +133,7 @@ module Racc
|
|
132
133
|
def outact(f, t, act)
|
133
134
|
case act
|
134
135
|
when Shift
|
135
|
-
f.printf " %-12s shift, and go to state %d\n",
|
136
|
+
f.printf " %-12s shift, and go to state %d\n",
|
136
137
|
t.to_s, act.goto_id
|
137
138
|
when Reduce
|
138
139
|
f.printf " %-12s reduce using rule %d (%s)\n",
|
data/lib/racc/parser-text.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
module Racc
|
2
2
|
PARSER_TEXT = <<'__end_of_file__'
|
3
|
-
#
|
4
|
-
|
5
|
-
#
|
3
|
+
# frozen_string_literal: false
|
4
|
+
#--
|
6
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
7
6
|
#
|
8
7
|
# This program is free software.
|
@@ -11,7 +10,7 @@ module Racc
|
|
11
10
|
# As a special exception, when this code is copied by Racc
|
12
11
|
# into a Racc output file, you may use that output file
|
13
12
|
# without restriction.
|
14
|
-
|
13
|
+
#++
|
15
14
|
|
16
15
|
require 'racc/info'
|
17
16
|
|
@@ -32,7 +31,7 @@ end
|
|
32
31
|
# == Command-line Reference
|
33
32
|
#
|
34
33
|
# racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
|
35
|
-
# [-e<var>rubypath</var>] [--
|
34
|
+
# [-e<var>rubypath</var>] [--executable=<var>rubypath</var>]
|
36
35
|
# [-v] [--verbose]
|
37
36
|
# [-O<var>filename</var>] [--log-file=<var>filename</var>]
|
38
37
|
# [-g] [--debug]
|
@@ -44,8 +43,8 @@ end
|
|
44
43
|
# [-S] [--output-status]
|
45
44
|
# [--version] [--copyright] [--help] <var>grammarfile</var>
|
46
45
|
#
|
47
|
-
# [+
|
48
|
-
# Racc grammar file. Any
|
46
|
+
# [+grammarfile+]
|
47
|
+
# Racc grammar file. Any extension is permitted.
|
49
48
|
# [-o+outfile+, --output-file=+outfile+]
|
50
49
|
# A filename for output. default is <+filename+>.tab.rb
|
51
50
|
# [-O+filename+, --log-file=+filename+]
|
@@ -61,7 +60,7 @@ end
|
|
61
60
|
# [-E, --embedded]
|
62
61
|
# Output parser which doesn't need runtime files (racc/parser.rb).
|
63
62
|
# [-C, --check-only]
|
64
|
-
# Check syntax of racc
|
63
|
+
# Check syntax of racc grammar file and quit.
|
65
64
|
# [-S, --output-status]
|
66
65
|
# Print messages time to time while compiling.
|
67
66
|
# [-l, --no-line-convert]
|
@@ -178,49 +177,43 @@ end
|
|
178
177
|
# This command creates myparser.rb which `includes' Racc runtime.
|
179
178
|
# Only you must do is to distribute your parser file (myparser.rb).
|
180
179
|
#
|
181
|
-
# Note: parser.rb is
|
180
|
+
# Note: parser.rb is ruby license, but your parser is not.
|
182
181
|
# Your own parser is completely yours.
|
183
182
|
module Racc
|
184
183
|
|
185
|
-
unless defined?(
|
186
|
-
|
184
|
+
unless defined?(Racc_No_Extensions)
|
185
|
+
Racc_No_Extensions = false # :nodoc:
|
187
186
|
end
|
188
187
|
|
189
188
|
class Parser
|
190
189
|
|
191
190
|
Racc_Runtime_Version = ::Racc::VERSION
|
192
|
-
Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
|
193
|
-
|
194
191
|
Racc_Runtime_Core_Version_R = ::Racc::VERSION
|
195
|
-
|
192
|
+
|
196
193
|
begin
|
197
194
|
if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
195
|
+
require 'jruby'
|
198
196
|
require 'racc/cparse-jruby.jar'
|
199
197
|
com.headius.racc.Cparse.new.load(JRuby.runtime, false)
|
200
198
|
else
|
201
199
|
require 'racc/cparse'
|
202
200
|
end
|
203
|
-
|
204
|
-
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
|
201
|
+
|
205
202
|
unless new.respond_to?(:_racc_do_parse_c, true)
|
206
203
|
raise LoadError, 'old cparse.so'
|
207
204
|
end
|
208
|
-
if
|
205
|
+
if Racc_No_Extensions
|
209
206
|
raise LoadError, 'selecting ruby version of racc runtime core'
|
210
207
|
end
|
211
208
|
|
212
209
|
Racc_Main_Parsing_Routine = :_racc_do_parse_c # :nodoc:
|
213
210
|
Racc_YY_Parse_Method = :_racc_yyparse_c # :nodoc:
|
214
211
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C # :nodoc:
|
215
|
-
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C # :nodoc:
|
216
212
|
Racc_Runtime_Type = 'c' # :nodoc:
|
217
213
|
rescue LoadError
|
218
|
-
puts $!
|
219
|
-
puts $!.backtrace
|
220
214
|
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
221
215
|
Racc_YY_Parse_Method = :_racc_yyparse_rb
|
222
216
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
|
223
|
-
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
|
224
217
|
Racc_Runtime_Type = 'ruby'
|
225
218
|
end
|
226
219
|
|
@@ -269,9 +262,11 @@ puts $!.backtrace
|
|
269
262
|
# def next_token
|
270
263
|
# @q.shift
|
271
264
|
# end
|
265
|
+
class_eval %{
|
272
266
|
def do_parse
|
273
|
-
|
267
|
+
#{Racc_Main_Parsing_Routine}(_racc_setup(), false)
|
274
268
|
end
|
269
|
+
}
|
275
270
|
|
276
271
|
# The method to fetch next token.
|
277
272
|
# If you use #do_parse method, you must implement #next_token.
|
@@ -329,9 +324,11 @@ puts $!.backtrace
|
|
329
324
|
#
|
330
325
|
# RECEIVER#METHOD_ID is a method to get next token.
|
331
326
|
# It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
|
327
|
+
class_eval %{
|
332
328
|
def yyparse(recv, mid)
|
333
|
-
|
329
|
+
#{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), false)
|
334
330
|
end
|
331
|
+
}
|
335
332
|
|
336
333
|
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
337
334
|
action_table, action_check, action_default, action_pointer,
|
data/lib/racc/parser.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
#
|
1
|
+
# frozen_string_literal: false
|
2
|
+
#--
|
4
3
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
4
|
#
|
6
5
|
# This program is free software.
|
@@ -9,7 +8,7 @@
|
|
9
8
|
# As a special exception, when this code is copied by Racc
|
10
9
|
# into a Racc output file, you may use that output file
|
11
10
|
# without restriction.
|
12
|
-
|
11
|
+
#++
|
13
12
|
|
14
13
|
require 'racc/info'
|
15
14
|
|
@@ -30,7 +29,7 @@ end
|
|
30
29
|
# == Command-line Reference
|
31
30
|
#
|
32
31
|
# racc [-o<var>filename</var>] [--output-file=<var>filename</var>]
|
33
|
-
# [-e<var>rubypath</var>] [--
|
32
|
+
# [-e<var>rubypath</var>] [--executable=<var>rubypath</var>]
|
34
33
|
# [-v] [--verbose]
|
35
34
|
# [-O<var>filename</var>] [--log-file=<var>filename</var>]
|
36
35
|
# [-g] [--debug]
|
@@ -42,8 +41,8 @@ end
|
|
42
41
|
# [-S] [--output-status]
|
43
42
|
# [--version] [--copyright] [--help] <var>grammarfile</var>
|
44
43
|
#
|
45
|
-
# [+
|
46
|
-
# Racc grammar file. Any
|
44
|
+
# [+grammarfile+]
|
45
|
+
# Racc grammar file. Any extension is permitted.
|
47
46
|
# [-o+outfile+, --output-file=+outfile+]
|
48
47
|
# A filename for output. default is <+filename+>.tab.rb
|
49
48
|
# [-O+filename+, --log-file=+filename+]
|
@@ -59,7 +58,7 @@ end
|
|
59
58
|
# [-E, --embedded]
|
60
59
|
# Output parser which doesn't need runtime files (racc/parser.rb).
|
61
60
|
# [-C, --check-only]
|
62
|
-
# Check syntax of racc
|
61
|
+
# Check syntax of racc grammar file and quit.
|
63
62
|
# [-S, --output-status]
|
64
63
|
# Print messages time to time while compiling.
|
65
64
|
# [-l, --no-line-convert]
|
@@ -176,49 +175,43 @@ end
|
|
176
175
|
# This command creates myparser.rb which `includes' Racc runtime.
|
177
176
|
# Only you must do is to distribute your parser file (myparser.rb).
|
178
177
|
#
|
179
|
-
# Note: parser.rb is
|
178
|
+
# Note: parser.rb is ruby license, but your parser is not.
|
180
179
|
# Your own parser is completely yours.
|
181
180
|
module Racc
|
182
181
|
|
183
|
-
unless defined?(
|
184
|
-
|
182
|
+
unless defined?(Racc_No_Extensions)
|
183
|
+
Racc_No_Extensions = false # :nodoc:
|
185
184
|
end
|
186
185
|
|
187
186
|
class Parser
|
188
187
|
|
189
188
|
Racc_Runtime_Version = ::Racc::VERSION
|
190
|
-
Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
|
191
|
-
|
192
189
|
Racc_Runtime_Core_Version_R = ::Racc::VERSION
|
193
|
-
|
190
|
+
|
194
191
|
begin
|
195
192
|
if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
|
193
|
+
require 'jruby'
|
196
194
|
require 'racc/cparse-jruby.jar'
|
197
195
|
com.headius.racc.Cparse.new.load(JRuby.runtime, false)
|
198
196
|
else
|
199
197
|
require 'racc/cparse'
|
200
198
|
end
|
201
|
-
|
202
|
-
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
|
199
|
+
|
203
200
|
unless new.respond_to?(:_racc_do_parse_c, true)
|
204
201
|
raise LoadError, 'old cparse.so'
|
205
202
|
end
|
206
|
-
if
|
203
|
+
if Racc_No_Extensions
|
207
204
|
raise LoadError, 'selecting ruby version of racc runtime core'
|
208
205
|
end
|
209
206
|
|
210
207
|
Racc_Main_Parsing_Routine = :_racc_do_parse_c # :nodoc:
|
211
208
|
Racc_YY_Parse_Method = :_racc_yyparse_c # :nodoc:
|
212
209
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C # :nodoc:
|
213
|
-
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C # :nodoc:
|
214
210
|
Racc_Runtime_Type = 'c' # :nodoc:
|
215
211
|
rescue LoadError
|
216
|
-
puts $!
|
217
|
-
puts $!.backtrace
|
218
212
|
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
219
213
|
Racc_YY_Parse_Method = :_racc_yyparse_rb
|
220
214
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
|
221
|
-
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
|
222
215
|
Racc_Runtime_Type = 'ruby'
|
223
216
|
end
|
224
217
|
|
@@ -267,9 +260,11 @@ puts $!.backtrace
|
|
267
260
|
# def next_token
|
268
261
|
# @q.shift
|
269
262
|
# end
|
263
|
+
class_eval %{
|
270
264
|
def do_parse
|
271
|
-
|
265
|
+
#{Racc_Main_Parsing_Routine}(_racc_setup(), false)
|
272
266
|
end
|
267
|
+
}
|
273
268
|
|
274
269
|
# The method to fetch next token.
|
275
270
|
# If you use #do_parse method, you must implement #next_token.
|
@@ -327,9 +322,11 @@ puts $!.backtrace
|
|
327
322
|
#
|
328
323
|
# RECEIVER#METHOD_ID is a method to get next token.
|
329
324
|
# It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
|
325
|
+
class_eval %{
|
330
326
|
def yyparse(recv, mid)
|
331
|
-
|
327
|
+
#{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), false)
|
332
328
|
end
|
329
|
+
}
|
333
330
|
|
334
331
|
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
335
332
|
action_table, action_check, action_default, action_pointer,
|
@@ -1,15 +1,15 @@
|
|
1
|
+
#--
|
2
|
+
#
|
1
3
|
#
|
2
|
-
# $Id: f2d2788af2323ada1913f1dad5fea8aae4cc6830 $
|
3
4
|
#
|
4
5
|
# Copyright (c) 1999-2006 Minero Aoki
|
5
6
|
#
|
6
7
|
# This program is free software.
|
7
|
-
# You can distribute/modify this program under the terms of
|
8
|
-
# the
|
9
|
-
# For details of the GNU LGPL, see the file "COPYING".
|
8
|
+
# You can distribute/modify this program under the same terms of ruby.
|
9
|
+
# see the file "COPYING".
|
10
10
|
#
|
11
|
+
#++
|
11
12
|
|
12
|
-
require 'enumerator'
|
13
13
|
require 'racc/compat'
|
14
14
|
require 'racc/sourcetext'
|
15
15
|
require 'racc/parser-text'
|
@@ -125,7 +125,7 @@ module Racc
|
|
125
125
|
line %q[#]
|
126
126
|
line %q[# DO NOT MODIFY!!!!]
|
127
127
|
line %Q[# This file is automatically generated by Racc #{Racc::Version}]
|
128
|
-
line %Q[# from Racc
|
128
|
+
line %Q[# from Racc grammar file "#{@params.filename}".]
|
129
129
|
line %q[#]
|
130
130
|
end
|
131
131
|
|
@@ -159,8 +159,8 @@ module Racc
|
|
159
159
|
cref_pop
|
160
160
|
indent; line "end \# class #{classid}"
|
161
161
|
mods.reverse_each do |mod|
|
162
|
-
indent; line "end \# module #{mod}"
|
163
162
|
cref_pop
|
163
|
+
indent; line "end \# module #{mod}"
|
164
164
|
end
|
165
165
|
end
|
166
166
|
|
@@ -237,7 +237,7 @@ module Racc
|
|
237
237
|
end
|
238
238
|
|
239
239
|
def unique_separator(id)
|
240
|
-
sep = "...end #{id}/module_eval..."
|
240
|
+
sep = String.new "...end #{id}/module_eval..."
|
241
241
|
while @used_separator.key?(sep)
|
242
242
|
sep.concat sprintf('%02x', rand(255))
|
243
243
|
end
|
@@ -331,7 +331,7 @@ module Racc
|
|
331
331
|
# TODO: this can be made a LOT more clean with a simple split/map
|
332
332
|
sep = "\n"
|
333
333
|
nsep = ",\n"
|
334
|
-
buf =
|
334
|
+
buf = String.new
|
335
335
|
com = ''
|
336
336
|
ncom = ','
|
337
337
|
co = com
|
@@ -341,7 +341,7 @@ module Racc
|
|
341
341
|
if buf.size > 66
|
342
342
|
@f.print sep; sep = nsep
|
343
343
|
@f.print "'", buf, "'"
|
344
|
-
buf =
|
344
|
+
buf = String.new
|
345
345
|
co = com
|
346
346
|
end
|
347
347
|
end
|