racc 1.4.15-java → 1.4.16-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/COPYING +22 -515
  3. data/Manifest.txt +3 -9
  4. data/README.ja.rdoc +3 -4
  5. data/README.rdoc +4 -4
  6. data/Rakefile +13 -55
  7. data/bin/racc +2 -4
  8. data/ext/racc/{cparse.c → cparse/cparse.c} +64 -31
  9. data/ext/racc/cparse/extconf.rb +8 -0
  10. data/lib/racc/cparse-jruby.jar +0 -0
  11. data/lib/racc/exception.rb +3 -5
  12. data/lib/racc/grammar.rb +5 -7
  13. data/lib/racc/grammarfileparser.rb +4 -3
  14. data/lib/racc/info.rb +4 -6
  15. data/lib/racc/iset.rb +2 -2
  16. data/lib/racc/logfilegenerator.rb +2 -2
  17. data/lib/racc/parser-text.rb +14 -11
  18. data/lib/racc/parser.rb +14 -11
  19. data/lib/racc/parserfilegenerator.rb +5 -7
  20. data/lib/racc/state.rb +11 -13
  21. data/test/assets/intp.y +4 -4
  22. data/test/assets/mailp.y +27 -27
  23. data/test/assets/mof.y +12 -12
  24. data/test/assets/nullbug2.y +2 -2
  25. data/test/assets/recv.y +20 -20
  26. data/test/assets/syntax.y +1 -1
  27. data/test/assets/twowaysql.y +1 -1
  28. data/test/helper.rb +65 -54
  29. data/test/regress/cadenza +60 -60
  30. data/test/regress/cast +8 -8
  31. data/test/regress/csspool +167 -167
  32. data/test/regress/edtf +115 -115
  33. data/test/regress/huia +75 -75
  34. data/test/regress/journey +12 -12
  35. data/test/regress/liquor +54 -54
  36. data/test/regress/machete +37 -37
  37. data/test/regress/mediacloth +83 -83
  38. data/test/regress/mof +60 -60
  39. data/test/regress/namae +29 -29
  40. data/test/regress/nasl +174 -174
  41. data/test/regress/nokogiri-css +59 -59
  42. data/test/regress/opal +352 -352
  43. data/test/regress/php_serialization +20 -20
  44. data/test/regress/riml +261 -261
  45. data/test/regress/ruby18 +353 -353
  46. data/test/regress/ruby22 +433 -433
  47. data/test/regress/tp_plus +125 -125
  48. data/test/regress/twowaysql +30 -30
  49. data/test/test_chk_y.rb +1 -0
  50. data/test/test_racc_command.rb +5 -24
  51. data/test/test_scan_y.rb +1 -0
  52. data/test/testscanner.rb +1 -1
  53. metadata +8 -75
  54. data/ext/racc/depend +0 -1
  55. data/ext/racc/extconf.rb +0 -7
  56. data/test/assets/bibtex.y +0 -141
  57. data/test/assets/rdblockparser.y +0 -576
  58. data/test/assets/rdinlineparser.y +0 -561
  59. data/test/regress/bibtex +0 -474
  60. data/test/regress/rdblockparser +0 -1061
  61. data/test/regress/rdinlineparser +0 -1243
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: false
2
+ # $Id: a9187b5bc40e6adf05e7b6ee5b370b39a3429ecd $
3
+
4
+ require 'mkmf'
5
+
6
+ have_func('rb_ary_subseq')
7
+
8
+ create_makefile 'racc/cparse'
Binary file
@@ -1,13 +1,11 @@
1
1
  #
2
- # $Id: a26517cc7b6a673ce1985c8c75fba88492e1e820 $
2
+ # $Id: ebb9798ad0b211e031670a12a1ab154678c1c8f3 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
6
6
  # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- # For details of the GNU LGPL, see the file "COPYING".
10
- #
7
+ # You can distribute/modify this program under the same terms of ruby.
8
+ # see the file "COPYING".
11
9
 
12
10
  module Racc
13
11
  class Error < StandardError; end
@@ -1,13 +1,11 @@
1
1
  #
2
- # $Id: 733f7084ff1dca50994cba55c8a05aba8d82eb31 $
2
+ # $Id: 3fcabd58bef02540bf78e8142469681cb9f975c2 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
6
6
  # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- # For details of the GNU LGPL, see the file "COPYING".
10
- #
7
+ # You can distribute/modify this program under the same terms of ruby.
8
+ # see the file "COPYING".
11
9
 
12
10
  require 'racc/compat'
13
11
  require 'racc/iset'
@@ -571,7 +569,7 @@ module Racc
571
569
  check_symbols_useless s
572
570
  end until r.size == rs and s.size == ss
573
571
  end
574
-
572
+
575
573
  def check_rules_useless(rules)
576
574
  rules.delete_if do |rule|
577
575
  rule.useless = false
@@ -855,7 +853,7 @@ module Racc
855
853
  end
856
854
 
857
855
  private
858
-
856
+
859
857
  def ptr_bug!
860
858
  raise "racc: fatal: pointer not exist: self: #{to_s}"
861
859
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id: 5e1871defa15d288d2252e6a76bb2c4cf2119ed3 $
2
+ # $Id: 63bd084db2dce8a2c9760318faae6104717cead7 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -284,7 +284,7 @@ module Racc
284
284
  end
285
285
  label
286
286
  end
287
-
287
+
288
288
  def add_user_code(label, src)
289
289
  @result.params.send(USER_CODE_LABELS[label]).push src
290
290
  end
@@ -295,7 +295,7 @@ module Racc
295
295
  class GrammarFileScanner
296
296
 
297
297
  def initialize(str, filename = '-')
298
- @lines = str.split(/\n|\r\n|\r/)
298
+ @lines = str.b.split(/\n|\r\n|\r/)
299
299
  @filename = filename
300
300
  @lineno = -1
301
301
  @line_head = true
@@ -450,6 +450,7 @@ module Racc
450
450
  nest -= 1
451
451
  if nest == 0
452
452
  @in_block = nil
453
+ buf.sub!(/[ \t\f]+\z/, '')
453
454
  return buf
454
455
  end
455
456
  buf << (pre = ch)
@@ -1,16 +1,14 @@
1
1
  #
2
- # $Id: 6c7f0a682cba7c1dce1b4e63faeca2b8c7cdf7c7 $
2
+ # $Id: 9479ae04c6714b9f3eba0c6c98bc58efc82a219c $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
6
6
  # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- # For details of the GNU LGPL, see the file "COPYING".
10
- #
7
+ # You can distribute/modify this program under the same terms of ruby.
8
+ # see the file "COPYING".
11
9
 
12
10
  module Racc
13
- VERSION = '1.4.15'
11
+ VERSION = '1.4.16'
14
12
  Version = VERSION
15
13
  Copyright = 'Copyright (c) 1999-2006 Minero Aoki'
16
14
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id: de638608cfd72d3ed9819d87b65a89ee6a57b589 $
2
+ # $Id: 31aa4331c08dfd4609c06eb5f94b7ef38dc708e1 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -85,7 +85,7 @@ module Racc
85
85
  def dup
86
86
  ISet.new(@set.dup)
87
87
  end
88
-
88
+
89
89
  end # class ISet
90
90
 
91
91
  end # module Racc
@@ -1,5 +1,5 @@
1
1
  #
2
- # $Id: a7e9663605afdda065d305b250a9805e3bd3fa70 $
2
+ # $Id: 5e9d0a01b5d56fd9cdc3d5cb078b1a3e1bbaf779 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
@@ -132,7 +132,7 @@ module Racc
132
132
  def outact(f, t, act)
133
133
  case act
134
134
  when Shift
135
- f.printf " %-12s shift, and go to state %d\n",
135
+ f.printf " %-12s shift, and go to state %d\n",
136
136
  t.to_s, act.goto_id
137
137
  when Reduce
138
138
  f.printf " %-12s reduce using rule %d (%s)\n",
@@ -1,8 +1,7 @@
1
1
  module Racc
2
2
  PARSER_TEXT = <<'__end_of_file__'
3
- #
4
- # $Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $
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
 
@@ -45,7 +44,7 @@ end
45
44
  # [--version] [--copyright] [--help] <var>grammarfile</var>
46
45
  #
47
46
  # [+filename+]
48
- # Racc grammar file. Any extention is permitted.
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 grammer file and quit.
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,7 +177,7 @@ 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 LGPL, but your parser is not.
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
 
@@ -189,10 +188,10 @@ module Racc
189
188
  class Parser
190
189
 
191
190
  Racc_Runtime_Version = ::Racc::VERSION
192
- Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
191
+ Racc_Runtime_Revision = '$Id: e754525bd317344c4284fca6fdce0a425979ade1 $'
193
192
 
194
193
  Racc_Runtime_Core_Version_R = ::Racc::VERSION
195
- Racc_Runtime_Core_Revision_R = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'.split[1]
194
+ Racc_Runtime_Core_Revision_R = '$Id: e754525bd317344c4284fca6fdce0a425979ade1 $'.split[1]
196
195
  begin
197
196
  if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
198
197
  require 'racc/cparse-jruby.jar'
@@ -269,9 +268,11 @@ puts $!.backtrace
269
268
  # def next_token
270
269
  # @q.shift
271
270
  # end
271
+ class_eval %{
272
272
  def do_parse
273
- __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
273
+ #{Racc_Main_Parsing_Routine}(_racc_setup(), false)
274
274
  end
275
+ }
275
276
 
276
277
  # The method to fetch next token.
277
278
  # If you use #do_parse method, you must implement #next_token.
@@ -329,9 +330,11 @@ puts $!.backtrace
329
330
  #
330
331
  # RECEIVER#METHOD_ID is a method to get next token.
331
332
  # It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
333
+ class_eval %{
332
334
  def yyparse(recv, mid)
333
- __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), false)
335
+ #{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), true)
334
336
  end
337
+ }
335
338
 
336
339
  def _racc_yyparse_rb(recv, mid, arg, c_debug)
337
340
  action_table, action_check, action_default, action_pointer,
@@ -1,6 +1,5 @@
1
- #
2
- # $Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $
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
 
@@ -43,7 +42,7 @@ end
43
42
  # [--version] [--copyright] [--help] <var>grammarfile</var>
44
43
  #
45
44
  # [+filename+]
46
- # Racc grammar file. Any extention is permitted.
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 grammer file and quit.
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,7 +175,7 @@ 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 LGPL, but your parser is not.
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
 
@@ -187,10 +186,10 @@ module Racc
187
186
  class Parser
188
187
 
189
188
  Racc_Runtime_Version = ::Racc::VERSION
190
- Racc_Runtime_Revision = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'
189
+ Racc_Runtime_Revision = '$Id: e754525bd317344c4284fca6fdce0a425979ade1 $'
191
190
 
192
191
  Racc_Runtime_Core_Version_R = ::Racc::VERSION
193
- Racc_Runtime_Core_Revision_R = '$Id: 2bd697d1146b280d8d3878e21e556ef769484a37 $'.split[1]
192
+ Racc_Runtime_Core_Revision_R = '$Id: e754525bd317344c4284fca6fdce0a425979ade1 $'.split[1]
194
193
  begin
195
194
  if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == 'jruby'
196
195
  require 'racc/cparse-jruby.jar'
@@ -267,9 +266,11 @@ puts $!.backtrace
267
266
  # def next_token
268
267
  # @q.shift
269
268
  # end
269
+ class_eval %{
270
270
  def do_parse
271
- __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
271
+ #{Racc_Main_Parsing_Routine}(_racc_setup(), false)
272
272
  end
273
+ }
273
274
 
274
275
  # The method to fetch next token.
275
276
  # If you use #do_parse method, you must implement #next_token.
@@ -327,9 +328,11 @@ puts $!.backtrace
327
328
  #
328
329
  # RECEIVER#METHOD_ID is a method to get next token.
329
330
  # It must 'yield' the token, which format is [TOKEN-SYMBOL, VALUE].
331
+ class_eval %{
330
332
  def yyparse(recv, mid)
331
- __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), false)
333
+ #{Racc_YY_Parse_Method}(recv, mid, _racc_setup(), true)
332
334
  end
335
+ }
333
336
 
334
337
  def _racc_yyparse_rb(recv, mid, arg, c_debug)
335
338
  action_table, action_check, action_default, action_pointer,
@@ -1,13 +1,11 @@
1
1
  #
2
- # $Id: f2d2788af2323ada1913f1dad5fea8aae4cc6830 $
2
+ # $Id: fff07ebfd582f8dbc845e424908cb9f41f8bf42f $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
6
6
  # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- # For details of the GNU LGPL, see the file "COPYING".
10
- #
7
+ # You can distribute/modify this program under the same terms of ruby.
8
+ # see the file "COPYING".
11
9
 
12
10
  require 'enumerator'
13
11
  require 'racc/compat'
@@ -125,7 +123,7 @@ module Racc
125
123
  line %q[#]
126
124
  line %q[# DO NOT MODIFY!!!!]
127
125
  line %Q[# This file is automatically generated by Racc #{Racc::Version}]
128
- line %Q[# from Racc grammer file "#{@params.filename}".]
126
+ line %Q[# from Racc grammar file "#{@params.filename}".]
129
127
  line %q[#]
130
128
  end
131
129
 
@@ -159,8 +157,8 @@ module Racc
159
157
  cref_pop
160
158
  indent; line "end \# class #{classid}"
161
159
  mods.reverse_each do |mod|
162
- indent; line "end \# module #{mod}"
163
160
  cref_pop
161
+ indent; line "end \# module #{mod}"
164
162
  end
165
163
  end
166
164
 
@@ -1,13 +1,11 @@
1
1
  #
2
- # $Id: 735e622baf286554d4a31d42664ea07b3a17115d $
2
+ # $Id: 6bd3136439c94cb8d928917f5e0de9c593181527 $
3
3
  #
4
4
  # Copyright (c) 1999-2006 Minero Aoki
5
5
  #
6
6
  # This program is free software.
7
- # You can distribute/modify this program under the terms of
8
- # the GNU LGPL, Lesser General Public License version 2.1.
9
- # For details of the GNU LGPL, see the file "COPYING".
10
- #
7
+ # You can distribute/modify this program under the same terms of ruby.
8
+ # see the file "COPYING".
11
9
 
12
10
  require 'racc/iset'
13
11
  require 'racc/statetransitiontable'
@@ -170,7 +168,7 @@ module Racc
170
168
  @states.push dest
171
169
 
172
170
  @statecache[k] = dest
173
-
171
+
174
172
  puts "core_to_state: create state ID #{dest.ident}" if @d_state
175
173
  else
176
174
  if @d_state
@@ -308,7 +306,7 @@ module Racc
308
306
 
309
307
  la
310
308
  end
311
-
309
+
312
310
  def create_tmap(size)
313
311
  Array.new(size, 0) # use Integer as bitmap
314
312
  end
@@ -512,13 +510,13 @@ module Racc
512
510
  end
513
511
  end
514
512
  end
515
-
513
+
516
514
  ASSOC = {
517
515
  :Left => :Reduce,
518
516
  :Right => :Shift,
519
517
  :Nonassoc => :Error
520
518
  }
521
-
519
+
522
520
  def do_resolve_sr(stok, rtok)
523
521
  puts "resolve_sr: s/r conflict: rtok=#{rtok}, stok=#{stok}" if @d_prec
524
522
 
@@ -775,7 +773,7 @@ module Racc
775
773
  attr_reader :symbol
776
774
  attr_reader :from_state
777
775
  attr_reader :to_state
778
-
776
+
779
777
  def inspect
780
778
  "(#{@from_state.ident}-#{@symbol}->#{@to_state.ident})"
781
779
  end
@@ -938,11 +936,11 @@ module Racc
938
936
  @shift = shift
939
937
  @reduce = reduce
940
938
  end
941
-
939
+
942
940
  attr_reader :stateid
943
941
  attr_reader :shift
944
942
  attr_reader :reduce
945
-
943
+
946
944
  def to_s
947
945
  sprintf('state %d: S/R conflict rule %d reduce and shift %s',
948
946
  @stateid, @reduce.ruleid, @shift.to_s)
@@ -961,7 +959,7 @@ module Racc
961
959
  attr_reader :high_prec
962
960
  attr_reader :low_prec
963
961
  attr_reader :token
964
-
962
+
965
963
  def to_s
966
964
  sprintf('state %d: R/R conflict with rule %d and %d on %s',
967
965
  @stateid, @high_prec.ident, @low_prec.ident, @token.to_s)
@@ -27,7 +27,7 @@ rule
27
27
  result.push val[1]
28
28
  }
29
29
  | stmt_list EOL
30
-
30
+
31
31
  stmt : expr
32
32
  | assign
33
33
  | IDENT realprim
@@ -38,7 +38,7 @@ rule
38
38
  | if_stmt
39
39
  | while_stmt
40
40
  | defun
41
-
41
+
42
42
  if_stmt : IF stmt THEN EOL stmt_list else_stmt END
43
43
  {
44
44
  result = IfNode.new( @fname, val[0][0],
@@ -261,7 +261,7 @@ module Intp
261
261
 
262
262
  class Core
263
263
 
264
- def initialize
264
+ def initialize
265
265
  @ftab = {}
266
266
  @obj = Object.new
267
267
  @stack = []
@@ -318,7 +318,7 @@ module Intp
318
318
  def lvar?(name)
319
319
  @lvars.key? name
320
320
  end
321
-
321
+
322
322
  def [](key)
323
323
  @lvars[key]
324
324
  end