3e57cee2222aca7a634eda7405726c0d213b5415
[nit.git] / contrib / pep8analysis / src / parser / parser.nit
1 # Parser.
2 # This file was generated by SableCC (http://www.sablecc.org/).
3 module parser
4
5 intrude import parser_prod
6 import tables
7
8 # State of the parser automata as stored in the parser stack.
9 private class State
10 # The internal state number
11 readable writable var _state: Int
12
13 # The node stored with the state in the stack
14 readable writable var _nodes: nullable Object
15
16 init(state: Int, nodes: nullable Object)
17 do
18 _state = state
19 _nodes = nodes
20 end
21 end
22
23 class Parser
24 super TablesCapable
25 # Associated lexer
26 var _lexer: Lexer
27
28 # Stack of pushed states and productions
29 var _stack: Array[State]
30
31 # Position in the stack
32 var _stack_pos: Int
33
34 # Create a new parser based on a given lexer
35 init(lexer: Lexer)
36 do
37 _lexer = lexer
38 _stack = new Array[State]
39 _stack_pos = -1
40 build_reduce_table
41 end
42
43 # Do a transition in the automata
44 private fun go_to(index: Int): Int
45 do
46 var state = state
47 var low = 1
48 var high = parser_goto(index, 0) - 1
49
50 while low <= high do
51 var middle = (low + high) / 2
52 var subindex = middle * 2 + 1 # +1 because parser_goto(index, 0) is the length
53
54 var goal = parser_goto(index, subindex)
55 if state < goal then
56 high = middle - 1
57 else if state > goal then
58 low = middle + 1
59 else
60 return parser_goto(index, subindex+1)
61 end
62 end
63
64 return parser_goto(index, 2) # Default value
65 end
66
67 # Push someting in the state stack
68 private fun push(numstate: Int, list_node: nullable Object)
69 do
70 var pos = _stack_pos + 1
71 _stack_pos = pos
72 if pos < _stack.length then
73 var state = _stack[pos]
74 state.state = numstate
75 state.nodes = list_node
76 else
77 _stack.push(new State(numstate, list_node))
78 end
79 end
80
81 # The current state
82 private fun state: Int
83 do
84 return _stack[_stack_pos].state
85 end
86
87 # Pop something from the stack state
88 private fun pop: nullable Object
89 do
90 var res = _stack[_stack_pos].nodes
91 _stack_pos = _stack_pos -1
92 return res
93 end
94
95 # Build and return a full AST.
96 fun parse: Start
97 do
98 push(0, null)
99
100 var lexer = _lexer
101 loop
102 var token = lexer.peek
103 if token isa AError then
104 return new Start(null, token)
105 end
106
107 var state = self.state
108 var index = token.parser_index
109 var action_type = parser_action(state, 2)
110 var action_value = parser_action(state, 3)
111
112 var low = 1
113 var high = parser_action(state, 0) - 1
114
115 while low <= high do
116 var middle = (low + high) / 2
117 var subindex = middle * 3 + 1 # +1 because parser_action(state, 0) is the length
118
119 var goal = parser_action(state, subindex)
120 if index < goal then
121 high = middle - 1
122 else if index > goal then
123 low = middle + 1
124 else
125 action_type = parser_action(state, subindex+1)
126 action_value = parser_action(state, subindex+2)
127 break
128 end
129 end
130
131 if action_type == 0 then # SHIFT
132 push(action_value, lexer.next)
133 else if action_type == 1 then # REDUCE
134 _reduce_table[action_value].action(self)
135 else if action_type == 2 then # ACCEPT
136 var node2 = lexer.next
137 assert node2 isa EOF
138 var node1 = pop
139 assert node1 isa AListing
140 var node = new Start(node1, node2)
141 (new ComputeProdLocationVisitor).enter_visit(node)
142 return node
143 else if action_type == 3 then # ERROR
144 var node2 = new AError.init_error("Syntax error: unexpected {token}.", token.location)
145 var node = new Start(null, node2)
146 return node
147 end
148 end
149 end
150
151 var _reduce_table: Array[ReduceAction]
152 private fun build_reduce_table
153 do
154 _reduce_table = new Array[ReduceAction].with_items(
155 new ReduceAction0(0),
156 new ReduceAction1(0),
157 new ReduceAction2(0),
158 new ReduceAction3(0),
159 new ReduceAction4(1),
160 new ReduceAction5(1),
161 new ReduceAction6(1),
162 new ReduceAction7(1),
163 new ReduceAction8(1),
164 new ReduceAction9(1),
165 new ReduceAction10(1),
166 new ReduceAction11(1),
167 new ReduceAction12(1),
168 new ReduceAction13(1),
169 new ReduceAction14(1),
170 new ReduceAction15(1),
171 new ReduceAction16(2),
172 new ReduceAction17(3),
173 new ReduceAction18(3),
174 new ReduceAction19(4),
175 new ReduceAction20(4),
176 new ReduceAction21(5),
177 new ReduceAction22(5),
178 new ReduceAction23(5),
179 new ReduceAction24(5),
180 new ReduceAction25(5),
181 new ReduceAction26(6),
182 new ReduceAction27(6),
183 new ReduceAction28(6),
184 new ReduceAction29(6),
185 new ReduceAction30(6),
186 new ReduceAction31(6),
187 new ReduceAction32(6),
188 new ReduceAction33(7),
189 new ReduceAction34(7)
190 )
191 end
192 end
193
194 redef class Prod
195 # Location on the first token after the start of a production
196 # So outside the production for epilon production
197 var _first_location: nullable Location
198
199 # Location of the last token before the end of a production
200 # So outside the production for epilon production
201 var _last_location: nullable Location
202 end
203
204 # Find location of production nodes
205 # Uses existing token locations to infer location of productions.
206 private class ComputeProdLocationVisitor
207 super Visitor
208 # Currenlty visited productions that need a first token
209 var _need_first_prods: Array[Prod] = new Array[Prod]
210
211 # Already visited epsilon productions that waits something after them
212 var _need_after_epsilons: Array[Prod] = new Array[Prod]
213
214 # Already visited epsilon production that waits something before them
215 var _need_before_epsilons: Array[Prod] = new Array[Prod]
216
217 # Location of the last visited token in the current production
218 var _last_location: nullable Location = null
219
220 redef fun visit(n: nullable ANode)
221 do
222 if n == null then
223 return
224 else if n isa Token then
225 var loc = n.location
226 _last_location = loc
227
228 # Add a first token to productions that need one
229 if not _need_first_prods.is_empty then
230 for no in _need_first_prods do
231 no._first_location = loc
232 end
233 _need_first_prods.clear
234 end
235
236 # Find location for already visited epsilon production that need one
237 if not _need_after_epsilons.is_empty then
238 for no in _need_after_epsilons do
239 # Epsilon production that is in the middle of a non-epsilon production
240 # The epsilon production has both a token before and after it
241 var endl = loc
242 var startl = no._last_location
243 no.location = new Location(endl.file, startl.line_end, endl.line_start, startl.column_end, endl.column_start)
244 end
245 _need_after_epsilons.clear
246 end
247 else
248 assert n isa Prod
249 _need_first_prods.add(n)
250
251 var old_last = _last_location
252 _last_location = null
253 n.visit_all(self)
254 var endl = _last_location
255 if endl == null then _last_location = old_last
256
257 n._last_location = endl
258 var startl = n._first_location
259 if startl != null then
260 # Non-epsilon production
261 assert endl != null
262
263 n.location = new Location(startl.file, startl.line_start, endl.line_end, startl.column_start, endl.column_end)
264
265 if not _need_before_epsilons.is_empty then
266 var loc = new Location(startl.file, startl.line_start, startl.line_start, startl.column_start, startl.column_start)
267 for no in _need_before_epsilons do
268 # Epsilon production that starts the current non-epsilon production
269 no.location = loc
270 end
271 _need_before_epsilons.clear
272 end
273
274 if not _need_after_epsilons.is_empty then
275 var loc = new Location(endl.file, endl.line_end, endl.line_end, endl.column_end, endl.column_end)
276 for no in _need_after_epsilons do
277 # Epsilon production that finishes the current non-epsilon production
278 no.location = loc
279 end
280 _need_after_epsilons.clear
281 end
282 else
283 # No first token means epsilon production (or "throw all my tokens" production)
284 # So, it must be located it later
285 if endl == null then
286 # Epsilon production that starts a parent non-epsilon production
287 _need_before_epsilons.add(n)
288 else
289 # Epsilon production in the middle or that finishes a parent non-epsilon production
290 _need_after_epsilons.add(n)
291 end
292 end
293 end
294 end
295
296 init do end
297 end
298
299 # Each reduca action has its own class, this one is the root of the hierarchy.
300 private abstract class ReduceAction
301 fun action(p: Parser) is abstract
302 fun concat(l1, l2 : Array[Object]): Array[Object]
303 do
304 if l1.is_empty then return l2
305 l1.append(l2)
306 return l1
307 end
308 var _goto: Int
309 init(g: Int) do _goto = g
310 end
311
312 private class ReduceAction0
313 super ReduceAction
314 redef fun action(p: Parser)
315 do
316 var node_list: nullable Object = null
317 var nodearraylist1 = p.pop
318 var listnode2 = new Array[Object]
319 var tendblocknode4 = nodearraylist1
320 assert tendblocknode4 isa nullable TEndBlock
321 var plistingnode1: nullable AListing = new AListing.init_alisting(
322 listnode2,
323 null,
324 tendblocknode4
325 )
326 node_list = plistingnode1
327 p.push(p.go_to(_goto), node_list)
328 end
329 end
330 private class ReduceAction1
331 super ReduceAction
332 redef fun action(p: Parser)
333 do
334 var node_list: nullable Object = null
335 var nodearraylist2 = p.pop
336 var nodearraylist1 = p.pop
337 var listnode3 = new Array[Object]
338 var listnode2 = nodearraylist1
339 assert listnode2 isa Array[Object]
340 listnode3 = concat(listnode3, listnode2)
341 var tendblocknode5 = nodearraylist2
342 assert tendblocknode5 isa nullable TEndBlock
343 var plistingnode1: nullable AListing = new AListing.init_alisting(
344 listnode3,
345 null,
346 tendblocknode5
347 )
348 node_list = plistingnode1
349 p.push(p.go_to(_goto), node_list)
350 end
351 end
352 private class ReduceAction2
353 super ReduceAction
354 redef fun action(p: Parser)
355 do
356 var node_list: nullable Object = null
357 var nodearraylist2 = p.pop
358 var nodearraylist1 = p.pop
359 var listnode2 = new Array[Object]
360 var plabeldeclnode3 = nodearraylist1
361 assert plabeldeclnode3 isa nullable ALabelDecl
362 var tendblocknode4 = nodearraylist2
363 assert tendblocknode4 isa nullable TEndBlock
364 var plistingnode1: nullable AListing = new AListing.init_alisting(
365 listnode2,
366 plabeldeclnode3,
367 tendblocknode4
368 )
369 node_list = plistingnode1
370 p.push(p.go_to(_goto), node_list)
371 end
372 end
373 private class ReduceAction3
374 super ReduceAction
375 redef fun action(p: Parser)
376 do
377 var node_list: nullable Object = null
378 var nodearraylist3 = p.pop
379 var nodearraylist2 = p.pop
380 var nodearraylist1 = p.pop
381 var listnode3 = new Array[Object]
382 var listnode2 = nodearraylist1
383 assert listnode2 isa Array[Object]
384 listnode3 = concat(listnode3, listnode2)
385 var plabeldeclnode4 = nodearraylist2
386 assert plabeldeclnode4 isa nullable ALabelDecl
387 var tendblocknode5 = nodearraylist3
388 assert tendblocknode5 isa nullable TEndBlock
389 var plistingnode1: nullable AListing = new AListing.init_alisting(
390 listnode3,
391 plabeldeclnode4,
392 tendblocknode5
393 )
394 node_list = plistingnode1
395 p.push(p.go_to(_goto), node_list)
396 end
397 end
398 private class ReduceAction4
399 super ReduceAction
400 redef fun action(p: Parser)
401 do
402 var node_list: nullable Object = null
403 var nodearraylist1 = p.pop
404 var teolnode4 = nodearraylist1
405 assert teolnode4 isa nullable TEol
406 var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
407 null,
408 null,
409 teolnode4
410 )
411 node_list = plinenode1
412 p.push(p.go_to(_goto), node_list)
413 end
414 end
415 private class ReduceAction5
416 super ReduceAction
417 redef fun action(p: Parser)
418 do
419 var node_list: nullable Object = null
420 var nodearraylist2 = p.pop
421 var nodearraylist1 = p.pop
422 var plabeldeclnode2 = nodearraylist1
423 assert plabeldeclnode2 isa nullable ALabelDecl
424 var teolnode4 = nodearraylist2
425 assert teolnode4 isa nullable TEol
426 var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
427 plabeldeclnode2,
428 null,
429 teolnode4
430 )
431 node_list = plinenode1
432 p.push(p.go_to(_goto), node_list)
433 end
434 end
435 private class ReduceAction6
436 super ReduceAction
437 redef fun action(p: Parser)
438 do
439 var node_list: nullable Object = null
440 var nodearraylist2 = p.pop
441 var nodearraylist1 = p.pop
442 var tcommentnode3 = nodearraylist1
443 assert tcommentnode3 isa nullable TComment
444 var teolnode4 = nodearraylist2
445 assert teolnode4 isa nullable TEol
446 var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
447 null,
448 tcommentnode3,
449 teolnode4
450 )
451 node_list = plinenode1
452 p.push(p.go_to(_goto), node_list)
453 end
454 end
455 private class ReduceAction7
456 super ReduceAction
457 redef fun action(p: Parser)
458 do
459 var node_list: nullable Object = null
460 var nodearraylist3 = p.pop
461 var nodearraylist2 = p.pop
462 var nodearraylist1 = p.pop
463 var plabeldeclnode2 = nodearraylist1
464 assert plabeldeclnode2 isa nullable ALabelDecl
465 var tcommentnode3 = nodearraylist2
466 assert tcommentnode3 isa nullable TComment
467 var teolnode4 = nodearraylist3
468 assert teolnode4 isa nullable TEol
469 var plinenode1: nullable AEmptyLine = new AEmptyLine.init_aemptyline(
470 plabeldeclnode2,
471 tcommentnode3,
472 teolnode4
473 )
474 node_list = plinenode1
475 p.push(p.go_to(_goto), node_list)
476 end
477 end
478 private class ReduceAction8
479 super ReduceAction
480 redef fun action(p: Parser)
481 do
482 var node_list: nullable Object = null
483 var nodearraylist2 = p.pop
484 var nodearraylist1 = p.pop
485 var pinstructionnode3 = nodearraylist1
486 assert pinstructionnode3 isa nullable AInstruction
487 var teolnode5 = nodearraylist2
488 assert teolnode5 isa nullable TEol
489 var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
490 null,
491 pinstructionnode3,
492 null,
493 teolnode5
494 )
495 node_list = plinenode1
496 p.push(p.go_to(_goto), node_list)
497 end
498 end
499 private class ReduceAction9
500 super ReduceAction
501 redef fun action(p: Parser)
502 do
503 var node_list: nullable Object = null
504 var nodearraylist3 = p.pop
505 var nodearraylist2 = p.pop
506 var nodearraylist1 = p.pop
507 var plabeldeclnode2 = nodearraylist1
508 assert plabeldeclnode2 isa nullable ALabelDecl
509 var pinstructionnode3 = nodearraylist2
510 assert pinstructionnode3 isa nullable AInstruction
511 var teolnode5 = nodearraylist3
512 assert teolnode5 isa nullable TEol
513 var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
514 plabeldeclnode2,
515 pinstructionnode3,
516 null,
517 teolnode5
518 )
519 node_list = plinenode1
520 p.push(p.go_to(_goto), node_list)
521 end
522 end
523 private class ReduceAction10
524 super ReduceAction
525 redef fun action(p: Parser)
526 do
527 var node_list: nullable Object = null
528 var nodearraylist3 = p.pop
529 var nodearraylist2 = p.pop
530 var nodearraylist1 = p.pop
531 var pinstructionnode3 = nodearraylist1
532 assert pinstructionnode3 isa nullable AInstruction
533 var tcommentnode4 = nodearraylist2
534 assert tcommentnode4 isa nullable TComment
535 var teolnode5 = nodearraylist3
536 assert teolnode5 isa nullable TEol
537 var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
538 null,
539 pinstructionnode3,
540 tcommentnode4,
541 teolnode5
542 )
543 node_list = plinenode1
544 p.push(p.go_to(_goto), node_list)
545 end
546 end
547 private class ReduceAction11
548 super ReduceAction
549 redef fun action(p: Parser)
550 do
551 var node_list: nullable Object = null
552 var nodearraylist4 = p.pop
553 var nodearraylist3 = p.pop
554 var nodearraylist2 = p.pop
555 var nodearraylist1 = p.pop
556 var plabeldeclnode2 = nodearraylist1
557 assert plabeldeclnode2 isa nullable ALabelDecl
558 var pinstructionnode3 = nodearraylist2
559 assert pinstructionnode3 isa nullable AInstruction
560 var tcommentnode4 = nodearraylist3
561 assert tcommentnode4 isa nullable TComment
562 var teolnode5 = nodearraylist4
563 assert teolnode5 isa nullable TEol
564 var plinenode1: nullable AInstructionLine = new AInstructionLine.init_ainstructionline(
565 plabeldeclnode2,
566 pinstructionnode3,
567 tcommentnode4,
568 teolnode5
569 )
570 node_list = plinenode1
571 p.push(p.go_to(_goto), node_list)
572 end
573 end
574 private class ReduceAction12
575 super ReduceAction
576 redef fun action(p: Parser)
577 do
578 var node_list: nullable Object = null
579 var nodearraylist2 = p.pop
580 var nodearraylist1 = p.pop
581 var pdirectivenode3 = nodearraylist1
582 assert pdirectivenode3 isa nullable ADirective
583 var teolnode5 = nodearraylist2
584 assert teolnode5 isa nullable TEol
585 var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
586 null,
587 pdirectivenode3,
588 null,
589 teolnode5
590 )
591 node_list = plinenode1
592 p.push(p.go_to(_goto), node_list)
593 end
594 end
595 private class ReduceAction13
596 super ReduceAction
597 redef fun action(p: Parser)
598 do
599 var node_list: nullable Object = null
600 var nodearraylist3 = p.pop
601 var nodearraylist2 = p.pop
602 var nodearraylist1 = p.pop
603 var plabeldeclnode2 = nodearraylist1
604 assert plabeldeclnode2 isa nullable ALabelDecl
605 var pdirectivenode3 = nodearraylist2
606 assert pdirectivenode3 isa nullable ADirective
607 var teolnode5 = nodearraylist3
608 assert teolnode5 isa nullable TEol
609 var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
610 plabeldeclnode2,
611 pdirectivenode3,
612 null,
613 teolnode5
614 )
615 node_list = plinenode1
616 p.push(p.go_to(_goto), node_list)
617 end
618 end
619 private class ReduceAction14
620 super ReduceAction
621 redef fun action(p: Parser)
622 do
623 var node_list: nullable Object = null
624 var nodearraylist3 = p.pop
625 var nodearraylist2 = p.pop
626 var nodearraylist1 = p.pop
627 var pdirectivenode3 = nodearraylist1
628 assert pdirectivenode3 isa nullable ADirective
629 var tcommentnode4 = nodearraylist2
630 assert tcommentnode4 isa nullable TComment
631 var teolnode5 = nodearraylist3
632 assert teolnode5 isa nullable TEol
633 var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
634 null,
635 pdirectivenode3,
636 tcommentnode4,
637 teolnode5
638 )
639 node_list = plinenode1
640 p.push(p.go_to(_goto), node_list)
641 end
642 end
643 private class ReduceAction15
644 super ReduceAction
645 redef fun action(p: Parser)
646 do
647 var node_list: nullable Object = null
648 var nodearraylist4 = p.pop
649 var nodearraylist3 = p.pop
650 var nodearraylist2 = p.pop
651 var nodearraylist1 = p.pop
652 var plabeldeclnode2 = nodearraylist1
653 assert plabeldeclnode2 isa nullable ALabelDecl
654 var pdirectivenode3 = nodearraylist2
655 assert pdirectivenode3 isa nullable ADirective
656 var tcommentnode4 = nodearraylist3
657 assert tcommentnode4 isa nullable TComment
658 var teolnode5 = nodearraylist4
659 assert teolnode5 isa nullable TEol
660 var plinenode1: nullable ADirectiveLine = new ADirectiveLine.init_adirectiveline(
661 plabeldeclnode2,
662 pdirectivenode3,
663 tcommentnode4,
664 teolnode5
665 )
666 node_list = plinenode1
667 p.push(p.go_to(_goto), node_list)
668 end
669 end
670 private class ReduceAction16
671 super ReduceAction
672 redef fun action(p: Parser)
673 do
674 var node_list: nullable Object = null
675 var nodearraylist2 = p.pop
676 var nodearraylist1 = p.pop
677 var tidnode2 = nodearraylist1
678 assert tidnode2 isa nullable TId
679 var tcolonnode3 = nodearraylist2
680 assert tcolonnode3 isa nullable TColon
681 var plabeldeclnode1: nullable ALabelDecl = new ALabelDecl.init_alabeldecl(
682 tidnode2,
683 tcolonnode3
684 )
685 node_list = plabeldeclnode1
686 p.push(p.go_to(_goto), node_list)
687 end
688 end
689 private class ReduceAction17
690 super ReduceAction
691 redef fun action(p: Parser)
692 do
693 var node_list: nullable Object = null
694 var nodearraylist1 = p.pop
695 var tidnode2 = nodearraylist1
696 assert tidnode2 isa nullable TId
697 var pinstructionnode1: nullable AUnaryInstruction = new AUnaryInstruction.init_aunaryinstruction(
698 tidnode2
699 )
700 node_list = pinstructionnode1
701 p.push(p.go_to(_goto), node_list)
702 end
703 end
704 private class ReduceAction18
705 super ReduceAction
706 redef fun action(p: Parser)
707 do
708 var node_list: nullable Object = null
709 var nodearraylist2 = p.pop
710 var nodearraylist1 = p.pop
711 var tidnode2 = nodearraylist1
712 assert tidnode2 isa nullable TId
713 var poperandnode3 = nodearraylist2
714 assert poperandnode3 isa nullable AOperand
715 var pinstructionnode1: nullable ABinaryInstruction = new ABinaryInstruction.init_abinaryinstruction(
716 tidnode2,
717 poperandnode3
718 )
719 node_list = pinstructionnode1
720 p.push(p.go_to(_goto), node_list)
721 end
722 end
723 private class ReduceAction19
724 super ReduceAction
725 redef fun action(p: Parser)
726 do
727 var node_list: nullable Object = null
728 var nodearraylist1 = p.pop
729 var pvaluenode2 = nodearraylist1
730 assert pvaluenode2 isa nullable AValue
731 var poperandnode1: nullable AImmediateOperand = new AImmediateOperand.init_aimmediateoperand(
732 pvaluenode2
733 )
734 node_list = poperandnode1
735 p.push(p.go_to(_goto), node_list)
736 end
737 end
738 private class ReduceAction20
739 super ReduceAction
740 redef fun action(p: Parser)
741 do
742 var node_list: nullable Object = null
743 var nodearraylist3 = p.pop
744 var nodearraylist2 = p.pop
745 var nodearraylist1 = p.pop
746 var pvaluenode2 = nodearraylist1
747 assert pvaluenode2 isa nullable AValue
748 var tcommanode3 = nodearraylist2
749 assert tcommanode3 isa nullable TComma
750 var tidnode4 = nodearraylist3
751 assert tidnode4 isa nullable TId
752 var poperandnode1: nullable AAnyOperand = new AAnyOperand.init_aanyoperand(
753 pvaluenode2,
754 tcommanode3,
755 tidnode4
756 )
757 node_list = poperandnode1
758 p.push(p.go_to(_goto), node_list)
759 end
760 end
761 private class ReduceAction21
762 super ReduceAction
763 redef fun action(p: Parser)
764 do
765 var node_list: nullable Object = null
766 var nodearraylist1 = p.pop
767 var tidnode2 = nodearraylist1
768 assert tidnode2 isa nullable TId
769 var pvaluenode1: nullable ALabelValue = new ALabelValue.init_alabelvalue(
770 tidnode2
771 )
772 node_list = pvaluenode1
773 p.push(p.go_to(_goto), node_list)
774 end
775 end
776 private class ReduceAction22
777 super ReduceAction
778 redef fun action(p: Parser)
779 do
780 var node_list: nullable Object = null
781 var nodearraylist1 = p.pop
782 var tnumbernode2 = nodearraylist1
783 assert tnumbernode2 isa nullable TNumber
784 var pvaluenode1: nullable ANumberValue = new ANumberValue.init_anumbervalue(
785 tnumbernode2
786 )
787 node_list = pvaluenode1
788 p.push(p.go_to(_goto), node_list)
789 end
790 end
791 private class ReduceAction23
792 super ReduceAction
793 redef fun action(p: Parser)
794 do
795 var node_list: nullable Object = null
796 var nodearraylist1 = p.pop
797 var tcharnode2 = nodearraylist1
798 assert tcharnode2 isa nullable TChar
799 var pvaluenode1: nullable ACharValue = new ACharValue.init_acharvalue(
800 tcharnode2
801 )
802 node_list = pvaluenode1
803 p.push(p.go_to(_goto), node_list)
804 end
805 end
806 private class ReduceAction24
807 super ReduceAction
808 redef fun action(p: Parser)
809 do
810 var node_list: nullable Object = null
811 var nodearraylist1 = p.pop
812 var tstringnode2 = nodearraylist1
813 assert tstringnode2 isa nullable TString
814 var pvaluenode1: nullable AStringValue = new AStringValue.init_astringvalue(
815 tstringnode2
816 )
817 node_list = pvaluenode1
818 p.push(p.go_to(_goto), node_list)
819 end
820 end
821 private class ReduceAction25
822 super ReduceAction
823 redef fun action(p: Parser)
824 do
825 var node_list: nullable Object = null
826 var nodearraylist1 = p.pop
827 var thexnode2 = nodearraylist1
828 assert thexnode2 isa nullable THex
829 var pvaluenode1: nullable AHexValue = new AHexValue.init_ahexvalue(
830 thexnode2
831 )
832 node_list = pvaluenode1
833 p.push(p.go_to(_goto), node_list)
834 end
835 end
836 private class ReduceAction26
837 super ReduceAction
838 redef fun action(p: Parser)
839 do
840 var node_list: nullable Object = null
841 var nodearraylist2 = p.pop
842 var nodearraylist1 = p.pop
843 var ttkbytenode2 = nodearraylist1
844 assert ttkbytenode2 isa nullable TTkByte
845 var pvaluenode3 = nodearraylist2
846 assert pvaluenode3 isa nullable AValue
847 var pdirectivenode1: nullable AByteDirective = new AByteDirective.init_abytedirective(
848 ttkbytenode2,
849 pvaluenode3
850 )
851 node_list = pdirectivenode1
852 p.push(p.go_to(_goto), node_list)
853 end
854 end
855 private class ReduceAction27
856 super ReduceAction
857 redef fun action(p: Parser)
858 do
859 var node_list: nullable Object = null
860 var nodearraylist2 = p.pop
861 var nodearraylist1 = p.pop
862 var ttkwordnode2 = nodearraylist1
863 assert ttkwordnode2 isa nullable TTkWord
864 var pvaluenode3 = nodearraylist2
865 assert pvaluenode3 isa nullable AValue
866 var pdirectivenode1: nullable AWordDirective = new AWordDirective.init_aworddirective(
867 ttkwordnode2,
868 pvaluenode3
869 )
870 node_list = pdirectivenode1
871 p.push(p.go_to(_goto), node_list)
872 end
873 end
874 private class ReduceAction28
875 super ReduceAction
876 redef fun action(p: Parser)
877 do
878 var node_list: nullable Object = null
879 var nodearraylist2 = p.pop
880 var nodearraylist1 = p.pop
881 var ttkblocknode2 = nodearraylist1
882 assert ttkblocknode2 isa nullable TTkBlock
883 var pvaluenode3 = nodearraylist2
884 assert pvaluenode3 isa nullable AValue
885 var pdirectivenode1: nullable ABlockDirective = new ABlockDirective.init_ablockdirective(
886 ttkblocknode2,
887 pvaluenode3
888 )
889 node_list = pdirectivenode1
890 p.push(p.go_to(_goto), node_list)
891 end
892 end
893 private class ReduceAction29
894 super ReduceAction
895 redef fun action(p: Parser)
896 do
897 var node_list: nullable Object = null
898 var nodearraylist2 = p.pop
899 var nodearraylist1 = p.pop
900 var ttkasciinode2 = nodearraylist1
901 assert ttkasciinode2 isa nullable TTkAscii
902 var pvaluenode3 = nodearraylist2
903 assert pvaluenode3 isa nullable AValue
904 var pdirectivenode1: nullable AAsciiDirective = new AAsciiDirective.init_aasciidirective(
905 ttkasciinode2,
906 pvaluenode3
907 )
908 node_list = pdirectivenode1
909 p.push(p.go_to(_goto), node_list)
910 end
911 end
912 private class ReduceAction30
913 super ReduceAction
914 redef fun action(p: Parser)
915 do
916 var node_list: nullable Object = null
917 var nodearraylist2 = p.pop
918 var nodearraylist1 = p.pop
919 var ttkaddrssnode2 = nodearraylist1
920 assert ttkaddrssnode2 isa nullable TTkAddrss
921 var pvaluenode3 = nodearraylist2
922 assert pvaluenode3 isa nullable AValue
923 var pdirectivenode1: nullable AAddrssDirective = new AAddrssDirective.init_aaddrssdirective(
924 ttkaddrssnode2,
925 pvaluenode3
926 )
927 node_list = pdirectivenode1
928 p.push(p.go_to(_goto), node_list)
929 end
930 end
931 private class ReduceAction31
932 super ReduceAction
933 redef fun action(p: Parser)
934 do
935 var node_list: nullable Object = null
936 var nodearraylist2 = p.pop
937 var nodearraylist1 = p.pop
938 var ttkequatenode2 = nodearraylist1
939 assert ttkequatenode2 isa nullable TTkEquate
940 var pvaluenode3 = nodearraylist2
941 assert pvaluenode3 isa nullable AValue
942 var pdirectivenode1: nullable AEquateDirective = new AEquateDirective.init_aequatedirective(
943 ttkequatenode2,
944 pvaluenode3
945 )
946 node_list = pdirectivenode1
947 p.push(p.go_to(_goto), node_list)
948 end
949 end
950 private class ReduceAction32
951 super ReduceAction
952 redef fun action(p: Parser)
953 do
954 var node_list: nullable Object = null
955 var nodearraylist2 = p.pop
956 var nodearraylist1 = p.pop
957 var ttkburnnode2 = nodearraylist1
958 assert ttkburnnode2 isa nullable TTkBurn
959 var pvaluenode3 = nodearraylist2
960 assert pvaluenode3 isa nullable AValue
961 var pdirectivenode1: nullable ABurnDirective = new ABurnDirective.init_aburndirective(
962 ttkburnnode2,
963 pvaluenode3
964 )
965 node_list = pdirectivenode1
966 p.push(p.go_to(_goto), node_list)
967 end
968 end
969 private class ReduceAction33
970 super ReduceAction
971 redef fun action(p: Parser)
972 do
973 var node_list: nullable Object = null
974 var nodearraylist1 = p.pop
975 var listnode2 = new Array[Object]
976 var plinenode1 = nodearraylist1
977 if plinenode1 != null then
978 listnode2.add(plinenode1)
979 end
980 node_list = listnode2
981 p.push(p.go_to(_goto), node_list)
982 end
983 end
984 private class ReduceAction34
985 super ReduceAction
986 redef fun action(p: Parser)
987 do
988 var node_list: nullable Object = null
989 var nodearraylist2 = p.pop
990 var nodearraylist1 = p.pop
991 var listnode3 = new Array[Object]
992 var listnode1 = nodearraylist1
993 assert listnode1 isa Array[Object]
994 var plinenode2 = nodearraylist2
995 listnode3 = concat(listnode3, listnode1)
996 if plinenode2 != null then
997 listnode3.add(plinenode2)
998 end
999 node_list = listnode3
1000 p.push(p.go_to(_goto), node_list)
1001 end
1002 end