racc 1.4.6 → 1.4.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/.gemtest +0 -0
  2. data/Manifest.txt +105 -0
  3. data/{README.en.rdoc → README.rdoc} +0 -0
  4. data/Rakefile +43 -12
  5. data/ext/racc/{cparse/MANIFEST → MANIFEST} +0 -0
  6. data/ext/racc/{cparse/cparse.c → cparse.c} +0 -0
  7. data/ext/racc/{cparse/depend → depend} +0 -0
  8. data/ext/racc/extconf.rb +5 -0
  9. data/lib/racc/compat.rb +1 -1
  10. data/lib/racc/debugflags.rb +1 -1
  11. data/lib/racc/exception.rb +1 -1
  12. data/lib/racc/grammar.rb +1 -1
  13. data/lib/racc/grammarfileparser.rb +1 -1
  14. data/lib/racc/info.rb +3 -3
  15. data/lib/racc/iset.rb +1 -1
  16. data/lib/racc/logfilegenerator.rb +1 -1
  17. data/lib/racc/parser-text.rb +444 -0
  18. data/lib/racc/parser.rb +3 -3
  19. data/lib/racc/parserfilegenerator.rb +1 -1
  20. data/lib/racc/sourcetext.rb +1 -1
  21. data/lib/racc/state.rb +1 -1
  22. data/lib/racc/statetransitiontable.rb +1 -1
  23. data/{doc → rdoc}/en/NEWS.en.rdoc +0 -0
  24. data/{doc → rdoc}/en/command.en.html +0 -0
  25. data/{doc → rdoc}/en/debug.en.rdoc +0 -0
  26. data/{doc → rdoc}/en/grammar.en.rdoc +0 -0
  27. data/{doc → rdoc}/en/index.en.html +0 -0
  28. data/{doc → rdoc}/en/parser.en.rdoc +0 -0
  29. data/{doc → rdoc}/en/usage.en.html +0 -0
  30. data/{doc → rdoc}/ja/NEWS.ja.rdoc +0 -0
  31. data/{doc → rdoc}/ja/command.ja.html +0 -0
  32. data/{doc → rdoc}/ja/debug.ja.rdoc +0 -0
  33. data/{doc → rdoc}/ja/grammar.ja.rdoc +0 -0
  34. data/{doc → rdoc}/ja/index.ja.html +0 -0
  35. data/{doc → rdoc}/ja/parser.ja.rdoc +0 -0
  36. data/{doc → rdoc}/ja/usage.ja.html +0 -0
  37. metadata +96 -47
  38. data/.gitattributes +0 -2
  39. data/.gitignore +0 -7
  40. data/ext/racc/cparse/extconf.rb +0 -7
  41. data/tasks/file.rb +0 -37
  42. data/tasks/gem.rb +0 -37
  43. data/tasks/test.rb +0 -16
File without changes
@@ -0,0 +1,105 @@
1
+ COPYING
2
+ ChangeLog
3
+ DEPENDS
4
+ Manifest.txt
5
+ README.ja.rdoc
6
+ README.rdoc
7
+ Rakefile
8
+ TODO
9
+ bin/racc
10
+ bin/racc2y
11
+ bin/y2racc
12
+ ext/racc/MANIFEST
13
+ ext/racc/cparse.c
14
+ ext/racc/depend
15
+ ext/racc/extconf.rb
16
+ fastcache/extconf.rb
17
+ fastcache/fastcache.c
18
+ lib/racc.rb
19
+ lib/racc/compat.rb
20
+ lib/racc/debugflags.rb
21
+ lib/racc/exception.rb
22
+ lib/racc/grammar.rb
23
+ lib/racc/grammarfileparser.rb
24
+ lib/racc/info.rb
25
+ lib/racc/iset.rb
26
+ lib/racc/logfilegenerator.rb
27
+ lib/racc/parser-text.rb
28
+ lib/racc/parser.rb
29
+ lib/racc/parserfilegenerator.rb
30
+ lib/racc/pre-setup
31
+ lib/racc/sourcetext.rb
32
+ lib/racc/state.rb
33
+ lib/racc/statetransitiontable.rb
34
+ lib/racc/static.rb
35
+ misc/dist.sh
36
+ rdoc/en/NEWS.en.rdoc
37
+ rdoc/en/command.en.html
38
+ rdoc/en/debug.en.rdoc
39
+ rdoc/en/grammar.en.rdoc
40
+ rdoc/en/index.en.html
41
+ rdoc/en/parser.en.rdoc
42
+ rdoc/en/usage.en.html
43
+ rdoc/ja/NEWS.ja.rdoc
44
+ rdoc/ja/command.ja.html
45
+ rdoc/ja/debug.ja.rdoc
46
+ rdoc/ja/grammar.ja.rdoc
47
+ rdoc/ja/index.ja.html
48
+ rdoc/ja/parser.ja.rdoc
49
+ rdoc/ja/usage.ja.html
50
+ sample/array.y
51
+ sample/array2.y
52
+ sample/calc-ja.y
53
+ sample/calc.y
54
+ sample/conflict.y
55
+ sample/hash.y
56
+ sample/lalr.y
57
+ sample/lists.y
58
+ sample/syntax.y
59
+ sample/yyerr.y
60
+ setup.rb
61
+ tasks/doc.rb
62
+ tasks/email.rb
63
+ test/assets/chk.y
64
+ test/assets/conf.y
65
+ test/assets/digraph.y
66
+ test/assets/echk.y
67
+ test/assets/err.y
68
+ test/assets/expect.y
69
+ test/assets/firstline.y
70
+ test/assets/ichk.y
71
+ test/assets/intp.y
72
+ test/assets/mailp.y
73
+ test/assets/newsyn.y
74
+ test/assets/noend.y
75
+ test/assets/nonass.y
76
+ test/assets/normal.y
77
+ test/assets/norule.y
78
+ test/assets/nullbug1.y
79
+ test/assets/nullbug2.y
80
+ test/assets/opt.y
81
+ test/assets/percent.y
82
+ test/assets/recv.y
83
+ test/assets/rrconf.y
84
+ test/assets/scan.y
85
+ test/assets/syntax.y
86
+ test/assets/unterm.y
87
+ test/assets/useless.y
88
+ test/assets/yyerr.y
89
+ test/bench.y
90
+ test/helper.rb
91
+ test/infini.y
92
+ test/scandata/brace
93
+ test/scandata/gvar
94
+ test/scandata/normal
95
+ test/scandata/percent
96
+ test/scandata/slash
97
+ test/src.intp
98
+ test/start.y
99
+ test/test_chk_y.rb
100
+ test/test_grammar_file_parser.rb
101
+ test/test_racc_command.rb
102
+ test/test_scan_y.rb
103
+ test/testscanner.rb
104
+ web/racc.en.rhtml
105
+ web/racc.ja.rhtml
File without changes
data/Rakefile CHANGED
@@ -1,15 +1,46 @@
1
- require 'rake'
2
- require 'rake/gempackagetask'
3
- require 'rake/rdoctask'
4
- require 'rake/testtask'
5
- require 'rake/clean'
1
+ # -*- ruby -*-
6
2
 
7
- require 'lib/racc/parser'
3
+ require 'rubygems'
4
+ require 'hoe'
8
5
 
9
- require 'tasks/file'
10
- require 'tasks/gem'
11
- require 'tasks/test'
12
- require 'tasks/doc'
13
- require 'tasks/email'
6
+ gem 'rake-compiler', '>= 0.4.1'
7
+ require "rake/extensiontask"
14
8
 
15
- task :default => :test
9
+ Hoe.plugin :debugging, :doofus, :git, :isolate
10
+
11
+ Hoe.spec 'racc' do
12
+ developer 'Aaron Patterson', 'aaron@tenderlovemaking.com'
13
+
14
+ self.extra_rdoc_files = Dir['*.rdoc']
15
+ self.history_file = 'ChangeLog'
16
+ self.readme_file = 'README.rdoc'
17
+ self.testlib = :minitest
18
+
19
+ extra_dev_deps << ['rake-compiler', '>= 0.4.1']
20
+
21
+ self.spec_extras = {
22
+ :extensions => ["ext/racc/extconf.rb"]
23
+ }
24
+
25
+ Rake::ExtensionTask.new "cparse", spec do |ext|
26
+ ext.lib_dir = File.join 'lib', 'racc'
27
+ ext.ext_dir = File.join 'ext', 'racc'
28
+ end
29
+ end
30
+
31
+ file 'lib/racc/parser-text.rb' => ['lib/racc/parser.rb'] do |t|
32
+ file = 'lib/racc/parser.rb'
33
+ File.open(t.name, 'wb') { |file|
34
+ file.write(<<-eorb)
35
+ module Racc
36
+ PARSER_TEXT = <<'__end_of_file__'
37
+ #{File.read(file)}"
38
+ __end_of_file__
39
+ end
40
+ eorb
41
+ }
42
+ end
43
+
44
+ Hoe.add_include_dirs('.:lib/psych')
45
+
46
+ task :compile => 'lib/racc/parser-text.rb'
File without changes
File without changes
File without changes
@@ -0,0 +1,5 @@
1
+ # $Id: 24b2ba178fd74c1e6029e30ed31e654178865854 $
2
+
3
+ require 'mkmf'
4
+
5
+ create_makefile 'racc/cparse'
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: b40c10cc1a30073bf591fef553277971e3c4cd75 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 74ff4369ce53c7f45cfc2644ce907785104ebf6e $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: a26517cc7b6a673ce1985c8c75fba88492e1e820 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 59cb78bc6d79cb4801cea37e379c9ee58fae03b1 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 3f7136294dbfbc25783f216ca3168a37c671960b $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 96a81cf328285b90878c3bb512715a95950dba46 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -10,7 +10,7 @@
10
10
  #
11
11
 
12
12
  module Racc
13
- Version = '1.4.6'
14
- VERSION = Version
13
+ VERSION = '1.4.7'
14
+ Version = VERSION
15
15
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
16
16
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: de638608cfd72d3ed9819d87b65a89ee6a57b589 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: e5067781f44dc04098421f5c717f2c1c3563a1ff $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -0,0 +1,444 @@
1
+ module Racc
2
+ PARSER_TEXT = <<'__end_of_file__'
3
+ #
4
+ # $Id: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $
5
+ #
6
+ # Copyright (c) 1999-2006 Minero Aoki
7
+ #
8
+ # This program is free software.
9
+ # You can distribute/modify this program under the same terms of ruby.
10
+ #
11
+ # As a special exception, when this code is copied by Racc
12
+ # into a Racc output file, you may use that output file
13
+ # without restriction.
14
+ #
15
+
16
+ unless defined?(NotImplementedError)
17
+ NotImplementedError = NotImplementError
18
+ end
19
+
20
+ module Racc
21
+ class ParseError < StandardError; end
22
+ end
23
+ unless defined?(::ParseError)
24
+ ParseError = Racc::ParseError
25
+ end
26
+
27
+ module Racc
28
+
29
+ unless defined?(Racc_No_Extentions)
30
+ Racc_No_Extentions = false
31
+ end
32
+
33
+ class Parser
34
+
35
+ Racc_Runtime_Version = '1.4.6'
36
+ Racc_Runtime_Revision = '$Id: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $'
37
+
38
+ Racc_Runtime_Core_Version_R = '1.4.6'
39
+ Racc_Runtime_Core_Revision_R = '$Id: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $'.split[1]
40
+ begin
41
+ require 'racc/cparse'
42
+ # Racc_Runtime_Core_Version_C = (defined in extention)
43
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
44
+ unless new.respond_to?(:_racc_do_parse_c, true)
45
+ raise LoadError, 'old cparse.so'
46
+ end
47
+ if Racc_No_Extentions
48
+ raise LoadError, 'selecting ruby version of racc runtime core'
49
+ end
50
+
51
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c
52
+ Racc_YY_Parse_Method = :_racc_yyparse_c
53
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
54
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
55
+ Racc_Runtime_Type = 'c'
56
+ rescue LoadError
57
+ Racc_Main_Parsing_Routine = :_racc_do_parse_rb
58
+ Racc_YY_Parse_Method = :_racc_yyparse_rb
59
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
60
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
61
+ Racc_Runtime_Type = 'ruby'
62
+ end
63
+
64
+ def Parser.racc_runtime_type
65
+ Racc_Runtime_Type
66
+ end
67
+
68
+ private
69
+
70
+ def _racc_setup
71
+ @yydebug = false unless self.class::Racc_debug_parser
72
+ @yydebug = false unless defined?(@yydebug)
73
+ if @yydebug
74
+ @racc_debug_out = $stderr unless defined?(@racc_debug_out)
75
+ @racc_debug_out ||= $stderr
76
+ end
77
+ arg = self.class::Racc_arg
78
+ arg[13] = true if arg.size < 14
79
+ arg
80
+ end
81
+
82
+ def _racc_init_sysvars
83
+ @racc_state = [0]
84
+ @racc_tstack = []
85
+ @racc_vstack = []
86
+
87
+ @racc_t = nil
88
+ @racc_val = nil
89
+
90
+ @racc_read_next = true
91
+
92
+ @racc_user_yyerror = false
93
+ @racc_error_status = 0
94
+ end
95
+
96
+ ###
97
+ ### do_parse
98
+ ###
99
+
100
+ def do_parse
101
+ __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
102
+ end
103
+
104
+ def next_token
105
+ raise NotImplementedError, "#{self.class}\#next_token is not defined"
106
+ end
107
+
108
+ def _racc_do_parse_rb(arg, in_debug)
109
+ action_table, action_check, action_default, action_pointer,
110
+ goto_table, goto_check, goto_default, goto_pointer,
111
+ nt_base, reduce_table, token_table, shift_n,
112
+ reduce_n, use_result, * = arg
113
+
114
+ _racc_init_sysvars
115
+ tok = act = i = nil
116
+ nerr = 0
117
+
118
+ catch(:racc_end_parse) {
119
+ while true
120
+ if i = action_pointer[@racc_state[-1]]
121
+ if @racc_read_next
122
+ if @racc_t != 0 # not EOF
123
+ tok, @racc_val = next_token()
124
+ unless tok # EOF
125
+ @racc_t = 0
126
+ else
127
+ @racc_t = (token_table[tok] or 1) # error token
128
+ end
129
+ racc_read_token(@racc_t, tok, @racc_val) if @yydebug
130
+ @racc_read_next = false
131
+ end
132
+ end
133
+ i += @racc_t
134
+ unless i >= 0 and
135
+ act = action_table[i] and
136
+ action_check[i] == @racc_state[-1]
137
+ act = action_default[@racc_state[-1]]
138
+ end
139
+ else
140
+ act = action_default[@racc_state[-1]]
141
+ end
142
+ while act = _racc_evalact(act, arg)
143
+ ;
144
+ end
145
+ end
146
+ }
147
+ end
148
+
149
+ ###
150
+ ### yyparse
151
+ ###
152
+
153
+ def yyparse(recv, mid)
154
+ __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
155
+ end
156
+
157
+ def _racc_yyparse_rb(recv, mid, arg, c_debug)
158
+ action_table, action_check, action_default, action_pointer,
159
+ goto_table, goto_check, goto_default, goto_pointer,
160
+ nt_base, reduce_table, token_table, shift_n,
161
+ reduce_n, use_result, * = arg
162
+
163
+ _racc_init_sysvars
164
+ nerr = 0
165
+
166
+ catch(:racc_end_parse) {
167
+ until i = action_pointer[@racc_state[-1]]
168
+ while act = _racc_evalact(action_default[@racc_state[-1]], arg)
169
+ ;
170
+ end
171
+ end
172
+ recv.__send__(mid) do |tok, val|
173
+ unless tok
174
+ @racc_t = 0
175
+ else
176
+ @racc_t = (token_table[tok] or 1) # error token
177
+ end
178
+ @racc_val = val
179
+ @racc_read_next = false
180
+
181
+ i += @racc_t
182
+ unless i >= 0 and
183
+ act = action_table[i] and
184
+ action_check[i] == @racc_state[-1]
185
+ act = action_default[@racc_state[-1]]
186
+ end
187
+ while act = _racc_evalact(act, arg)
188
+ ;
189
+ end
190
+
191
+ while !(i = action_pointer[@racc_state[-1]]) ||
192
+ ! @racc_read_next ||
193
+ @racc_t == 0 # $
194
+ unless i and i += @racc_t and
195
+ i >= 0 and
196
+ act = action_table[i] and
197
+ action_check[i] == @racc_state[-1]
198
+ act = action_default[@racc_state[-1]]
199
+ end
200
+ while act = _racc_evalact(act, arg)
201
+ ;
202
+ end
203
+ end
204
+ end
205
+ }
206
+ end
207
+
208
+ ###
209
+ ### common
210
+ ###
211
+
212
+ def _racc_evalact(act, arg)
213
+ action_table, action_check, action_default, action_pointer,
214
+ goto_table, goto_check, goto_default, goto_pointer,
215
+ nt_base, reduce_table, token_table, shift_n,
216
+ reduce_n, use_result, * = arg
217
+ nerr = 0 # tmp
218
+
219
+ if act > 0 and act < shift_n
220
+ #
221
+ # shift
222
+ #
223
+ if @racc_error_status > 0
224
+ @racc_error_status -= 1 unless @racc_t == 1 # error token
225
+ end
226
+ @racc_vstack.push @racc_val
227
+ @racc_state.push act
228
+ @racc_read_next = true
229
+ if @yydebug
230
+ @racc_tstack.push @racc_t
231
+ racc_shift @racc_t, @racc_tstack, @racc_vstack
232
+ end
233
+
234
+ elsif act < 0 and act > -reduce_n
235
+ #
236
+ # reduce
237
+ #
238
+ code = catch(:racc_jump) {
239
+ @racc_state.push _racc_do_reduce(arg, act)
240
+ false
241
+ }
242
+ if code
243
+ case code
244
+ when 1 # yyerror
245
+ @racc_user_yyerror = true # user_yyerror
246
+ return -reduce_n
247
+ when 2 # yyaccept
248
+ return shift_n
249
+ else
250
+ raise '[Racc Bug] unknown jump code'
251
+ end
252
+ end
253
+
254
+ elsif act == shift_n
255
+ #
256
+ # accept
257
+ #
258
+ racc_accept if @yydebug
259
+ throw :racc_end_parse, @racc_vstack[0]
260
+
261
+ elsif act == -reduce_n
262
+ #
263
+ # error
264
+ #
265
+ case @racc_error_status
266
+ when 0
267
+ unless arg[21] # user_yyerror
268
+ nerr += 1
269
+ on_error @racc_t, @racc_val, @racc_vstack
270
+ end
271
+ when 3
272
+ if @racc_t == 0 # is $
273
+ throw :racc_end_parse, nil
274
+ end
275
+ @racc_read_next = true
276
+ end
277
+ @racc_user_yyerror = false
278
+ @racc_error_status = 3
279
+ while true
280
+ if i = action_pointer[@racc_state[-1]]
281
+ i += 1 # error token
282
+ if i >= 0 and
283
+ (act = action_table[i]) and
284
+ action_check[i] == @racc_state[-1]
285
+ break
286
+ end
287
+ end
288
+ throw :racc_end_parse, nil if @racc_state.size <= 1
289
+ @racc_state.pop
290
+ @racc_vstack.pop
291
+ if @yydebug
292
+ @racc_tstack.pop
293
+ racc_e_pop @racc_state, @racc_tstack, @racc_vstack
294
+ end
295
+ end
296
+ return act
297
+
298
+ else
299
+ raise "[Racc Bug] unknown action #{act.inspect}"
300
+ end
301
+
302
+ racc_next_state(@racc_state[-1], @racc_state) if @yydebug
303
+
304
+ nil
305
+ end
306
+
307
+ def _racc_do_reduce(arg, act)
308
+ action_table, action_check, action_default, action_pointer,
309
+ goto_table, goto_check, goto_default, goto_pointer,
310
+ nt_base, reduce_table, token_table, shift_n,
311
+ reduce_n, use_result, * = arg
312
+ state = @racc_state
313
+ vstack = @racc_vstack
314
+ tstack = @racc_tstack
315
+
316
+ i = act * -3
317
+ len = reduce_table[i]
318
+ reduce_to = reduce_table[i+1]
319
+ method_id = reduce_table[i+2]
320
+ void_array = []
321
+
322
+ tmp_t = tstack[-len, len] if @yydebug
323
+ tmp_v = vstack[-len, len]
324
+ tstack[-len, len] = void_array if @yydebug
325
+ vstack[-len, len] = void_array
326
+ state[-len, len] = void_array
327
+
328
+ # tstack must be updated AFTER method call
329
+ if use_result
330
+ vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
331
+ else
332
+ vstack.push __send__(method_id, tmp_v, vstack)
333
+ end
334
+ tstack.push reduce_to
335
+
336
+ racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
337
+
338
+ k1 = reduce_to - nt_base
339
+ if i = goto_pointer[k1]
340
+ i += state[-1]
341
+ if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
342
+ return curstate
343
+ end
344
+ end
345
+ goto_default[k1]
346
+ end
347
+
348
+ def on_error(t, val, vstack)
349
+ raise ParseError, sprintf("\nparse error on value %s (%s)",
350
+ val.inspect, token_to_str(t) || '?')
351
+ end
352
+
353
+ def yyerror
354
+ throw :racc_jump, 1
355
+ end
356
+
357
+ def yyaccept
358
+ throw :racc_jump, 2
359
+ end
360
+
361
+ def yyerrok
362
+ @racc_error_status = 0
363
+ end
364
+
365
+ #
366
+ # for debugging output
367
+ #
368
+
369
+ def racc_read_token(t, tok, val)
370
+ @racc_debug_out.print 'read '
371
+ @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
372
+ @racc_debug_out.puts val.inspect
373
+ @racc_debug_out.puts
374
+ end
375
+
376
+ def racc_shift(tok, tstack, vstack)
377
+ @racc_debug_out.puts "shift #{racc_token2str tok}"
378
+ racc_print_stacks tstack, vstack
379
+ @racc_debug_out.puts
380
+ end
381
+
382
+ def racc_reduce(toks, sim, tstack, vstack)
383
+ out = @racc_debug_out
384
+ out.print 'reduce '
385
+ if toks.empty?
386
+ out.print ' <none>'
387
+ else
388
+ toks.each {|t| out.print ' ', racc_token2str(t) }
389
+ end
390
+ out.puts " --> #{racc_token2str(sim)}"
391
+
392
+ racc_print_stacks tstack, vstack
393
+ @racc_debug_out.puts
394
+ end
395
+
396
+ def racc_accept
397
+ @racc_debug_out.puts 'accept'
398
+ @racc_debug_out.puts
399
+ end
400
+
401
+ def racc_e_pop(state, tstack, vstack)
402
+ @racc_debug_out.puts 'error recovering mode: pop token'
403
+ racc_print_states state
404
+ racc_print_stacks tstack, vstack
405
+ @racc_debug_out.puts
406
+ end
407
+
408
+ def racc_next_state(curstate, state)
409
+ @racc_debug_out.puts "goto #{curstate}"
410
+ racc_print_states state
411
+ @racc_debug_out.puts
412
+ end
413
+
414
+ def racc_print_stacks(t, v)
415
+ out = @racc_debug_out
416
+ out.print ' ['
417
+ t.each_index do |i|
418
+ out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
419
+ end
420
+ out.puts ' ]'
421
+ end
422
+
423
+ def racc_print_states(s)
424
+ out = @racc_debug_out
425
+ out.print ' ['
426
+ s.each {|st| out.print ' ', st }
427
+ out.puts ' ]'
428
+ end
429
+
430
+ def racc_token2str(tok)
431
+ self.class::Racc_token_to_s_table[tok] or
432
+ raise "[Racc Bug] can't convert token #{tok} to string"
433
+ end
434
+
435
+ def token_to_str(t)
436
+ self.class::Racc_token_to_s_table[t]
437
+ end
438
+
439
+ end
440
+
441
+ end
442
+
443
+ __end_of_file__
444
+ end
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $
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: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $'
35
35
 
36
36
  Racc_Runtime_Core_Version_R = '1.4.6'
37
- Racc_Runtime_Core_Revision_R = '$Id$'.split[1]
37
+ Racc_Runtime_Core_Revision_R = '$Id: 3c2cf4b8b66a54ac219c7a6020e94b8668ec7e25 $'.split[1]
38
38
  begin
39
39
  require 'racc/cparse'
40
40
  # Racc_Runtime_Core_Version_C = (defined in extention)
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 4c1690f648d6f4b195cbd631a5e1af301727a241 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 3b2d89d9ada2f5fcb043837dcc5c9631856d5b70 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: 735e622baf286554d4a31d42664ea07b3a17115d $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id$
2
+ # $Id: ac1616603c3b544fd4a8922377cb566e4b64cfc9 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,60 +1,88 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: racc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.6
4
+ hash: 9
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 4
9
+ - 7
10
+ version: 1.4.7
5
11
  platform: ruby
6
12
  authors:
7
- - Aoki Minero
8
13
  - Aaron Patterson
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2009-01-02 00:00:00 -08:00
14
- default_executable:
15
- dependencies: []
16
-
17
- description: Racc is a LALR(1) parser generator. It is written in Ruby itself, and generates Ruby program.
18
- email: aaronp@rubyforge.org
18
+ date: 2011-10-19 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rake-compiler
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 13
29
+ segments:
30
+ - 0
31
+ - 4
32
+ - 1
33
+ version: 0.4.1
34
+ type: :development
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: hoe
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 27
45
+ segments:
46
+ - 2
47
+ - 12
48
+ version: "2.12"
49
+ type: :development
50
+ version_requirements: *id002
51
+ description: |-
52
+ Racc is a LALR(1) parser generator.
53
+ It is written in Ruby itself, and generates Ruby program.
54
+
55
+ NOTE: Ruby 1.8.x comes with Racc runtime module. You
56
+ can run your parsers generated by racc 1.4.x out of the
57
+ box.
58
+ email:
59
+ - aaron@tenderlovemaking.com
19
60
  executables:
20
61
  - racc
21
62
  - racc2y
22
63
  - y2racc
23
64
  extensions:
24
- - ext/racc/cparse/extconf.rb
25
- extra_rdoc_files: []
26
-
65
+ - ext/racc/extconf.rb
66
+ extra_rdoc_files:
67
+ - Manifest.txt
68
+ - README.ja.rdoc
69
+ - README.rdoc
27
70
  files:
28
- - .gitattributes
29
- - .gitignore
30
71
  - COPYING
31
72
  - ChangeLog
32
73
  - DEPENDS
33
- - README.en.rdoc
74
+ - Manifest.txt
34
75
  - README.ja.rdoc
76
+ - README.rdoc
35
77
  - Rakefile
36
78
  - TODO
37
79
  - bin/racc
38
80
  - bin/racc2y
39
81
  - bin/y2racc
40
- - doc/en/NEWS.en.rdoc
41
- - doc/en/command.en.html
42
- - doc/en/debug.en.rdoc
43
- - doc/en/grammar.en.rdoc
44
- - doc/en/index.en.html
45
- - doc/en/parser.en.rdoc
46
- - doc/en/usage.en.html
47
- - doc/ja/NEWS.ja.rdoc
48
- - doc/ja/command.ja.html
49
- - doc/ja/debug.ja.rdoc
50
- - doc/ja/grammar.ja.rdoc
51
- - doc/ja/index.ja.html
52
- - doc/ja/parser.ja.rdoc
53
- - doc/ja/usage.ja.html
54
- - ext/racc/cparse/MANIFEST
55
- - ext/racc/cparse/cparse.c
56
- - ext/racc/cparse/depend
57
- - ext/racc/cparse/extconf.rb
82
+ - ext/racc/MANIFEST
83
+ - ext/racc/cparse.c
84
+ - ext/racc/depend
85
+ - ext/racc/extconf.rb
58
86
  - fastcache/extconf.rb
59
87
  - fastcache/fastcache.c
60
88
  - lib/racc.rb
@@ -66,6 +94,7 @@ files:
66
94
  - lib/racc/info.rb
67
95
  - lib/racc/iset.rb
68
96
  - lib/racc/logfilegenerator.rb
97
+ - lib/racc/parser-text.rb
69
98
  - lib/racc/parser.rb
70
99
  - lib/racc/parserfilegenerator.rb
71
100
  - lib/racc/pre-setup
@@ -74,6 +103,20 @@ files:
74
103
  - lib/racc/statetransitiontable.rb
75
104
  - lib/racc/static.rb
76
105
  - misc/dist.sh
106
+ - rdoc/en/NEWS.en.rdoc
107
+ - rdoc/en/command.en.html
108
+ - rdoc/en/debug.en.rdoc
109
+ - rdoc/en/grammar.en.rdoc
110
+ - rdoc/en/index.en.html
111
+ - rdoc/en/parser.en.rdoc
112
+ - rdoc/en/usage.en.html
113
+ - rdoc/ja/NEWS.ja.rdoc
114
+ - rdoc/ja/command.ja.html
115
+ - rdoc/ja/debug.ja.rdoc
116
+ - rdoc/ja/grammar.ja.rdoc
117
+ - rdoc/ja/index.ja.html
118
+ - rdoc/ja/parser.ja.rdoc
119
+ - rdoc/ja/usage.ja.html
77
120
  - sample/array.y
78
121
  - sample/array2.y
79
122
  - sample/calc-ja.y
@@ -87,9 +130,6 @@ files:
87
130
  - setup.rb
88
131
  - tasks/doc.rb
89
132
  - tasks/email.rb
90
- - tasks/file.rb
91
- - tasks/gem.rb
92
- - tasks/test.rb
93
133
  - test/assets/chk.y
94
134
  - test/assets/conf.y
95
135
  - test/assets/digraph.y
@@ -133,34 +173,43 @@ files:
133
173
  - test/testscanner.rb
134
174
  - web/racc.en.rhtml
135
175
  - web/racc.ja.rhtml
136
- - lib/racc/parser-text.rb
137
- has_rdoc: true
138
- homepage: http://racc.rubyforge.org/
176
+ - .gemtest
177
+ homepage: http://i.loveruby.net/en/projects/racc/
178
+ licenses: []
179
+
139
180
  post_install_message:
140
181
  rdoc_options:
141
182
  - --main
142
- - README.en.rdoc
183
+ - README.rdoc
143
184
  require_paths:
144
185
  - lib
145
- - ext
146
186
  required_ruby_version: !ruby/object:Gem::Requirement
187
+ none: false
147
188
  requirements:
148
189
  - - ">="
149
190
  - !ruby/object:Gem::Version
191
+ hash: 3
192
+ segments:
193
+ - 0
150
194
  version: "0"
151
- version:
152
195
  required_rubygems_version: !ruby/object:Gem::Requirement
196
+ none: false
153
197
  requirements:
154
198
  - - ">="
155
199
  - !ruby/object:Gem::Version
200
+ hash: 3
201
+ segments:
202
+ - 0
156
203
  version: "0"
157
- version:
158
204
  requirements: []
159
205
 
160
206
  rubyforge_project: racc
161
- rubygems_version: 1.3.1
207
+ rubygems_version: 1.8.10
162
208
  signing_key:
163
- specification_version: 2
164
- summary: Racc is a LALR(1) parser generator.
165
- test_files: []
166
-
209
+ specification_version: 3
210
+ summary: Racc is a LALR(1) parser generator
211
+ test_files:
212
+ - test/test_chk_y.rb
213
+ - test/test_grammar_file_parser.rb
214
+ - test/test_racc_command.rb
215
+ - test/test_scan_y.rb
@@ -1,2 +0,0 @@
1
- *.rb ident
2
- *.rdoc ident
data/.gitignore DELETED
@@ -1,7 +0,0 @@
1
- *.swp
2
- *.o
3
- *.bundle
4
- *.so
5
- lib/racc/parser-text.rb
6
- Makefile
7
- tags
@@ -1,7 +0,0 @@
1
- # $Id$
2
-
3
- ENV["ARCHFLAGS"] = "-arch #{`uname -p` =~ /powerpc/ ? 'ppc' : 'i386'}"
4
-
5
- require 'mkmf'
6
-
7
- create_makefile 'racc/cparse/cparse'
@@ -1,37 +0,0 @@
1
- kind = Config::CONFIG['DLEXT']
2
-
3
- EXT = "ext/racc/cparse/cparse.#{kind}"
4
- [
5
- EXT,
6
- 'lib/racc/parser-text.rb',
7
- 'ext/racc/cparse/Makefile',
8
- 'ext/racc/cparse/*.o',
9
- ].each { |f| Dir[f].each { |file| CLEAN << file } }
10
-
11
- file 'lib/racc/parser.rb'
12
-
13
- file 'lib/racc/parser-text.rb' => ['lib/racc/parser.rb'] do |t|
14
- File.open(t.name, 'wb') { |file|
15
- file.write(<<-eorb)
16
- module Racc
17
- PARSER_TEXT = <<'__end_of_file__'
18
- #{File.read(t.prerequisites.first)}
19
- __end_of_file__
20
- end
21
- eorb
22
- }
23
- end
24
-
25
- task 'ext/racc/cparse/Makefile' do
26
- Dir.chdir('ext/racc/cparse') do
27
- ruby "extconf.rb"
28
- end
29
- end
30
-
31
- task EXT => 'ext/racc/cparse/Makefile' do
32
- Dir.chdir('ext/racc/cparse') do
33
- sh 'make'
34
- end
35
- end
36
-
37
- task :build => ['lib/racc/parser-text.rb', EXT]
@@ -1,37 +0,0 @@
1
- SPEC = Gem::Specification.new do |s|
2
- s.platform = Gem::Platform::RUBY
3
- s.summary = "Racc is a LALR(1) parser generator."
4
- s.name = 'racc'
5
- s.authors << 'Aoki Minero'
6
- s.authors << 'Aaron Patterson'
7
- s.email = 'aaronp@rubyforge.org'
8
- s.version = Racc::Parser::Racc_Runtime_Version
9
- s.require_paths = Dir['{lib,ext}']
10
- s.extensions = ['ext/racc/cparse/extconf.rb']
11
- s.files = `git ls-files`.split("\n") + ['lib/racc/parser-text.rb']
12
- s.homepage = 'http://racc.rubyforge.org/'
13
- s.rdoc_options = ['--main', 'README.en.rdoc']
14
- s.has_rdoc = true
15
- s.rubyforge_project = s.name
16
- s.executables = s.files.grep(/^bin/) { |f| File.basename(f) }
17
- s.bindir = "bin"
18
- s.description = <<EOF
19
- Racc is a LALR(1) parser generator.
20
- It is written in Ruby itself, and generates Ruby program.
21
- EOF
22
- end
23
-
24
- namespace :gem do
25
- namespace :dev do
26
- task :spec => SPEC.files do
27
- File.open("#{SPEC.name}.gemspec", 'w') do |f|
28
- SPEC.version = "#{SPEC.version}.#{Time.now.strftime("%Y%m%d%H%M%S")}"
29
- f.write(SPEC.to_ruby)
30
- end
31
- end
32
- end
33
- end
34
-
35
- Rake::GemPackageTask.new(SPEC) do |pkg|
36
- pkg.need_tar = true
37
- end
@@ -1,16 +0,0 @@
1
- namespace :test do
2
- task :multi do
3
- sh 'multiruby -S rake clean test'
4
- end
5
- end
6
-
7
- Rake::TestTask.new do |t|
8
- %w[ ext lib ].each do |dir|
9
- t.libs << dir
10
- end
11
-
12
- t.test_files = FileList['test/test_*.rb']
13
- t.verbose = true
14
- end
15
-
16
- Rake::Task[:test].prerequisites << :build