racc 1.5.2-java → 1.6.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/README.ja.rdoc +0 -1
  3. data/README.rdoc +6 -7
  4. data/{rdoc → doc}/en/NEWS.en.rdoc +0 -0
  5. data/{rdoc → doc}/en/grammar.en.rdoc +27 -31
  6. data/doc/en/grammar2.en.rdoc +219 -0
  7. data/{rdoc → doc}/ja/NEWS.ja.rdoc +0 -0
  8. data/{rdoc → doc}/ja/command.ja.html +0 -0
  9. data/{rdoc → doc}/ja/debug.ja.rdoc +0 -0
  10. data/{rdoc → doc}/ja/grammar.ja.rdoc +0 -0
  11. data/{rdoc → doc}/ja/index.ja.html +0 -0
  12. data/{rdoc → doc}/ja/parser.ja.rdoc +0 -0
  13. data/{rdoc → doc}/ja/usage.ja.html +0 -0
  14. data/ext/racc/cparse/cparse.c +1 -1
  15. data/ext/racc/cparse/extconf.rb +1 -0
  16. data/lib/racc/cparse-jruby.jar +0 -0
  17. data/lib/racc/info.rb +1 -1
  18. data/lib/racc/parser-text.rb +1 -1
  19. data/lib/racc/parser.rb +1 -1
  20. data/lib/racc/parserfilegenerator.rb +0 -44
  21. data/lib/racc/statetransitiontable.rb +2 -8
  22. metadata +15 -121
  23. data/Rakefile +0 -79
  24. data/ext/racc/com/headius/racc/Cparse.java +0 -849
  25. data/lib/racc/pre-setup +0 -13
  26. data/sample/array.y +0 -67
  27. data/sample/array2.y +0 -59
  28. data/sample/calc-ja.y +0 -66
  29. data/sample/calc.y +0 -65
  30. data/sample/conflict.y +0 -15
  31. data/sample/hash.y +0 -60
  32. data/sample/lalr.y +0 -17
  33. data/sample/lists.y +0 -57
  34. data/sample/syntax.y +0 -46
  35. data/sample/yyerr.y +0 -46
  36. data/test/assets/cadenza.y +0 -170
  37. data/test/assets/cast.y +0 -926
  38. data/test/assets/chk.y +0 -126
  39. data/test/assets/conf.y +0 -16
  40. data/test/assets/csspool.y +0 -729
  41. data/test/assets/digraph.y +0 -29
  42. data/test/assets/echk.y +0 -118
  43. data/test/assets/edtf.y +0 -583
  44. data/test/assets/err.y +0 -60
  45. data/test/assets/error_recovery.y +0 -35
  46. data/test/assets/expect.y +0 -7
  47. data/test/assets/firstline.y +0 -4
  48. data/test/assets/huia.y +0 -318
  49. data/test/assets/ichk.y +0 -102
  50. data/test/assets/intp.y +0 -546
  51. data/test/assets/journey.y +0 -47
  52. data/test/assets/liquor.y +0 -313
  53. data/test/assets/machete.y +0 -423
  54. data/test/assets/macruby.y +0 -2197
  55. data/test/assets/mailp.y +0 -437
  56. data/test/assets/mediacloth.y +0 -599
  57. data/test/assets/mof.y +0 -649
  58. data/test/assets/namae.y +0 -302
  59. data/test/assets/nasl.y +0 -626
  60. data/test/assets/newsyn.y +0 -25
  61. data/test/assets/noend.y +0 -4
  62. data/test/assets/nokogiri-css.y +0 -255
  63. data/test/assets/nonass.y +0 -41
  64. data/test/assets/normal.y +0 -27
  65. data/test/assets/norule.y +0 -4
  66. data/test/assets/nullbug1.y +0 -25
  67. data/test/assets/nullbug2.y +0 -15
  68. data/test/assets/opal.y +0 -1807
  69. data/test/assets/opt.y +0 -123
  70. data/test/assets/percent.y +0 -35
  71. data/test/assets/php_serialization.y +0 -98
  72. data/test/assets/recv.y +0 -97
  73. data/test/assets/riml.y +0 -665
  74. data/test/assets/rrconf.y +0 -14
  75. data/test/assets/ruby18.y +0 -1943
  76. data/test/assets/ruby19.y +0 -2174
  77. data/test/assets/ruby20.y +0 -2350
  78. data/test/assets/ruby21.y +0 -2359
  79. data/test/assets/ruby22.y +0 -2381
  80. data/test/assets/scan.y +0 -72
  81. data/test/assets/syntax.y +0 -50
  82. data/test/assets/tp_plus.y +0 -622
  83. data/test/assets/twowaysql.y +0 -278
  84. data/test/assets/unterm.y +0 -5
  85. data/test/assets/useless.y +0 -12
  86. data/test/assets/yyerr.y +0 -46
  87. data/test/bench.y +0 -36
  88. data/test/helper.rb +0 -115
  89. data/test/infini.y +0 -8
  90. data/test/regress/cadenza +0 -796
  91. data/test/regress/cast +0 -3428
  92. data/test/regress/csspool +0 -2314
  93. data/test/regress/edtf +0 -1794
  94. data/test/regress/huia +0 -1392
  95. data/test/regress/journey +0 -222
  96. data/test/regress/liquor +0 -885
  97. data/test/regress/machete +0 -833
  98. data/test/regress/mediacloth +0 -1463
  99. data/test/regress/mof +0 -1368
  100. data/test/regress/namae +0 -634
  101. data/test/regress/nasl +0 -2058
  102. data/test/regress/nokogiri-css +0 -836
  103. data/test/regress/opal +0 -6431
  104. data/test/regress/php_serialization +0 -336
  105. data/test/regress/riml +0 -3283
  106. data/test/regress/ruby18 +0 -6344
  107. data/test/regress/ruby22 +0 -7460
  108. data/test/regress/tp_plus +0 -1933
  109. data/test/regress/twowaysql +0 -556
  110. data/test/scandata/brace +0 -7
  111. data/test/scandata/gvar +0 -1
  112. data/test/scandata/normal +0 -4
  113. data/test/scandata/percent +0 -18
  114. data/test/scandata/slash +0 -10
  115. data/test/src.intp +0 -34
  116. data/test/start.y +0 -20
  117. data/test/test_chk_y.rb +0 -52
  118. data/test/test_grammar_file_parser.rb +0 -15
  119. data/test/test_racc_command.rb +0 -339
  120. data/test/test_scan_y.rb +0 -52
  121. data/test/testscanner.rb +0 -51
  122. data/web/racc.en.rhtml +0 -42
  123. data/web/racc.ja.rhtml +0 -51
@@ -1,556 +0,0 @@
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
- module TwoWaySQL
9
- class Parser < Racc::Parser
10
-
11
- module_eval(<<'...end twowaysql.y/module_eval...', 'twowaysql.y', 148)
12
-
13
- require 'strscan'
14
-
15
- def initialize(opts={})
16
- opts = {
17
- :debug => false,
18
- :preserve_space => true,
19
- :preserve_comment => false
20
- }.merge(opts)
21
- @yydebug = opts[:debug]
22
- @preserve_space = opts[:preserve_space]
23
- @preserve_comment = opts[:preserve_comment]
24
- @num_questions = 0
25
- end
26
-
27
-
28
- PAREN_EXAMPLE = '\([^\)]+\)'
29
- BEGIN_BIND_VARIABLE = '(\/|\#)\*([^\*]+)\*\1'
30
- BIND_VARIABLE_PATTERN = /\A#{BEGIN_BIND_VARIABLE}\s*/
31
- PAREN_BIND_VARIABLE_PATTERN = /\A#{BEGIN_BIND_VARIABLE}\s*#{PAREN_EXAMPLE}/
32
- EMBED_VARIABLE_PATTERN = /\A(\/|\#)\*\$([^\*]+)\*\1\s*/
33
-
34
- CONDITIONAL_PATTERN = /\A(\/|\#)\*(IF)\s+([^\*]+)\s*\*\1/
35
- BEGIN_END_PATTERN = /\A(\/|\#)\*(BEGIN|END)\s*\*\1/
36
- STRING_LITERAL_PATTERN = /\A(\'(?:[^\']+|\'\')*\')/ ## quoted string
37
- SPLIT_TOKEN_PATTERN = /\A(\S+?)(?=\s*(?:(?:\/|\#)\*|-{2,}|\(|\)|\,))/ ## stop on delimiters --,/*,#*,',',(,)
38
- LITERAL_PATTERN = /\A([^;\s]+)/
39
- SPACES_PATTERN = /\A(\s+)/
40
- QUESTION_PATTERN = /\A\?/
41
- COMMA_PATTERN = /\A\,/
42
- LPAREN_PATTERN = /\A\(/
43
- RPAREN_PATTERN = /\A\)/
44
- ACTUAL_COMMENT_PATTERN = /\A(\/|\#)\*(\s{1,}(?:.*?))\*\1/m ## start with spaces
45
- SEMICOLON_AT_INPUT_END_PATTERN = /\A\;\s*\Z/
46
- UNMATCHED_COMMENT_START_PATTERN = /\A(?:(?:\/|\#)\*)/
47
-
48
- #TODO: remove trailing spaces for S2Dao compatibility, but this spec sometimes causes SQL bugs...
49
- ELSE_PATTERN = /\A\-{2,}\s*ELSE\s*/
50
- AND_PATTERN = /\A(\ *AND)\b/i
51
- OR_PATTERN = /\A(\ *OR)\b/i
52
-
53
-
54
- def parse( io )
55
- @q = []
56
- io.each_line(nil) do |whole|
57
- @s = StringScanner.new(whole)
58
- end
59
- scan_str
60
-
61
- # @q.push [ false, nil ]
62
- @q.push [ false, [@s.pos, nil] ]
63
-
64
- ## call racc's private parse method
65
- do_parse
66
- end
67
-
68
-
69
- ## called by racc
70
- def next_token
71
- @q.shift
72
- end
73
-
74
-
75
- def scan_str
76
- until @s.eos? do
77
- case
78
- when @s.scan(AND_PATTERN)
79
- @q.push [ :AND, [@s.pos, @s[1]] ]
80
- when @s.scan(OR_PATTERN)
81
- @q.push [ :OR, [@s.pos, @s[1]] ]
82
- when @s.scan(SPACES_PATTERN)
83
- @q.push [ :SPACES, [@s.pos, @s[1]] ]
84
- when @s.scan(QUESTION_PATTERN)
85
- @q.push [ :QUESTION, [@s.pos, nil] ]
86
- when @s.scan(COMMA_PATTERN)
87
- @q.push [ :COMMA, [@s.pos, ','] ]
88
- when @s.scan(LPAREN_PATTERN)
89
- @q.push [ :LPAREN, [@s.pos, '('] ]
90
- when @s.scan(RPAREN_PATTERN)
91
- @q.push [ :RPAREN, [@s.pos, ')'] ]
92
- when @s.scan(ELSE_PATTERN)
93
- @q.push [ :ELSE, [@s.pos, nil] ]
94
- when @s.scan(ACTUAL_COMMENT_PATTERN)
95
- @q.push [ :ACTUAL_COMMENT, [@s.pos, @s[1], @s[2]] ] if @preserve_comment
96
- when @s.scan(BEGIN_END_PATTERN)
97
- @q.push [ @s[2].intern, [@s.pos, nil] ]
98
- when @s.scan(CONDITIONAL_PATTERN)
99
- @q.push [ @s[2].intern, [@s.pos, @s[3]] ]
100
- when @s.scan(EMBED_VARIABLE_PATTERN)
101
- @q.push [ :EMBED_VARIABLE, [@s.pos, @s[2]] ]
102
- when @s.scan(PAREN_BIND_VARIABLE_PATTERN)
103
- @q.push [ :PAREN_BIND_VARIABLE, [@s.pos, @s[2]] ]
104
- when @s.scan(BIND_VARIABLE_PATTERN)
105
- @q.push [ :BIND_VARIABLE, [@s.pos, @s[2]] ]
106
- when @s.scan(STRING_LITERAL_PATTERN)
107
- @q.push [ :STRING_LITERAL, [@s.pos, @s[1]] ]
108
- when @s.scan(SPLIT_TOKEN_PATTERN)
109
- @q.push [ :IDENT, [@s.pos, @s[1]] ]
110
- when @s.scan(UNMATCHED_COMMENT_START_PATTERN) ## unmatched comment start, '/*','#*'
111
- raise Racc::ParseError, "unmatched comment. line:[#{line_no(@s.pos)}], str:[#{@s.rest}]"
112
- when @s.scan(LITERAL_PATTERN) ## other string token
113
- @q.push [ :IDENT, [@s.pos, @s[1]] ]
114
- when @s.scan(SEMICOLON_AT_INPUT_END_PATTERN)
115
- #drop semicolon at input end
116
- else
117
- raise Racc::ParseError, "syntax error at or near line:[#{line_no(@s.pos)}], str:[#{@s.rest}]"
118
- end
119
- end
120
- end
121
-
122
-
123
- ## override racc's default on_error method
124
- def on_error(t, v, vstack)
125
- ## cursor in value-stack is an array of two items,
126
- ## that have position value as 0th item. like [731, "ctx[:limit] "]
127
- cursor = vstack.find do |tokens|
128
- tokens.size == 2 and tokens[0].kind_of?(Fixnum)
129
- end
130
- pos = cursor[0]
131
- line = line_no(pos)
132
- rest = @s.string[pos .. -1]
133
- raise Racc::ParseError, "syntax error at or near line:[#{line}], str:[#{rest}]"
134
- end
135
-
136
-
137
- def line_no(pos)
138
- lines = 0
139
- scanned = @s.string[0..(pos)]
140
- scanned.each_line { lines += 1 }
141
- lines
142
- end
143
- ...end twowaysql.y/module_eval...
144
- ##### State transition tables begin ###
145
-
146
- racc_action_table = [
147
- 8, 36, 9, 37, 12, 13, 10, 11, 14, 15,
148
- 16, 17, 18, 19, 22, 23, 24, 8, 38, 9,
149
- 3, 12, 13, 10, 11, 14, 15, 16, 17, 18,
150
- 19, 22, 23, 24, 8, 25, 9, 40, 12, 13,
151
- 10, 11, 14, 15, 16, 17, 18, 19, 22, 23,
152
- 24, 8, 45, 9, 46, 12, 13, 10, 11, 14,
153
- 15, 16, 17, 18, 19, 22, 23, 24, 8, nil,
154
- 9, nil, 12, 13, 10, 11, 14, 15, 16, 17,
155
- 18, 19, 22, 23, 24, 35, 33, 34, 31, 32,
156
- 44, 43, 31, 32 ]
157
-
158
- racc_action_check = [
159
- 2, 24, 2, 24, 2, 2, 2, 2, 2, 2,
160
- 2, 2, 2, 2, 2, 2, 2, 26, 26, 26,
161
- 1, 26, 26, 26, 26, 26, 26, 26, 26, 26,
162
- 26, 26, 26, 26, 27, 3, 27, 28, 27, 27,
163
- 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
164
- 27, 41, 37, 41, 39, 41, 41, 41, 41, 41,
165
- 41, 41, 41, 41, 41, 41, 41, 41, 42, nil,
166
- 42, nil, 42, 42, 42, 42, 42, 42, 42, 42,
167
- 42, 42, 42, 42, 42, 22, 22, 22, 9, 9,
168
- 34, 34, 40, 40 ]
169
-
170
- racc_action_pointer = [
171
- nil, 20, -2, 35, nil, nil, nil, nil, nil, 82,
172
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
173
- nil, nil, 77, nil, -7, nil, 15, 32, 32, nil,
174
- nil, nil, nil, nil, 82, nil, nil, 44, nil, 51,
175
- 86, 49, 66, nil, nil, nil, nil, nil ]
176
-
177
- racc_action_default = [
178
- -2, -35, -1, -35, -3, -4, -5, -6, -2, -2,
179
- -16, -17, -18, -19, -20, -21, -22, -23, -24, -25,
180
- -26, -27, -35, -32, -35, 48, -35, -13, -10, -11,
181
- -12, -2, -2, -28, -35, -30, -33, -35, -7, -35,
182
- -2, -14, -15, -29, -31, -34, -8, -9 ]
183
-
184
- racc_goto_table = [
185
- 2, 1, 28, 39, nil, nil, nil, nil, 26, nil,
186
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
187
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
188
- nil, 41, 42, 47 ]
189
-
190
- racc_goto_check = [
191
- 2, 1, 7, 8, nil, nil, nil, nil, 2, nil,
192
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
193
- nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
194
- nil, 2, 2, 7 ]
195
-
196
- racc_goto_pointer = [
197
- nil, 1, 0, nil, nil, nil, nil, -7, -25, nil,
198
- nil, nil, nil ]
199
-
200
- racc_goto_default = [
201
- nil, nil, 27, 4, 5, 6, 7, nil, nil, 29,
202
- 30, 20, 21 ]
203
-
204
- racc_reduce_table = [
205
- 0, 0, :racc_error,
206
- 1, 20, :_reduce_1,
207
- 0, 21, :_reduce_2,
208
- 2, 21, :_reduce_3,
209
- 1, 22, :_reduce_none,
210
- 1, 22, :_reduce_none,
211
- 1, 22, :_reduce_none,
212
- 3, 25, :_reduce_7,
213
- 4, 24, :_reduce_8,
214
- 2, 27, :_reduce_9,
215
- 0, 27, :_reduce_10,
216
- 1, 26, :_reduce_none,
217
- 1, 26, :_reduce_none,
218
- 1, 26, :_reduce_none,
219
- 2, 28, :_reduce_14,
220
- 2, 29, :_reduce_15,
221
- 1, 23, :_reduce_16,
222
- 1, 23, :_reduce_17,
223
- 1, 23, :_reduce_18,
224
- 1, 23, :_reduce_19,
225
- 1, 23, :_reduce_20,
226
- 1, 23, :_reduce_21,
227
- 1, 23, :_reduce_22,
228
- 1, 23, :_reduce_23,
229
- 1, 23, :_reduce_24,
230
- 1, 23, :_reduce_25,
231
- 1, 23, :_reduce_none,
232
- 1, 23, :_reduce_none,
233
- 2, 30, :_reduce_28,
234
- 3, 30, :_reduce_29,
235
- 2, 30, :_reduce_30,
236
- 3, 30, :_reduce_31,
237
- 1, 30, :_reduce_32,
238
- 2, 31, :_reduce_33,
239
- 3, 31, :_reduce_34 ]
240
-
241
- racc_reduce_n = 35
242
-
243
- racc_shift_n = 48
244
-
245
- racc_token_table = {
246
- false => 0,
247
- :error => 1,
248
- :BEGIN => 2,
249
- :END => 3,
250
- :IF => 4,
251
- :ELSE => 5,
252
- :AND => 6,
253
- :OR => 7,
254
- :IDENT => 8,
255
- :STRING_LITERAL => 9,
256
- :SPACES => 10,
257
- :COMMA => 11,
258
- :LPAREN => 12,
259
- :RPAREN => 13,
260
- :QUESTION => 14,
261
- :ACTUAL_COMMENT => 15,
262
- :BIND_VARIABLE => 16,
263
- :PAREN_BIND_VARIABLE => 17,
264
- :EMBED_VARIABLE => 18 }
265
-
266
- racc_nt_base = 19
267
-
268
- racc_use_result_var = true
269
-
270
- Racc_arg = [
271
- racc_action_table,
272
- racc_action_check,
273
- racc_action_default,
274
- racc_action_pointer,
275
- racc_goto_table,
276
- racc_goto_check,
277
- racc_goto_default,
278
- racc_goto_pointer,
279
- racc_nt_base,
280
- racc_reduce_table,
281
- racc_token_table,
282
- racc_shift_n,
283
- racc_reduce_n,
284
- racc_use_result_var ]
285
-
286
- Racc_token_to_s_table = [
287
- "$end",
288
- "error",
289
- "BEGIN",
290
- "END",
291
- "IF",
292
- "ELSE",
293
- "AND",
294
- "OR",
295
- "IDENT",
296
- "STRING_LITERAL",
297
- "SPACES",
298
- "COMMA",
299
- "LPAREN",
300
- "RPAREN",
301
- "QUESTION",
302
- "ACTUAL_COMMENT",
303
- "BIND_VARIABLE",
304
- "PAREN_BIND_VARIABLE",
305
- "EMBED_VARIABLE",
306
- "$start",
307
- "sql",
308
- "stmt_list",
309
- "stmt",
310
- "primary",
311
- "if_stmt",
312
- "begin_stmt",
313
- "sub_stmt",
314
- "else_stmt",
315
- "and_stmt",
316
- "or_stmt",
317
- "bind_var",
318
- "embed_var" ]
319
-
320
- Racc_debug_parser = false
321
-
322
- ##### State transition tables end #####
323
-
324
- # reduce 0 omitted
325
-
326
- module_eval(<<'.,.,', 'twowaysql.y', 20)
327
- def _reduce_1(val, _values, result)
328
- result = RootNode.new( val[0] )
329
-
330
- result
331
- end
332
- .,.,
333
-
334
- module_eval(<<'.,.,', 'twowaysql.y', 25)
335
- def _reduce_2(val, _values, result)
336
- result = []
337
-
338
- result
339
- end
340
- .,.,
341
-
342
- module_eval(<<'.,.,', 'twowaysql.y', 29)
343
- def _reduce_3(val, _values, result)
344
- result.push val[1]
345
-
346
- result
347
- end
348
- .,.,
349
-
350
- # reduce 4 omitted
351
-
352
- # reduce 5 omitted
353
-
354
- # reduce 6 omitted
355
-
356
- module_eval(<<'.,.,', 'twowaysql.y', 38)
357
- def _reduce_7(val, _values, result)
358
- result = BeginNode.new( val[1] )
359
-
360
- result
361
- end
362
- .,.,
363
-
364
- module_eval(<<'.,.,', 'twowaysql.y', 43)
365
- def _reduce_8(val, _values, result)
366
- result = IfNode.new( val[0][1], val[1], val[2] )
367
-
368
- result
369
- end
370
- .,.,
371
-
372
- module_eval(<<'.,.,', 'twowaysql.y', 48)
373
- def _reduce_9(val, _values, result)
374
- result = val[1]
375
-
376
- result
377
- end
378
- .,.,
379
-
380
- module_eval(<<'.,.,', 'twowaysql.y', 52)
381
- def _reduce_10(val, _values, result)
382
- result = nil
383
-
384
- result
385
- end
386
- .,.,
387
-
388
- # reduce 11 omitted
389
-
390
- # reduce 12 omitted
391
-
392
- # reduce 13 omitted
393
-
394
- module_eval(<<'.,.,', 'twowaysql.y', 61)
395
- def _reduce_14(val, _values, result)
396
- result = SubStatementNode.new( val[0][1], val[1] )
397
-
398
- result
399
- end
400
- .,.,
401
-
402
- module_eval(<<'.,.,', 'twowaysql.y', 66)
403
- def _reduce_15(val, _values, result)
404
- result = SubStatementNode.new( val[0][1], val[1] )
405
-
406
- result
407
- end
408
- .,.,
409
-
410
- module_eval(<<'.,.,', 'twowaysql.y', 71)
411
- def _reduce_16(val, _values, result)
412
- result = LiteralNode.new( val[0][1] )
413
-
414
- result
415
- end
416
- .,.,
417
-
418
- module_eval(<<'.,.,', 'twowaysql.y', 75)
419
- def _reduce_17(val, _values, result)
420
- result = LiteralNode.new( val[0][1] )
421
-
422
- result
423
- end
424
- .,.,
425
-
426
- module_eval(<<'.,.,', 'twowaysql.y', 79)
427
- def _reduce_18(val, _values, result)
428
- result = LiteralNode.new( val[0][1] )
429
-
430
- result
431
- end
432
- .,.,
433
-
434
- module_eval(<<'.,.,', 'twowaysql.y', 83)
435
- def _reduce_19(val, _values, result)
436
- result = LiteralNode.new( val[0][1] )
437
-
438
- result
439
- end
440
- .,.,
441
-
442
- module_eval(<<'.,.,', 'twowaysql.y', 87)
443
- def _reduce_20(val, _values, result)
444
- result = WhiteSpaceNode.new( val[0][1], @preserve_space )
445
-
446
- result
447
- end
448
- .,.,
449
-
450
- module_eval(<<'.,.,', 'twowaysql.y', 91)
451
- def _reduce_21(val, _values, result)
452
- result = LiteralNode.new( val[0][1] )
453
-
454
- result
455
- end
456
- .,.,
457
-
458
- module_eval(<<'.,.,', 'twowaysql.y', 95)
459
- def _reduce_22(val, _values, result)
460
- result = LiteralNode.new( val[0][1] )
461
-
462
- result
463
- end
464
- .,.,
465
-
466
- module_eval(<<'.,.,', 'twowaysql.y', 99)
467
- def _reduce_23(val, _values, result)
468
- result = LiteralNode.new( val[0][1] )
469
-
470
- result
471
- end
472
- .,.,
473
-
474
- module_eval(<<'.,.,', 'twowaysql.y', 103)
475
- def _reduce_24(val, _values, result)
476
- @num_questions += 1
477
- result = QuestionNode.new( @num_questions )
478
-
479
- result
480
- end
481
- .,.,
482
-
483
- module_eval(<<'.,.,', 'twowaysql.y', 108)
484
- def _reduce_25(val, _values, result)
485
- result = ActualCommentNode.new( val[0][1] , val[0][2] )
486
-
487
- result
488
- end
489
- .,.,
490
-
491
- # reduce 26 omitted
492
-
493
- # reduce 27 omitted
494
-
495
- module_eval(<<'.,.,', 'twowaysql.y', 115)
496
- def _reduce_28(val, _values, result)
497
- result = BindVariableNode.new( val[0][1] )
498
-
499
- result
500
- end
501
- .,.,
502
-
503
- module_eval(<<'.,.,', 'twowaysql.y', 119)
504
- def _reduce_29(val, _values, result)
505
- result = BindVariableNode.new( val[0][1] )
506
-
507
- result
508
- end
509
- .,.,
510
-
511
- module_eval(<<'.,.,', 'twowaysql.y', 123)
512
- def _reduce_30(val, _values, result)
513
- result = BindVariableNode.new( val[0][1] )
514
-
515
- result
516
- end
517
- .,.,
518
-
519
- module_eval(<<'.,.,', 'twowaysql.y', 127)
520
- def _reduce_31(val, _values, result)
521
- result = BindVariableNode.new( val[0][1] )
522
-
523
- result
524
- end
525
- .,.,
526
-
527
- module_eval(<<'.,.,', 'twowaysql.y', 131)
528
- def _reduce_32(val, _values, result)
529
- result = ParenBindVariableNode.new( val[0][1] )
530
-
531
- result
532
- end
533
- .,.,
534
-
535
- module_eval(<<'.,.,', 'twowaysql.y', 136)
536
- def _reduce_33(val, _values, result)
537
- result = EmbedVariableNode.new( val[0][1] )
538
-
539
- result
540
- end
541
- .,.,
542
-
543
- module_eval(<<'.,.,', 'twowaysql.y', 140)
544
- def _reduce_34(val, _values, result)
545
- result = EmbedVariableNode.new( val[0][1] )
546
-
547
- result
548
- end
549
- .,.,
550
-
551
- def _reduce_none(val, _values, result)
552
- val[0]
553
- end
554
-
555
- end # class Parser
556
- end # module TwoWaySQL
data/test/scandata/brace DELETED
@@ -1,7 +0,0 @@
1
- { {
2
- } { } {
3
- { { { } } }
4
- { { { {} } } }
5
- {} {} {}
6
- }
7
- }
data/test/scandata/gvar DELETED
@@ -1 +0,0 @@
1
- { $' $" $& $-a $/ $\ $( $1 $2 $3 $? $-i }
data/test/scandata/normal DELETED
@@ -1,4 +0,0 @@
1
- {
2
- # comment
3
- result = "string".match(/regexp/)[0]
4
- }
@@ -1,18 +0,0 @@
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 DELETED
@@ -1,10 +0,0 @@
1
- {
2
- # here's many '/'s
3
- i = 5/1 # div
4
- re = /regex/ # regexp
5
- i /= 5 # div
6
- result = 5 / 1 # div
7
- result = 5/ 1 # div
8
- call(/regex/) # regexp
9
- call /regex/ # regexp
10
- }
data/test/src.intp DELETED
@@ -1,34 +0,0 @@
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 DELETED
@@ -1,20 +0,0 @@
1
- class S
2
-
3
- start st
4
-
5
- rule
6
-
7
- n: D { result = 'no' }
8
- st : A B C n { result = 'ok' }
9
-
10
- end
11
-
12
- ---- inner
13
-
14
- def parse
15
- do_parse
16
- end
17
-
18
- ---- footer
19
-
20
- S.new.parse == 'ok' or raise 'start stmt not worked'
data/test/test_chk_y.rb DELETED
@@ -1,52 +0,0 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
2
-
3
- module Racc
4
- class TestChkY < TestCase
5
- def setup
6
- super
7
- file = File.join(ASSET_DIR, 'chk.y')
8
- @debug_flags = Racc::DebugFlags.parse_option_string('o')
9
- parser = Racc::GrammarFileParser.new(@debug_flags)
10
- @result = parser.parse(File.read(file), File.basename(file))
11
- @states = Racc::States.new(@result.grammar).nfa
12
- @states.dfa
13
- end
14
-
15
- def test_compile_chk_y
16
- generator = Racc::ParserFileGenerator.new(@states, @result.params.dup)
17
-
18
- # it generates valid ruby
19
- assert Module.new {
20
- self.instance_eval(generator.generate_parser, __FILE__, __LINE__)
21
- }
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
- # it generates valid ruby
39
- assert Module.new {
40
- self.instance_eval(generator.generate_parser, __FILE__, __LINE__)
41
- }
42
-
43
- grammar = @states.grammar
44
-
45
- assert_equal 0, @states.n_srconflicts
46
- assert_equal 0, @states.n_rrconflicts
47
- assert_equal 0, grammar.n_useless_nonterminals
48
- assert_equal 0, grammar.n_useless_rules
49
- assert_nil grammar.n_expected_srconflicts
50
- end
51
- end
52
- end