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