racc 1.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitattributes +2 -0
- data/.gitignore +7 -0
- data/COPYING +515 -0
- data/ChangeLog +846 -0
- data/DEPENDS +4 -0
- data/README.en.rdoc +86 -0
- data/README.ja.rdoc +96 -0
- data/Rakefile +15 -0
- data/TODO +5 -0
- data/bin/racc +308 -0
- data/bin/racc2y +195 -0
- data/bin/y2racc +339 -0
- data/doc/en/NEWS.en.rdoc +282 -0
- data/doc/en/command.en.html +78 -0
- data/doc/en/debug.en.rdoc +20 -0
- data/doc/en/grammar.en.rdoc +230 -0
- data/doc/en/index.en.html +10 -0
- data/doc/en/parser.en.rdoc +74 -0
- data/doc/en/usage.en.html +92 -0
- data/doc/ja/NEWS.ja.rdoc +307 -0
- data/doc/ja/command.ja.html +94 -0
- data/doc/ja/debug.ja.rdoc +36 -0
- data/doc/ja/grammar.ja.rdoc +348 -0
- data/doc/ja/index.ja.html +10 -0
- data/doc/ja/parser.ja.rdoc +125 -0
- data/doc/ja/usage.ja.html +414 -0
- data/ext/racc/cparse/MANIFEST +4 -0
- data/ext/racc/cparse/cparse.c +824 -0
- data/ext/racc/cparse/depend +1 -0
- data/ext/racc/cparse/extconf.rb +7 -0
- data/fastcache/extconf.rb +2 -0
- data/fastcache/fastcache.c +185 -0
- data/lib/racc.rb +6 -0
- data/lib/racc/compat.rb +40 -0
- data/lib/racc/debugflags.rb +59 -0
- data/lib/racc/exception.rb +15 -0
- data/lib/racc/grammar.rb +1115 -0
- data/lib/racc/grammarfileparser.rb +559 -0
- data/lib/racc/info.rb +16 -0
- data/lib/racc/iset.rb +91 -0
- data/lib/racc/logfilegenerator.rb +214 -0
- data/lib/racc/parser.rb +439 -0
- data/lib/racc/parserfilegenerator.rb +511 -0
- data/lib/racc/pre-setup +13 -0
- data/lib/racc/sourcetext.rb +34 -0
- data/lib/racc/state.rb +971 -0
- data/lib/racc/statetransitiontable.rb +316 -0
- data/lib/racc/static.rb +5 -0
- data/misc/dist.sh +31 -0
- data/sample/array.y +67 -0
- data/sample/array2.y +59 -0
- data/sample/calc-ja.y +66 -0
- data/sample/calc.y +65 -0
- data/sample/conflict.y +15 -0
- data/sample/hash.y +60 -0
- data/sample/lalr.y +17 -0
- data/sample/lists.y +57 -0
- data/sample/syntax.y +46 -0
- data/sample/yyerr.y +46 -0
- data/setup.rb +1587 -0
- data/tasks/doc.rb +12 -0
- data/tasks/email.rb +55 -0
- data/tasks/file.rb +37 -0
- data/tasks/gem.rb +37 -0
- data/tasks/test.rb +16 -0
- data/test/assets/chk.y +126 -0
- data/test/assets/conf.y +16 -0
- data/test/assets/digraph.y +29 -0
- data/test/assets/echk.y +118 -0
- data/test/assets/err.y +60 -0
- data/test/assets/expect.y +7 -0
- data/test/assets/firstline.y +4 -0
- data/test/assets/ichk.y +102 -0
- data/test/assets/intp.y +546 -0
- data/test/assets/mailp.y +437 -0
- data/test/assets/newsyn.y +25 -0
- data/test/assets/noend.y +4 -0
- data/test/assets/nonass.y +41 -0
- data/test/assets/normal.y +27 -0
- data/test/assets/norule.y +4 -0
- data/test/assets/nullbug1.y +25 -0
- data/test/assets/nullbug2.y +15 -0
- data/test/assets/opt.y +123 -0
- data/test/assets/percent.y +35 -0
- data/test/assets/recv.y +97 -0
- data/test/assets/rrconf.y +14 -0
- data/test/assets/scan.y +72 -0
- data/test/assets/syntax.y +50 -0
- data/test/assets/unterm.y +5 -0
- data/test/assets/useless.y +12 -0
- data/test/assets/yyerr.y +46 -0
- data/test/bench.y +36 -0
- data/test/helper.rb +88 -0
- data/test/infini.y +8 -0
- data/test/scandata/brace +7 -0
- data/test/scandata/gvar +1 -0
- data/test/scandata/normal +4 -0
- data/test/scandata/percent +18 -0
- data/test/scandata/slash +10 -0
- data/test/src.intp +34 -0
- data/test/start.y +20 -0
- data/test/test_chk_y.rb +51 -0
- data/test/test_grammar_file_parser.rb +15 -0
- data/test/test_racc_command.rb +155 -0
- data/test/test_scan_y.rb +51 -0
- data/test/testscanner.rb +51 -0
- data/web/racc.en.rhtml +42 -0
- data/web/racc.ja.rhtml +51 -0
- metadata +166 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
#
|
2
|
+
# racc syntax checker
|
3
|
+
#
|
4
|
+
|
5
|
+
class M1::M2::ParserClass < S1::S2::SuperClass
|
6
|
+
|
7
|
+
token A
|
8
|
+
| B C
|
9
|
+
|
10
|
+
convert
|
11
|
+
A '5'
|
12
|
+
end
|
13
|
+
|
14
|
+
prechigh
|
15
|
+
left B
|
16
|
+
preclow
|
17
|
+
|
18
|
+
start target
|
19
|
+
|
20
|
+
expect 0
|
21
|
+
|
22
|
+
rule
|
23
|
+
|
24
|
+
target: A B C
|
25
|
+
{
|
26
|
+
print 'abc'
|
27
|
+
}
|
28
|
+
| B C A
|
29
|
+
| C B A
|
30
|
+
{
|
31
|
+
print 'cba'
|
32
|
+
}
|
33
|
+
| cont
|
34
|
+
|
35
|
+
cont : A c2 B c2 C
|
36
|
+
|
37
|
+
c2 : C C C C C
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
---- inner
|
42
|
+
|
43
|
+
junk code !!!!
|
44
|
+
|
45
|
+
kjaljlajrlaolanbla /// %%% (*((( token rule
|
46
|
+
akiurtlajluealjflaj @@@@ end end end end __END__
|
47
|
+
laieu2o879urkq96ga(Q#*&%Q#
|
48
|
+
#&lkji END
|
49
|
+
|
50
|
+
q395q?/// liutjqlkr7
|
data/test/assets/yyerr.y
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# yyerror/yyerrok/yyaccept test
|
3
|
+
#
|
4
|
+
|
5
|
+
class A
|
6
|
+
rule
|
7
|
+
|
8
|
+
target: a b c
|
9
|
+
|
10
|
+
a:
|
11
|
+
{
|
12
|
+
yyerror
|
13
|
+
raise ArgumentError, "yyerror failed"
|
14
|
+
}
|
15
|
+
| error
|
16
|
+
|
17
|
+
b:
|
18
|
+
{
|
19
|
+
yyerrok
|
20
|
+
}
|
21
|
+
|
22
|
+
c:
|
23
|
+
{
|
24
|
+
yyaccept
|
25
|
+
raise ArgumentError, "yyaccept failed"
|
26
|
+
}
|
27
|
+
|
28
|
+
end
|
29
|
+
|
30
|
+
---- inner
|
31
|
+
|
32
|
+
def parse
|
33
|
+
do_parse
|
34
|
+
end
|
35
|
+
|
36
|
+
def next_token
|
37
|
+
[false, '$end']
|
38
|
+
end
|
39
|
+
|
40
|
+
def on_error( *args )
|
41
|
+
$stderr.puts "on_error called: args=#{args.inspect}"
|
42
|
+
end
|
43
|
+
|
44
|
+
---- footer
|
45
|
+
|
46
|
+
A.new.parse
|
data/test/bench.y
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
class BenchmarkParser
|
2
|
+
|
3
|
+
rule
|
4
|
+
|
5
|
+
target: a a a a a a a a a a;
|
6
|
+
a: b b b b b b b b b b;
|
7
|
+
b: c c c c c c c c c c;
|
8
|
+
c: d d d d d d d d d d;
|
9
|
+
d: e e e e e e e e e e;
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
---- inner
|
14
|
+
|
15
|
+
def initialize
|
16
|
+
@old = [ :e, 'e' ]
|
17
|
+
@i = 0
|
18
|
+
end
|
19
|
+
|
20
|
+
def next_token
|
21
|
+
return [false, '$'] if @i >= 10_0000
|
22
|
+
@i += 1
|
23
|
+
@old
|
24
|
+
end
|
25
|
+
|
26
|
+
def parse
|
27
|
+
do_parse
|
28
|
+
end
|
29
|
+
|
30
|
+
---- footer
|
31
|
+
|
32
|
+
require 'benchmark'
|
33
|
+
|
34
|
+
Benchmark.bm do |x|
|
35
|
+
x.report { BenchmarkParser.new.parse }
|
36
|
+
end
|
data/test/helper.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
$VERBOSE = true
|
2
|
+
require 'test/unit'
|
3
|
+
require 'racc/static'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module Racc
|
7
|
+
class TestCase < Test::Unit::TestCase
|
8
|
+
PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
9
|
+
|
10
|
+
TEST_DIR = File.join(PROJECT_DIR, 'test')
|
11
|
+
|
12
|
+
RACC = File.join(PROJECT_DIR, 'bin', 'racc')
|
13
|
+
OUT_DIR = File.join(TEST_DIR, 'out')
|
14
|
+
TAB_DIR = File.join(TEST_DIR, 'tab')
|
15
|
+
LOG_DIR = File.join(TEST_DIR, 'log')
|
16
|
+
ERR_DIR = File.join(TEST_DIR, 'err')
|
17
|
+
ASSET_DIR = File.join(TEST_DIR, 'assets')
|
18
|
+
|
19
|
+
INC = [
|
20
|
+
File.join(PROJECT_DIR, 'lib'),
|
21
|
+
File.join(PROJECT_DIR, 'ext'),
|
22
|
+
].join(':')
|
23
|
+
|
24
|
+
unless RUBY_VERSION >= '1.9'
|
25
|
+
undef :default_test
|
26
|
+
end
|
27
|
+
|
28
|
+
def setup
|
29
|
+
[OUT_DIR, TAB_DIR, LOG_DIR, ERR_DIR].each do |dir|
|
30
|
+
FileUtils.mkdir_p(dir)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def teardown
|
35
|
+
[OUT_DIR, TAB_DIR, LOG_DIR, ERR_DIR].each do |dir|
|
36
|
+
FileUtils.rm_rf(dir)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def assert_compile asset, args = []
|
41
|
+
asset = File.basename(asset, '.y')
|
42
|
+
args = ([args].flatten) + [
|
43
|
+
"#{ASSET_DIR}/#{asset}.y",
|
44
|
+
'-Do',
|
45
|
+
"-O#{OUT_DIR}/#{asset}",
|
46
|
+
"-o#{TAB_DIR}/#{asset}",
|
47
|
+
]
|
48
|
+
racc "#{args.join(' ')}"
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_debugfile asset, ok
|
52
|
+
name = File.basename(asset, '.y')
|
53
|
+
Dir.chdir(TEST_DIR) do
|
54
|
+
File.foreach("log/#{name}.y") do |line|
|
55
|
+
line.strip!
|
56
|
+
case line
|
57
|
+
when /sr/ then assert_equal "sr#{ok[0]}", line
|
58
|
+
when /rr/ then assert_equal "rr#{ok[1]}", line
|
59
|
+
when /un/ then assert_equal "un#{ok[2]}", line
|
60
|
+
when /ur/ then assert_equal "ur#{ok[3]}", line
|
61
|
+
when /ex/ then assert_equal "ex#{ok[4]}", line
|
62
|
+
else
|
63
|
+
raise TestFailed, 'racc outputs unknown debug report???'
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
def assert_exec file
|
70
|
+
file = File.basename(file, '.y')
|
71
|
+
Dir.chdir(TEST_DIR) do
|
72
|
+
ruby("tab/#{file}")
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def racc arg
|
77
|
+
ruby "-S #{RACC} #{arg}"
|
78
|
+
end
|
79
|
+
|
80
|
+
def ruby arg
|
81
|
+
Dir.chdir(TEST_DIR) do
|
82
|
+
cmd = "#{ENV['_']} -I #{INC} #{arg} 2>>/tmp/out"
|
83
|
+
result = system(cmd)
|
84
|
+
result ? assert(result) : raise(cmd)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
data/test/infini.y
ADDED
data/test/scandata/brace
ADDED
data/test/scandata/gvar
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
{ $' $" $& $-a $/ $\ $( $1 $2 $3 $? $-i }
|
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
3 % 5 # mod
|
3
|
+
3%5 # mod
|
4
|
+
3% 5 # mod
|
5
|
+
i % 5 # mod
|
6
|
+
i%5 # mod
|
7
|
+
i% 5 # mod
|
8
|
+
call %{str} # string
|
9
|
+
call(%{str}) # string
|
10
|
+
%q{string} # string
|
11
|
+
%Q{string} # string
|
12
|
+
%r{string} # string
|
13
|
+
%w(array) # array
|
14
|
+
%x{array} # command string
|
15
|
+
%{string} # string
|
16
|
+
%_string_ # string
|
17
|
+
%/string/ # regexp
|
18
|
+
}
|
data/test/scandata/slash
ADDED
data/test/src.intp
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
def assert( no, cond )
|
2
|
+
if cond then
|
3
|
+
else
|
4
|
+
raise( 'assert ' + to_s(no) + ' failed' )
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
assert( 1, concat(concat(concat('str=', 'a'), "b"), 'c') == 'str=abc' )
|
9
|
+
assert( 2, 'operator' + ' ok' == 'operator ok' )
|
10
|
+
assert( 3, 1 + 1 == 2 )
|
11
|
+
assert( 4, 4 * 1 + 10 * 1 == 14 )
|
12
|
+
|
13
|
+
if true then
|
14
|
+
assert( 5, true )
|
15
|
+
else
|
16
|
+
assert( 6, false )
|
17
|
+
end
|
18
|
+
|
19
|
+
i = 1
|
20
|
+
while i == 1 do
|
21
|
+
i = false
|
22
|
+
end
|
23
|
+
assert( 7, i == false )
|
24
|
+
assert( 8, nil == nil )
|
25
|
+
|
26
|
+
def func
|
27
|
+
assert( 9, true )
|
28
|
+
end
|
29
|
+
func
|
30
|
+
|
31
|
+
def argfunc( str )
|
32
|
+
assert( 10, str == 'ok' )
|
33
|
+
end
|
34
|
+
argfunc 'ok'
|
data/test/start.y
ADDED
data/test/test_chk_y.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
module Racc
|
4
|
+
class TestChkY < TestCase
|
5
|
+
def setup
|
6
|
+
file = File.join(ASSET_DIR, 'chk.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_chk_y
|
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_chk_y_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,15 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
module Racc
|
4
|
+
class TestGrammarFileParser < TestCase
|
5
|
+
def test_parse
|
6
|
+
file = File.join(ASSET_DIR, 'yyerr.y')
|
7
|
+
|
8
|
+
debug_flags = Racc::DebugFlags.parse_option_string('o')
|
9
|
+
assert debug_flags.status_logging
|
10
|
+
|
11
|
+
parser = Racc::GrammarFileParser.new(debug_flags)
|
12
|
+
parser.parse(File.read(file), File.basename(file))
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
|
2
|
+
|
3
|
+
module Racc
|
4
|
+
class TestRaccCommand < TestCase
|
5
|
+
def test_syntax_y
|
6
|
+
assert_compile 'syntax.y', '-v'
|
7
|
+
assert_debugfile 'syntax.y', [0,0,0,0,0]
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_percent_y
|
11
|
+
assert_compile 'percent.y'
|
12
|
+
assert_debugfile 'percent.y', []
|
13
|
+
assert_exec 'percent.y'
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_scan_y
|
17
|
+
assert_compile 'scan.y'
|
18
|
+
assert_debugfile 'scan.y', []
|
19
|
+
assert_exec 'scan.y'
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_newsyn_y
|
23
|
+
assert_compile 'newsyn.y'
|
24
|
+
assert_debugfile 'newsyn.y', []
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_normal_y
|
28
|
+
assert_compile 'normal.y'
|
29
|
+
assert_debugfile 'normal.y', []
|
30
|
+
|
31
|
+
assert_compile 'normal.y', '-vg'
|
32
|
+
assert_debugfile 'normal.y', []
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_chk_y
|
36
|
+
assert_compile 'chk.y', '-vg'
|
37
|
+
assert_debugfile 'chk.y', []
|
38
|
+
assert_exec 'chk.y'
|
39
|
+
|
40
|
+
assert_compile 'chk.y', '--line-convert-all'
|
41
|
+
assert_debugfile 'chk.y', []
|
42
|
+
assert_exec 'chk.y'
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_echk_y
|
46
|
+
assert_compile 'echk.y', '-E'
|
47
|
+
assert_debugfile 'echk.y', []
|
48
|
+
assert_exec 'echk.y'
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_err_y
|
52
|
+
assert_compile 'err.y'
|
53
|
+
assert_debugfile 'err.y', []
|
54
|
+
assert_exec 'err.y'
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_mailp_y
|
58
|
+
assert_compile 'mailp.y'
|
59
|
+
assert_debugfile 'mailp.y', []
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_conf_y
|
63
|
+
assert_compile 'conf.y', '-v'
|
64
|
+
assert_debugfile 'conf.y', [4,1,1,2]
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_rrconf_y
|
68
|
+
assert_compile 'rrconf.y'
|
69
|
+
assert_debugfile 'rrconf.y', [1,1,0,0]
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_useless_y
|
73
|
+
assert_compile 'useless.y'
|
74
|
+
assert_debugfile 'useless.y', [0,0,1,2]
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_opt_y
|
78
|
+
assert_compile 'opt.y'
|
79
|
+
assert_debugfile 'opt.y', []
|
80
|
+
assert_exec 'opt.y'
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_yyerr_y
|
84
|
+
assert_compile 'yyerr.y'
|
85
|
+
assert_debugfile 'yyerr.y', []
|
86
|
+
assert_exec 'yyerr.y'
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_recv_y
|
90
|
+
assert_compile 'recv.y'
|
91
|
+
assert_debugfile 'recv.y', [5,10,1,4]
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_ichk_y
|
95
|
+
assert_compile 'ichk.y'
|
96
|
+
assert_debugfile 'ichk.y', []
|
97
|
+
assert_exec 'ichk.y'
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_intp_y
|
101
|
+
assert_compile 'intp.y'
|
102
|
+
assert_debugfile 'intp.y', []
|
103
|
+
assert_exec 'intp.y'
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_expect_y
|
107
|
+
assert_compile 'expect.y'
|
108
|
+
assert_debugfile 'expect.y', [1,0,0,0,1]
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_nullbug1_y
|
112
|
+
assert_compile 'nullbug1.y'
|
113
|
+
assert_debugfile 'nullbug1.y', [0,0,0,0]
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_nullbug2_y
|
117
|
+
assert_compile 'nullbug2.y'
|
118
|
+
assert_debugfile 'nullbug2.y', [0,0,0,0]
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_firstline_y
|
122
|
+
assert_compile 'firstline.y'
|
123
|
+
assert_debugfile 'firstline.y', []
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_nonass_y
|
127
|
+
assert_compile 'nonass.y'
|
128
|
+
assert_debugfile 'nonass.y', []
|
129
|
+
assert_exec 'nonass.y'
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_digraph_y
|
133
|
+
assert_compile 'digraph.y'
|
134
|
+
assert_debugfile 'digraph.y', []
|
135
|
+
assert_exec 'digraph.y'
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_noend_y
|
139
|
+
assert_compile 'noend.y'
|
140
|
+
assert_debugfile 'noend.y', []
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_norule_y
|
144
|
+
assert_raises(RuntimeError) {
|
145
|
+
assert_compile 'norule.y'
|
146
|
+
}
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_unterm_y
|
150
|
+
assert_raises(RuntimeError) {
|
151
|
+
assert_compile 'unterm.y'
|
152
|
+
}
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|