parser: add some basic tree services in ANode
[nit.git] / src / parser / parser_nodes.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
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 # AST nodes of the Nit language
16 # Was previously based on parser_abs.nit.
17 module parser_nodes
18
19 import location
20
21 # Root of the AST class-hierarchy
22 abstract class ANode
23 var _location: nullable Location = null
24
25 # Location is set during AST building. Once built, location cannon be null.
26 # However, manual instantiated nodes may need more care.
27 fun location: Location do return _location.as(not null)
28
29 # The location of the important part of the node (identifier or whatever)
30 fun hot_location: Location do return location
31
32 # Display a message for the colored location of the node
33 fun debug(message: String)
34 do
35 print "{hot_location} {self.class_name}: {message}\n{hot_location.colored_line("0;32")}"
36 end
37
38 # Parent of the node in the AST
39 var parent: nullable ANode = null
40
41 # The topmost ancestor of the element
42 # This just apply `parent` until the first one
43 fun root: ANode
44 do
45 var res = self
46 loop
47 var p = res.parent
48 if p == null then return res
49 res = p
50 end
51 end
52
53 # The most specific common parent between `self` and `other`
54 # Return null if the two node are unrelated (distinct root)
55 fun common_parent(other: ANode): nullable ANode
56 do
57 # First, get the same depth
58 var s: nullable ANode = self
59 var o: nullable ANode = other
60 var d = s.depth - o.depth
61 while d > 0 do
62 s = s.parent
63 d -= 1
64 end
65 while d < 0 do
66 o = o.parent
67 d += 1
68 end
69 assert o.depth == s.depth
70 # Second, go up until same in found
71 while s != o do
72 s = s.parent
73 o = o.parent
74 end
75 return s
76 end
77
78 # Number of nodes between `self` and the `root` of the AST
79 # ENSURE `self == self.root implies result == 0 `
80 # ENSURE `self != self.root implies result == self.parent.depth + 1`
81 fun depth: Int
82 do
83 var n = self
84 var res = 0
85 loop
86 var p = n.parent
87 if p == null then return res
88 n = p
89 res += 1
90 end
91 end
92
93 # Protect from invalid instantiation of nodes
94 private init do end
95
96 # Replace a child with an other node in the AST
97 private fun replace_child(old_child: ANode, new_child: nullable ANode) is abstract
98
99 # Detach a node from its parent
100 # Aborts if the node is not detashable. use `replace_with` instead
101 # REQUIRE: parent != null
102 # REQUIRE: is_detachable
103 # ENDURE: parent == null
104 fun detach
105 do
106 assert parent != null
107 parent.replace_child(self, null)
108 parent = null
109 end
110
111 # Replace itself with an other node in the AST
112 # REQUIRE: parent != null
113 # ENSURE: node.parent == old(parent)
114 # ENSURE: parent == null
115 fun replace_with(node: ANode)
116 do
117 assert parent != null
118 parent.replace_child(self, node)
119 parent = null
120 end
121
122 # Visit all nodes in order.
123 # Thus, call `v.enter_visit(e)` for each child `e`
124 fun visit_all(v: Visitor) is abstract
125 end
126
127 # A sequence of nodes
128 # There is a specifc class (instead of a using Array) to track the parent/child relation when nodes are added or removed
129 class ANodes[E: ANode]
130 super Sequence[E]
131 private var parent: ANode
132 private var items = new Array[E]
133 redef fun iterator do return items.iterator
134 redef fun length do return items.length
135 redef fun is_empty do return items.is_empty
136 redef fun push(e)
137 do
138 hook_add(e)
139 items.push(e)
140 end
141 redef fun pop
142 do
143 var res = items.pop
144 hook_remove(res)
145 return res
146 end
147 redef fun unshift(e)
148 do
149 hook_add(e)
150 items.unshift(e)
151 end
152 redef fun shift
153 do
154 var res = items.shift
155 hook_remove(res)
156 return res
157 end
158 redef fun has(e)
159 do
160 return items.has(e)
161 end
162 redef fun [](index)
163 do
164 return items[index]
165 end
166 redef fun []=(index, e)
167 do
168 hook_remove(self[index])
169 hook_add(e)
170 items[index]=e
171 end
172 redef fun remove_at(index)
173 do
174 hook_remove(items[index])
175 items.remove_at(index)
176 end
177 private fun hook_add(e: E)
178 do
179 #assert e.parent == null
180 e.parent = parent
181 end
182 private fun hook_remove(e: E)
183 do
184 assert e.parent == parent
185 e.parent = null
186 end
187
188 # Used in parent contructor to fill elements
189 private fun unsafe_add_all(nodes: Collection[Object])
190 do
191 var parent = self.parent
192 for n in nodes do
193 assert n isa E
194 add n
195 n.parent = parent
196 end
197 end
198
199 private fun replace_child(old_child: ANode, new_child: nullable ANode): Bool
200 do
201 var parent = self.parent
202 for i in [0..length[ do
203 if self[i] == old_child then
204 if new_child != null then
205 assert new_child isa E
206 self[i] = new_child
207 new_child.parent = parent
208 else
209 self.remove_at(i)
210 end
211 return true
212 end
213 end
214 return false
215 end
216
217 private fun visit_all(v: Visitor)
218 do
219 for n in self do v.enter_visit(n)
220 end
221 end
222
223 # Ancestor of all tokens
224 # A token is a node that has a `text` but no children.
225 abstract class Token
226 super ANode
227
228 # The raw content on the token
229 fun text: String is abstract
230 fun text=(text: String) is abstract
231
232 # The previous token in the Lexer.
233 # May have disapeared in the AST
234 var prev_token: nullable Token = null
235
236 # The next token in the Lexer.
237 # May have disapeared in the AST
238 var next_token: nullable Token = null
239
240 redef fun to_s: String do
241 return "'{text}'"
242 end
243
244 redef fun visit_all(v: Visitor) do end
245 redef fun replace_child(old_child: ANode, new_child: nullable ANode) do end
246 end
247
248 redef class SourceFile
249 # The first token parser by the lexer
250 # May have disapeared in the final AST
251 var first_token: nullable Token = null
252
253 # The first token parser by the lexer
254 # May have disapeared in the final AST
255 var last_token: nullable Token = null
256 end
257
258 # Ancestor of all productions
259 # A production is a node without text but that usually has children.
260 abstract class Prod
261 super ANode
262
263 fun location=(l: Location) do _location = l
264
265 # All the annotations attached directly to the node
266 readable writable var _n_annotations: nullable AAnnotations = null
267
268 redef fun replace_with(n: ANode)
269 do
270 super
271 assert n isa Prod
272 if n._location == null then n._location = _location
273 end
274 end
275
276 # Abstract standard visitor on the AST
277 abstract class Visitor
278 # What the visitor do when a node is visited
279 # Concrete visitors should implement this method.
280 # @toimplement
281 protected fun visit(e: ANode) is abstract
282
283 # Ask the visitor to visit a given node.
284 # Usually automatically called by visit_all* methods.
285 # This method should not be redefined
286 fun enter_visit(e: nullable ANode)
287 do
288 if e == null then return
289 var old = _current_node
290 _current_node = e
291 visit(e)
292 _current_node = old
293 end
294
295 # The current visited node
296 readable writable var _current_node: nullable ANode = null
297 end
298
299 # Token of end of line (basically `\n`)
300 class TEol
301 super Token
302 redef fun to_s
303 do
304 return "end of line"
305 end
306 end
307
308 # Token of a line of comments
309 # Starts with the `#` and contains the final end-of-line (if any)
310 class TComment
311 super Token
312 end
313
314 # A token associated with a keyword
315 abstract class TokenKeyword
316 super Token
317 redef fun to_s
318 do
319 return "keyword '{text}'"
320 end
321 end
322 class TKwpackage
323 super TokenKeyword
324 end
325 class TKwmodule
326 super TokenKeyword
327 end
328 class TKwimport
329 super TokenKeyword
330 end
331 class TKwclass
332 super TokenKeyword
333 end
334 class TKwabstract
335 super TokenKeyword
336 end
337 class TKwinterface
338 super TokenKeyword
339 end
340 class TKwenum
341 super TokenKeyword
342 end
343 class TKwend
344 super TokenKeyword
345 end
346 class TKwmeth
347 super TokenKeyword
348 end
349 class TKwtype
350 super TokenKeyword
351 end
352 class TKwinit
353 super TokenKeyword
354 end
355 class TKwredef
356 super TokenKeyword
357 end
358 class TKwis
359 super TokenKeyword
360 end
361 class TKwdo
362 super TokenKeyword
363 end
364 class TKwreadable
365 super TokenKeyword
366 end
367 class TKwwritable
368 super TokenKeyword
369 end
370 class TKwvar
371 super TokenKeyword
372 end
373 class TKwintern
374 super TokenKeyword
375 end
376 class TKwextern
377 super TokenKeyword
378 end
379 class TKwpublic
380 super TokenKeyword
381 end
382 class TKwprotected
383 super TokenKeyword
384 end
385 class TKwprivate
386 super TokenKeyword
387 end
388 class TKwintrude
389 super TokenKeyword
390 end
391 class TKwif
392 super TokenKeyword
393 end
394 class TKwthen
395 super TokenKeyword
396 end
397 class TKwelse
398 super TokenKeyword
399 end
400 class TKwwhile
401 super TokenKeyword
402 end
403 class TKwloop
404 super TokenKeyword
405 end
406 class TKwfor
407 super TokenKeyword
408 end
409 class TKwin
410 super TokenKeyword
411 end
412 class TKwand
413 super TokenKeyword
414 end
415 class TKwor
416 super TokenKeyword
417 end
418 class TKwimplies
419 super TokenKeyword
420 end
421 class TKwnot
422 super TokenKeyword
423 end
424 class TKwreturn
425 super TokenKeyword
426 end
427 class TKwcontinue
428 super TokenKeyword
429 end
430 class TKwbreak
431 super TokenKeyword
432 end
433 class TKwabort
434 super TokenKeyword
435 end
436 class TKwassert
437 super TokenKeyword
438 end
439 class TKwnew
440 super TokenKeyword
441 end
442 class TKwisa
443 super TokenKeyword
444 end
445 class TKwonce
446 super TokenKeyword
447 end
448 class TKwsuper
449 super TokenKeyword
450 end
451 class TKwself
452 super TokenKeyword
453 end
454 class TKwtrue
455 super TokenKeyword
456 end
457 class TKwfalse
458 super TokenKeyword
459 end
460 class TKwnull
461 super TokenKeyword
462 end
463 class TKwas
464 super TokenKeyword
465 end
466 class TKwnullable
467 super TokenKeyword
468 end
469 class TKwisset
470 super TokenKeyword
471 end
472 class TKwlabel
473 super TokenKeyword
474 end
475 class TKwdebug
476 super Token
477 end
478 class TOpar
479 super Token
480 end
481 class TCpar
482 super Token
483 end
484 class TObra
485 super Token
486 end
487 class TCbra
488 super Token
489 end
490 class TComma
491 super Token
492 end
493 class TColumn
494 super Token
495 end
496 class TQuad
497 super Token
498 end
499 class TAssign
500 super Token
501 end
502
503 # A token associated with an operator (and other lookalike symbols)
504 abstract class TokenOperator
505 super Token
506 redef fun to_s
507 do
508 return "operator '{text}'"
509 end
510 end
511 class TPluseq
512 super TokenOperator
513 end
514 class TMinuseq
515 super TokenOperator
516 end
517 class TDotdotdot
518 super TokenOperator
519 end
520 class TDotdot
521 super TokenOperator
522 end
523 class TDot
524 super TokenOperator
525 end
526 class TPlus
527 super TokenOperator
528 end
529 class TMinus
530 super TokenOperator
531 end
532 class TStar
533 super TokenOperator
534 end
535 class TSlash
536 super TokenOperator
537 end
538 class TPercent
539 super TokenOperator
540 end
541 class TEq
542 super TokenOperator
543 end
544 class TNe
545 super TokenOperator
546 end
547 class TLt
548 super TokenOperator
549 end
550 class TLe
551 super TokenOperator
552 end
553 class TLl
554 super TokenOperator
555 end
556 class TGt
557 super TokenOperator
558 end
559 class TGe
560 super TokenOperator
561 end
562 class TGg
563 super TokenOperator
564 end
565 class TStarship
566 super TokenOperator
567 end
568 class TBang
569 super TokenOperator
570 end
571 class TAt
572 super Token
573 end
574
575 # A class (or formal type) identifier. They start with an uppercase.
576 class TClassid
577 super Token
578 redef fun to_s
579 do
580 do return "type identifier '{text}'"
581 end
582 end
583
584 # A standard identifier (variable, method...). They start with a lowercase.
585 class TId
586 super Token
587 redef fun to_s
588 do
589 do return "identifier '{text}'"
590 end
591 end
592
593 # An attribute identifier. They start with an underscore.
594 class TAttrid
595 super Token
596 redef fun to_s
597 do
598 do return "attribute '{text}'"
599 end
600 end
601
602 # A token of a literal value (string, integer, etc).
603 abstract class TokenLiteral
604 super Token
605 redef fun to_s
606 do
607 do return "literal value '{text}'"
608 end
609 end
610 class TNumber
611 super TokenLiteral
612 end
613 class THexNumber
614 super TokenLiteral
615 end
616 class TFloat
617 super TokenLiteral
618 end
619 class TChar
620 super TokenLiteral
621 end
622 class TString
623 super TokenLiteral
624 end
625 class TStartString
626 super TokenLiteral
627 end
628 class TMidString
629 super TokenLiteral
630 end
631 class TEndString
632 super TokenLiteral
633 end
634
635 # A malformed string
636 class TBadString
637 super Token
638 redef fun to_s
639 do
640 do return "malformed string {text}"
641 end
642 end
643
644 # A malformed char
645 class TBadChar
646 super Token
647 redef fun to_s
648 do
649 do return "malformed character {text}"
650 end
651 end
652
653 class TExternCodeSegment
654 super Token
655 end
656
657 # A end of file
658 class EOF
659 super Token
660 redef fun to_s
661 do
662 return "end of file"
663 end
664 end
665
666 # A mark of an error
667 class AError
668 super EOF
669 end
670 class ALexerError
671 super AError
672 end
673 class AParserError
674 super AError
675 end
676
677 # The main node of a Nit source-file
678 class AModule
679 super Prod
680
681 readable writable var _n_moduledecl: nullable AModuledecl = null
682 readable var _n_imports: ANodes[AImport] = new ANodes[AImport](self)
683 readable var _n_extern_code_blocks: ANodes[AExternCodeBlock] = new ANodes[AExternCodeBlock](self)
684 readable var _n_classdefs: ANodes[AClassdef] = new ANodes[AClassdef](self)
685 init do end
686 end
687
688 # The declaration of the module with the documentation, name, and annotations
689 class AModuledecl
690 super Prod
691 readable writable var _n_doc: nullable ADoc = null
692 readable writable var _n_kwmodule: TKwmodule
693 readable writable var _n_name: AModuleName
694 init do end
695 end
696
697 # A import clause of a module
698 abstract class AImport
699 super Prod
700 end
701
702 # A standard import clause. eg `import x`
703 class AStdImport
704 super AImport
705 readable writable var _n_visibility: AVisibility
706 readable writable var _n_kwimport: TKwimport
707 readable writable var _n_name: AModuleName
708 init do end
709 end
710
711 # The special import clause of the kernel module. eg `import end`
712 class ANoImport
713 super AImport
714 readable writable var _n_visibility: AVisibility
715 readable writable var _n_kwimport: TKwimport
716 readable writable var _n_kwend: TKwend
717 init do end
718 end
719
720 # A visibility modifier
721 #
722 # The public visibility is an empty production (no keyword).
723 #
724 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
725 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
726 abstract class AVisibility
727 super Prod
728 end
729 class APublicVisibility
730 super AVisibility
731 end
732 class APrivateVisibility
733 super AVisibility
734 readable writable var _n_kwprivate: TKwprivate
735 init do end
736 end
737 class AProtectedVisibility
738 super AVisibility
739 readable writable var _n_kwprotected: TKwprotected
740 init do end
741 end
742 class AIntrudeVisibility
743 super AVisibility
744 readable writable var _n_kwintrude: TKwintrude
745 init do end
746 end
747
748 # A class definition
749 # While most definition are `AStdClassdef`
750 # There is tow special case of class definition
751 abstract class AClassdef
752 super Prod
753 readable var _n_propdefs: ANodes[APropdef] = new ANodes[APropdef](self)
754 init do end
755 end
756
757 # A standard class definition with a name, superclasses and properties
758 class AStdClassdef
759 super AClassdef
760 readable writable var _n_doc: nullable ADoc = null
761 readable writable var _n_kwredef: nullable TKwredef = null
762 readable writable var _n_visibility: AVisibility
763 readable writable var _n_classkind: AClasskind
764 readable writable var _n_id: nullable TClassid = null
765 readable var _n_formaldefs: ANodes[AFormaldef] = new ANodes[AFormaldef](self)
766 readable writable var _n_extern_code_block: nullable AExternCodeBlock = null
767 readable var _n_superclasses: ANodes[ASuperclass] = new ANodes[ASuperclass](self)
768 readable writable var _n_kwend: TKwend
769 redef fun hot_location do return n_id.location
770 init do end
771 end
772
773 # The implicit class definition of the implicit main method
774 class ATopClassdef
775 super AClassdef
776 end
777
778 # The implicit class definition of the top-level methods
779 class AMainClassdef
780 super AClassdef
781 end
782
783 # The modifier for the kind of class (abstract, interface, etc.)
784 abstract class AClasskind
785 super Prod
786 end
787 class AConcreteClasskind
788 super AClasskind
789 readable writable var _n_kwclass: TKwclass
790 init do end
791 end
792 class AAbstractClasskind
793 super AClasskind
794 readable writable var _n_kwabstract: TKwabstract
795 readable writable var _n_kwclass: TKwclass
796 init do end
797 end
798 class AInterfaceClasskind
799 super AClasskind
800 readable writable var _n_kwinterface: TKwinterface
801 init do end
802 end
803 class AEnumClasskind
804 super AClasskind
805 readable writable var _n_kwenum: TKwenum
806 init do end
807 end
808 class AExternClasskind
809 super AClasskind
810 readable writable var _n_kwextern: TKwextern
811 readable writable var _n_kwclass: nullable TKwclass = null
812 init do end
813 end
814
815 # The definition of a formal generic parameter type. eg `X: Y`
816 class AFormaldef
817 super Prod
818 readable writable var _n_id: TClassid
819 # The bound of the parameter type
820 readable writable var _n_type: nullable AType = null
821 init do end
822 end
823
824 # A super-class. eg `super X`
825 class ASuperclass
826 super Prod
827 readable writable var _n_kwsuper: TKwsuper
828 readable writable var _n_type: AType
829 init do end
830 end
831
832 # The definition of a property
833 abstract class APropdef
834 super Prod
835 readable writable var _n_doc: nullable ADoc = null
836 readable writable var _n_kwredef: nullable TKwredef = null
837 readable writable var _n_visibility: nullable AVisibility = null
838 end
839
840 # A definition of an attribute
841 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
842 class AAttrPropdef
843 super APropdef
844 readable writable var _n_kwvar: TKwvar
845
846 # The identifier for an old-style attribute (null if new-style)
847 readable writable var _n_id: nullable TAttrid
848
849 # The identifier for a new-style attribute (null if old-style)
850 readable writable var _n_id2: nullable TId
851
852 readable writable var _n_type: nullable AType = null
853 readable writable var _n_readable: nullable AAble = null
854 readable writable var _n_writable: nullable AAble = null
855
856 # The initial value, if any
857 readable writable var _n_expr: nullable AExpr = null
858 redef fun hot_location
859 do
860 if n_id != null then return n_id.location else return n_id2.location
861 end
862 init do end
863 end
864
865 # A definition of all kind of method (including constructors)
866 abstract class AMethPropdef
867 super APropdef
868 readable writable var _n_kwmeth: nullable TKwmeth = null
869 readable writable var _n_kwinit: nullable TKwinit = null
870 readable writable var _n_kwnew: nullable TKwnew = null
871 readable writable var _n_methid: nullable AMethid = null
872 readable writable var _n_signature: nullable ASignature = null
873 readable writable var _n_block: nullable AExpr = null
874 readable writable var _n_extern: nullable TString = null
875 readable writable var _n_extern_calls: nullable AExternCalls = null
876 readable writable var _n_extern_code_block: nullable AExternCodeBlock = null
877 redef fun hot_location
878 do
879 if n_methid != null then
880 return n_methid.location
881 else if n_kwinit != null then
882 return n_kwinit.location
883 else if n_kwnew != null then
884 return n_kwnew.location
885 else
886 return location
887 end
888 end
889 end
890
891 # A method marked abstract
892 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
893 class ADeferredMethPropdef
894 super AMethPropdef
895 end
896
897 # A method marked intern
898 class AInternMethPropdef
899 super AMethPropdef
900 end
901
902 # A method of a constructor marked extern
903 abstract class AExternPropdef
904 super AMethPropdef
905 end
906
907 # A method marked extern
908 class AExternMethPropdef
909 super AExternPropdef
910 end
911
912 # A method with a body
913 class AConcreteMethPropdef
914 super AMethPropdef
915 end
916
917 # A constructor
918 abstract class AInitPropdef
919 super AMethPropdef
920 end
921
922 # A constructor with a body
923 class AConcreteInitPropdef
924 super AConcreteMethPropdef
925 super AInitPropdef
926 end
927
928 # A constructor marked extern (defined with the `new` keyword)
929 class AExternInitPropdef
930 super AExternPropdef
931 super AInitPropdef
932 end
933
934 # The implicit main method
935 class AMainMethPropdef
936 super AConcreteMethPropdef
937 end
938
939 # Declaration of callbacks for extern methods
940 class AExternCalls
941 super Prod
942 readable writable var _n_kwimport: TKwimport
943 readable var _n_extern_calls: ANodes[AExternCall] = new ANodes[AExternCall](self)
944 init do end
945 end
946 abstract class AExternCall
947 super Prod
948 end
949 abstract class APropExternCall
950 super AExternCall
951 end
952 class ALocalPropExternCall
953 super APropExternCall
954 readable writable var _n_methid: AMethid
955 init do end
956 end
957 class AFullPropExternCall
958 super APropExternCall
959 readable writable var _n_type: AType
960 readable writable var _n_dot: nullable TDot = null
961 readable writable var _n_methid: AMethid
962 init do end
963 end
964 class AInitPropExternCall
965 super APropExternCall
966 readable writable var _n_type: AType
967 init do end
968 end
969 class ASuperExternCall
970 super AExternCall
971 readable writable var _n_kwsuper: TKwsuper
972 init do end
973 end
974 abstract class ACastExternCall
975 super AExternCall
976 end
977 class ACastAsExternCall
978 super ACastExternCall
979 readable writable var _n_from_type: AType
980 readable writable var _n_dot: nullable TDot = null
981 readable writable var _n_kwas: TKwas
982 readable writable var _n_to_type: AType
983 init do end
984 end
985 class AAsNullableExternCall
986 super ACastExternCall
987 readable writable var _n_type: AType
988 readable writable var _n_kwas: TKwas
989 readable writable var _n_kwnullable: TKwnullable
990 init do end
991 end
992 class AAsNotNullableExternCall
993 super ACastExternCall
994 readable writable var _n_type: AType
995 readable writable var _n_kwas: TKwas
996 readable writable var _n_kwnot: TKwnot
997 readable writable var _n_kwnullable: TKwnullable
998 init do end
999 end
1000
1001 # A definition of a virtual type
1002 class ATypePropdef
1003 super APropdef
1004 readable writable var _n_kwtype: TKwtype
1005 readable writable var _n_id: TClassid
1006 readable writable var _n_type: AType
1007 init do end
1008 end
1009
1010 # A `writable` or `readable` modifier
1011 abstract class AAble
1012 super Prod
1013 readable writable var _n_visibility: nullable AVisibility = null
1014 readable writable var _n_kwredef: nullable TKwredef = null
1015 init do end
1016 end
1017
1018 # A `readable` modifier
1019 class AReadAble
1020 super AAble
1021 readable writable var _n_kwreadable: TKwreadable
1022 init do end
1023 end
1024
1025 # A `writable` modifier
1026 class AWriteAble
1027 super AAble
1028 readable writable var _n_kwwritable: TKwwritable
1029 init do end
1030 end
1031
1032 # The identifier of a method in a method declaration.
1033 # There is a specific class because of operator and setters.
1034 abstract class AMethid
1035 super Prod
1036 end
1037 class AIdMethid
1038 super AMethid
1039 readable writable var _n_id: TId
1040 init do end
1041 end
1042 class APlusMethid
1043 super AMethid
1044 readable writable var _n_plus: TPlus
1045 init do end
1046 end
1047 class AMinusMethid
1048 super AMethid
1049 readable writable var _n_minus: TMinus
1050 init do end
1051 end
1052 class AStarMethid
1053 super AMethid
1054 readable writable var _n_star: TStar
1055 init do end
1056 end
1057 class ASlashMethid
1058 super AMethid
1059 readable writable var _n_slash: TSlash
1060 init do end
1061 end
1062 class APercentMethid
1063 super AMethid
1064 readable writable var _n_percent: TPercent
1065 init do end
1066 end
1067 class AEqMethid
1068 super AMethid
1069 readable writable var _n_eq: TEq
1070 init do end
1071 end
1072 class ANeMethid
1073 super AMethid
1074 readable writable var _n_ne: TNe
1075 init do end
1076 end
1077 class ALeMethid
1078 super AMethid
1079 readable writable var _n_le: TLe
1080 init do end
1081 end
1082 class AGeMethid
1083 super AMethid
1084 readable writable var _n_ge: TGe
1085 init do end
1086 end
1087 class ALtMethid
1088 super AMethid
1089 readable writable var _n_lt: TLt
1090 init do end
1091 end
1092 class AGtMethid
1093 super AMethid
1094 readable writable var _n_gt: TGt
1095 init do end
1096 end
1097 class ALlMethid
1098 super AMethid
1099 readable writable var _n_ll: TLl
1100 init do end
1101 end
1102 class AGgMethid
1103 super AMethid
1104 readable writable var _n_gg: TGg
1105 init do end
1106 end
1107 class ABraMethid
1108 super AMethid
1109 readable writable var _n_obra: TObra
1110 readable writable var _n_cbra: TCbra
1111 init do end
1112 end
1113 class AStarshipMethid
1114 super AMethid
1115 readable writable var _n_starship: TStarship
1116 init do end
1117 end
1118 class AAssignMethid
1119 super AMethid
1120 readable writable var _n_id: TId
1121 readable writable var _n_assign: TAssign
1122 init do end
1123 end
1124 class ABraassignMethid
1125 super AMethid
1126 readable writable var _n_obra: TObra
1127 readable writable var _n_cbra: TCbra
1128 readable writable var _n_assign: TAssign
1129 init do end
1130 end
1131
1132 # A signature in a method definition. eg `(x,y:X,z:Z):T`
1133 class ASignature
1134 super Prod
1135 readable writable var _n_opar: nullable TOpar = null
1136 readable var _n_params: ANodes[AParam] = new ANodes[AParam](self)
1137 readable writable var _n_cpar: nullable TCpar = null
1138 readable writable var _n_type: nullable AType = null
1139 init do end
1140 end
1141
1142 # A parameter definition in a signature. eg `x:X`
1143 class AParam
1144 super Prod
1145 readable writable var _n_id: TId
1146 readable writable var _n_type: nullable AType = null
1147 readable writable var _n_dotdotdot: nullable TDotdotdot = null
1148 init do end
1149 end
1150
1151 # A static type. eg `nullable X[Y]`
1152 class AType
1153 super Prod
1154 readable writable var _n_kwnullable: nullable TKwnullable = null
1155
1156 # The name of the class or of the formal type
1157 readable writable var _n_id: TClassid
1158
1159 # Type arguments for a generic type
1160 readable var _n_types: ANodes[AType] = new ANodes[AType](self)
1161 init do end
1162 end
1163
1164 # A label at the end of a block or in a break/continue statement. eg `label x`
1165 class ALabel
1166 super Prod
1167 readable writable var _n_kwlabel: TKwlabel
1168 readable writable var _n_id: TId
1169 init do end
1170 end
1171
1172 # Expression and statements
1173 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
1174 abstract class AExpr
1175 super Prod
1176 end
1177
1178 # A sequence of AExpr (usually statements)
1179 # The last AExpr gives the value of the whole block
1180 class ABlockExpr
1181 super AExpr
1182 readable var _n_expr: ANodes[AExpr] = new ANodes[AExpr](self)
1183 readable writable var _n_kwend: nullable TKwend = null
1184 init do end
1185 end
1186
1187 # A declaration of a local variable. eg `var x: X = y`
1188 class AVardeclExpr
1189 super AExpr
1190 readable writable var _n_kwvar: TKwvar
1191 readable writable var _n_id: TId
1192 readable writable var _n_type: nullable AType = null
1193 readable writable var _n_assign: nullable TAssign = null
1194
1195 # The initial value, if any
1196 readable writable var _n_expr: nullable AExpr = null
1197 init do end
1198 end
1199
1200 # A `return` statement. eg `return x`
1201 class AReturnExpr
1202 super AExpr
1203 readable writable var _n_kwreturn: nullable TKwreturn = null
1204 readable writable var _n_expr: nullable AExpr = null
1205 init do end
1206 end
1207
1208 # Something that has a label.
1209 abstract class ALabelable
1210 super Prod
1211 readable writable var _n_label: nullable ALabel = null
1212 init do end
1213 end
1214
1215 # A `break` statement.
1216 class ABreakExpr
1217 super AExpr
1218 super ALabelable
1219 readable writable var _n_kwbreak: TKwbreak
1220 readable writable var _n_expr: nullable AExpr = null
1221 init do end
1222 end
1223
1224 # An `abort` statement
1225 class AAbortExpr
1226 super AExpr
1227 readable writable var _n_kwabort: TKwabort
1228 init do end
1229 end
1230
1231 # A `continue` statement
1232 class AContinueExpr
1233 super AExpr
1234 super ALabelable
1235 readable writable var _n_kwcontinue: nullable TKwcontinue = null
1236 readable writable var _n_expr: nullable AExpr = null
1237 init do end
1238 end
1239
1240 # A `do` statement
1241 class ADoExpr
1242 super AExpr
1243 super ALabelable
1244 readable writable var _n_kwdo: TKwdo
1245 readable writable var _n_block: nullable AExpr = null
1246 init do end
1247 end
1248
1249 # A `if` statement
1250 class AIfExpr
1251 super AExpr
1252 readable writable var _n_kwif: TKwif
1253 readable writable var _n_expr: AExpr
1254 readable writable var _n_then: nullable AExpr = null
1255 readable writable var _n_else: nullable AExpr = null
1256 init do end
1257 end
1258
1259 # A `if` expression
1260 class AIfexprExpr
1261 super AExpr
1262 readable writable var _n_kwif: TKwif
1263 readable writable var _n_expr: AExpr
1264 readable writable var _n_kwthen: TKwthen
1265 readable writable var _n_then: AExpr
1266 readable writable var _n_kwelse: TKwelse
1267 readable writable var _n_else: AExpr
1268 init do end
1269 end
1270
1271 # A `while` statement
1272 class AWhileExpr
1273 super AExpr
1274 super ALabelable
1275 readable writable var _n_kwwhile: TKwwhile
1276 readable writable var _n_expr: AExpr
1277 readable writable var _n_kwdo: TKwdo
1278 readable writable var _n_block: nullable AExpr = null
1279 init do end
1280 end
1281
1282 # A `loop` statement
1283 class ALoopExpr
1284 super AExpr
1285 super ALabelable
1286 readable writable var _n_kwloop: TKwloop
1287 readable writable var _n_block: nullable AExpr = null
1288 init do end
1289 end
1290
1291 # A `for` statement
1292 class AForExpr
1293 super AExpr
1294 super ALabelable
1295 readable writable var _n_kwfor: TKwfor
1296 readable var _n_ids: ANodes[TId] = new ANodes[TId](self)
1297 readable writable var _n_expr: AExpr
1298 readable writable var _n_kwdo: TKwdo
1299 readable writable var _n_block: nullable AExpr = null
1300 init do end
1301 end
1302
1303 # An `assert` statement
1304 class AAssertExpr
1305 super AExpr
1306 readable writable var _n_kwassert: TKwassert
1307 readable writable var _n_id: nullable TId = null
1308 readable writable var _n_expr: AExpr
1309 readable writable var _n_else: nullable AExpr = null
1310 init do end
1311 end
1312
1313 # Whatever is a simple assignment. eg `= something`
1314 abstract class AAssignFormExpr
1315 super AExpr
1316 readable writable var _n_assign: TAssign
1317 readable writable var _n_value: AExpr
1318 init do end
1319 end
1320
1321 # Whatever is a combined assignment. eg `+= something`
1322 abstract class AReassignFormExpr
1323 super AExpr
1324 readable writable var _n_assign_op: AAssignOp
1325 readable writable var _n_value: AExpr
1326 init do end
1327 end
1328
1329 # A `once` expression. eg `once x`
1330 class AOnceExpr
1331 super AProxyExpr
1332 readable writable var _n_kwonce: TKwonce
1333 init do end
1334 end
1335
1336 # A polymorphic invocation of a method
1337 # The form of the invocation (name, arguments, etc) are specific
1338 abstract class ASendExpr
1339 super AExpr
1340 # The receiver of the method invocation
1341 readable writable var _n_expr: AExpr
1342 init do end
1343 end
1344
1345 # A binary operation on a method
1346 abstract class ABinopExpr
1347 super ASendExpr
1348 # The second operand of the operation
1349 # Note: the receiver (`n_expr`) is the first operand
1350 readable writable var _n_expr2: AExpr
1351 init do end
1352 end
1353
1354 # Something that is boolean expression
1355 abstract class ABoolExpr
1356 super AExpr
1357 end
1358
1359 # A `or` expression
1360 class AOrExpr
1361 super ABoolExpr
1362 readable writable var _n_expr: AExpr
1363 readable writable var _n_expr2: AExpr
1364 init do end
1365 end
1366
1367 # A `and` expression
1368 class AAndExpr
1369 super ABoolExpr
1370 readable writable var _n_expr: AExpr
1371 readable writable var _n_expr2: AExpr
1372 init do end
1373 end
1374
1375 # A `or else` expression
1376 class AOrElseExpr
1377 super ABoolExpr
1378 readable writable var _n_expr: AExpr
1379 readable writable var _n_expr2: AExpr
1380 init do end
1381 end
1382
1383 # A `implies` expression
1384 class AImpliesExpr
1385 super ABoolExpr
1386 readable writable var _n_expr: AExpr
1387 readable writable var _n_expr2: AExpr
1388 init do end
1389 end
1390
1391 # A `not` expression
1392 class ANotExpr
1393 super ABoolExpr
1394 readable writable var _n_kwnot: TKwnot
1395 readable writable var _n_expr: AExpr
1396 init do end
1397 end
1398
1399 # A `==` expression
1400 class AEqExpr
1401 super ABinopExpr
1402 end
1403
1404 # A `!=` expression
1405 class ANeExpr
1406 super ABinopExpr
1407 end
1408
1409 # A `<` expression
1410 class ALtExpr
1411 super ABinopExpr
1412 end
1413
1414 # A `<=` expression
1415 class ALeExpr
1416 super ABinopExpr
1417 end
1418
1419 # A `<<` expression
1420 class ALlExpr
1421 super ABinopExpr
1422 end
1423
1424 # A `>` expression
1425 class AGtExpr
1426 super ABinopExpr
1427 end
1428
1429 # A `>=` expression
1430 class AGeExpr
1431 super ABinopExpr
1432 end
1433
1434 # A `>>` expression
1435 class AGgExpr
1436 super ABinopExpr
1437 end
1438
1439 # A type-ckeck expression. eg `x isa T`
1440 class AIsaExpr
1441 super ABoolExpr
1442 readable writable var _n_expr: AExpr
1443 readable writable var _n_type: AType
1444 init do end
1445 end
1446
1447 # A `+` expression
1448 class APlusExpr
1449 super ABinopExpr
1450 end
1451
1452 # A `-` expression
1453 class AMinusExpr
1454 super ABinopExpr
1455 end
1456
1457 # A `<=>` expression
1458 class AStarshipExpr
1459 super ABinopExpr
1460 end
1461
1462 # A `*` expression
1463 class AStarExpr
1464 super ABinopExpr
1465 end
1466
1467 # A `/` expression
1468 class ASlashExpr
1469 super ABinopExpr
1470 end
1471
1472 # A `%` expression
1473 class APercentExpr
1474 super ABinopExpr
1475 end
1476
1477 # A unary minus expression. eg `-x`
1478 class AUminusExpr
1479 super ASendExpr
1480 readable writable var _n_minus: TMinus
1481 init do end
1482 end
1483
1484 # An explicit instantiation. eg `new T`
1485 class ANewExpr
1486 super AExpr
1487 readable writable var _n_kwnew: TKwnew
1488 readable writable var _n_type: AType
1489
1490 # The name of the named-constructor, if any
1491 readable writable var _n_id: nullable TId = null
1492 readable writable var _n_args: AExprs
1493 init do end
1494 end
1495
1496 # Whatever is a old-style attribute access
1497 abstract class AAttrFormExpr
1498 super AExpr
1499
1500 # The receiver of the attribute
1501 readable writable var _n_expr: AExpr
1502
1503 # The name of the attribute
1504 readable writable var _n_id: TAttrid
1505
1506 init do end
1507 end
1508
1509 # The read of an attribute. eg `x._a`
1510 class AAttrExpr
1511 super AAttrFormExpr
1512 end
1513
1514 # The assignment of an attribute. eg `x._a=y`
1515 class AAttrAssignExpr
1516 super AAttrFormExpr
1517 super AAssignFormExpr
1518 end
1519
1520 # Whatever looks-like a call with a standard method and any number of arguments.
1521 abstract class ACallFormExpr
1522 super ASendExpr
1523
1524 # The name of the method
1525 readable writable var _n_id: TId
1526
1527 # The arguments of the call
1528 readable writable var _n_args: AExprs
1529 init do end
1530 end
1531
1532 # A complex setter call (standard or brackets)
1533 abstract class ASendReassignFormExpr
1534 super ASendExpr
1535 super AReassignFormExpr
1536 end
1537
1538 # A complex attribute assignment. eg `x._a+=y`
1539 class AAttrReassignExpr
1540 super AAttrFormExpr
1541 super AReassignFormExpr
1542 end
1543
1544 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1545 # Note: because the parser cannot distinguish a variable read with a method call with an implicit receiver and no arguments, it always returns a `ACallExpr`.
1546 # Semantic analysis have to transform them to instance of `AVarExpr`.
1547 class ACallExpr
1548 super ACallFormExpr
1549 end
1550
1551 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1552 # Note: because the parser cannot distinguish a variable write with a setter call with an implicit receiver and no arguments, it always returns a `ACallAssignExpr`.
1553 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1554 class ACallAssignExpr
1555 super ACallFormExpr
1556 super AAssignFormExpr
1557 end
1558
1559 # A complex setter call with a standard method-name and any number of arguments. eg `x.m(y)+=z`. OR just a simple complex assignment.
1560 # Note: because the parser cannot distinguish a variable write with a compex setter call with an implicit receiver and no arguments, it always returns a `ACallReassignExpr`.
1561 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1562 class ACallReassignExpr
1563 super ACallFormExpr
1564 super ASendReassignFormExpr
1565 end
1566
1567 # A call to `super`. OR a call of a super-constructor
1568 class ASuperExpr
1569 super AExpr
1570 readable writable var _n_qualified: nullable AQualified = null
1571 readable writable var _n_kwsuper: TKwsuper
1572 readable writable var _n_args: AExprs
1573 init do end
1574 end
1575
1576 # A call to the `init` constructor.
1577 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr.
1578 class AInitExpr
1579 super ASendExpr
1580 readable writable var _n_kwinit: TKwinit
1581 readable writable var _n_args: AExprs
1582 init do end
1583 end
1584
1585 # Whatever looks-like a call of the brackets `[]` operator.
1586 abstract class ABraFormExpr
1587 super ASendExpr
1588 readable writable var _n_args: AExprs
1589 init do end
1590 end
1591
1592 # A call of the brackets operator. eg `x[y,z]`
1593 class ABraExpr
1594 super ABraFormExpr
1595 end
1596
1597 # A setter call of the bracket operator. eg `x[y,z]=t`
1598 class ABraAssignExpr
1599 super ABraFormExpr
1600 super AAssignFormExpr
1601 end
1602
1603 # Whatever is an access to a local variable
1604 abstract class AVarFormExpr
1605 super AExpr
1606 readable writable var _n_id: TId
1607 init do end
1608 end
1609
1610 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1611 class ABraReassignExpr
1612 super ABraFormExpr
1613 super ASendReassignFormExpr
1614 end
1615
1616 # A local variable read access.
1617 # The parser cannot instantiate them, see `ACallExpr`.
1618 class AVarExpr
1619 super AVarFormExpr
1620 end
1621
1622 # A local variable simple assigment access
1623 # The parser cannot instantiate them, see `ACallAssignExpr`.
1624 class AVarAssignExpr
1625 super AVarFormExpr
1626 super AAssignFormExpr
1627 end
1628
1629 # A local variable complex assignment access
1630 # The parser cannot instantiate them, see `ACallReassignExpr`.
1631 class AVarReassignExpr
1632 super AVarFormExpr
1633 super AReassignFormExpr
1634 end
1635
1636 # A literal range, open or closed
1637 abstract class ARangeExpr
1638 super AExpr
1639 readable writable var _n_expr: AExpr
1640 readable writable var _n_expr2: AExpr
1641 init do end
1642 end
1643
1644 # A closed literal range. eg `[x..y]`
1645 class ACrangeExpr
1646 super ARangeExpr
1647 readable writable var _n_obra: TObra
1648 readable writable var _n_cbra: TCbra
1649 init do end
1650 end
1651
1652 # An open literal range. eg `[x..y[`
1653 class AOrangeExpr
1654 super ARangeExpr
1655 readable writable var _n_obra: TObra
1656 readable writable var _n_cbra: TObra
1657 init do end
1658 end
1659
1660 # A literal array. eg. `[x,y,z]`
1661 class AArrayExpr
1662 super AExpr
1663 readable writable var _n_exprs: AExprs
1664 init do end
1665 end
1666
1667 # A read of `self`
1668 class ASelfExpr
1669 super AExpr
1670 readable writable var _n_kwself: nullable TKwself
1671 init do end
1672 end
1673
1674 # When there is no explicit receiver, `self` is implicit
1675 class AImplicitSelfExpr
1676 super ASelfExpr
1677 end
1678
1679 # A `true` boolean literal constant
1680 class ATrueExpr
1681 super ABoolExpr
1682 readable writable var _n_kwtrue: TKwtrue
1683 init do end
1684 end
1685 # A `false` boolean literal constant
1686 class AFalseExpr
1687 super ABoolExpr
1688 readable writable var _n_kwfalse: TKwfalse
1689 init do end
1690 end
1691 # A `null` literal constant
1692 class ANullExpr
1693 super AExpr
1694 readable writable var _n_kwnull: TKwnull
1695 init do end
1696 end
1697 # An integer literal
1698 class AIntExpr
1699 super AExpr
1700 end
1701 # An integer literal in decimal format
1702 class ADecIntExpr
1703 super AIntExpr
1704 readable writable var _n_number: TNumber
1705 init do end
1706 end
1707 # An integer literal in hexadecimal format
1708 class AHexIntExpr
1709 super AIntExpr
1710 readable writable var _n_hex_number: THexNumber
1711 init do end
1712 end
1713 # A float literal
1714 class AFloatExpr
1715 super AExpr
1716 readable writable var _n_float: TFloat
1717 init do end
1718 end
1719 # A character literal
1720 class ACharExpr
1721 super AExpr
1722 readable writable var _n_char: TChar
1723 init do end
1724 end
1725 # A string literal
1726 abstract class AStringFormExpr
1727 super AExpr
1728 readable writable var _n_string: Token
1729 init do end
1730 end
1731
1732 # A simple string. eg. `"abc"`
1733 class AStringExpr
1734 super AStringFormExpr
1735 end
1736
1737 # The start of a superstring. eg `"abc{`
1738 class AStartStringExpr
1739 super AStringFormExpr
1740 end
1741
1742 # The middle of a superstring. eg `}abc{`
1743 class AMidStringExpr
1744 super AStringFormExpr
1745 end
1746
1747 # The end of a superstrng. eg `}abc"`
1748 class AEndStringExpr
1749 super AStringFormExpr
1750 end
1751
1752 # A superstring literal. eg `"a{x}b{y}c"`
1753 # Each part is modelized a sequence of expression. eg. `["a{, x, }b{, y, }c"]`
1754 class ASuperstringExpr
1755 super AExpr
1756 readable var _n_exprs: ANodes[AExpr] = new ANodes[AExpr](self)
1757 init do end
1758 end
1759
1760 # A simple parenthesis. eg `(x)`
1761 class AParExpr
1762 super AProxyExpr
1763 readable writable var _n_opar: TOpar
1764 readable writable var _n_cpar: TCpar
1765 init do end
1766 end
1767
1768 # Whatevej just contains (and mimic) an other expression
1769 abstract class AProxyExpr
1770 super AExpr
1771 readable writable var _n_expr: AExpr
1772 init do end
1773 end
1774
1775 # A type cast. eg `x.as(T)`
1776 class AAsCastExpr
1777 super AExpr
1778 readable writable var _n_expr: AExpr
1779 readable writable var _n_kwas: TKwas
1780 readable writable var _n_opar: nullable TOpar = null
1781 readable writable var _n_type: AType
1782 readable writable var _n_cpar: nullable TCpar = null
1783 init do end
1784 end
1785
1786 # A as-not-null cast. eg `x.as(not null)`
1787 class AAsNotnullExpr
1788 super AExpr
1789 readable writable var _n_expr: AExpr
1790 readable writable var _n_kwas: TKwas
1791 readable writable var _n_opar: nullable TOpar = null
1792 readable writable var _n_kwnot: TKwnot
1793 readable writable var _n_kwnull: TKwnull
1794 readable writable var _n_cpar: nullable TCpar = null
1795 init do end
1796 end
1797
1798 # A is-set check of old-style attributes. eg `isset x._a`
1799 class AIssetAttrExpr
1800 super AAttrFormExpr
1801 readable writable var _n_kwisset: TKwisset
1802 init do end
1803 end
1804
1805 # A list of expression separated with commas (arguments for instance)
1806 abstract class AExprs
1807 super Prod
1808 readable var _n_exprs: ANodes[AExpr] = new ANodes[AExpr](self)
1809 init do end
1810 end
1811
1812 class ADebugTypeExpr
1813 super AExpr
1814 readable writable var _n_kwdebug: TKwdebug
1815 readable writable var _n_kwtype: TKwtype
1816 readable writable var _n_expr: AExpr
1817 readable writable var _n_type: AType
1818 init do end
1819 end
1820
1821 # A simple list of expressions
1822 class AListExprs
1823 super AExprs
1824 end
1825
1826 # A list of expressions enclosed in parentheses
1827 class AParExprs
1828 super AExprs
1829 readable writable var _n_opar: TOpar
1830 readable writable var _n_cpar: TCpar
1831 init do end
1832 end
1833
1834 # A list of expressions enclosed in brackets
1835 class ABraExprs
1836 super AExprs
1837 readable writable var _n_obra: TObra
1838 readable writable var _n_cbra: TCbra
1839 init do end
1840 end
1841
1842 # A complex assignment operator. eg `+=`
1843 abstract class AAssignOp
1844 super Prod
1845 end
1846 class APlusAssignOp
1847 super AAssignOp
1848 readable writable var _n_pluseq: TPluseq
1849 init do end
1850 end
1851 class AMinusAssignOp
1852 super AAssignOp
1853 readable writable var _n_minuseq: TMinuseq
1854 init do end
1855 end
1856
1857 class AModuleName
1858 super Prod
1859 readable writable var _n_quad: nullable TQuad = null
1860 readable var _n_path: ANodes[TId] = new ANodes[TId](self)
1861 readable writable var _n_id: TId
1862 init do end
1863 end
1864 class AInLanguage
1865 super Prod
1866 readable writable var _n_kwin: TKwin
1867 readable writable var _n_string: TString
1868 init do end
1869 end
1870 class AExternCodeBlock
1871 super Prod
1872 readable writable var _n_in_language: nullable AInLanguage = null
1873 readable writable var _n_extern_code_segment: TExternCodeSegment
1874 init do end
1875 end
1876 class AQualified
1877 super Prod
1878 readable writable var _n_quad: nullable TQuad = null
1879 readable var _n_id: ANodes[TId] = new ANodes[TId](self)
1880 readable writable var _n_classid: nullable TClassid = null
1881 init do end
1882 end
1883
1884 # A documentation of a definition
1885 # It contains the block of comments just above the declaration
1886 class ADoc
1887 super Prod
1888 readable var _n_comment: ANodes[TComment] = new ANodes[TComment](self)
1889 init do end
1890 end
1891
1892 class AAnnotations
1893 super Prod
1894 readable writable var _n_at: nullable TAt = null
1895 readable writable var _n_opar: nullable TOpar = null
1896 readable var _n_items: ANodes[AAnnotation] = new ANodes[AAnnotation](self)
1897 readable writable var _n_cpar: nullable TCpar = null
1898 init do end
1899 end
1900 class AAnnotation
1901 super Prod
1902 readable writable var _n_atid: AAtid
1903 readable writable var _n_opar: nullable TOpar = null
1904 readable var _n_args: ANodes[AAtArg] = new ANodes[AAtArg](self)
1905 readable writable var _n_cpar: nullable TCpar = null
1906 init do end
1907 end
1908 abstract class AAtArg
1909 super Prod
1910 end
1911 class ATypeAtArg
1912 super AAtArg
1913 readable writable var _n_type: AType
1914 init do end
1915 end
1916 class AExprAtArg
1917 super AAtArg
1918 readable writable var _n_expr: AExpr
1919 init do end
1920 end
1921 class AAtAtArg
1922 super AAtArg
1923 end
1924 abstract class AAtid
1925 super Prod
1926 readable writable var _n_id: Token
1927 init do end
1928 end
1929 class AIdAtid
1930 super AAtid
1931 end
1932 class AKwexternAtid
1933 super AAtid
1934 end
1935 class AKwinternAtid
1936 super AAtid
1937 end
1938 class AKwreadableAtid
1939 super AAtid
1940 end
1941 class AKwwritableAtid
1942 super AAtid
1943 end
1944 class AKwimportAtid
1945 super AAtid
1946 end
1947
1948 # The root of the AST
1949 class Start
1950 super Prod
1951 readable writable var _n_base: nullable AModule
1952 readable writable var _n_eof: EOF
1953 init(n_base: nullable AModule, n_eof: EOF)
1954 do
1955 self._n_base = n_base
1956 self._n_eof = n_eof
1957 end
1958 end