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
@@ -0,0 +1,278 @@
|
|
1
|
+
# Copyright 2008-2015 Takuto Wada
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
class TwoWaySQL::Parser
|
16
|
+
|
17
|
+
rule
|
18
|
+
|
19
|
+
sql : stmt_list
|
20
|
+
{
|
21
|
+
result = RootNode.new( val[0] )
|
22
|
+
}
|
23
|
+
|
24
|
+
stmt_list :
|
25
|
+
{
|
26
|
+
result = []
|
27
|
+
}
|
28
|
+
| stmt_list stmt
|
29
|
+
{
|
30
|
+
result.push val[1]
|
31
|
+
}
|
32
|
+
|
33
|
+
stmt : primary
|
34
|
+
| if_stmt
|
35
|
+
| begin_stmt
|
36
|
+
|
37
|
+
begin_stmt : BEGIN stmt_list END
|
38
|
+
{
|
39
|
+
result = BeginNode.new( val[1] )
|
40
|
+
}
|
41
|
+
|
42
|
+
if_stmt : IF sub_stmt else_stmt END
|
43
|
+
{
|
44
|
+
result = IfNode.new( val[0][1], val[1], val[2] )
|
45
|
+
}
|
46
|
+
|
47
|
+
else_stmt : ELSE sub_stmt
|
48
|
+
{
|
49
|
+
result = val[1]
|
50
|
+
}
|
51
|
+
|
|
52
|
+
{
|
53
|
+
result = nil
|
54
|
+
}
|
55
|
+
|
56
|
+
sub_stmt : and_stmt
|
57
|
+
| or_stmt
|
58
|
+
| stmt_list
|
59
|
+
|
60
|
+
and_stmt : AND stmt_list
|
61
|
+
{
|
62
|
+
result = SubStatementNode.new( val[0][1], val[1] )
|
63
|
+
}
|
64
|
+
|
65
|
+
or_stmt : OR stmt_list
|
66
|
+
{
|
67
|
+
result = SubStatementNode.new( val[0][1], val[1] )
|
68
|
+
}
|
69
|
+
|
70
|
+
primary : IDENT
|
71
|
+
{
|
72
|
+
result = LiteralNode.new( val[0][1] )
|
73
|
+
}
|
74
|
+
| STRING_LITERAL
|
75
|
+
{
|
76
|
+
result = LiteralNode.new( val[0][1] )
|
77
|
+
}
|
78
|
+
| AND
|
79
|
+
{
|
80
|
+
result = LiteralNode.new( val[0][1] )
|
81
|
+
}
|
82
|
+
| OR
|
83
|
+
{
|
84
|
+
result = LiteralNode.new( val[0][1] )
|
85
|
+
}
|
86
|
+
| SPACES
|
87
|
+
{
|
88
|
+
result = WhiteSpaceNode.new( val[0][1], @preserve_space )
|
89
|
+
}
|
90
|
+
| COMMA
|
91
|
+
{
|
92
|
+
result = LiteralNode.new( val[0][1] )
|
93
|
+
}
|
94
|
+
| LPAREN
|
95
|
+
{
|
96
|
+
result = LiteralNode.new( val[0][1] )
|
97
|
+
}
|
98
|
+
| RPAREN
|
99
|
+
{
|
100
|
+
result = LiteralNode.new( val[0][1] )
|
101
|
+
}
|
102
|
+
| QUESTION
|
103
|
+
{
|
104
|
+
@num_questions += 1
|
105
|
+
result = QuestionNode.new( @num_questions )
|
106
|
+
}
|
107
|
+
| ACTUAL_COMMENT
|
108
|
+
{
|
109
|
+
result = ActualCommentNode.new( val[0][1] , val[0][2] )
|
110
|
+
}
|
111
|
+
| bind_var
|
112
|
+
| embed_var
|
113
|
+
|
114
|
+
bind_var : BIND_VARIABLE STRING_LITERAL
|
115
|
+
{
|
116
|
+
result = BindVariableNode.new( val[0][1] )
|
117
|
+
}
|
118
|
+
| BIND_VARIABLE SPACES STRING_LITERAL
|
119
|
+
{
|
120
|
+
result = BindVariableNode.new( val[0][1] )
|
121
|
+
}
|
122
|
+
| BIND_VARIABLE IDENT
|
123
|
+
{
|
124
|
+
result = BindVariableNode.new( val[0][1] )
|
125
|
+
}
|
126
|
+
| BIND_VARIABLE SPACES IDENT
|
127
|
+
{
|
128
|
+
result = BindVariableNode.new( val[0][1] )
|
129
|
+
}
|
130
|
+
| PAREN_BIND_VARIABLE
|
131
|
+
{
|
132
|
+
result = ParenBindVariableNode.new( val[0][1] )
|
133
|
+
}
|
134
|
+
|
135
|
+
embed_var : EMBED_VARIABLE IDENT
|
136
|
+
{
|
137
|
+
result = EmbedVariableNode.new( val[0][1] )
|
138
|
+
}
|
139
|
+
| EMBED_VARIABLE SPACES IDENT
|
140
|
+
{
|
141
|
+
result = EmbedVariableNode.new( val[0][1] )
|
142
|
+
}
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
|
147
|
+
---- inner
|
148
|
+
|
149
|
+
require 'strscan'
|
150
|
+
|
151
|
+
def initialize(opts={})
|
152
|
+
opts = {
|
153
|
+
:debug => false,
|
154
|
+
:preserve_space => true,
|
155
|
+
:preserve_comment => false
|
156
|
+
}.merge(opts)
|
157
|
+
@yydebug = opts[:debug]
|
158
|
+
@preserve_space = opts[:preserve_space]
|
159
|
+
@preserve_comment = opts[:preserve_comment]
|
160
|
+
@num_questions = 0
|
161
|
+
end
|
162
|
+
|
163
|
+
|
164
|
+
PAREN_EXAMPLE = '\([^\)]+\)'
|
165
|
+
BEGIN_BIND_VARIABLE = '(\/|\#)\*([^\*]+)\*\1'
|
166
|
+
BIND_VARIABLE_PATTERN = /\A#{BEGIN_BIND_VARIABLE}\s*/
|
167
|
+
PAREN_BIND_VARIABLE_PATTERN = /\A#{BEGIN_BIND_VARIABLE}\s*#{PAREN_EXAMPLE}/
|
168
|
+
EMBED_VARIABLE_PATTERN = /\A(\/|\#)\*\$([^\*]+)\*\1\s*/
|
169
|
+
|
170
|
+
CONDITIONAL_PATTERN = /\A(\/|\#)\*(IF)\s+([^\*]+)\s*\*\1/
|
171
|
+
BEGIN_END_PATTERN = /\A(\/|\#)\*(BEGIN|END)\s*\*\1/
|
172
|
+
STRING_LITERAL_PATTERN = /\A(\'(?:[^\']+|\'\')*\')/ ## quoted string
|
173
|
+
SPLIT_TOKEN_PATTERN = /\A(\S+?)(?=\s*(?:(?:\/|\#)\*|-{2,}|\(|\)|\,))/ ## stop on delimiters --,/*,#*,',',(,)
|
174
|
+
LITERAL_PATTERN = /\A([^;\s]+)/
|
175
|
+
SPACES_PATTERN = /\A(\s+)/
|
176
|
+
QUESTION_PATTERN = /\A\?/
|
177
|
+
COMMA_PATTERN = /\A\,/
|
178
|
+
LPAREN_PATTERN = /\A\(/
|
179
|
+
RPAREN_PATTERN = /\A\)/
|
180
|
+
ACTUAL_COMMENT_PATTERN = /\A(\/|\#)\*(\s{1,}(?:.*?))\*\1/m ## start with spaces
|
181
|
+
SEMICOLON_AT_INPUT_END_PATTERN = /\A\;\s*\Z/
|
182
|
+
UNMATCHED_COMMENT_START_PATTERN = /\A(?:(?:\/|\#)\*)/
|
183
|
+
|
184
|
+
#TODO: remove trailing spaces for S2Dao compatibility, but this spec sometimes causes SQL bugs...
|
185
|
+
ELSE_PATTERN = /\A\-{2,}\s*ELSE\s*/
|
186
|
+
AND_PATTERN = /\A(\ *AND)\b/i
|
187
|
+
OR_PATTERN = /\A(\ *OR)\b/i
|
188
|
+
|
189
|
+
|
190
|
+
def parse( io )
|
191
|
+
@q = []
|
192
|
+
io.each_line(nil) do |whole|
|
193
|
+
@s = StringScanner.new(whole)
|
194
|
+
end
|
195
|
+
scan_str
|
196
|
+
|
197
|
+
# @q.push [ false, nil ]
|
198
|
+
@q.push [ false, [@s.pos, nil] ]
|
199
|
+
|
200
|
+
## call racc's private parse method
|
201
|
+
do_parse
|
202
|
+
end
|
203
|
+
|
204
|
+
|
205
|
+
## called by racc
|
206
|
+
def next_token
|
207
|
+
@q.shift
|
208
|
+
end
|
209
|
+
|
210
|
+
|
211
|
+
def scan_str
|
212
|
+
until @s.eos? do
|
213
|
+
case
|
214
|
+
when @s.scan(AND_PATTERN)
|
215
|
+
@q.push [ :AND, [@s.pos, @s[1]] ]
|
216
|
+
when @s.scan(OR_PATTERN)
|
217
|
+
@q.push [ :OR, [@s.pos, @s[1]] ]
|
218
|
+
when @s.scan(SPACES_PATTERN)
|
219
|
+
@q.push [ :SPACES, [@s.pos, @s[1]] ]
|
220
|
+
when @s.scan(QUESTION_PATTERN)
|
221
|
+
@q.push [ :QUESTION, [@s.pos, nil] ]
|
222
|
+
when @s.scan(COMMA_PATTERN)
|
223
|
+
@q.push [ :COMMA, [@s.pos, ','] ]
|
224
|
+
when @s.scan(LPAREN_PATTERN)
|
225
|
+
@q.push [ :LPAREN, [@s.pos, '('] ]
|
226
|
+
when @s.scan(RPAREN_PATTERN)
|
227
|
+
@q.push [ :RPAREN, [@s.pos, ')'] ]
|
228
|
+
when @s.scan(ELSE_PATTERN)
|
229
|
+
@q.push [ :ELSE, [@s.pos, nil] ]
|
230
|
+
when @s.scan(ACTUAL_COMMENT_PATTERN)
|
231
|
+
@q.push [ :ACTUAL_COMMENT, [@s.pos, @s[1], @s[2]] ] if @preserve_comment
|
232
|
+
when @s.scan(BEGIN_END_PATTERN)
|
233
|
+
@q.push [ @s[2].intern, [@s.pos, nil] ]
|
234
|
+
when @s.scan(CONDITIONAL_PATTERN)
|
235
|
+
@q.push [ @s[2].intern, [@s.pos, @s[3]] ]
|
236
|
+
when @s.scan(EMBED_VARIABLE_PATTERN)
|
237
|
+
@q.push [ :EMBED_VARIABLE, [@s.pos, @s[2]] ]
|
238
|
+
when @s.scan(PAREN_BIND_VARIABLE_PATTERN)
|
239
|
+
@q.push [ :PAREN_BIND_VARIABLE, [@s.pos, @s[2]] ]
|
240
|
+
when @s.scan(BIND_VARIABLE_PATTERN)
|
241
|
+
@q.push [ :BIND_VARIABLE, [@s.pos, @s[2]] ]
|
242
|
+
when @s.scan(STRING_LITERAL_PATTERN)
|
243
|
+
@q.push [ :STRING_LITERAL, [@s.pos, @s[1]] ]
|
244
|
+
when @s.scan(SPLIT_TOKEN_PATTERN)
|
245
|
+
@q.push [ :IDENT, [@s.pos, @s[1]] ]
|
246
|
+
when @s.scan(UNMATCHED_COMMENT_START_PATTERN) ## unmatched comment start, '/*','#*'
|
247
|
+
raise Racc::ParseError, "unmatched comment. line:[#{line_no(@s.pos)}], str:[#{@s.rest}]"
|
248
|
+
when @s.scan(LITERAL_PATTERN) ## other string token
|
249
|
+
@q.push [ :IDENT, [@s.pos, @s[1]] ]
|
250
|
+
when @s.scan(SEMICOLON_AT_INPUT_END_PATTERN)
|
251
|
+
#drop semicolon at input end
|
252
|
+
else
|
253
|
+
raise Racc::ParseError, "syntax error at or near line:[#{line_no(@s.pos)}], str:[#{@s.rest}]"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
|
259
|
+
## override racc's default on_error method
|
260
|
+
def on_error(t, v, vstack)
|
261
|
+
## cursor in value-stack is an array of two items,
|
262
|
+
## that have position value as 0th item. like [731, "ctx[:limit] "]
|
263
|
+
cursor = vstack.find do |tokens|
|
264
|
+
tokens.size == 2 and tokens[0].kind_of?(Fixnum)
|
265
|
+
end
|
266
|
+
pos = cursor[0]
|
267
|
+
line = line_no(pos)
|
268
|
+
rest = @s.string[pos .. -1]
|
269
|
+
raise Racc::ParseError, "syntax error at or near line:[#{line}], str:[#{rest}]"
|
270
|
+
end
|
271
|
+
|
272
|
+
|
273
|
+
def line_no(pos)
|
274
|
+
lines = 0
|
275
|
+
scanned = @s.string[0..(pos)]
|
276
|
+
scanned.each_line { lines += 1 }
|
277
|
+
lines
|
278
|
+
end
|
data/test/helper.rb
CHANGED
@@ -1,22 +1,30 @@
|
|
1
|
+
verbose = $VERBOSE
|
1
2
|
$VERBOSE = true
|
2
|
-
|
3
|
+
begin
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
begin
|
7
|
+
require_relative './lib/core_assertions'
|
8
|
+
Test::Unit::TestCase.include Test::Unit::CoreAssertions
|
9
|
+
rescue LoadError
|
10
|
+
end
|
3
11
|
require 'racc/static'
|
4
12
|
require 'fileutils'
|
5
13
|
require 'tempfile'
|
6
14
|
require 'timeout'
|
7
15
|
|
8
16
|
module Racc
|
9
|
-
class TestCase <
|
17
|
+
class TestCase < Test::Unit::TestCase
|
10
18
|
PROJECT_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
+
test_dir = File.join(PROJECT_DIR, 'test')
|
21
|
+
test_dir = File.join(PROJECT_DIR, 'racc') unless File.exist?(test_dir)
|
22
|
+
TEST_DIR = test_dir
|
23
|
+
racc = File.join(PROJECT_DIR, 'bin', 'racc')
|
24
|
+
racc = File.join(PROJECT_DIR, '..', 'libexec', 'racc') unless File.exist?(racc)
|
25
|
+
RACC = racc
|
26
|
+
ASSET_DIR = File.join(TEST_DIR, 'assets') # test grammars
|
27
|
+
REGRESS_DIR = File.join(TEST_DIR, 'regress') # known-good generated outputs
|
20
28
|
|
21
29
|
INC = [
|
22
30
|
File.join(PROJECT_DIR, 'lib'),
|
@@ -24,32 +32,35 @@ module Racc
|
|
24
32
|
].join(':')
|
25
33
|
|
26
34
|
def setup
|
27
|
-
|
28
|
-
|
29
|
-
|
35
|
+
@TEMP_DIR = Dir.mktmpdir("racc")
|
36
|
+
@OUT_DIR = File.join(@TEMP_DIR, 'out')
|
37
|
+
@TAB_DIR = File.join(@TEMP_DIR, 'tab') # generated parsers go here
|
38
|
+
@LOG_DIR = File.join(@TEMP_DIR, 'log')
|
39
|
+
@ERR_DIR = File.join(@TEMP_DIR, 'err')
|
40
|
+
FileUtils.mkdir_p([@OUT_DIR, @TAB_DIR, @LOG_DIR, @ERR_DIR])
|
41
|
+
FileUtils.cp File.join(TEST_DIR, "src.intp"), @TEMP_DIR
|
30
42
|
end
|
31
43
|
|
32
44
|
def teardown
|
33
|
-
|
34
|
-
|
35
|
-
end
|
45
|
+
FileUtils.rm_f(File.join(@TEMP_DIR, "src.intp"))
|
46
|
+
FileUtils.rm_rf([@OUT_DIR, @TAB_DIR, @LOG_DIR, @ERR_DIR, @TEMP_DIR])
|
36
47
|
end
|
37
48
|
|
38
|
-
def assert_compile
|
39
|
-
|
49
|
+
def assert_compile(asset, args = [], **opt)
|
50
|
+
file = File.basename(asset, '.y')
|
40
51
|
args = ([args].flatten) + [
|
41
|
-
"#{ASSET_DIR}/#{
|
52
|
+
"#{ASSET_DIR}/#{file}.y",
|
42
53
|
'-Do',
|
43
|
-
"-O#{OUT_DIR}/#{
|
44
|
-
"-o#{TAB_DIR}/#{
|
54
|
+
"-O#{@OUT_DIR}/#{file}",
|
55
|
+
"-o#{@TAB_DIR}/#{file}",
|
45
56
|
]
|
46
|
-
racc
|
57
|
+
racc(*args, **opt)
|
47
58
|
end
|
48
59
|
|
49
|
-
def assert_debugfile
|
50
|
-
|
51
|
-
Dir.chdir(
|
52
|
-
File.foreach("
|
60
|
+
def assert_debugfile(asset, ok)
|
61
|
+
file = File.basename(asset, '.y')
|
62
|
+
Dir.chdir(@LOG_DIR) do
|
63
|
+
File.foreach("#{file}.y") do |line|
|
53
64
|
line.strip!
|
54
65
|
case line
|
55
66
|
when /sr/ then assert_equal "sr#{ok[0]}", line
|
@@ -64,25 +75,41 @@ module Racc
|
|
64
75
|
end
|
65
76
|
end
|
66
77
|
|
67
|
-
def assert_exec
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
end
|
78
|
+
def assert_exec(asset)
|
79
|
+
lib_path = File.expand_path("../../lib", __FILE__)
|
80
|
+
file = File.basename(asset, '.y')
|
81
|
+
ruby "-I#{lib_path}", "#{@TAB_DIR}/#{file}"
|
72
82
|
end
|
73
83
|
|
74
|
-
def
|
75
|
-
|
84
|
+
def strip_version(source)
|
85
|
+
source.sub(/This file is automatically generated by Racc \d+\.\d+\.\d+/, '')
|
76
86
|
end
|
77
87
|
|
78
|
-
def
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
88
|
+
def assert_output_unchanged(asset)
|
89
|
+
file = File.basename(asset, '.y')
|
90
|
+
|
91
|
+
# Code to re-generate the expectation files
|
92
|
+
# File.write("#{REGRESS_DIR}/#{file}", File.read("#{@TAB_DIR}/#{file}"))
|
93
|
+
|
94
|
+
expected = File.read("#{REGRESS_DIR}/#{file}")
|
95
|
+
actual = File.read("#{@TAB_DIR}/#{file}")
|
96
|
+
result = (strip_version(expected) == strip_version(actual))
|
97
|
+
|
98
|
+
assert(result, "Output of test/assets/#{file}.y differed from " \
|
99
|
+
"expectation. Try compiling it and diff with test/regress/#{file}.")
|
100
|
+
end
|
101
|
+
|
102
|
+
def racc(*arg, **opt)
|
103
|
+
lib_path = File.expand_path("../../lib", __FILE__)
|
104
|
+
ruby "-I#{lib_path}", "-S", RACC, *arg, **opt
|
105
|
+
end
|
106
|
+
|
107
|
+
def ruby(*arg, **opt)
|
108
|
+
assert_ruby_status(["-C", @TEMP_DIR, *arg], **opt)
|
86
109
|
end
|
87
110
|
end
|
88
111
|
end
|
112
|
+
|
113
|
+
ensure
|
114
|
+
$VERBOSE = verbose
|
115
|
+
end
|
@@ -0,0 +1,796 @@
|
|
1
|
+
#
|
2
|
+
# DO NOT MODIFY!!!!
|
3
|
+
# This file is automatically generated by Racc 1.5.0
|
4
|
+
# from Racc grammar file "".
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'racc/parser.rb'
|
8
|
+
|
9
|
+
# racc_parser.rb : generated by racc
|
10
|
+
|
11
|
+
module Cadenza
|
12
|
+
class RaccParser < Racc::Parser
|
13
|
+
|
14
|
+
module_eval(<<'...end cadenza.y/module_eval...', 'cadenza.y', 171)
|
15
|
+
|
16
|
+
...end cadenza.y/module_eval...
|
17
|
+
##### State transition tables begin ###
|
18
|
+
|
19
|
+
racc_action_table = [
|
20
|
+
37, 89, 65, 66, 20, 21, 22, 23, 24, 17,
|
21
|
+
106, 37, 3, 76, 4, 3, 75, 4, 50, 37,
|
22
|
+
29, 68, 65, 66, 33, 67, 34, 110, 9, 74,
|
23
|
+
35, 9, 37, 36, 71, 33, 38, 34, 77, 78,
|
24
|
+
79, 35, 72, 33, 36, 34, 37, 38, 3, 35,
|
25
|
+
39, 83, 36, 54, 55, 38, 33, 89, 34, 37,
|
26
|
+
90, 3, 35, 43, 9, 36, 85, 103, 38, 108,
|
27
|
+
33, 109, 34, 56, 57, 111, 35, 9, 3, 36,
|
28
|
+
46, 122, 38, 33, 112, 34, 113, 78, 79, 35,
|
29
|
+
114, 3, 36, 4, 9, 38, 20, 21, 22, 23,
|
30
|
+
24, 20, 21, 22, 23, 24, 115, 9, 65, 66,
|
31
|
+
65, 66, 29, 54, 55, 120, 107, 29, 20, 21,
|
32
|
+
22, 23, 24, 20, 21, 22, 23, 24, 20, 21,
|
33
|
+
22, 23, 24, 3, 29, 39, 3, 121, 4, 29,
|
34
|
+
3, 3, 43, 46, 29, 3, 124, 87, 125, 9,
|
35
|
+
54, 55, 9, 56, 57, 128, 9, 9, 3, 103,
|
36
|
+
116, 9, 20, 21, 22, 23, 24, 20, 21, 22,
|
37
|
+
23, 24, 131, 3, 9, 116, 56, 57, 29, 3,
|
38
|
+
89, 116, nil, 29, 20, 21, 22, 23, 24, 9,
|
39
|
+
20, 21, 22, 23, 24, 9, 56, 57, 56, 57,
|
40
|
+
29, 20, 21, 22, 23, 24, 29, 58, 59, 60,
|
41
|
+
61, 62, 63, 56, 57, 56, 57, 29, 58, 59,
|
42
|
+
60, 61, 62, 63, 20, 21, 22, 23, 24, 20,
|
43
|
+
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
|
44
|
+
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
|
45
|
+
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
|
46
|
+
21, 22, 23, 24, 20, 21, 22, 23, 24, 20,
|
47
|
+
21, 22, 23, 24, 20, 21, 22, 23, 24, 65,
|
48
|
+
66 ]
|
49
|
+
|
50
|
+
racc_action_check = [
|
51
|
+
4, 73, 69, 69, 37, 37, 37, 37, 37, 1,
|
52
|
+
69, 39, 0, 38, 0, 2, 38, 2, 17, 43,
|
53
|
+
37, 32, 31, 31, 4, 31, 4, 73, 0, 37,
|
54
|
+
4, 2, 46, 4, 35, 39, 4, 39, 39, 39,
|
55
|
+
39, 39, 36, 43, 39, 43, 87, 39, 5, 43,
|
56
|
+
5, 43, 43, 26, 26, 43, 46, 52, 46, 116,
|
57
|
+
53, 6, 46, 6, 5, 46, 46, 67, 46, 71,
|
58
|
+
87, 72, 87, 27, 27, 75, 87, 6, 7, 87,
|
59
|
+
7, 87, 87, 116, 76, 116, 77, 116, 116, 116,
|
60
|
+
78, 8, 116, 8, 7, 116, 3, 3, 3, 3,
|
61
|
+
3, 20, 20, 20, 20, 20, 79, 8, 70, 70,
|
62
|
+
51, 51, 3, 93, 93, 83, 70, 20, 24, 24,
|
63
|
+
24, 24, 24, 33, 33, 33, 33, 33, 34, 34,
|
64
|
+
34, 34, 34, 41, 24, 41, 42, 85, 42, 33,
|
65
|
+
45, 48, 45, 48, 34, 49, 103, 49, 105, 41,
|
66
|
+
94, 94, 42, 95, 95, 122, 45, 48, 81, 125,
|
67
|
+
81, 49, 65, 65, 65, 65, 65, 66, 66, 66,
|
68
|
+
66, 66, 126, 82, 81, 82, 96, 96, 65, 118,
|
69
|
+
129, 118, nil, 66, 89, 89, 89, 89, 89, 82,
|
70
|
+
108, 108, 108, 108, 108, 118, 97, 97, 98, 98,
|
71
|
+
89, 124, 124, 124, 124, 124, 108, 28, 28, 28,
|
72
|
+
28, 28, 28, 99, 99, 100, 100, 124, 64, 64,
|
73
|
+
64, 64, 64, 64, 29, 29, 29, 29, 29, 54,
|
74
|
+
54, 54, 54, 54, 55, 55, 55, 55, 55, 56,
|
75
|
+
56, 56, 56, 56, 57, 57, 57, 57, 57, 58,
|
76
|
+
58, 58, 58, 58, 59, 59, 59, 59, 59, 60,
|
77
|
+
60, 60, 60, 60, 61, 61, 61, 61, 61, 62,
|
78
|
+
62, 62, 62, 62, 63, 63, 63, 63, 63, 123,
|
79
|
+
123 ]
|
80
|
+
|
81
|
+
racc_action_pointer = [
|
82
|
+
-12, 9, -9, 93, -3, 24, 37, 54, 67, nil,
|
83
|
+
nil, nil, nil, nil, nil, nil, nil, 18, nil, nil,
|
84
|
+
98, nil, nil, nil, 115, nil, 44, 62, 194, 221,
|
85
|
+
nil, 2, -4, 120, 125, 31, 39, 1, 10, 8,
|
86
|
+
nil, 109, 112, 16, nil, 116, 29, nil, 117, 121,
|
87
|
+
nil, 90, 55, 52, 226, 231, 236, 241, 246, 251,
|
88
|
+
256, 261, 266, 271, 205, 159, 164, 64, nil, -18,
|
89
|
+
88, 35, 43, -1, nil, 47, 56, 58, 62, 78,
|
90
|
+
nil, 134, 149, 87, nil, 109, nil, 43, nil, 181,
|
91
|
+
nil, nil, nil, 104, 141, 142, 165, 185, 187, 202,
|
92
|
+
204, nil, nil, 124, nil, 125, nil, nil, 187, nil,
|
93
|
+
nil, nil, nil, nil, nil, nil, 56, nil, 155, nil,
|
94
|
+
nil, nil, 127, 259, 198, 156, 144, nil, nil, 178,
|
95
|
+
nil, nil ]
|
96
|
+
|
97
|
+
racc_action_default = [
|
98
|
+
-2, -70, -1, -70, -70, -70, -70, -70, -70, -60,
|
99
|
+
-61, -62, -63, -64, -65, -66, -68, -70, -67, -69,
|
100
|
+
-5, -7, -8, -9, -70, -11, -14, -17, -24, -70,
|
101
|
+
-26, -33, -70, -70, -70, -70, -70, -70, -70, -70,
|
102
|
+
-41, -70, -70, -70, -48, -70, -70, -52, -70, -70,
|
103
|
+
132, -3, -6, -70, -70, -70, -70, -70, -70, -70,
|
104
|
+
-70, -70, -70, -70, -25, -70, -70, -70, -35, -70,
|
105
|
+
-70, -70, -70, -70, -54, -70, -70, -70, -70, -70,
|
106
|
+
-42, -70, -70, -70, -49, -70, -53, -70, -57, -70,
|
107
|
+
-10, -12, -13, -15, -16, -18, -19, -20, -21, -22,
|
108
|
+
-23, -27, -28, -29, -31, -34, -36, -37, -70, -50,
|
109
|
+
-55, -58, -59, -38, -39, -40, -70, -44, -70, -43,
|
110
|
+
-47, -51, -70, -4, -70, -70, -70, -45, -56, -30,
|
111
|
+
-32, -46 ]
|
112
|
+
|
113
|
+
racc_goto_table = [
|
114
|
+
19, 40, 18, 32, 104, 52, 51, 1, 2, 64,
|
115
|
+
47, 91, 92, 41, 45, 48, 49, 44, 42, 69,
|
116
|
+
70, 105, 73, 51, 53, 95, 96, 97, 98, 99,
|
117
|
+
100, 93, 94, 101, 102, 88, nil, 80, nil, 19,
|
118
|
+
nil, 18, nil, 19, nil, 18, 19, 19, 18, 18,
|
119
|
+
82, 86, nil, nil, 81, nil, 84, nil, nil, nil,
|
120
|
+
nil, nil, 130, nil, nil, nil, nil, nil, nil, nil,
|
121
|
+
nil, nil, nil, nil, nil, 123, nil, 117, 119, nil,
|
122
|
+
19, nil, 18, nil, nil, nil, nil, nil, nil, 118,
|
123
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
124
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 126, 129,
|
125
|
+
51, nil, nil, nil, 127, nil, 19, nil, 18 ]
|
126
|
+
|
127
|
+
racc_goto_check = [
|
128
|
+
27, 16, 28, 6, 11, 3, 4, 1, 2, 9,
|
129
|
+
22, 5, 5, 2, 2, 2, 2, 19, 15, 4,
|
130
|
+
4, 12, 3, 4, 6, 8, 8, 8, 8, 8,
|
131
|
+
8, 7, 7, 10, 10, 25, nil, 16, nil, 27,
|
132
|
+
nil, 28, nil, 27, nil, 28, 27, 27, 28, 28,
|
133
|
+
2, 22, nil, nil, 15, nil, 19, nil, nil, nil,
|
134
|
+
nil, nil, 11, nil, nil, nil, nil, nil, nil, nil,
|
135
|
+
nil, nil, nil, nil, nil, 4, nil, 16, 16, nil,
|
136
|
+
27, nil, 28, nil, nil, nil, nil, nil, nil, 2,
|
137
|
+
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
138
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 6, 3,
|
139
|
+
4, nil, nil, nil, 16, nil, 27, nil, 28 ]
|
140
|
+
|
141
|
+
racc_goto_pointer = [
|
142
|
+
nil, 7, 8, -15, -14, -43, 0, -25, -33, -20,
|
143
|
+
-32, -63, -46, nil, nil, 13, -4, nil, nil, 11,
|
144
|
+
nil, nil, 3, nil, nil, -14, nil, -2, 0 ]
|
145
|
+
|
146
|
+
racc_goto_default = [
|
147
|
+
nil, nil, nil, nil, 31, 25, nil, 26, 27, 28,
|
148
|
+
30, nil, nil, 10, 5, nil, nil, 11, 6, nil,
|
149
|
+
12, 7, nil, 14, 8, nil, 13, 16, 15 ]
|
150
|
+
|
151
|
+
racc_reduce_table = [
|
152
|
+
0, 0, :racc_error,
|
153
|
+
1, 42, :_reduce_none,
|
154
|
+
0, 42, :_reduce_2,
|
155
|
+
1, 44, :_reduce_3,
|
156
|
+
3, 44, :_reduce_4,
|
157
|
+
1, 46, :_reduce_5,
|
158
|
+
2, 46, :_reduce_6,
|
159
|
+
1, 46, :_reduce_7,
|
160
|
+
1, 46, :_reduce_8,
|
161
|
+
1, 46, :_reduce_9,
|
162
|
+
3, 46, :_reduce_10,
|
163
|
+
1, 48, :_reduce_none,
|
164
|
+
3, 48, :_reduce_12,
|
165
|
+
3, 48, :_reduce_13,
|
166
|
+
1, 49, :_reduce_none,
|
167
|
+
3, 49, :_reduce_15,
|
168
|
+
3, 49, :_reduce_16,
|
169
|
+
1, 50, :_reduce_none,
|
170
|
+
3, 50, :_reduce_18,
|
171
|
+
3, 50, :_reduce_19,
|
172
|
+
3, 50, :_reduce_20,
|
173
|
+
3, 50, :_reduce_21,
|
174
|
+
3, 50, :_reduce_22,
|
175
|
+
3, 50, :_reduce_23,
|
176
|
+
1, 51, :_reduce_none,
|
177
|
+
2, 51, :_reduce_25,
|
178
|
+
1, 45, :_reduce_none,
|
179
|
+
3, 45, :_reduce_27,
|
180
|
+
3, 45, :_reduce_28,
|
181
|
+
1, 52, :_reduce_29,
|
182
|
+
3, 52, :_reduce_30,
|
183
|
+
1, 53, :_reduce_31,
|
184
|
+
3, 53, :_reduce_32,
|
185
|
+
1, 47, :_reduce_none,
|
186
|
+
3, 47, :_reduce_34,
|
187
|
+
3, 54, :_reduce_35,
|
188
|
+
4, 55, :_reduce_36,
|
189
|
+
4, 55, :_reduce_37,
|
190
|
+
3, 56, :_reduce_38,
|
191
|
+
3, 57, :_reduce_39,
|
192
|
+
3, 57, :_reduce_40,
|
193
|
+
2, 58, :_reduce_41,
|
194
|
+
3, 58, :_reduce_42,
|
195
|
+
4, 58, :_reduce_43,
|
196
|
+
4, 58, :_reduce_44,
|
197
|
+
5, 58, :_reduce_45,
|
198
|
+
6, 59, :_reduce_46,
|
199
|
+
3, 60, :_reduce_47,
|
200
|
+
2, 61, :_reduce_48,
|
201
|
+
3, 61, :_reduce_49,
|
202
|
+
4, 62, :_reduce_50,
|
203
|
+
3, 63, :_reduce_51,
|
204
|
+
2, 64, :_reduce_52,
|
205
|
+
3, 64, :_reduce_53,
|
206
|
+
3, 65, :_reduce_54,
|
207
|
+
4, 65, :_reduce_55,
|
208
|
+
3, 66, :_reduce_56,
|
209
|
+
3, 67, :_reduce_57,
|
210
|
+
4, 68, :_reduce_58,
|
211
|
+
4, 68, :_reduce_59,
|
212
|
+
1, 69, :_reduce_60,
|
213
|
+
1, 69, :_reduce_none,
|
214
|
+
1, 69, :_reduce_none,
|
215
|
+
1, 69, :_reduce_none,
|
216
|
+
1, 69, :_reduce_none,
|
217
|
+
1, 69, :_reduce_none,
|
218
|
+
1, 43, :_reduce_66,
|
219
|
+
2, 43, :_reduce_67,
|
220
|
+
1, 43, :_reduce_68,
|
221
|
+
2, 43, :_reduce_69 ]
|
222
|
+
|
223
|
+
racc_reduce_n = 70
|
224
|
+
|
225
|
+
racc_shift_n = 132
|
226
|
+
|
227
|
+
racc_token_table = {
|
228
|
+
false => 0,
|
229
|
+
:error => 1,
|
230
|
+
"," => 2,
|
231
|
+
:IDENTIFIER => 3,
|
232
|
+
:INTEGER => 4,
|
233
|
+
:REAL => 5,
|
234
|
+
:STRING => 6,
|
235
|
+
"(" => 7,
|
236
|
+
")" => 8,
|
237
|
+
"*" => 9,
|
238
|
+
"/" => 10,
|
239
|
+
"+" => 11,
|
240
|
+
"-" => 12,
|
241
|
+
:OP_EQ => 13,
|
242
|
+
:OP_NEQ => 14,
|
243
|
+
:OP_LEQ => 15,
|
244
|
+
:OP_GEQ => 16,
|
245
|
+
">" => 17,
|
246
|
+
"<" => 18,
|
247
|
+
:NOT => 19,
|
248
|
+
:AND => 20,
|
249
|
+
:OR => 21,
|
250
|
+
":" => 22,
|
251
|
+
"|" => 23,
|
252
|
+
:VAR_OPEN => 24,
|
253
|
+
:VAR_CLOSE => 25,
|
254
|
+
:STMT_OPEN => 26,
|
255
|
+
:IF => 27,
|
256
|
+
:STMT_CLOSE => 28,
|
257
|
+
:UNLESS => 29,
|
258
|
+
:ELSE => 30,
|
259
|
+
:ENDIF => 31,
|
260
|
+
:ENDUNLESS => 32,
|
261
|
+
:FOR => 33,
|
262
|
+
:IN => 34,
|
263
|
+
:ENDFOR => 35,
|
264
|
+
:BLOCK => 36,
|
265
|
+
:ENDBLOCK => 37,
|
266
|
+
:END => 38,
|
267
|
+
:EXTENDS => 39,
|
268
|
+
:TEXT_BLOCK => 40 }
|
269
|
+
|
270
|
+
racc_nt_base = 41
|
271
|
+
|
272
|
+
racc_use_result_var = true
|
273
|
+
|
274
|
+
Racc_arg = [
|
275
|
+
racc_action_table,
|
276
|
+
racc_action_check,
|
277
|
+
racc_action_default,
|
278
|
+
racc_action_pointer,
|
279
|
+
racc_goto_table,
|
280
|
+
racc_goto_check,
|
281
|
+
racc_goto_default,
|
282
|
+
racc_goto_pointer,
|
283
|
+
racc_nt_base,
|
284
|
+
racc_reduce_table,
|
285
|
+
racc_token_table,
|
286
|
+
racc_shift_n,
|
287
|
+
racc_reduce_n,
|
288
|
+
racc_use_result_var ]
|
289
|
+
|
290
|
+
Racc_token_to_s_table = [
|
291
|
+
"$end",
|
292
|
+
"error",
|
293
|
+
"\",\"",
|
294
|
+
"IDENTIFIER",
|
295
|
+
"INTEGER",
|
296
|
+
"REAL",
|
297
|
+
"STRING",
|
298
|
+
"\"(\"",
|
299
|
+
"\")\"",
|
300
|
+
"\"*\"",
|
301
|
+
"\"/\"",
|
302
|
+
"\"+\"",
|
303
|
+
"\"-\"",
|
304
|
+
"OP_EQ",
|
305
|
+
"OP_NEQ",
|
306
|
+
"OP_LEQ",
|
307
|
+
"OP_GEQ",
|
308
|
+
"\">\"",
|
309
|
+
"\"<\"",
|
310
|
+
"NOT",
|
311
|
+
"AND",
|
312
|
+
"OR",
|
313
|
+
"\":\"",
|
314
|
+
"\"|\"",
|
315
|
+
"VAR_OPEN",
|
316
|
+
"VAR_CLOSE",
|
317
|
+
"STMT_OPEN",
|
318
|
+
"IF",
|
319
|
+
"STMT_CLOSE",
|
320
|
+
"UNLESS",
|
321
|
+
"ELSE",
|
322
|
+
"ENDIF",
|
323
|
+
"ENDUNLESS",
|
324
|
+
"FOR",
|
325
|
+
"IN",
|
326
|
+
"ENDFOR",
|
327
|
+
"BLOCK",
|
328
|
+
"ENDBLOCK",
|
329
|
+
"END",
|
330
|
+
"EXTENDS",
|
331
|
+
"TEXT_BLOCK",
|
332
|
+
"$start",
|
333
|
+
"target",
|
334
|
+
"document",
|
335
|
+
"parameter_list",
|
336
|
+
"logical_expression",
|
337
|
+
"primary_expression",
|
338
|
+
"filtered_expression",
|
339
|
+
"multiplicative_expression",
|
340
|
+
"additive_expression",
|
341
|
+
"boolean_expression",
|
342
|
+
"inverse_expression",
|
343
|
+
"filter",
|
344
|
+
"filter_list",
|
345
|
+
"inject_statement",
|
346
|
+
"if_tag",
|
347
|
+
"else_tag",
|
348
|
+
"end_if_tag",
|
349
|
+
"if_block",
|
350
|
+
"for_tag",
|
351
|
+
"end_for_tag",
|
352
|
+
"for_block",
|
353
|
+
"block_tag",
|
354
|
+
"end_block_tag",
|
355
|
+
"block_block",
|
356
|
+
"generic_block_tag",
|
357
|
+
"end_generic_block_tag",
|
358
|
+
"generic_block",
|
359
|
+
"extends_statement",
|
360
|
+
"document_component" ]
|
361
|
+
|
362
|
+
Racc_debug_parser = false
|
363
|
+
|
364
|
+
##### State transition tables end #####
|
365
|
+
|
366
|
+
# reduce 0 omitted
|
367
|
+
|
368
|
+
# reduce 1 omitted
|
369
|
+
|
370
|
+
module_eval(<<'.,.,', 'cadenza.y', 12)
|
371
|
+
def _reduce_2(val, _values, result)
|
372
|
+
result = nil
|
373
|
+
result
|
374
|
+
end
|
375
|
+
.,.,
|
376
|
+
|
377
|
+
module_eval(<<'.,.,', 'cadenza.y', 16)
|
378
|
+
def _reduce_3(val, _values, result)
|
379
|
+
result = [val[0]]
|
380
|
+
result
|
381
|
+
end
|
382
|
+
.,.,
|
383
|
+
|
384
|
+
module_eval(<<'.,.,', 'cadenza.y', 17)
|
385
|
+
def _reduce_4(val, _values, result)
|
386
|
+
result = val[0].push(val[2])
|
387
|
+
result
|
388
|
+
end
|
389
|
+
.,.,
|
390
|
+
|
391
|
+
module_eval(<<'.,.,', 'cadenza.y', 22)
|
392
|
+
def _reduce_5(val, _values, result)
|
393
|
+
result = VariableNode.new(val[0].value)
|
394
|
+
result
|
395
|
+
end
|
396
|
+
.,.,
|
397
|
+
|
398
|
+
module_eval(<<'.,.,', 'cadenza.y', 23)
|
399
|
+
def _reduce_6(val, _values, result)
|
400
|
+
result = VariableNode.new(val[0].value, val[1])
|
401
|
+
result
|
402
|
+
end
|
403
|
+
.,.,
|
404
|
+
|
405
|
+
module_eval(<<'.,.,', 'cadenza.y', 24)
|
406
|
+
def _reduce_7(val, _values, result)
|
407
|
+
result = ConstantNode.new(val[0].value)
|
408
|
+
result
|
409
|
+
end
|
410
|
+
.,.,
|
411
|
+
|
412
|
+
module_eval(<<'.,.,', 'cadenza.y', 25)
|
413
|
+
def _reduce_8(val, _values, result)
|
414
|
+
result = ConstantNode.new(val[0].value)
|
415
|
+
result
|
416
|
+
end
|
417
|
+
.,.,
|
418
|
+
|
419
|
+
module_eval(<<'.,.,', 'cadenza.y', 26)
|
420
|
+
def _reduce_9(val, _values, result)
|
421
|
+
result = ConstantNode.new(val[0].value)
|
422
|
+
result
|
423
|
+
end
|
424
|
+
.,.,
|
425
|
+
|
426
|
+
module_eval(<<'.,.,', 'cadenza.y', 27)
|
427
|
+
def _reduce_10(val, _values, result)
|
428
|
+
result = val[1]
|
429
|
+
result
|
430
|
+
end
|
431
|
+
.,.,
|
432
|
+
|
433
|
+
# reduce 11 omitted
|
434
|
+
|
435
|
+
module_eval(<<'.,.,', 'cadenza.y', 32)
|
436
|
+
def _reduce_12(val, _values, result)
|
437
|
+
result = OperationNode.new(val[0], "*", val[2])
|
438
|
+
result
|
439
|
+
end
|
440
|
+
.,.,
|
441
|
+
|
442
|
+
module_eval(<<'.,.,', 'cadenza.y', 33)
|
443
|
+
def _reduce_13(val, _values, result)
|
444
|
+
result = OperationNode.new(val[0], "/", val[2])
|
445
|
+
result
|
446
|
+
end
|
447
|
+
.,.,
|
448
|
+
|
449
|
+
# reduce 14 omitted
|
450
|
+
|
451
|
+
module_eval(<<'.,.,', 'cadenza.y', 38)
|
452
|
+
def _reduce_15(val, _values, result)
|
453
|
+
result = OperationNode.new(val[0], "+", val[2])
|
454
|
+
result
|
455
|
+
end
|
456
|
+
.,.,
|
457
|
+
|
458
|
+
module_eval(<<'.,.,', 'cadenza.y', 39)
|
459
|
+
def _reduce_16(val, _values, result)
|
460
|
+
result = OperationNode.new(val[0], "-", val[2])
|
461
|
+
result
|
462
|
+
end
|
463
|
+
.,.,
|
464
|
+
|
465
|
+
# reduce 17 omitted
|
466
|
+
|
467
|
+
module_eval(<<'.,.,', 'cadenza.y', 44)
|
468
|
+
def _reduce_18(val, _values, result)
|
469
|
+
result = OperationNode.new(val[0], "==", val[2])
|
470
|
+
result
|
471
|
+
end
|
472
|
+
.,.,
|
473
|
+
|
474
|
+
module_eval(<<'.,.,', 'cadenza.y', 45)
|
475
|
+
def _reduce_19(val, _values, result)
|
476
|
+
result = OperationNode.new(val[0], "!=", val[2])
|
477
|
+
result
|
478
|
+
end
|
479
|
+
.,.,
|
480
|
+
|
481
|
+
module_eval(<<'.,.,', 'cadenza.y', 46)
|
482
|
+
def _reduce_20(val, _values, result)
|
483
|
+
result = OperationNode.new(val[0], "<=", val[2])
|
484
|
+
result
|
485
|
+
end
|
486
|
+
.,.,
|
487
|
+
|
488
|
+
module_eval(<<'.,.,', 'cadenza.y', 47)
|
489
|
+
def _reduce_21(val, _values, result)
|
490
|
+
result = OperationNode.new(val[0], ">=", val[2])
|
491
|
+
result
|
492
|
+
end
|
493
|
+
.,.,
|
494
|
+
|
495
|
+
module_eval(<<'.,.,', 'cadenza.y', 48)
|
496
|
+
def _reduce_22(val, _values, result)
|
497
|
+
result = OperationNode.new(val[0], ">", val[2])
|
498
|
+
result
|
499
|
+
end
|
500
|
+
.,.,
|
501
|
+
|
502
|
+
module_eval(<<'.,.,', 'cadenza.y', 49)
|
503
|
+
def _reduce_23(val, _values, result)
|
504
|
+
result = OperationNode.new(val[0], "<", val[2])
|
505
|
+
result
|
506
|
+
end
|
507
|
+
.,.,
|
508
|
+
|
509
|
+
# reduce 24 omitted
|
510
|
+
|
511
|
+
module_eval(<<'.,.,', 'cadenza.y', 54)
|
512
|
+
def _reduce_25(val, _values, result)
|
513
|
+
result = BooleanInverseNode.new(val[1])
|
514
|
+
result
|
515
|
+
end
|
516
|
+
.,.,
|
517
|
+
|
518
|
+
# reduce 26 omitted
|
519
|
+
|
520
|
+
module_eval(<<'.,.,', 'cadenza.y', 59)
|
521
|
+
def _reduce_27(val, _values, result)
|
522
|
+
result = OperationNode.new(val[0], "and", val[2])
|
523
|
+
result
|
524
|
+
end
|
525
|
+
.,.,
|
526
|
+
|
527
|
+
module_eval(<<'.,.,', 'cadenza.y', 60)
|
528
|
+
def _reduce_28(val, _values, result)
|
529
|
+
result = OperationNode.new(val[0], "or", val[2])
|
530
|
+
result
|
531
|
+
end
|
532
|
+
.,.,
|
533
|
+
|
534
|
+
module_eval(<<'.,.,', 'cadenza.y', 64)
|
535
|
+
def _reduce_29(val, _values, result)
|
536
|
+
result = FilterNode.new(val[0].value)
|
537
|
+
result
|
538
|
+
end
|
539
|
+
.,.,
|
540
|
+
|
541
|
+
module_eval(<<'.,.,', 'cadenza.y', 65)
|
542
|
+
def _reduce_30(val, _values, result)
|
543
|
+
result = FilterNode.new(val[0].value, val[2])
|
544
|
+
result
|
545
|
+
end
|
546
|
+
.,.,
|
547
|
+
|
548
|
+
module_eval(<<'.,.,', 'cadenza.y', 69)
|
549
|
+
def _reduce_31(val, _values, result)
|
550
|
+
result = [val[0]]
|
551
|
+
result
|
552
|
+
end
|
553
|
+
.,.,
|
554
|
+
|
555
|
+
module_eval(<<'.,.,', 'cadenza.y', 70)
|
556
|
+
def _reduce_32(val, _values, result)
|
557
|
+
result = val[0].push(val[2])
|
558
|
+
result
|
559
|
+
end
|
560
|
+
.,.,
|
561
|
+
|
562
|
+
# reduce 33 omitted
|
563
|
+
|
564
|
+
module_eval(<<'.,.,', 'cadenza.y', 75)
|
565
|
+
def _reduce_34(val, _values, result)
|
566
|
+
result = FilteredValueNode.new(val[0], val[2])
|
567
|
+
result
|
568
|
+
end
|
569
|
+
.,.,
|
570
|
+
|
571
|
+
module_eval(<<'.,.,', 'cadenza.y', 79)
|
572
|
+
def _reduce_35(val, _values, result)
|
573
|
+
result = val[1]
|
574
|
+
result
|
575
|
+
end
|
576
|
+
.,.,
|
577
|
+
|
578
|
+
module_eval(<<'.,.,', 'cadenza.y', 83)
|
579
|
+
def _reduce_36(val, _values, result)
|
580
|
+
open_scope!; result = val[2]
|
581
|
+
result
|
582
|
+
end
|
583
|
+
.,.,
|
584
|
+
|
585
|
+
module_eval(<<'.,.,', 'cadenza.y', 84)
|
586
|
+
def _reduce_37(val, _values, result)
|
587
|
+
open_scope!; result = BooleanInverseNode.new(val[2])
|
588
|
+
result
|
589
|
+
end
|
590
|
+
.,.,
|
591
|
+
|
592
|
+
module_eval(<<'.,.,', 'cadenza.y', 88)
|
593
|
+
def _reduce_38(val, _values, result)
|
594
|
+
result = close_scope!; open_scope!
|
595
|
+
result
|
596
|
+
end
|
597
|
+
.,.,
|
598
|
+
|
599
|
+
module_eval(<<'.,.,', 'cadenza.y', 92)
|
600
|
+
def _reduce_39(val, _values, result)
|
601
|
+
result = close_scope!
|
602
|
+
result
|
603
|
+
end
|
604
|
+
.,.,
|
605
|
+
|
606
|
+
module_eval(<<'.,.,', 'cadenza.y', 93)
|
607
|
+
def _reduce_40(val, _values, result)
|
608
|
+
result = close_scope!
|
609
|
+
result
|
610
|
+
end
|
611
|
+
.,.,
|
612
|
+
|
613
|
+
module_eval(<<'.,.,', 'cadenza.y', 97)
|
614
|
+
def _reduce_41(val, _values, result)
|
615
|
+
result = IfNode.new(val[0], val[1])
|
616
|
+
result
|
617
|
+
end
|
618
|
+
.,.,
|
619
|
+
|
620
|
+
module_eval(<<'.,.,', 'cadenza.y', 98)
|
621
|
+
def _reduce_42(val, _values, result)
|
622
|
+
result = IfNode.new(val[0], val[2])
|
623
|
+
result
|
624
|
+
end
|
625
|
+
.,.,
|
626
|
+
|
627
|
+
module_eval(<<'.,.,', 'cadenza.y', 99)
|
628
|
+
def _reduce_43(val, _values, result)
|
629
|
+
result = IfNode.new(val[0], val[1], val[3])
|
630
|
+
result
|
631
|
+
end
|
632
|
+
.,.,
|
633
|
+
|
634
|
+
module_eval(<<'.,.,', 'cadenza.y', 100)
|
635
|
+
def _reduce_44(val, _values, result)
|
636
|
+
result = IfNode.new(val[0], val[2], val[3])
|
637
|
+
result
|
638
|
+
end
|
639
|
+
.,.,
|
640
|
+
|
641
|
+
module_eval(<<'.,.,', 'cadenza.y', 101)
|
642
|
+
def _reduce_45(val, _values, result)
|
643
|
+
result = IfNode.new(val[0], val[2], val[4])
|
644
|
+
result
|
645
|
+
end
|
646
|
+
.,.,
|
647
|
+
|
648
|
+
module_eval(<<'.,.,', 'cadenza.y', 105)
|
649
|
+
def _reduce_46(val, _values, result)
|
650
|
+
open_scope!; result = [val[2].value, val[4]]
|
651
|
+
result
|
652
|
+
end
|
653
|
+
.,.,
|
654
|
+
|
655
|
+
module_eval(<<'.,.,', 'cadenza.y', 109)
|
656
|
+
def _reduce_47(val, _values, result)
|
657
|
+
result = close_scope!
|
658
|
+
result
|
659
|
+
end
|
660
|
+
.,.,
|
661
|
+
|
662
|
+
module_eval(<<'.,.,', 'cadenza.y', 114)
|
663
|
+
def _reduce_48(val, _values, result)
|
664
|
+
result = ForNode.new(VariableNode.new(val[0].first), val[0].last, val[1])
|
665
|
+
result
|
666
|
+
end
|
667
|
+
.,.,
|
668
|
+
|
669
|
+
module_eval(<<'.,.,', 'cadenza.y', 115)
|
670
|
+
def _reduce_49(val, _values, result)
|
671
|
+
result = ForNode.new(VariableNode.new(val[0].first), val[0].last, val[2])
|
672
|
+
result
|
673
|
+
end
|
674
|
+
.,.,
|
675
|
+
|
676
|
+
module_eval(<<'.,.,', 'cadenza.y', 119)
|
677
|
+
def _reduce_50(val, _values, result)
|
678
|
+
result = open_block_scope!(val[2].value)
|
679
|
+
result
|
680
|
+
end
|
681
|
+
.,.,
|
682
|
+
|
683
|
+
module_eval(<<'.,.,', 'cadenza.y', 123)
|
684
|
+
def _reduce_51(val, _values, result)
|
685
|
+
result = close_block_scope!
|
686
|
+
result
|
687
|
+
end
|
688
|
+
.,.,
|
689
|
+
|
690
|
+
module_eval(<<'.,.,', 'cadenza.y', 128)
|
691
|
+
def _reduce_52(val, _values, result)
|
692
|
+
result = BlockNode.new(val[0], val[1])
|
693
|
+
result
|
694
|
+
end
|
695
|
+
.,.,
|
696
|
+
|
697
|
+
module_eval(<<'.,.,', 'cadenza.y', 129)
|
698
|
+
def _reduce_53(val, _values, result)
|
699
|
+
result = BlockNode.new(val[0], val[2])
|
700
|
+
result
|
701
|
+
end
|
702
|
+
.,.,
|
703
|
+
|
704
|
+
module_eval(<<'.,.,', 'cadenza.y', 133)
|
705
|
+
def _reduce_54(val, _values, result)
|
706
|
+
open_scope!; result = [val[1].value, []]
|
707
|
+
result
|
708
|
+
end
|
709
|
+
.,.,
|
710
|
+
|
711
|
+
module_eval(<<'.,.,', 'cadenza.y', 134)
|
712
|
+
def _reduce_55(val, _values, result)
|
713
|
+
open_scope!; result = [val[1].value, val[2]]
|
714
|
+
result
|
715
|
+
end
|
716
|
+
.,.,
|
717
|
+
|
718
|
+
module_eval(<<'.,.,', 'cadenza.y', 138)
|
719
|
+
def _reduce_56(val, _values, result)
|
720
|
+
result = close_scope!
|
721
|
+
result
|
722
|
+
end
|
723
|
+
.,.,
|
724
|
+
|
725
|
+
module_eval(<<'.,.,', 'cadenza.y', 142)
|
726
|
+
def _reduce_57(val, _values, result)
|
727
|
+
result = GenericBlockNode.new(val[0].first, val[2], val[0].last)
|
728
|
+
result
|
729
|
+
end
|
730
|
+
.,.,
|
731
|
+
|
732
|
+
module_eval(<<'.,.,', 'cadenza.y', 146)
|
733
|
+
def _reduce_58(val, _values, result)
|
734
|
+
result = val[2].value
|
735
|
+
result
|
736
|
+
end
|
737
|
+
.,.,
|
738
|
+
|
739
|
+
module_eval(<<'.,.,', 'cadenza.y', 147)
|
740
|
+
def _reduce_59(val, _values, result)
|
741
|
+
result = VariableNode.new(val[2].value)
|
742
|
+
result
|
743
|
+
end
|
744
|
+
.,.,
|
745
|
+
|
746
|
+
module_eval(<<'.,.,', 'cadenza.y', 151)
|
747
|
+
def _reduce_60(val, _values, result)
|
748
|
+
result = TextNode.new(val[0].value)
|
749
|
+
result
|
750
|
+
end
|
751
|
+
.,.,
|
752
|
+
|
753
|
+
# reduce 61 omitted
|
754
|
+
|
755
|
+
# reduce 62 omitted
|
756
|
+
|
757
|
+
# reduce 63 omitted
|
758
|
+
|
759
|
+
# reduce 64 omitted
|
760
|
+
|
761
|
+
# reduce 65 omitted
|
762
|
+
|
763
|
+
module_eval(<<'.,.,', 'cadenza.y', 160)
|
764
|
+
def _reduce_66(val, _values, result)
|
765
|
+
push val[0]
|
766
|
+
result
|
767
|
+
end
|
768
|
+
.,.,
|
769
|
+
|
770
|
+
module_eval(<<'.,.,', 'cadenza.y', 161)
|
771
|
+
def _reduce_67(val, _values, result)
|
772
|
+
push val[1]
|
773
|
+
result
|
774
|
+
end
|
775
|
+
.,.,
|
776
|
+
|
777
|
+
module_eval(<<'.,.,', 'cadenza.y', 162)
|
778
|
+
def _reduce_68(val, _values, result)
|
779
|
+
document.extends = val[0]
|
780
|
+
result
|
781
|
+
end
|
782
|
+
.,.,
|
783
|
+
|
784
|
+
module_eval(<<'.,.,', 'cadenza.y', 163)
|
785
|
+
def _reduce_69(val, _values, result)
|
786
|
+
document.extends = val[1]
|
787
|
+
result
|
788
|
+
end
|
789
|
+
.,.,
|
790
|
+
|
791
|
+
def _reduce_none(val, _values, result)
|
792
|
+
val[0]
|
793
|
+
end
|
794
|
+
|
795
|
+
end # class RaccParser
|
796
|
+
end # module Cadenza
|