Merge: SharedPreferences: Nit API wrapping android SharedPreferences class
[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 # A constructor marked extern (defined with the `new` keyword)
938 class AExternInitPropdef
939 super AExternPropdef
940 super AInitPropdef
941 end
942
943 # The implicit main method
944 class AMainMethPropdef
945 super AConcreteMethPropdef
946 end
947
948 # Declaration of callbacks for extern methods
949 class AExternCalls
950 super Prod
951 readable writable var _n_kwimport: TKwimport
952 readable var _n_extern_calls: ANodes[AExternCall] = new ANodes[AExternCall](self)
953 init do end
954 end
955 abstract class AExternCall
956 super Prod
957 end
958 abstract class APropExternCall
959 super AExternCall
960 end
961 class ALocalPropExternCall
962 super APropExternCall
963 readable writable var _n_methid: AMethid
964 init do end
965 end
966 class AFullPropExternCall
967 super APropExternCall
968 readable writable var _n_type: AType
969 readable writable var _n_dot: nullable TDot = null
970 readable writable var _n_methid: AMethid
971 init do end
972 end
973 class AInitPropExternCall
974 super APropExternCall
975 readable writable var _n_type: AType
976 init do end
977 end
978 class ASuperExternCall
979 super AExternCall
980 readable writable var _n_kwsuper: TKwsuper
981 init do end
982 end
983 abstract class ACastExternCall
984 super AExternCall
985 end
986 class ACastAsExternCall
987 super ACastExternCall
988 readable writable var _n_from_type: AType
989 readable writable var _n_dot: nullable TDot = null
990 readable writable var _n_kwas: TKwas
991 readable writable var _n_to_type: AType
992 init do end
993 end
994 class AAsNullableExternCall
995 super ACastExternCall
996 readable writable var _n_type: AType
997 readable writable var _n_kwas: TKwas
998 readable writable var _n_kwnullable: TKwnullable
999 init do end
1000 end
1001 class AAsNotNullableExternCall
1002 super ACastExternCall
1003 readable writable var _n_type: AType
1004 readable writable var _n_kwas: TKwas
1005 readable writable var _n_kwnot: TKwnot
1006 readable writable var _n_kwnullable: TKwnullable
1007 init do end
1008 end
1009
1010 # A definition of a virtual type
1011 class ATypePropdef
1012 super APropdef
1013 readable writable var _n_kwtype: TKwtype
1014 readable writable var _n_id: TClassid
1015 readable writable var _n_type: AType
1016 init do end
1017 end
1018
1019 # A `writable` or `readable` modifier
1020 abstract class AAble
1021 super Prod
1022 readable writable var _n_visibility: nullable AVisibility = null
1023 readable writable var _n_kwredef: nullable TKwredef = null
1024 init do end
1025 end
1026
1027 # A `readable` modifier
1028 class AReadAble
1029 super AAble
1030 readable writable var _n_kwreadable: TKwreadable
1031 init do end
1032 end
1033
1034 # A `writable` modifier
1035 class AWriteAble
1036 super AAble
1037 readable writable var _n_kwwritable: TKwwritable
1038 init do end
1039 end
1040
1041 # The identifier of a method in a method declaration.
1042 # There is a specific class because of operator and setters.
1043 abstract class AMethid
1044 super Prod
1045 end
1046 class AIdMethid
1047 super AMethid
1048 readable writable var _n_id: TId
1049 init do end
1050 end
1051 class APlusMethid
1052 super AMethid
1053 readable writable var _n_plus: TPlus
1054 init do end
1055 end
1056 class AMinusMethid
1057 super AMethid
1058 readable writable var _n_minus: TMinus
1059 init do end
1060 end
1061 class AStarMethid
1062 super AMethid
1063 readable writable var _n_star: TStar
1064 init do end
1065 end
1066 class ASlashMethid
1067 super AMethid
1068 readable writable var _n_slash: TSlash
1069 init do end
1070 end
1071 class APercentMethid
1072 super AMethid
1073 readable writable var _n_percent: TPercent
1074 init do end
1075 end
1076 class AEqMethid
1077 super AMethid
1078 readable writable var _n_eq: TEq
1079 init do end
1080 end
1081 class ANeMethid
1082 super AMethid
1083 readable writable var _n_ne: TNe
1084 init do end
1085 end
1086 class ALeMethid
1087 super AMethid
1088 readable writable var _n_le: TLe
1089 init do end
1090 end
1091 class AGeMethid
1092 super AMethid
1093 readable writable var _n_ge: TGe
1094 init do end
1095 end
1096 class ALtMethid
1097 super AMethid
1098 readable writable var _n_lt: TLt
1099 init do end
1100 end
1101 class AGtMethid
1102 super AMethid
1103 readable writable var _n_gt: TGt
1104 init do end
1105 end
1106 class ALlMethid
1107 super AMethid
1108 readable writable var _n_ll: TLl
1109 init do end
1110 end
1111 class AGgMethid
1112 super AMethid
1113 readable writable var _n_gg: TGg
1114 init do end
1115 end
1116 class ABraMethid
1117 super AMethid
1118 readable writable var _n_obra: TObra
1119 readable writable var _n_cbra: TCbra
1120 init do end
1121 end
1122 class AStarshipMethid
1123 super AMethid
1124 readable writable var _n_starship: TStarship
1125 init do end
1126 end
1127 class AAssignMethid
1128 super AMethid
1129 readable writable var _n_id: TId
1130 readable writable var _n_assign: TAssign
1131 init do end
1132 end
1133 class ABraassignMethid
1134 super AMethid
1135 readable writable var _n_obra: TObra
1136 readable writable var _n_cbra: TCbra
1137 readable writable var _n_assign: TAssign
1138 init do end
1139 end
1140
1141 # A signature in a method definition. eg `(x,y:X,z:Z):T`
1142 class ASignature
1143 super Prod
1144 readable writable var _n_opar: nullable TOpar = null
1145 readable var _n_params: ANodes[AParam] = new ANodes[AParam](self)
1146 readable writable var _n_cpar: nullable TCpar = null
1147 readable writable var _n_type: nullable AType = null
1148 init do end
1149 end
1150
1151 # A parameter definition in a signature. eg `x:X`
1152 class AParam
1153 super Prod
1154 readable writable var _n_id: TId
1155 readable writable var _n_type: nullable AType = null
1156 readable writable var _n_dotdotdot: nullable TDotdotdot = null
1157 init do end
1158 end
1159
1160 # A static type. eg `nullable X[Y]`
1161 class AType
1162 super Prod
1163 readable writable var _n_kwnullable: nullable TKwnullable = null
1164
1165 # The name of the class or of the formal type
1166 readable writable var _n_id: TClassid
1167
1168 # Type arguments for a generic type
1169 readable var _n_types: ANodes[AType] = new ANodes[AType](self)
1170 init do end
1171 end
1172
1173 # A label at the end of a block or in a break/continue statement. eg `label x`
1174 class ALabel
1175 super Prod
1176 readable writable var _n_kwlabel: TKwlabel
1177 readable writable var _n_id: TId
1178 init do end
1179 end
1180
1181 # Expression and statements
1182 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
1183 abstract class AExpr
1184 super Prod
1185 end
1186
1187 # A sequence of AExpr (usually statements)
1188 # The last AExpr gives the value of the whole block
1189 class ABlockExpr
1190 super AExpr
1191 readable var _n_expr: ANodes[AExpr] = new ANodes[AExpr](self)
1192 readable writable var _n_kwend: nullable TKwend = null
1193 init do end
1194 end
1195
1196 # A declaration of a local variable. eg `var x: X = y`
1197 class AVardeclExpr
1198 super AExpr
1199 readable writable var _n_kwvar: TKwvar
1200 readable writable var _n_id: TId
1201 readable writable var _n_type: nullable AType = null
1202 readable writable var _n_assign: nullable TAssign = null
1203
1204 # The initial value, if any
1205 readable writable var _n_expr: nullable AExpr = null
1206 init do end
1207 end
1208
1209 # A `return` statement. eg `return x`
1210 class AReturnExpr
1211 super AExpr
1212 readable writable var _n_kwreturn: nullable TKwreturn = null
1213 readable writable var _n_expr: nullable AExpr = null
1214 init do end
1215 end
1216
1217 # Something that has a label.
1218 abstract class ALabelable
1219 super Prod
1220 readable writable var _n_label: nullable ALabel = null
1221 init do end
1222 end
1223
1224 # A `break` statement.
1225 class ABreakExpr
1226 super AExpr
1227 super ALabelable
1228 readable writable var _n_kwbreak: TKwbreak
1229 readable writable var _n_expr: nullable AExpr = null
1230 init do end
1231 end
1232
1233 # An `abort` statement
1234 class AAbortExpr
1235 super AExpr
1236 readable writable var _n_kwabort: TKwabort
1237 init do end
1238 end
1239
1240 # A `continue` statement
1241 class AContinueExpr
1242 super AExpr
1243 super ALabelable
1244 readable writable var _n_kwcontinue: nullable TKwcontinue = null
1245 readable writable var _n_expr: nullable AExpr = null
1246 init do end
1247 end
1248
1249 # A `do` statement
1250 class ADoExpr
1251 super AExpr
1252 super ALabelable
1253 readable writable var _n_kwdo: TKwdo
1254 readable writable var _n_block: nullable AExpr = null
1255 init do end
1256 end
1257
1258 # A `if` statement
1259 class AIfExpr
1260 super AExpr
1261 readable writable var _n_kwif: TKwif
1262 readable writable var _n_expr: AExpr
1263 readable writable var _n_then: nullable AExpr = null
1264 readable writable var _n_else: nullable AExpr = null
1265 init do end
1266 end
1267
1268 # A `if` expression
1269 class AIfexprExpr
1270 super AExpr
1271 readable writable var _n_kwif: TKwif
1272 readable writable var _n_expr: AExpr
1273 readable writable var _n_kwthen: TKwthen
1274 readable writable var _n_then: AExpr
1275 readable writable var _n_kwelse: TKwelse
1276 readable writable var _n_else: AExpr
1277 init do end
1278 end
1279
1280 # A `while` statement
1281 class AWhileExpr
1282 super AExpr
1283 super ALabelable
1284 readable writable var _n_kwwhile: TKwwhile
1285 readable writable var _n_expr: AExpr
1286 readable writable var _n_kwdo: TKwdo
1287 readable writable var _n_block: nullable AExpr = null
1288 init do end
1289 end
1290
1291 # A `loop` statement
1292 class ALoopExpr
1293 super AExpr
1294 super ALabelable
1295 readable writable var _n_kwloop: TKwloop
1296 readable writable var _n_block: nullable AExpr = null
1297 init do end
1298 end
1299
1300 # A `for` statement
1301 class AForExpr
1302 super AExpr
1303 super ALabelable
1304 readable writable var _n_kwfor: TKwfor
1305 readable var _n_ids: ANodes[TId] = new ANodes[TId](self)
1306 readable writable var _n_expr: AExpr
1307 readable writable var _n_kwdo: TKwdo
1308 readable writable var _n_block: nullable AExpr = null
1309 init do end
1310 end
1311
1312 # An `assert` statement
1313 class AAssertExpr
1314 super AExpr
1315 readable writable var _n_kwassert: TKwassert
1316 readable writable var _n_id: nullable TId = null
1317 readable writable var _n_expr: AExpr
1318 readable writable var _n_else: nullable AExpr = null
1319 init do end
1320 end
1321
1322 # Whatever is a simple assignment. eg `= something`
1323 abstract class AAssignFormExpr
1324 super AExpr
1325 readable writable var _n_assign: TAssign
1326 readable writable var _n_value: AExpr
1327 init do end
1328 end
1329
1330 # Whatever is a combined assignment. eg `+= something`
1331 abstract class AReassignFormExpr
1332 super AExpr
1333 readable writable var _n_assign_op: AAssignOp
1334 readable writable var _n_value: AExpr
1335 init do end
1336 end
1337
1338 # A `once` expression. eg `once x`
1339 class AOnceExpr
1340 super AProxyExpr
1341 readable writable var _n_kwonce: TKwonce
1342 init do end
1343 end
1344
1345 # A polymorphic invocation of a method
1346 # The form of the invocation (name, arguments, etc) are specific
1347 abstract class ASendExpr
1348 super AExpr
1349 # The receiver of the method invocation
1350 readable writable var _n_expr: AExpr
1351 init do end
1352 end
1353
1354 # A binary operation on a method
1355 abstract class ABinopExpr
1356 super ASendExpr
1357 # The second operand of the operation
1358 # Note: the receiver (`n_expr`) is the first operand
1359 readable writable var _n_expr2: AExpr
1360 init do end
1361 end
1362
1363 # Something that is boolean expression
1364 abstract class ABoolExpr
1365 super AExpr
1366 end
1367
1368 # A `or` expression
1369 class AOrExpr
1370 super ABoolExpr
1371 readable writable var _n_expr: AExpr
1372 readable writable var _n_expr2: AExpr
1373 init do end
1374 end
1375
1376 # A `and` expression
1377 class AAndExpr
1378 super ABoolExpr
1379 readable writable var _n_expr: AExpr
1380 readable writable var _n_expr2: AExpr
1381 init do end
1382 end
1383
1384 # A `or else` expression
1385 class AOrElseExpr
1386 super ABoolExpr
1387 readable writable var _n_expr: AExpr
1388 readable writable var _n_expr2: AExpr
1389 init do end
1390 end
1391
1392 # A `implies` expression
1393 class AImpliesExpr
1394 super ABoolExpr
1395 readable writable var _n_expr: AExpr
1396 readable writable var _n_expr2: AExpr
1397 init do end
1398 end
1399
1400 # A `not` expression
1401 class ANotExpr
1402 super ABoolExpr
1403 readable writable var _n_kwnot: TKwnot
1404 readable writable var _n_expr: AExpr
1405 init do end
1406 end
1407
1408 # A `==` expression
1409 class AEqExpr
1410 super ABinopExpr
1411 end
1412
1413 # A `!=` expression
1414 class ANeExpr
1415 super ABinopExpr
1416 end
1417
1418 # A `<` expression
1419 class ALtExpr
1420 super ABinopExpr
1421 end
1422
1423 # A `<=` expression
1424 class ALeExpr
1425 super ABinopExpr
1426 end
1427
1428 # A `<<` expression
1429 class ALlExpr
1430 super ABinopExpr
1431 end
1432
1433 # A `>` expression
1434 class AGtExpr
1435 super ABinopExpr
1436 end
1437
1438 # A `>=` expression
1439 class AGeExpr
1440 super ABinopExpr
1441 end
1442
1443 # A `>>` expression
1444 class AGgExpr
1445 super ABinopExpr
1446 end
1447
1448 # A type-ckeck expression. eg `x isa T`
1449 class AIsaExpr
1450 super ABoolExpr
1451 readable writable var _n_expr: AExpr
1452 readable writable var _n_type: AType
1453 init do end
1454 end
1455
1456 # A `+` expression
1457 class APlusExpr
1458 super ABinopExpr
1459 end
1460
1461 # A `-` expression
1462 class AMinusExpr
1463 super ABinopExpr
1464 end
1465
1466 # A `<=>` expression
1467 class AStarshipExpr
1468 super ABinopExpr
1469 end
1470
1471 # A `*` expression
1472 class AStarExpr
1473 super ABinopExpr
1474 end
1475
1476 # A `/` expression
1477 class ASlashExpr
1478 super ABinopExpr
1479 end
1480
1481 # A `%` expression
1482 class APercentExpr
1483 super ABinopExpr
1484 end
1485
1486 # A unary minus expression. eg `-x`
1487 class AUminusExpr
1488 super ASendExpr
1489 readable writable var _n_minus: TMinus
1490 init do end
1491 end
1492
1493 # An explicit instantiation. eg `new T`
1494 class ANewExpr
1495 super AExpr
1496 readable writable var _n_kwnew: TKwnew
1497 readable writable var _n_type: AType
1498
1499 # The name of the named-constructor, if any
1500 readable writable var _n_id: nullable TId = null
1501 readable writable var _n_args: AExprs
1502 init do end
1503 end
1504
1505 # Whatever is a old-style attribute access
1506 abstract class AAttrFormExpr
1507 super AExpr
1508
1509 # The receiver of the attribute
1510 readable writable var _n_expr: AExpr
1511
1512 # The name of the attribute
1513 readable writable var _n_id: TAttrid
1514
1515 init do end
1516 end
1517
1518 # The read of an attribute. eg `x._a`
1519 class AAttrExpr
1520 super AAttrFormExpr
1521 end
1522
1523 # The assignment of an attribute. eg `x._a=y`
1524 class AAttrAssignExpr
1525 super AAttrFormExpr
1526 super AAssignFormExpr
1527 end
1528
1529 # Whatever looks-like a call with a standard method and any number of arguments.
1530 abstract class ACallFormExpr
1531 super ASendExpr
1532
1533 # The name of the method
1534 readable writable var _n_id: TId
1535
1536 # The arguments of the call
1537 readable writable var _n_args: AExprs
1538 init do end
1539 end
1540
1541 # A complex setter call (standard or brackets)
1542 abstract class ASendReassignFormExpr
1543 super ASendExpr
1544 super AReassignFormExpr
1545 end
1546
1547 # A complex attribute assignment. eg `x._a+=y`
1548 class AAttrReassignExpr
1549 super AAttrFormExpr
1550 super AReassignFormExpr
1551 end
1552
1553 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1554 # 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`.
1555 # Semantic analysis have to transform them to instance of `AVarExpr`.
1556 class ACallExpr
1557 super ACallFormExpr
1558 end
1559
1560 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1561 # 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`.
1562 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1563 class ACallAssignExpr
1564 super ACallFormExpr
1565 super AAssignFormExpr
1566 end
1567
1568 # 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.
1569 # 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`.
1570 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1571 class ACallReassignExpr
1572 super ACallFormExpr
1573 super ASendReassignFormExpr
1574 end
1575
1576 # A call to `super`. OR a call of a super-constructor
1577 class ASuperExpr
1578 super AExpr
1579 readable writable var _n_qualified: nullable AQualified = null
1580 readable writable var _n_kwsuper: TKwsuper
1581 readable writable var _n_args: AExprs
1582 init do end
1583 end
1584
1585 # A call to the `init` constructor.
1586 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr.
1587 class AInitExpr
1588 super ASendExpr
1589 readable writable var _n_kwinit: TKwinit
1590 readable writable var _n_args: AExprs
1591 init do end
1592 end
1593
1594 # Whatever looks-like a call of the brackets `[]` operator.
1595 abstract class ABraFormExpr
1596 super ASendExpr
1597 readable writable var _n_args: AExprs
1598 init do end
1599 end
1600
1601 # A call of the brackets operator. eg `x[y,z]`
1602 class ABraExpr
1603 super ABraFormExpr
1604 end
1605
1606 # A setter call of the bracket operator. eg `x[y,z]=t`
1607 class ABraAssignExpr
1608 super ABraFormExpr
1609 super AAssignFormExpr
1610 end
1611
1612 # Whatever is an access to a local variable
1613 abstract class AVarFormExpr
1614 super AExpr
1615 readable writable var _n_id: TId
1616 init do end
1617 end
1618
1619 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1620 class ABraReassignExpr
1621 super ABraFormExpr
1622 super ASendReassignFormExpr
1623 end
1624
1625 # A local variable read access.
1626 # The parser cannot instantiate them, see `ACallExpr`.
1627 class AVarExpr
1628 super AVarFormExpr
1629 end
1630
1631 # A local variable simple assigment access
1632 # The parser cannot instantiate them, see `ACallAssignExpr`.
1633 class AVarAssignExpr
1634 super AVarFormExpr
1635 super AAssignFormExpr
1636 end
1637
1638 # A local variable complex assignment access
1639 # The parser cannot instantiate them, see `ACallReassignExpr`.
1640 class AVarReassignExpr
1641 super AVarFormExpr
1642 super AReassignFormExpr
1643 end
1644
1645 # A literal range, open or closed
1646 abstract class ARangeExpr
1647 super AExpr
1648 readable writable var _n_expr: AExpr
1649 readable writable var _n_expr2: AExpr
1650 init do end
1651 end
1652
1653 # A closed literal range. eg `[x..y]`
1654 class ACrangeExpr
1655 super ARangeExpr
1656 readable writable var _n_obra: TObra
1657 readable writable var _n_cbra: TCbra
1658 init do end
1659 end
1660
1661 # An open literal range. eg `[x..y[`
1662 class AOrangeExpr
1663 super ARangeExpr
1664 readable writable var _n_obra: TObra
1665 readable writable var _n_cbra: TObra
1666 init do end
1667 end
1668
1669 # A literal array. eg. `[x,y,z]`
1670 class AArrayExpr
1671 super AExpr
1672 readable writable var _n_exprs: AExprs
1673 init do end
1674 end
1675
1676 # A read of `self`
1677 class ASelfExpr
1678 super AExpr
1679 readable writable var _n_kwself: nullable TKwself
1680 init do end
1681 end
1682
1683 # When there is no explicit receiver, `self` is implicit
1684 class AImplicitSelfExpr
1685 super ASelfExpr
1686 end
1687
1688 # A `true` boolean literal constant
1689 class ATrueExpr
1690 super ABoolExpr
1691 readable writable var _n_kwtrue: TKwtrue
1692 init do end
1693 end
1694 # A `false` boolean literal constant
1695 class AFalseExpr
1696 super ABoolExpr
1697 readable writable var _n_kwfalse: TKwfalse
1698 init do end
1699 end
1700 # A `null` literal constant
1701 class ANullExpr
1702 super AExpr
1703 readable writable var _n_kwnull: TKwnull
1704 init do end
1705 end
1706 # An integer literal
1707 class AIntExpr
1708 super AExpr
1709 end
1710 # An integer literal in decimal format
1711 class ADecIntExpr
1712 super AIntExpr
1713 readable writable var _n_number: TNumber
1714 init do end
1715 end
1716 # An integer literal in hexadecimal format
1717 class AHexIntExpr
1718 super AIntExpr
1719 readable writable var _n_hex_number: THexNumber
1720 init do end
1721 end
1722 # A float literal
1723 class AFloatExpr
1724 super AExpr
1725 readable writable var _n_float: TFloat
1726 init do end
1727 end
1728 # A character literal
1729 class ACharExpr
1730 super AExpr
1731 readable writable var _n_char: TChar
1732 init do end
1733 end
1734 # A string literal
1735 abstract class AStringFormExpr
1736 super AExpr
1737 readable writable var _n_string: Token
1738 init do end
1739 end
1740
1741 # A simple string. eg. `"abc"`
1742 class AStringExpr
1743 super AStringFormExpr
1744 end
1745
1746 # The start of a superstring. eg `"abc{`
1747 class AStartStringExpr
1748 super AStringFormExpr
1749 end
1750
1751 # The middle of a superstring. eg `}abc{`
1752 class AMidStringExpr
1753 super AStringFormExpr
1754 end
1755
1756 # The end of a superstrng. eg `}abc"`
1757 class AEndStringExpr
1758 super AStringFormExpr
1759 end
1760
1761 # A superstring literal. eg `"a{x}b{y}c"`
1762 # Each part is modelized a sequence of expression. eg. `["a{, x, }b{, y, }c"]`
1763 class ASuperstringExpr
1764 super AExpr
1765 readable var _n_exprs: ANodes[AExpr] = new ANodes[AExpr](self)
1766 init do end
1767 end
1768
1769 # A simple parenthesis. eg `(x)`
1770 class AParExpr
1771 super AProxyExpr
1772 readable writable var _n_opar: TOpar
1773 readable writable var _n_cpar: TCpar
1774 init do end
1775 end
1776
1777 # Whatevej just contains (and mimic) an other expression
1778 abstract class AProxyExpr
1779 super AExpr
1780 readable writable var _n_expr: AExpr
1781 init do end
1782 end
1783
1784 # A type cast. eg `x.as(T)`
1785 class AAsCastExpr
1786 super AExpr
1787 readable writable var _n_expr: AExpr
1788 readable writable var _n_kwas: TKwas
1789 readable writable var _n_opar: nullable TOpar = null
1790 readable writable var _n_type: AType
1791 readable writable var _n_cpar: nullable TCpar = null
1792 init do end
1793 end
1794
1795 # A as-not-null cast. eg `x.as(not null)`
1796 class AAsNotnullExpr
1797 super AExpr
1798 readable writable var _n_expr: AExpr
1799 readable writable var _n_kwas: TKwas
1800 readable writable var _n_opar: nullable TOpar = null
1801 readable writable var _n_kwnot: TKwnot
1802 readable writable var _n_kwnull: TKwnull
1803 readable writable var _n_cpar: nullable TCpar = null
1804 init do end
1805 end
1806
1807 # A is-set check of old-style attributes. eg `isset x._a`
1808 class AIssetAttrExpr
1809 super AAttrFormExpr
1810 readable writable var _n_kwisset: TKwisset
1811 init do end
1812 end
1813
1814 # A list of expression separated with commas (arguments for instance)
1815 abstract class AExprs
1816 super Prod
1817 readable var _n_exprs: ANodes[AExpr] = new ANodes[AExpr](self)
1818 init do end
1819 end
1820
1821 class ADebugTypeExpr
1822 super AExpr
1823 readable writable var _n_kwdebug: TKwdebug
1824 readable writable var _n_kwtype: TKwtype
1825 readable writable var _n_expr: AExpr
1826 readable writable var _n_type: AType
1827 init do end
1828 end
1829
1830 # A simple list of expressions
1831 class AListExprs
1832 super AExprs
1833 end
1834
1835 # A list of expressions enclosed in parentheses
1836 class AParExprs
1837 super AExprs
1838 readable writable var _n_opar: TOpar
1839 readable writable var _n_cpar: TCpar
1840 init do end
1841 end
1842
1843 # A list of expressions enclosed in brackets
1844 class ABraExprs
1845 super AExprs
1846 readable writable var _n_obra: TObra
1847 readable writable var _n_cbra: TCbra
1848 init do end
1849 end
1850
1851 # A complex assignment operator. eg `+=`
1852 abstract class AAssignOp
1853 super Prod
1854 end
1855 class APlusAssignOp
1856 super AAssignOp
1857 readable writable var _n_pluseq: TPluseq
1858 init do end
1859 end
1860 class AMinusAssignOp
1861 super AAssignOp
1862 readable writable var _n_minuseq: TMinuseq
1863 init do end
1864 end
1865
1866 class AModuleName
1867 super Prod
1868 readable writable var _n_quad: nullable TQuad = null
1869 readable var _n_path: ANodes[TId] = new ANodes[TId](self)
1870 readable writable var _n_id: TId
1871 init do end
1872 end
1873 class AInLanguage
1874 super Prod
1875 readable writable var _n_kwin: TKwin
1876 readable writable var _n_string: TString
1877 init do end
1878 end
1879 class AExternCodeBlock
1880 super Prod
1881 readable writable var _n_in_language: nullable AInLanguage = null
1882 readable writable var _n_extern_code_segment: TExternCodeSegment
1883 init do end
1884 end
1885 class AQualified
1886 super Prod
1887 readable writable var _n_quad: nullable TQuad = null
1888 readable var _n_id: ANodes[TId] = new ANodes[TId](self)
1889 readable writable var _n_classid: nullable TClassid = null
1890 init do end
1891 end
1892
1893 # A documentation of a definition
1894 # It contains the block of comments just above the declaration
1895 class ADoc
1896 super Prod
1897 readable var _n_comment: ANodes[TComment] = new ANodes[TComment](self)
1898 init do end
1899 end
1900
1901 class AAnnotations
1902 super Prod
1903 readable writable var _n_at: nullable TAt = null
1904 readable writable var _n_opar: nullable TOpar = null
1905 readable var _n_items: ANodes[AAnnotation] = new ANodes[AAnnotation](self)
1906 readable writable var _n_cpar: nullable TCpar = null
1907 init do end
1908 end
1909 class AAnnotation
1910 super Prod
1911 readable writable var _n_atid: AAtid
1912 readable writable var _n_opar: nullable TOpar = null
1913 readable var _n_args: ANodes[AAtArg] = new ANodes[AAtArg](self)
1914 readable writable var _n_cpar: nullable TCpar = null
1915 init do end
1916 end
1917 abstract class AAtArg
1918 super Prod
1919 end
1920 class ATypeAtArg
1921 super AAtArg
1922 readable writable var _n_type: AType
1923 init do end
1924 end
1925 class AExprAtArg
1926 super AAtArg
1927 readable writable var _n_expr: AExpr
1928 init do end
1929 end
1930 class AAtAtArg
1931 super AAtArg
1932 end
1933 abstract class AAtid
1934 super Prod
1935 readable writable var _n_id: Token
1936 init do end
1937 end
1938 class AIdAtid
1939 super AAtid
1940 end
1941 class AKwexternAtid
1942 super AAtid
1943 end
1944 class AKwinternAtid
1945 super AAtid
1946 end
1947 class AKwreadableAtid
1948 super AAtid
1949 end
1950 class AKwwritableAtid
1951 super AAtid
1952 end
1953 class AKwimportAtid
1954 super AAtid
1955 end
1956
1957 # The root of the AST
1958 class Start
1959 super Prod
1960 readable writable var _n_base: nullable AModule
1961 readable writable var _n_eof: EOF
1962 init(n_base: nullable AModule, n_eof: EOF)
1963 do
1964 self._n_base = n_base
1965 self._n_eof = n_eof
1966 end
1967 end