quanty 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,852 @@
1
+ #
2
+ # DO NOT MODIFY!!!!
3
+ # This file is automatically generated by Racc 1.4.6
4
+ # from Racc grammer file "".
5
+ #
6
+
7
+ ###### racc/parser.rb begin
8
+ unless $".index 'racc/parser.rb'
9
+ $".push 'racc/parser.rb'
10
+ self.class.module_eval(<<'...end racc/parser.rb/module_eval...', 'racc/parser.rb', 1)
11
+ #
12
+ # $Id$
13
+ #
14
+ # Copyright (c) 1999-2006 Minero Aoki
15
+ #
16
+ # This program is free software.
17
+ # You can distribute/modify this program under the same terms of ruby.
18
+ #
19
+ # As a special exception, when this code is copied by Racc
20
+ # into a Racc output file, you may use that output file
21
+ # without restriction.
22
+ #
23
+
24
+ unless defined?(NotImplementedError)
25
+ NotImplementedError = NotImplementError
26
+ end
27
+
28
+ module Racc
29
+ class ParseError < StandardError; end
30
+ end
31
+ unless defined?(::ParseError)
32
+ ParseError = Racc::ParseError
33
+ end
34
+
35
+ module Racc
36
+
37
+ unless defined?(Racc_No_Extentions)
38
+ Racc_No_Extentions = false
39
+ end
40
+
41
+ class Parser
42
+
43
+ Racc_Runtime_Version = '1.4.6'
44
+ Racc_Runtime_Revision = '$Id$'
45
+
46
+ Racc_Runtime_Core_Version_R = '1.4.6'
47
+ Racc_Runtime_Core_Revision_R = '$Id$'.split[1]
48
+ begin
49
+ require 'racc/cparse'
50
+ # Racc_Runtime_Core_Version_C = (defined in extention)
51
+ Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
52
+ unless new.respond_to?(:_racc_do_parse_c, true)
53
+ raise LoadError, 'old cparse.so'
54
+ end
55
+ if Racc_No_Extentions
56
+ raise LoadError, 'selecting ruby version of racc runtime core'
57
+ end
58
+
59
+ Racc_Main_Parsing_Routine = :_racc_do_parse_c
60
+ Racc_YY_Parse_Method = :_racc_yyparse_c
61
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
62
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
63
+ Racc_Runtime_Type = 'c'
64
+ rescue LoadError
65
+ Racc_Main_Parsing_Routine = :_racc_do_parse_rb
66
+ Racc_YY_Parse_Method = :_racc_yyparse_rb
67
+ Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
68
+ Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
69
+ Racc_Runtime_Type = 'ruby'
70
+ end
71
+
72
+ def Parser.racc_runtime_type
73
+ Racc_Runtime_Type
74
+ end
75
+
76
+ private
77
+
78
+ def _racc_setup
79
+ @yydebug = false unless self.class::Racc_debug_parser
80
+ @yydebug = false unless defined?(@yydebug)
81
+ if @yydebug
82
+ @racc_debug_out = $stderr unless defined?(@racc_debug_out)
83
+ @racc_debug_out ||= $stderr
84
+ end
85
+ arg = self.class::Racc_arg
86
+ arg[13] = true if arg.size < 14
87
+ arg
88
+ end
89
+
90
+ def _racc_init_sysvars
91
+ @racc_state = [0]
92
+ @racc_tstack = []
93
+ @racc_vstack = []
94
+
95
+ @racc_t = nil
96
+ @racc_val = nil
97
+
98
+ @racc_read_next = true
99
+
100
+ @racc_user_yyerror = false
101
+ @racc_error_status = 0
102
+ end
103
+
104
+ ###
105
+ ### do_parse
106
+ ###
107
+
108
+ def do_parse
109
+ __send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
110
+ end
111
+
112
+ def next_token
113
+ raise NotImplementedError, "#{self.class}\#next_token is not defined"
114
+ end
115
+
116
+ def _racc_do_parse_rb(arg, in_debug)
117
+ action_table, action_check, action_default, action_pointer,
118
+ goto_table, goto_check, goto_default, goto_pointer,
119
+ nt_base, reduce_table, token_table, shift_n,
120
+ reduce_n, use_result, * = arg
121
+
122
+ _racc_init_sysvars
123
+ tok = act = i = nil
124
+ nerr = 0
125
+
126
+ catch(:racc_end_parse) {
127
+ while true
128
+ if i = action_pointer[@racc_state[-1]]
129
+ if @racc_read_next
130
+ if @racc_t != 0 # not EOF
131
+ tok, @racc_val = next_token()
132
+ unless tok # EOF
133
+ @racc_t = 0
134
+ else
135
+ @racc_t = (token_table[tok] or 1) # error token
136
+ end
137
+ racc_read_token(@racc_t, tok, @racc_val) if @yydebug
138
+ @racc_read_next = false
139
+ end
140
+ end
141
+ i += @racc_t
142
+ unless i >= 0 and
143
+ act = action_table[i] and
144
+ action_check[i] == @racc_state[-1]
145
+ act = action_default[@racc_state[-1]]
146
+ end
147
+ else
148
+ act = action_default[@racc_state[-1]]
149
+ end
150
+ while act = _racc_evalact(act, arg)
151
+ ;
152
+ end
153
+ end
154
+ }
155
+ end
156
+
157
+ ###
158
+ ### yyparse
159
+ ###
160
+
161
+ def yyparse(recv, mid)
162
+ __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
163
+ end
164
+
165
+ def _racc_yyparse_rb(recv, mid, arg, c_debug)
166
+ action_table, action_check, action_default, action_pointer,
167
+ goto_table, goto_check, goto_default, goto_pointer,
168
+ nt_base, reduce_table, token_table, shift_n,
169
+ reduce_n, use_result, * = arg
170
+
171
+ _racc_init_sysvars
172
+ nerr = 0
173
+
174
+ catch(:racc_end_parse) {
175
+ until i = action_pointer[@racc_state[-1]]
176
+ while act = _racc_evalact(action_default[@racc_state[-1]], arg)
177
+ ;
178
+ end
179
+ end
180
+ recv.__send__(mid) do |tok, val|
181
+ unless tok
182
+ @racc_t = 0
183
+ else
184
+ @racc_t = (token_table[tok] or 1) # error token
185
+ end
186
+ @racc_val = val
187
+ @racc_read_next = false
188
+
189
+ i += @racc_t
190
+ unless i >= 0 and
191
+ act = action_table[i] and
192
+ action_check[i] == @racc_state[-1]
193
+ act = action_default[@racc_state[-1]]
194
+ end
195
+ while act = _racc_evalact(act, arg)
196
+ ;
197
+ end
198
+
199
+ while !(i = action_pointer[@racc_state[-1]]) ||
200
+ ! @racc_read_next ||
201
+ @racc_t == 0 # $
202
+ unless i and i += @racc_t and
203
+ i >= 0 and
204
+ act = action_table[i] and
205
+ action_check[i] == @racc_state[-1]
206
+ act = action_default[@racc_state[-1]]
207
+ end
208
+ while act = _racc_evalact(act, arg)
209
+ ;
210
+ end
211
+ end
212
+ end
213
+ }
214
+ end
215
+
216
+ ###
217
+ ### common
218
+ ###
219
+
220
+ def _racc_evalact(act, arg)
221
+ action_table, action_check, action_default, action_pointer,
222
+ goto_table, goto_check, goto_default, goto_pointer,
223
+ nt_base, reduce_table, token_table, shift_n,
224
+ reduce_n, use_result, * = arg
225
+ nerr = 0 # tmp
226
+
227
+ if act > 0 and act < shift_n
228
+ #
229
+ # shift
230
+ #
231
+ if @racc_error_status > 0
232
+ @racc_error_status -= 1 unless @racc_t == 1 # error token
233
+ end
234
+ @racc_vstack.push @racc_val
235
+ @racc_state.push act
236
+ @racc_read_next = true
237
+ if @yydebug
238
+ @racc_tstack.push @racc_t
239
+ racc_shift @racc_t, @racc_tstack, @racc_vstack
240
+ end
241
+
242
+ elsif act < 0 and act > -reduce_n
243
+ #
244
+ # reduce
245
+ #
246
+ code = catch(:racc_jump) {
247
+ @racc_state.push _racc_do_reduce(arg, act)
248
+ false
249
+ }
250
+ if code
251
+ case code
252
+ when 1 # yyerror
253
+ @racc_user_yyerror = true # user_yyerror
254
+ return -reduce_n
255
+ when 2 # yyaccept
256
+ return shift_n
257
+ else
258
+ raise '[Racc Bug] unknown jump code'
259
+ end
260
+ end
261
+
262
+ elsif act == shift_n
263
+ #
264
+ # accept
265
+ #
266
+ racc_accept if @yydebug
267
+ throw :racc_end_parse, @racc_vstack[0]
268
+
269
+ elsif act == -reduce_n
270
+ #
271
+ # error
272
+ #
273
+ case @racc_error_status
274
+ when 0
275
+ unless arg[21] # user_yyerror
276
+ nerr += 1
277
+ on_error @racc_t, @racc_val, @racc_vstack
278
+ end
279
+ when 3
280
+ if @racc_t == 0 # is $
281
+ throw :racc_end_parse, nil
282
+ end
283
+ @racc_read_next = true
284
+ end
285
+ @racc_user_yyerror = false
286
+ @racc_error_status = 3
287
+ while true
288
+ if i = action_pointer[@racc_state[-1]]
289
+ i += 1 # error token
290
+ if i >= 0 and
291
+ (act = action_table[i]) and
292
+ action_check[i] == @racc_state[-1]
293
+ break
294
+ end
295
+ end
296
+ throw :racc_end_parse, nil if @racc_state.size <= 1
297
+ @racc_state.pop
298
+ @racc_vstack.pop
299
+ if @yydebug
300
+ @racc_tstack.pop
301
+ racc_e_pop @racc_state, @racc_tstack, @racc_vstack
302
+ end
303
+ end
304
+ return act
305
+
306
+ else
307
+ raise "[Racc Bug] unknown action #{act.inspect}"
308
+ end
309
+
310
+ racc_next_state(@racc_state[-1], @racc_state) if @yydebug
311
+
312
+ nil
313
+ end
314
+
315
+ def _racc_do_reduce(arg, act)
316
+ action_table, action_check, action_default, action_pointer,
317
+ goto_table, goto_check, goto_default, goto_pointer,
318
+ nt_base, reduce_table, token_table, shift_n,
319
+ reduce_n, use_result, * = arg
320
+ state = @racc_state
321
+ vstack = @racc_vstack
322
+ tstack = @racc_tstack
323
+
324
+ i = act * -3
325
+ len = reduce_table[i]
326
+ reduce_to = reduce_table[i+1]
327
+ method_id = reduce_table[i+2]
328
+ void_array = []
329
+
330
+ tmp_t = tstack[-len, len] if @yydebug
331
+ tmp_v = vstack[-len, len]
332
+ tstack[-len, len] = void_array if @yydebug
333
+ vstack[-len, len] = void_array
334
+ state[-len, len] = void_array
335
+
336
+ # tstack must be updated AFTER method call
337
+ if use_result
338
+ vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
339
+ else
340
+ vstack.push __send__(method_id, tmp_v, vstack)
341
+ end
342
+ tstack.push reduce_to
343
+
344
+ racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
345
+
346
+ k1 = reduce_to - nt_base
347
+ if i = goto_pointer[k1]
348
+ i += state[-1]
349
+ if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
350
+ return curstate
351
+ end
352
+ end
353
+ goto_default[k1]
354
+ end
355
+
356
+ def on_error(t, val, vstack)
357
+ raise ParseError, sprintf("\nparse error on value %s (%s)",
358
+ val.inspect, token_to_str(t) || '?')
359
+ end
360
+
361
+ def yyerror
362
+ throw :racc_jump, 1
363
+ end
364
+
365
+ def yyaccept
366
+ throw :racc_jump, 2
367
+ end
368
+
369
+ def yyerrok
370
+ @racc_error_status = 0
371
+ end
372
+
373
+ #
374
+ # for debugging output
375
+ #
376
+
377
+ def racc_read_token(t, tok, val)
378
+ @racc_debug_out.print 'read '
379
+ @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
380
+ @racc_debug_out.puts val.inspect
381
+ @racc_debug_out.puts
382
+ end
383
+
384
+ def racc_shift(tok, tstack, vstack)
385
+ @racc_debug_out.puts "shift #{racc_token2str tok}"
386
+ racc_print_stacks tstack, vstack
387
+ @racc_debug_out.puts
388
+ end
389
+
390
+ def racc_reduce(toks, sim, tstack, vstack)
391
+ out = @racc_debug_out
392
+ out.print 'reduce '
393
+ if toks.empty?
394
+ out.print ' <none>'
395
+ else
396
+ toks.each {|t| out.print ' ', racc_token2str(t) }
397
+ end
398
+ out.puts " --> #{racc_token2str(sim)}"
399
+
400
+ racc_print_stacks tstack, vstack
401
+ @racc_debug_out.puts
402
+ end
403
+
404
+ def racc_accept
405
+ @racc_debug_out.puts 'accept'
406
+ @racc_debug_out.puts
407
+ end
408
+
409
+ def racc_e_pop(state, tstack, vstack)
410
+ @racc_debug_out.puts 'error recovering mode: pop token'
411
+ racc_print_states state
412
+ racc_print_stacks tstack, vstack
413
+ @racc_debug_out.puts
414
+ end
415
+
416
+ def racc_next_state(curstate, state)
417
+ @racc_debug_out.puts "goto #{curstate}"
418
+ racc_print_states state
419
+ @racc_debug_out.puts
420
+ end
421
+
422
+ def racc_print_stacks(t, v)
423
+ out = @racc_debug_out
424
+ out.print ' ['
425
+ t.each_index do |i|
426
+ out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
427
+ end
428
+ out.puts ' ]'
429
+ end
430
+
431
+ def racc_print_states(s)
432
+ out = @racc_debug_out
433
+ out.print ' ['
434
+ s.each {|st| out.print ' ', st }
435
+ out.puts ' ]'
436
+ end
437
+
438
+ def racc_token2str(tok)
439
+ self.class::Racc_token_to_s_table[tok] or
440
+ raise "[Racc Bug] can't convert token #{tok} to string"
441
+ end
442
+
443
+ def token_to_str(t)
444
+ self.class::Racc_token_to_s_table[t]
445
+ end
446
+
447
+ end
448
+
449
+ end
450
+
451
+ ...end racc/parser.rb/module_eval...
452
+ end
453
+ ###### racc/parser.rb end
454
+
455
+
456
+ # parse.y, quanty/parse.rb
457
+ #
458
+ # by Masahiro Tanaka <masa@ir.isas.ac.jp>
459
+ #
460
+ class Quanty
461
+
462
+ class Parse < Racc::Parser
463
+
464
+ module_eval(<<'...end parse.y/module_eval...', 'parse.y', 72)
465
+
466
+ def parse( str )
467
+ @q = []
468
+
469
+ while str.size > 0 do
470
+ #p str
471
+ case str
472
+ when /\A[\s\n]+/ou
473
+ when /\A\d+\.?\d*([eE][+-]?\d+)?/ou
474
+ @q.push [:NUMBER, $&.to_f]
475
+ when /\A([A-Z]\.){2}/u
476
+ when /\A[A-Za-z_]+ -/u
477
+ when /\A[A-Za-z_µ]+([A-Za-z_µ0-9-]+[A-Za-z_µ])?/ou
478
+ @q.push [:WORD, $&]
479
+ when /\A[$%'"]'?/ou
480
+ @q.push [:WORD, $&]
481
+ when /\A\^|\A\*\*/ou
482
+ @q.push [:POW, $&]
483
+ when /\A./ou
484
+ @q.push [$&,$&]
485
+ end
486
+ str = $'
487
+ end
488
+ @q.push [false, '$end']
489
+
490
+ do_parse
491
+ end
492
+
493
+ def next_token
494
+ @q.shift
495
+ end
496
+
497
+ ...end parse.y/module_eval...
498
+ ##### State transition tables begin ###
499
+
500
+ racc_action_table = [
501
+ 23, 22, 24, 25, 26, 27, 29, 23, 20, 38,
502
+ 3, 4, 23, 23, 24, 25, 26, 27, 29, 23,
503
+ 20, 23, 3, 4, 23, 33, 24, 25, 26, 27,
504
+ 29, 40, 20, 37, 3, 4, 23, 39, 24, 36,
505
+ 26, 27, 29, 30, 31, 38, nil, 30, 31, 20,
506
+ nil, 3, 4, 20, 5, 3, 4, 10, 12, 2,
507
+ 5, 3, 4, 10, 12, 2, 5, 3, 4, 10,
508
+ 12, 2, 5, 3, 4, 10, 12, 2, 14, 3,
509
+ 4, nil, nil, 23, 10, 12, 13, 26, 27, 29,
510
+ 23, nil, nil, 23, 26, 27, 29, 26, 27, 29,
511
+ 23, 10, 12, 13, 26, 27, 29, 10, 12, 2,
512
+ nil, 3, 4, 10, 12, 2, nil, 3, 4, 10,
513
+ 12, 2, nil, 3, 4, 23, nil, 24, 36, 26,
514
+ 23, nil, 24, 36, 26, 20, nil, 3, 4, 10,
515
+ 12, 13, 10, 12, 13, 10, 12, 13, 10, 12,
516
+ 13, 10, 12, 13, 10, 12, 13, 10, 12, 13 ]
517
+
518
+ racc_action_check = [
519
+ 17, 6, 17, 17, 17, 17, 17, 41, 17, 17,
520
+ 17, 17, 19, 42, 19, 19, 19, 19, 19, 43,
521
+ 19, 45, 19, 19, 8, 10, 8, 8, 8, 8,
522
+ 8, 22, 8, 16, 8, 8, 34, 18, 34, 34,
523
+ 34, 34, 34, 28, 28, 34, nil, 9, 9, 28,
524
+ nil, 28, 28, 9, 0, 9, 9, 0, 0, 0,
525
+ 20, 0, 0, 20, 20, 20, 4, 20, 20, 4,
526
+ 4, 4, 2, 4, 4, 2, 2, 2, 1, 2,
527
+ 2, nil, nil, 15, 1, 1, 1, 15, 15, 15,
528
+ 48, nil, nil, 35, 48, 48, 48, 35, 35, 35,
529
+ 50, 29, 29, 29, 50, 50, 50, 31, 31, 31,
530
+ nil, 31, 31, 30, 30, 30, nil, 30, 30, 25,
531
+ 25, 25, nil, 25, 25, 47, nil, 47, 47, 47,
532
+ 46, nil, 46, 46, 46, 5, nil, 5, 5, 27,
533
+ 27, 27, 13, 13, 13, 23, 23, 23, 14, 14,
534
+ 14, 36, 36, 36, 26, 26, 26, 24, 24, 24 ]
535
+
536
+ racc_action_pointer = [
537
+ 48, 75, 66, nil, 60, 124, 1, nil, 21, 42,
538
+ 15, nil, nil, 133, 139, 80, 21, -3, 22, 9,
539
+ 54, nil, 31, 136, 148, 110, 145, 130, 38, 92,
540
+ 104, 98, nil, nil, 33, 90, 142, nil, nil, nil,
541
+ nil, 4, 10, 16, nil, 18, 127, 122, 87, nil,
542
+ 97, nil ]
543
+
544
+ racc_action_default = [
545
+ -2, -23, -29, -26, -29, -29, -29, -1, -3, -13,
546
+ -29, -17, -4, -29, -29, -24, -29, -29, -29, -29,
547
+ -29, -15, -29, -29, -29, -29, -29, -29, -14, -29,
548
+ -29, -29, -18, -5, -29, -25, -29, -27, -12, -28,
549
+ 52, -11, -10, -9, -16, -8, -6, -7, -21, -19,
550
+ -22, -20 ]
551
+
552
+ racc_goto_table = [
553
+ 8, 15, 17, 7, 6, nil, 28, 18, nil, nil,
554
+ nil, nil, 21, 34, 35, 28, 32, 28, nil, nil,
555
+ nil, nil, nil, 41, 42, 43, 45, 46, nil, 47,
556
+ 48, 50, 44, nil, nil, 32, 43, 49, 51 ]
557
+
558
+ racc_goto_check = [
559
+ 3, 3, 3, 2, 1, nil, 4, 2, nil, nil,
560
+ nil, nil, 5, 3, 3, 4, 5, 4, nil, nil,
561
+ nil, nil, nil, 3, 3, 3, 3, 3, nil, 3,
562
+ 3, 3, 5, nil, nil, 5, 3, 5, 5 ]
563
+
564
+ racc_goto_pointer = [
565
+ nil, 4, 3, 0, -2, 7, nil ]
566
+
567
+ racc_goto_default = [
568
+ nil, nil, 16, 19, 9, 11, 1 ]
569
+
570
+ racc_reduce_table = [
571
+ 0, 0, :racc_error,
572
+ 1, 17, :_reduce_none,
573
+ 0, 17, :_reduce_2,
574
+ 1, 17, :_reduce_3,
575
+ 1, 19, :_reduce_none,
576
+ 2, 19, :_reduce_5,
577
+ 3, 19, :_reduce_6,
578
+ 3, 19, :_reduce_7,
579
+ 3, 19, :_reduce_8,
580
+ 3, 19, :_reduce_9,
581
+ 3, 19, :_reduce_10,
582
+ 3, 19, :_reduce_11,
583
+ 3, 19, :_reduce_12,
584
+ 1, 18, :_reduce_none,
585
+ 2, 18, :_reduce_14,
586
+ 2, 18, :_reduce_15,
587
+ 3, 18, :_reduce_16,
588
+ 1, 20, :_reduce_none,
589
+ 2, 20, :_reduce_18,
590
+ 3, 20, :_reduce_19,
591
+ 3, 20, :_reduce_20,
592
+ 3, 20, :_reduce_21,
593
+ 3, 20, :_reduce_22,
594
+ 1, 21, :_reduce_none,
595
+ 2, 21, :_reduce_24,
596
+ 3, 21, :_reduce_25,
597
+ 1, 22, :_reduce_26,
598
+ 3, 22, :_reduce_27,
599
+ 3, 22, :_reduce_28 ]
600
+
601
+ racc_reduce_n = 29
602
+
603
+ racc_shift_n = 52
604
+
605
+ racc_token_table = {
606
+ false => 0,
607
+ :error => 1,
608
+ :UMINUS => 2,
609
+ :POW => 3,
610
+ :UPOW => 4,
611
+ "*" => 5,
612
+ "/" => 6,
613
+ "|" => 7,
614
+ "+" => 8,
615
+ "-" => 9,
616
+ :NUMBER => 10,
617
+ "(" => 11,
618
+ ")" => 12,
619
+ :WORD => 13,
620
+ "[" => 14,
621
+ "]" => 15 }
622
+
623
+ racc_nt_base = 16
624
+
625
+ racc_use_result_var = true
626
+
627
+ Racc_arg = [
628
+ racc_action_table,
629
+ racc_action_check,
630
+ racc_action_default,
631
+ racc_action_pointer,
632
+ racc_goto_table,
633
+ racc_goto_check,
634
+ racc_goto_default,
635
+ racc_goto_pointer,
636
+ racc_nt_base,
637
+ racc_reduce_table,
638
+ racc_token_table,
639
+ racc_shift_n,
640
+ racc_reduce_n,
641
+ racc_use_result_var ]
642
+
643
+ Racc_token_to_s_table = [
644
+ "$end",
645
+ "error",
646
+ "UMINUS",
647
+ "POW",
648
+ "UPOW",
649
+ "\"*\"",
650
+ "\"/\"",
651
+ "\"|\"",
652
+ "\"+\"",
653
+ "\"-\"",
654
+ "NUMBER",
655
+ "\"(\"",
656
+ "\")\"",
657
+ "WORD",
658
+ "\"[\"",
659
+ "\"]\"",
660
+ "$start",
661
+ "target",
662
+ "val",
663
+ "num",
664
+ "seq",
665
+ "exp",
666
+ "unit" ]
667
+
668
+ Racc_debug_parser = false
669
+
670
+ ##### State transition tables end #####
671
+
672
+ # reduce 0 omitted
673
+
674
+ # reduce 1 omitted
675
+
676
+ module_eval(<<'.,.,', 'parse.y', 21)
677
+ def _reduce_2(val, _values, result)
678
+ result = Quanty::Fact.new
679
+ result
680
+ end
681
+ .,.,
682
+
683
+ module_eval(<<'.,.,', 'parse.y', 22)
684
+ def _reduce_3(val, _values, result)
685
+ result = Quanty::Fact.new(val[0])
686
+ result
687
+ end
688
+ .,.,
689
+
690
+ # reduce 4 omitted
691
+
692
+ module_eval(<<'.,.,', 'parse.y', 26)
693
+ def _reduce_5(val, _values, result)
694
+ result = -val[1]
695
+ result
696
+ end
697
+ .,.,
698
+
699
+ module_eval(<<'.,.,', 'parse.y', 27)
700
+ def _reduce_6(val, _values, result)
701
+ result += val[2]
702
+ result
703
+ end
704
+ .,.,
705
+
706
+ module_eval(<<'.,.,', 'parse.y', 28)
707
+ def _reduce_7(val, _values, result)
708
+ result -= val[2]
709
+ result
710
+ end
711
+ .,.,
712
+
713
+ module_eval(<<'.,.,', 'parse.y', 29)
714
+ def _reduce_8(val, _values, result)
715
+ result /= val[2]
716
+ result
717
+ end
718
+ .,.,
719
+
720
+ module_eval(<<'.,.,', 'parse.y', 30)
721
+ def _reduce_9(val, _values, result)
722
+ result /= val[2]
723
+ result
724
+ end
725
+ .,.,
726
+
727
+ module_eval(<<'.,.,', 'parse.y', 31)
728
+ def _reduce_10(val, _values, result)
729
+ result *= val[2]
730
+ result
731
+ end
732
+ .,.,
733
+
734
+ module_eval(<<'.,.,', 'parse.y', 32)
735
+ def _reduce_11(val, _values, result)
736
+ result **= val[2]
737
+ result
738
+ end
739
+ .,.,
740
+
741
+ module_eval(<<'.,.,', 'parse.y', 33)
742
+ def _reduce_12(val, _values, result)
743
+ result = val[1]
744
+ result
745
+ end
746
+ .,.,
747
+
748
+ # reduce 13 omitted
749
+
750
+ module_eval(<<'.,.,', 'parse.y', 37)
751
+ def _reduce_14(val, _values, result)
752
+ result = val[1].fac!(val[0])
753
+ result
754
+ end
755
+ .,.,
756
+
757
+ module_eval(<<'.,.,', 'parse.y', 38)
758
+ def _reduce_15(val, _values, result)
759
+ result = val[1].pow!(-1)
760
+ result
761
+ end
762
+ .,.,
763
+
764
+ module_eval(<<'.,.,', 'parse.y', 39)
765
+ def _reduce_16(val, _values, result)
766
+ result = val[2].pow!(-1).fac!(val[0])
767
+ result
768
+ end
769
+ .,.,
770
+
771
+ # reduce 17 omitted
772
+
773
+ module_eval(<<'.,.,', 'parse.y', 43)
774
+ def _reduce_18(val, _values, result)
775
+ result.mul!(val[1])
776
+ result
777
+ end
778
+ .,.,
779
+
780
+ module_eval(<<'.,.,', 'parse.y', 44)
781
+ def _reduce_19(val, _values, result)
782
+ result.mul!(val[2])
783
+ result
784
+ end
785
+ .,.,
786
+
787
+ module_eval(<<'.,.,', 'parse.y', 45)
788
+ def _reduce_20(val, _values, result)
789
+ result.div!(val[2])
790
+ result
791
+ end
792
+ .,.,
793
+
794
+ module_eval(<<'.,.,', 'parse.y', 46)
795
+ def _reduce_21(val, _values, result)
796
+ result.fac!(val[2])
797
+ result
798
+ end
799
+ .,.,
800
+
801
+ module_eval(<<'.,.,', 'parse.y', 47)
802
+ def _reduce_22(val, _values, result)
803
+ result.fac!(val[2]**-1)
804
+ result
805
+ end
806
+ .,.,
807
+
808
+ # reduce 23 omitted
809
+
810
+ module_eval(<<'.,.,', 'parse.y', 51)
811
+ def _reduce_24(val, _values, result)
812
+ result.pow!(val[1])
813
+ result
814
+ end
815
+ .,.,
816
+
817
+ module_eval(<<'.,.,', 'parse.y', 52)
818
+ def _reduce_25(val, _values, result)
819
+ result.pow!(val[2])
820
+ result
821
+ end
822
+ .,.,
823
+
824
+ module_eval(<<'.,.,', 'parse.y', 55)
825
+ def _reduce_26(val, _values, result)
826
+ result = Quanty::Fact.new(val[0])
827
+ result
828
+ end
829
+ .,.,
830
+
831
+ module_eval(<<'.,.,', 'parse.y', 56)
832
+ def _reduce_27(val, _values, result)
833
+ result = val[1]
834
+ result
835
+ end
836
+ .,.,
837
+
838
+ module_eval(<<'.,.,', 'parse.y', 57)
839
+ def _reduce_28(val, _values, result)
840
+ result = val[1]
841
+ result
842
+ end
843
+ .,.,
844
+
845
+ def _reduce_none(val, _values, result)
846
+ val[0]
847
+ end
848
+
849
+ end # class Parse
850
+
851
+
852
+ end # class Quanty