racc 1.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/.gitattributes +2 -0
  2. data/.gitignore +7 -0
  3. data/COPYING +515 -0
  4. data/ChangeLog +846 -0
  5. data/DEPENDS +4 -0
  6. data/README.en.rdoc +86 -0
  7. data/README.ja.rdoc +96 -0
  8. data/Rakefile +15 -0
  9. data/TODO +5 -0
  10. data/bin/racc +308 -0
  11. data/bin/racc2y +195 -0
  12. data/bin/y2racc +339 -0
  13. data/doc/en/NEWS.en.rdoc +282 -0
  14. data/doc/en/command.en.html +78 -0
  15. data/doc/en/debug.en.rdoc +20 -0
  16. data/doc/en/grammar.en.rdoc +230 -0
  17. data/doc/en/index.en.html +10 -0
  18. data/doc/en/parser.en.rdoc +74 -0
  19. data/doc/en/usage.en.html +92 -0
  20. data/doc/ja/NEWS.ja.rdoc +307 -0
  21. data/doc/ja/command.ja.html +94 -0
  22. data/doc/ja/debug.ja.rdoc +36 -0
  23. data/doc/ja/grammar.ja.rdoc +348 -0
  24. data/doc/ja/index.ja.html +10 -0
  25. data/doc/ja/parser.ja.rdoc +125 -0
  26. data/doc/ja/usage.ja.html +414 -0
  27. data/ext/racc/cparse/MANIFEST +4 -0
  28. data/ext/racc/cparse/cparse.c +824 -0
  29. data/ext/racc/cparse/depend +1 -0
  30. data/ext/racc/cparse/extconf.rb +7 -0
  31. data/fastcache/extconf.rb +2 -0
  32. data/fastcache/fastcache.c +185 -0
  33. data/lib/racc.rb +6 -0
  34. data/lib/racc/compat.rb +40 -0
  35. data/lib/racc/debugflags.rb +59 -0
  36. data/lib/racc/exception.rb +15 -0
  37. data/lib/racc/grammar.rb +1115 -0
  38. data/lib/racc/grammarfileparser.rb +559 -0
  39. data/lib/racc/info.rb +16 -0
  40. data/lib/racc/iset.rb +91 -0
  41. data/lib/racc/logfilegenerator.rb +214 -0
  42. data/lib/racc/parser.rb +439 -0
  43. data/lib/racc/parserfilegenerator.rb +511 -0
  44. data/lib/racc/pre-setup +13 -0
  45. data/lib/racc/sourcetext.rb +34 -0
  46. data/lib/racc/state.rb +971 -0
  47. data/lib/racc/statetransitiontable.rb +316 -0
  48. data/lib/racc/static.rb +5 -0
  49. data/misc/dist.sh +31 -0
  50. data/sample/array.y +67 -0
  51. data/sample/array2.y +59 -0
  52. data/sample/calc-ja.y +66 -0
  53. data/sample/calc.y +65 -0
  54. data/sample/conflict.y +15 -0
  55. data/sample/hash.y +60 -0
  56. data/sample/lalr.y +17 -0
  57. data/sample/lists.y +57 -0
  58. data/sample/syntax.y +46 -0
  59. data/sample/yyerr.y +46 -0
  60. data/setup.rb +1587 -0
  61. data/tasks/doc.rb +12 -0
  62. data/tasks/email.rb +55 -0
  63. data/tasks/file.rb +37 -0
  64. data/tasks/gem.rb +37 -0
  65. data/tasks/test.rb +16 -0
  66. data/test/assets/chk.y +126 -0
  67. data/test/assets/conf.y +16 -0
  68. data/test/assets/digraph.y +29 -0
  69. data/test/assets/echk.y +118 -0
  70. data/test/assets/err.y +60 -0
  71. data/test/assets/expect.y +7 -0
  72. data/test/assets/firstline.y +4 -0
  73. data/test/assets/ichk.y +102 -0
  74. data/test/assets/intp.y +546 -0
  75. data/test/assets/mailp.y +437 -0
  76. data/test/assets/newsyn.y +25 -0
  77. data/test/assets/noend.y +4 -0
  78. data/test/assets/nonass.y +41 -0
  79. data/test/assets/normal.y +27 -0
  80. data/test/assets/norule.y +4 -0
  81. data/test/assets/nullbug1.y +25 -0
  82. data/test/assets/nullbug2.y +15 -0
  83. data/test/assets/opt.y +123 -0
  84. data/test/assets/percent.y +35 -0
  85. data/test/assets/recv.y +97 -0
  86. data/test/assets/rrconf.y +14 -0
  87. data/test/assets/scan.y +72 -0
  88. data/test/assets/syntax.y +50 -0
  89. data/test/assets/unterm.y +5 -0
  90. data/test/assets/useless.y +12 -0
  91. data/test/assets/yyerr.y +46 -0
  92. data/test/bench.y +36 -0
  93. data/test/helper.rb +88 -0
  94. data/test/infini.y +8 -0
  95. data/test/scandata/brace +7 -0
  96. data/test/scandata/gvar +1 -0
  97. data/test/scandata/normal +4 -0
  98. data/test/scandata/percent +18 -0
  99. data/test/scandata/slash +10 -0
  100. data/test/src.intp +34 -0
  101. data/test/start.y +20 -0
  102. data/test/test_chk_y.rb +51 -0
  103. data/test/test_grammar_file_parser.rb +15 -0
  104. data/test/test_racc_command.rb +155 -0
  105. data/test/test_scan_y.rb +51 -0
  106. data/test/testscanner.rb +51 -0
  107. data/web/racc.en.rhtml +42 -0
  108. data/web/racc.ja.rhtml +51 -0
  109. metadata +166 -0
@@ -0,0 +1,51 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
+
3
+ module Racc
4
+ class TestScanY < TestCase
5
+ def setup
6
+ file = File.join(ASSET_DIR, 'scan.y')
7
+ @debug_flags = Racc::DebugFlags.parse_option_string('o')
8
+ parser = Racc::GrammarFileParser.new(@debug_flags)
9
+ @result = parser.parse(File.read(file), File.basename(file))
10
+ @states = Racc::States.new(@result.grammar).nfa
11
+ @states.dfa
12
+ end
13
+
14
+ def test_compile
15
+ generator = Racc::ParserFileGenerator.new(@states, @result.params.dup)
16
+
17
+ fork {
18
+ eval(generator.generate_parser)
19
+ }
20
+ Process.wait
21
+ assert_equal 0, $?.exitstatus
22
+
23
+ grammar = @states.grammar
24
+
25
+ assert_equal 0, @states.n_srconflicts
26
+ assert_equal 0, @states.n_rrconflicts
27
+ assert_equal 0, grammar.n_useless_nonterminals
28
+ assert_equal 0, grammar.n_useless_rules
29
+ assert_nil grammar.n_expected_srconflicts
30
+ end
31
+
32
+ def test_compile_line_convert
33
+ params = @result.params.dup
34
+ params.convert_line_all = true
35
+
36
+ generator = Racc::ParserFileGenerator.new(@states, @result.params.dup)
37
+
38
+ fork { eval(generator.generate_parser) }
39
+ assert_equal 0, $?.exitstatus
40
+ Process.wait
41
+
42
+ grammar = @states.grammar
43
+
44
+ assert_equal 0, @states.n_srconflicts
45
+ assert_equal 0, @states.n_rrconflicts
46
+ assert_equal 0, grammar.n_useless_nonterminals
47
+ assert_equal 0, grammar.n_useless_rules
48
+ assert_nil grammar.n_expected_srconflicts
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,51 @@
1
+ #
2
+ # racc scanner tester
3
+ #
4
+
5
+ require 'racc/raccs'
6
+
7
+
8
+ class ScanError < StandardError; end
9
+
10
+ def testdata( dir, argv )
11
+ if argv.empty? then
12
+ Dir.glob( dir + '/*' ) -
13
+ Dir.glob( dir + '/*.swp' ) -
14
+ [ dir + '/CVS' ]
15
+ else
16
+ argv.collect {|i| dir + '/' + i }
17
+ end
18
+ end
19
+
20
+
21
+ if ARGV.delete '--print' then
22
+ $raccs_print_type = true
23
+ printonly = true
24
+ else
25
+ printonly = false
26
+ end
27
+
28
+ testdata( File.dirname($0) + '/scandata', ARGV ).each do |file|
29
+ $stderr.print File.basename(file) + ': '
30
+ begin
31
+ ok = File.read(file)
32
+ s = Racc::GrammarFileScanner.new( ok )
33
+ sym, (val, lineno) = s.scan
34
+ if printonly then
35
+ $stderr.puts
36
+ $stderr.puts val
37
+ next
38
+ end
39
+
40
+ val = '{' + val + "}\n"
41
+ sym == :ACTION or raise ScanError, 'is not action!'
42
+ val == ok or raise ScanError, "\n>>>\n#{ok}----\n#{val}<<<"
43
+
44
+ $stderr.puts 'ok'
45
+ rescue => err
46
+ $stderr.puts 'fail (' + err.type.to_s + ')'
47
+ $stderr.puts err.message
48
+ $stderr.puts err.backtrace
49
+ $stderr.puts
50
+ end
51
+ end
@@ -0,0 +1,42 @@
1
+ % require 'makefile'
2
+ % version = Makefile.get_parameter('Makefile', 'version')
3
+ <h1>Racc</h1>
4
+ <p>
5
+ $Id$
6
+ </p>
7
+
8
+ <table summary="package descriptor">
9
+ <tr><th>Version</th><td><%= version %></td></tr>
10
+ <tr><th>Type</th><td>Parser Generator</td></tr>
11
+ <tr><th>Format</th><td>Ruby script + Ruby extention</td></tr>
12
+ <tr><th>Requirement</th><td>ruby (&gt;=1.6)</td></tr>
13
+ <tr><th>License</th><td>LGPL</td></tr>
14
+ </table>
15
+ <p>
16
+ -- <a href="/archive/racc/racc-<%= version %>-all.tar.gz">Download (.tar.gz)</a>
17
+ -- <a href="/archive/racc/">Old Versions</a>
18
+ -- <a href="doc/">Online Manual</a>
19
+ --
20
+ </p>
21
+
22
+ <p>
23
+ Racc (Ruby yACC) is a LALR(1) parser generator for Ruby.
24
+ Version 1.4.x is stable release.
25
+ </p>
26
+ <p>
27
+ Parsers generated by Racc requires "Racc Runtime Module".
28
+ Ruby 1.8.x comes with this runtime.
29
+ If you want to run your parsers with ruby 1.6.x,
30
+ use "racc -E" command. For details, see <a href="doc/">online manual</a>.
31
+ </p>
32
+
33
+ <h2>Anonymous CVS</h2>
34
+ <p>
35
+ You can true latest version of Racc via anonymous CVS.
36
+ To check out working copy, type:
37
+ </p>
38
+ <pre>
39
+ $ cvs -d :pserver:anonymous@cvs.loveruby.net:/src login
40
+ Password: (Just hit [Enter])
41
+ $ cvs -d :pserver:anonymous@cvs.loveruby.net:/src co racc
42
+ </pre>
@@ -0,0 +1,51 @@
1
+ % require 'makefile'
2
+ % version = Makefile.get_parameter('Makefile', 'version')
3
+ <h1>Racc</h1>
4
+ <p>
5
+ $Id$
6
+ </p>
7
+ <table summary="package descriptor">
8
+ <tr><th>�ǿ���</th><td><%= version %></td></tr>
9
+ <tr><th>����</th><td>parser generator</td></tr>
10
+ <tr><th>����</th><td>ruby script, ruby extention</td></tr>
11
+ <tr><th>ɬ�״Ķ�</th><td>ruby (&gt;=1.6)</td></tr>
12
+ <tr><th>���۾��</th><td>LGPL</td></tr>
13
+ </table>
14
+ <ul>
15
+ <li><a href="/archive/racc/racc-<%= version %>-all.tar.gz">�����������</a></li>
16
+ <li><a href="/archive/racc/">��С������ꥹ��</a></li>
17
+ <li><a href="doc/">����饤��ޥ˥奢��</a></li>
18
+ </ul>
19
+ </p>
20
+ <p>
21
+ Ruby �Ѥ� LALR(1) �ѡ��������ͥ졼���Ǥ���
22
+ ���������ѡ����Ϥ���ʤ�˹�®��ư��ޤ���
23
+ </p>
24
+ <p>
25
+ Racc �����������ѡ�����ư����˥�󥿥���⥸�塼�뤬ɬ�פǤ���
26
+ Ruby 1.8 �ˤϤ��Υ�󥿥��ब�ǽ餫��ź�դ���Ƥ���Τ�
27
+ ����ͤ��ʤ�������פǤ�����Ruby 1.6 �������оݤˤ���Ȥ���
28
+ racc -E �ǥѡ�������������ɬ�פ�����ޤ���
29
+ </p>
30
+ <p>
31
+ �ʤ���Racc 1.4.x �Υ�󥿥���� Ruby 1.8 ź�դ� Racc ��󥿥���ϡ�
32
+ �����������ɾ�Ǥ���̯�˰㤤������ޤ����������˸ߴ���������ޤ���
33
+ </p>
34
+
35
+ <h2>����</h2>
36
+ <p>
37
+ �⤦����Ū����ʬ�ϸϤ�Ƥ���Ϥ��Ǥ���
38
+ TODO �Ϥޤ������Ĥ�����ޤ�������������¾�ˤ��äƤ�Τ�
39
+ ��ʬ���礭���ѹ�����Ĥ��Ϥ���ޤ���
40
+ </p>
41
+
42
+ <h2>CVS ��ݥ��ȥ�</h2>
43
+ <p>
44
+ CVS ��Ȥ��� Racc �ο��κǿ��Ǥ�����Ǥ��ޤ���
45
+ ���ޥ�ɥ饤��Ǽ��Τ褦���ǤäƤ���������
46
+ </p>
47
+ <pre>
48
+ $ cvs -d :pserver:anonymous@cvs.loveruby.net:/src login
49
+ Password: (������Enter���Ǥ�)
50
+ $ cvs -d :pserver:anonymous@cvs.loveruby.net:/src co racc
51
+ </pre>
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: racc
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.6
5
+ platform: ruby
6
+ authors:
7
+ - Aoki Minero
8
+ - Aaron Patterson
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+
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
19
+ executables:
20
+ - racc
21
+ - racc2y
22
+ - y2racc
23
+ extensions:
24
+ - ext/racc/cparse/extconf.rb
25
+ extra_rdoc_files: []
26
+
27
+ files:
28
+ - .gitattributes
29
+ - .gitignore
30
+ - COPYING
31
+ - ChangeLog
32
+ - DEPENDS
33
+ - README.en.rdoc
34
+ - README.ja.rdoc
35
+ - Rakefile
36
+ - TODO
37
+ - bin/racc
38
+ - bin/racc2y
39
+ - 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
58
+ - fastcache/extconf.rb
59
+ - fastcache/fastcache.c
60
+ - lib/racc.rb
61
+ - lib/racc/compat.rb
62
+ - lib/racc/debugflags.rb
63
+ - lib/racc/exception.rb
64
+ - lib/racc/grammar.rb
65
+ - lib/racc/grammarfileparser.rb
66
+ - lib/racc/info.rb
67
+ - lib/racc/iset.rb
68
+ - lib/racc/logfilegenerator.rb
69
+ - lib/racc/parser.rb
70
+ - lib/racc/parserfilegenerator.rb
71
+ - lib/racc/pre-setup
72
+ - lib/racc/sourcetext.rb
73
+ - lib/racc/state.rb
74
+ - lib/racc/statetransitiontable.rb
75
+ - lib/racc/static.rb
76
+ - misc/dist.sh
77
+ - sample/array.y
78
+ - sample/array2.y
79
+ - sample/calc-ja.y
80
+ - sample/calc.y
81
+ - sample/conflict.y
82
+ - sample/hash.y
83
+ - sample/lalr.y
84
+ - sample/lists.y
85
+ - sample/syntax.y
86
+ - sample/yyerr.y
87
+ - setup.rb
88
+ - tasks/doc.rb
89
+ - tasks/email.rb
90
+ - tasks/file.rb
91
+ - tasks/gem.rb
92
+ - tasks/test.rb
93
+ - test/assets/chk.y
94
+ - test/assets/conf.y
95
+ - test/assets/digraph.y
96
+ - test/assets/echk.y
97
+ - test/assets/err.y
98
+ - test/assets/expect.y
99
+ - test/assets/firstline.y
100
+ - test/assets/ichk.y
101
+ - test/assets/intp.y
102
+ - test/assets/mailp.y
103
+ - test/assets/newsyn.y
104
+ - test/assets/noend.y
105
+ - test/assets/nonass.y
106
+ - test/assets/normal.y
107
+ - test/assets/norule.y
108
+ - test/assets/nullbug1.y
109
+ - test/assets/nullbug2.y
110
+ - test/assets/opt.y
111
+ - test/assets/percent.y
112
+ - test/assets/recv.y
113
+ - test/assets/rrconf.y
114
+ - test/assets/scan.y
115
+ - test/assets/syntax.y
116
+ - test/assets/unterm.y
117
+ - test/assets/useless.y
118
+ - test/assets/yyerr.y
119
+ - test/bench.y
120
+ - test/helper.rb
121
+ - test/infini.y
122
+ - test/scandata/brace
123
+ - test/scandata/gvar
124
+ - test/scandata/normal
125
+ - test/scandata/percent
126
+ - test/scandata/slash
127
+ - test/src.intp
128
+ - test/start.y
129
+ - test/test_chk_y.rb
130
+ - test/test_grammar_file_parser.rb
131
+ - test/test_racc_command.rb
132
+ - test/test_scan_y.rb
133
+ - test/testscanner.rb
134
+ - web/racc.en.rhtml
135
+ - web/racc.ja.rhtml
136
+ - lib/racc/parser-text.rb
137
+ has_rdoc: true
138
+ homepage: http://racc.rubyforge.org/
139
+ post_install_message:
140
+ rdoc_options:
141
+ - --main
142
+ - README.en.rdoc
143
+ require_paths:
144
+ - lib
145
+ - ext
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - ">="
149
+ - !ruby/object:Gem::Version
150
+ version: "0"
151
+ version:
152
+ required_rubygems_version: !ruby/object:Gem::Requirement
153
+ requirements:
154
+ - - ">="
155
+ - !ruby/object:Gem::Version
156
+ version: "0"
157
+ version:
158
+ requirements: []
159
+
160
+ rubyforge_project: racc
161
+ rubygems_version: 1.3.1
162
+ signing_key:
163
+ specification_version: 2
164
+ summary: Racc is a LALR(1) parser generator.
165
+ test_files: []
166
+