1 # This file is part of NIT ( http://www.nitlanguage.org ).
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 # AST nodes of the Nit language
16 # Was previously based on parser_abs.nit.
21 # Root of the AST class-hierarchy
23 var _location
: nullable Location = null
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)
29 # The location of the important part of the node (identifier or whatever)
30 fun hot_location
: Location do return location
32 # Display a message for the colored location of the node
33 fun debug
(message
: String)
35 print
"{hot_location} {self.class_name}: {message}\n{hot_location.colored_line("0;32")}"
38 # Parent of the node in the AST
39 var parent
: nullable ANode = null
41 # Protect form invalid instantiation of nodes
44 # Replace a child with an other node in the AST
45 private fun replace_child
(old_child
: ANode, new_child
: nullable ANode) is abstract
47 # Detach a node from its parent
48 # Aborts if the node is not detashable. use `replace_with` instead
49 # REQUIRE: parent != null
50 # REQUIRE: is_detachable
51 # ENDURE: parent == null
55 parent
.replace_child
(self, null)
59 # Replace itself with an other node in the AST
60 # REQUIRE: parent != null
61 # ENSURE: node.parent == old(parent)
62 # ENSURE: parent == null
63 fun replace_with
(node
: ANode)
66 parent
.replace_child
(self, node
)
70 # Visit all nodes in order.
71 # Thus, call `v.enter_visit(e)` for each child `e`
72 fun visit_all
(v
: Visitor) is abstract
76 # There is a specifc class (instead of a using Array) to track the parent/child relation when nodes are added or removed
77 class ANodes[E
: ANode]
79 private var parent
: ANode
80 private var items
= new Array[E
]
81 redef fun iterator
do return items
.iterator
82 redef fun length
do return items
.length
83 redef fun is_empty
do return items
.is_empty
102 var res
= items
.shift
114 redef fun []=(index
, e
)
116 hook_remove
(self[index
])
120 redef fun remove_at
(index
)
122 hook_remove
(items
[index
])
123 items
.remove_at
(index
)
125 private fun hook_add
(e
: E
)
127 #assert e.parent == null
130 private fun hook_remove
(e
: E
)
132 assert e
.parent
== parent
136 # Used in parent contructor to fill elements
137 private fun unsafe_add_all
(nodes
: Collection[Object])
139 var parent
= self.parent
147 private fun replace_child
(old_child
: ANode, new_child
: nullable ANode): Bool
149 var parent
= self.parent
150 for i
in [0..length
[ do
151 if self[i
] == old_child
then
152 if new_child
!= null then
153 assert new_child
isa E
155 new_child
.parent
= parent
165 private fun visit_all
(v
: Visitor)
167 for n
in self do v
.enter_visit
(n
)
171 # Ancestor of all tokens
172 # A token is a node that has a `text` but no children.
176 # The raw content on the token
177 fun text
: String is abstract
178 fun text
=(text
: String) is abstract
180 # The previous token in the Lexer.
181 # May have disapeared in the AST
182 var prev_token
: nullable Token
184 # The next token in the Lexer.
185 # May have disapeared in the AST
186 var next_token
: nullable Token
188 redef fun to_s
: String do
192 redef fun visit_all
(v
: Visitor) do end
193 redef fun replace_child
(old_child
: ANode, new_child
: nullable ANode) do end
196 # Ancestor of all productions
197 # A production is a node without text but that usually has children.
201 fun location
=(l
: Location) do _location
= l
203 # All the annotations attached directly to the node
204 readable writable var _n_annotations
: nullable AAnnotations = null
206 redef fun replace_with
(n
: ANode)
210 if n
._location
== null then n
._location
= _location
214 # Abstract standard visitor on the AST
215 abstract class Visitor
216 # What the visitor do when a node is visited
217 # Concrete visitors should implement this method.
219 protected fun visit
(e
: ANode) is abstract
221 # Ask the visitor to visit a given node.
222 # Usually automatically called by visit_all* methods.
223 # This method should not be redefined
224 fun enter_visit
(e
: nullable ANode)
226 if e
== null then return
227 var old
= _current_node
233 # The current visited node
234 readable writable var _current_node
: nullable ANode = null
237 # Token of end of line (basically `\n`)
246 # Token of a line of comments
247 # Starts with the `#` and contains the final end-of-line (if any)
252 # A token associated with a keyword
253 abstract class TokenKeyword
257 return "keyword '{text}'"
441 # A token associated with an operator (and other lookalike symbols)
442 abstract class TokenOperator
446 return "operator '{text}'"
513 # A class (or formal type) identifier. They start with an uppercase.
518 do return "type identifier '{text}'"
522 # A standard identifier (variable, method...). They start with a lowercase.
527 do return "identifier '{text}'"
531 # An attribute identifier. They start with an underscore.
536 do return "attribute '{text}'"
540 # A token of a literal value (string, integer, etc).
541 abstract class TokenLiteral
545 do return "literal value '{text}'"
578 do return "malformed string {text}"
587 do return "malformed character {text}"
591 class TExternCodeSegment
615 # The main node of a Nit source-file
619 readable writable var _n_moduledecl
: nullable AModuledecl = null
620 readable var _n_imports
: ANodes[AImport] = new ANodes[AImport](self)
621 readable var _n_extern_code_blocks
: ANodes[AExternCodeBlock] = new ANodes[AExternCodeBlock](self)
622 readable var _n_classdefs
: ANodes[AClassdef] = new ANodes[AClassdef](self)
625 # The declaration of the module with the documentation, name, and annotations
628 readable writable var _n_doc
: nullable ADoc = null
629 readable writable var _n_kwmodule
: TKwmodule
630 readable writable var _n_name
: AModuleName
633 # A import clause of a module
634 abstract class AImport
638 # A standard import clause. eg `import x`
641 readable writable var _n_visibility
: AVisibility
642 readable writable var _n_kwimport
: TKwimport
643 readable writable var _n_name
: AModuleName
646 # The special import clause of the kernel module. eg `import end`
649 readable writable var _n_visibility
: AVisibility
650 readable writable var _n_kwimport
: TKwimport
651 readable writable var _n_kwend
: TKwend
654 # A visibility modifier
656 # The public visibility is an empty production (no keyword).
658 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
659 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
660 abstract class AVisibility
663 class APublicVisibility
666 class APrivateVisibility
668 readable writable var _n_kwprivate
: TKwprivate
670 class AProtectedVisibility
672 readable writable var _n_kwprotected
: TKwprotected
674 class AIntrudeVisibility
676 readable writable var _n_kwintrude
: TKwintrude
680 # While most definition are `AStdClassdef`
681 # There is tow special case of class definition
682 abstract class AClassdef super Prod
683 readable var _n_propdefs
: ANodes[APropdef] = new ANodes[APropdef](self)
686 # A standard class definition with a name, superclasses and properties
689 readable writable var _n_doc
: nullable ADoc = null
690 readable writable var _n_kwredef
: nullable TKwredef = null
691 readable writable var _n_visibility
: AVisibility
692 readable writable var _n_classkind
: AClasskind
693 readable writable var _n_id
: nullable TClassid = null
694 readable var _n_formaldefs
: ANodes[AFormaldef] = new ANodes[AFormaldef](self)
695 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
696 readable var _n_superclasses
: ANodes[ASuperclass] = new ANodes[ASuperclass](self)
697 readable writable var _n_kwend
: TKwend
698 redef fun hot_location
do return n_id
.location
701 # The implicit class definition of the implicit main method
706 # The implicit class definition of the top-level methods
711 # The modifier for the kind of class (abstract, interface, etc.)
712 abstract class AClasskind
715 class AConcreteClasskind
717 readable writable var _n_kwclass
: TKwclass
719 class AAbstractClasskind
721 readable writable var _n_kwabstract
: TKwabstract
722 readable writable var _n_kwclass
: TKwclass
724 class AInterfaceClasskind
726 readable writable var _n_kwinterface
: TKwinterface
730 readable writable var _n_kwenum
: TKwenum
732 class AExternClasskind
734 readable writable var _n_kwextern
: TKwextern
735 readable writable var _n_kwclass
: nullable TKwclass = null
738 # The definition of a formal generic parameter type. eg `X: Y`
741 readable writable var _n_id
: TClassid
742 # The bound of the parameter type
743 readable writable var _n_type
: nullable AType = null
746 # A super-class. eg `super X`
749 readable writable var _n_kwsuper
: TKwsuper
750 readable writable var _n_type
: AType
753 # The definition of a property
754 abstract class APropdef
756 readable writable var _n_doc
: nullable ADoc = null
757 readable writable var _n_kwredef
: nullable TKwredef = null
758 readable writable var _n_visibility
: nullable AVisibility = null
761 # A definition of an attribute
762 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
765 readable writable var _n_kwvar
: TKwvar
767 # The identifier for an old-style attribute (null if new-style)
768 readable writable var _n_id
: nullable TAttrid
770 # The identifier for a new-style attribute (null if old-style)
771 readable writable var _n_id2
: nullable TId
773 readable writable var _n_type
: nullable AType = null
774 readable writable var _n_readable
: nullable AAble = null
775 readable writable var _n_writable
: nullable AAble = null
777 # The initial value, if any
778 readable writable var _n_expr
: nullable AExpr = null
779 redef fun hot_location
781 if n_id
!= null then return n_id
.location
else return n_id2
.location
785 # A definition of all kind of method (including constructors)
786 abstract class AMethPropdef
788 readable writable var _n_kwmeth
: nullable TKwmeth
789 readable writable var _n_kwinit
: nullable TKwinit
790 readable writable var _n_kwnew
: nullable TKwnew
791 readable writable var _n_methid
: nullable AMethid = null
792 readable writable var _n_signature
: nullable ASignature
793 readable writable var _n_block
: nullable AExpr = null
794 readable writable var _n_extern
: nullable TString = null
795 readable writable var _n_extern_calls
: nullable AExternCalls = null
796 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
797 redef fun hot_location
799 if n_methid
!= null then
800 return n_methid
.location
801 else if n_kwinit
!= null then
802 return n_kwinit
.location
803 else if n_kwnew
!= null then
804 return n_kwnew
.location
811 # A method marked abstract
812 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
813 class ADeferredMethPropdef
817 # A method marked intern
818 class AInternMethPropdef
822 # A method of a constructor marked extern
823 abstract class AExternPropdef
827 # A method marked extern
828 class AExternMethPropdef
832 # A method with a body
833 class AConcreteMethPropdef
838 abstract class AInitPropdef
842 # A constructor with a body
843 class AConcreteInitPropdef
844 super AConcreteMethPropdef
848 # A constructor marked extern (defined with the `new` keyword)
849 class AExternInitPropdef
854 # The implicit main method
855 class AMainMethPropdef
856 super AConcreteMethPropdef
859 # Declaration of callbacks for extern methods
862 readable writable var _n_kwimport
: TKwimport
863 readable var _n_extern_calls
: ANodes[AExternCall] = new ANodes[AExternCall](self)
865 abstract class AExternCall
868 abstract class APropExternCall
871 class ALocalPropExternCall
872 super APropExternCall
873 readable writable var _n_methid
: AMethid
875 class AFullPropExternCall
876 super APropExternCall
877 readable writable var _n_type
: AType
878 readable writable var _n_dot
: nullable TDot = null
879 readable writable var _n_methid
: AMethid
881 class AInitPropExternCall
882 super APropExternCall
883 readable writable var _n_type
: AType
885 class ASuperExternCall
887 readable writable var _n_kwsuper
: TKwsuper
889 abstract class ACastExternCall
892 class ACastAsExternCall
893 super ACastExternCall
894 readable writable var _n_from_type
: AType
895 readable writable var _n_dot
: nullable TDot = null
896 readable writable var _n_kwas
: TKwas
897 readable writable var _n_to_type
: AType
899 class AAsNullableExternCall
900 super ACastExternCall
901 readable writable var _n_type
: AType
902 readable writable var _n_kwas
: TKwas
903 readable writable var _n_kwnullable
: TKwnullable
905 class AAsNotNullableExternCall
906 super ACastExternCall
907 readable writable var _n_type
: AType
908 readable writable var _n_kwas
: TKwas
909 readable writable var _n_kwnot
: TKwnot
910 readable writable var _n_kwnullable
: TKwnullable
913 # A definition of a virtual type
916 readable writable var _n_kwtype
: TKwtype
917 readable writable var _n_id
: TClassid
918 readable writable var _n_type
: AType
921 # A `writable` or `readable` modifier
924 readable writable var _n_visibility
: nullable AVisibility = null
925 readable writable var _n_kwredef
: nullable TKwredef = null
928 # A `readable` modifier
931 readable writable var _n_kwreadable
: TKwreadable
934 # A `writable` modifier
937 readable writable var _n_kwwritable
: TKwwritable
940 # The identifier of a method in a method declaration.
941 # There is a specific class because of operator and setters.
942 abstract class AMethid
947 readable writable var _n_id
: TId
951 readable writable var _n_plus
: TPlus
955 readable writable var _n_minus
: TMinus
959 readable writable var _n_star
: TStar
963 readable writable var _n_slash
: TSlash
967 readable writable var _n_percent
: TPercent
971 readable writable var _n_eq
: TEq
975 readable writable var _n_ne
: TNe
979 readable writable var _n_le
: TLe
983 readable writable var _n_ge
: TGe
987 readable writable var _n_lt
: TLt
991 readable writable var _n_gt
: TGt
995 readable writable var _n_ll
: TLl
999 readable writable var _n_gg
: TGg
1003 readable writable var _n_obra
: TObra
1004 readable writable var _n_cbra
: TCbra
1006 class AStarshipMethid
1008 readable writable var _n_starship
: TStarship
1012 readable writable var _n_id
: TId
1013 readable writable var _n_assign
: TAssign
1015 class ABraassignMethid
1017 readable writable var _n_obra
: TObra
1018 readable writable var _n_cbra
: TCbra
1019 readable writable var _n_assign
: TAssign
1022 # A signature in a method definition. eg `(x,y:X,z:Z):T`
1025 readable writable var _n_opar
: nullable TOpar = null
1026 readable var _n_params
: ANodes[AParam] = new ANodes[AParam](self)
1027 readable writable var _n_cpar
: nullable TCpar = null
1028 readable writable var _n_type
: nullable AType = null
1031 # A parameter definition in a signature. eg `x:X`
1034 readable writable var _n_id
: TId
1035 readable writable var _n_type
: nullable AType = null
1036 readable writable var _n_dotdotdot
: nullable TDotdotdot = null
1039 # A static type. eg `nullable X[Y]`
1042 readable writable var _n_kwnullable
: nullable TKwnullable = null
1044 # The name of the class or of the formal type
1045 readable writable var _n_id
: TClassid
1047 # Type arguments for a generic type
1048 readable var _n_types
: ANodes[AType] = new ANodes[AType](self)
1051 # A label at the end of a block or in a break/continue statement. eg `label x`
1054 readable writable var _n_kwlabel
: TKwlabel
1055 readable writable var _n_id
: TId
1058 # Expression and statements
1059 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
1060 abstract class AExpr
1064 # A sequence of AExpr (usually statements)
1065 # The last AExpr gives the value of the whole block
1068 readable var _n_expr
: ANodes[AExpr] = new ANodes[AExpr](self)
1069 readable writable var _n_kwend
: nullable TKwend = null
1072 # A declaration of a local variable. eg `var x: X = y`
1075 readable writable var _n_kwvar
: TKwvar
1076 readable writable var _n_id
: TId
1077 readable writable var _n_type
: nullable AType = null
1078 readable writable var _n_assign
: nullable TAssign = null
1080 # The initial value, if any
1081 readable writable var _n_expr
: nullable AExpr = null
1084 # A `return` statement. eg `return x`
1087 readable writable var _n_kwreturn
: nullable TKwreturn = null
1088 readable writable var _n_expr
: nullable AExpr = null
1091 # Something that has a label.
1092 abstract class ALabelable
1094 readable writable var _n_label
: nullable ALabel = null
1097 # A `break` statement.
1101 readable writable var _n_kwbreak
: TKwbreak
1102 readable writable var _n_expr
: nullable AExpr = null
1105 # An `abort` statement
1108 readable writable var _n_kwabort
: TKwabort
1111 # A `continue` statement
1115 readable writable var _n_kwcontinue
: nullable TKwcontinue = null
1116 readable writable var _n_expr
: nullable AExpr = null
1123 readable writable var _n_kwdo
: TKwdo
1124 readable writable var _n_block
: nullable AExpr = null
1130 readable writable var _n_kwif
: TKwif
1131 readable writable var _n_expr
: AExpr
1132 readable writable var _n_then
: nullable AExpr = null
1133 readable writable var _n_else
: nullable AExpr = null
1139 readable writable var _n_kwif
: TKwif
1140 readable writable var _n_expr
: AExpr
1141 readable writable var _n_kwthen
: TKwthen
1142 readable writable var _n_then
: AExpr
1143 readable writable var _n_kwelse
: TKwelse
1144 readable writable var _n_else
: AExpr
1147 # A `while` statement
1151 readable writable var _n_kwwhile
: TKwwhile
1152 readable writable var _n_expr
: AExpr
1153 readable writable var _n_kwdo
: TKwdo
1154 readable writable var _n_block
: nullable AExpr = null
1157 # A `loop` statement
1161 readable writable var _n_kwloop
: TKwloop
1162 readable writable var _n_block
: nullable AExpr = null
1169 readable writable var _n_kwfor
: TKwfor
1170 readable var _n_ids
: ANodes[TId] = new ANodes[TId](self)
1171 readable writable var _n_expr
: AExpr
1172 readable writable var _n_kwdo
: TKwdo
1173 readable writable var _n_block
: nullable AExpr = null
1176 # An `assert` statement
1179 readable writable var _n_kwassert
: TKwassert
1180 readable writable var _n_id
: nullable TId = null
1181 readable writable var _n_expr
: AExpr
1182 readable writable var _n_else
: nullable AExpr = null
1185 # Whatever is a simple assignment. eg `= something`
1186 abstract class AAssignFormExpr
1188 readable writable var _n_assign
: TAssign
1189 readable writable var _n_value
: AExpr
1192 # Whatever is a combined assignment. eg `+= something`
1193 abstract class AReassignFormExpr
1195 readable writable var _n_assign_op
: AAssignOp
1196 readable writable var _n_value
: AExpr
1199 # A `once` expression. eg `once x`
1202 readable writable var _n_kwonce
: TKwonce
1205 # A polymorphic invocation of a method
1206 # The form of the invocation (name, arguments, etc) are specific
1207 abstract class ASendExpr
1209 # The receiver of the method invocation
1210 readable writable var _n_expr
: AExpr
1213 # A binary operation on a method
1214 abstract class ABinopExpr
1216 # The second operand of the operation
1217 # Note: the receiver (`n_expr`) is the first operand
1218 readable writable var _n_expr2
: AExpr
1221 # Something that is boolean expression
1222 abstract class ABoolExpr
1229 readable writable var _n_expr
: AExpr
1230 readable writable var _n_expr2
: AExpr
1233 # A `and` expression
1236 readable writable var _n_expr
: AExpr
1237 readable writable var _n_expr2
: AExpr
1240 # A `or else` expression
1243 readable writable var _n_expr
: AExpr
1244 readable writable var _n_expr2
: AExpr
1247 # A `implies` expression
1250 readable writable var _n_expr
: AExpr
1251 readable writable var _n_expr2
: AExpr
1254 # A `not` expression
1257 readable writable var _n_kwnot
: TKwnot
1258 readable writable var _n_expr
: AExpr
1301 # A type-ckeck expression. eg `x isa T`
1304 readable writable var _n_expr
: AExpr
1305 readable writable var _n_type
: AType
1318 # A `<=>` expression
1338 # A unary minus expression. eg `-x`
1341 readable writable var _n_minus
: TMinus
1344 # An explicit instantiation. eg `new T`
1347 readable writable var _n_kwnew
: TKwnew
1348 readable writable var _n_type
: AType
1350 # The name of the named-constructor, if any
1351 readable writable var _n_id
: nullable TId = null
1352 readable writable var _n_args
: AExprs
1355 # Whatever is a old-style attribute access
1356 abstract class AAttrFormExpr
1359 # The receiver of the attribute
1360 readable writable var _n_expr
: AExpr
1362 # The name of the attribute
1363 readable writable var _n_id
: TAttrid
1366 # The read of an attribute. eg `x._a`
1371 # The assignment of an attribute. eg `x._a=y`
1372 class AAttrAssignExpr
1374 super AAssignFormExpr
1377 # Whatever looks-like a call with a standard method and any number of arguments.
1378 abstract class ACallFormExpr
1381 # The name of the method
1382 readable writable var _n_id
: TId
1384 # The arguments of the call
1385 readable writable var _n_args
: AExprs
1388 # A complex setter call (standard or brackets)
1389 abstract class ASendReassignFormExpr
1391 super AReassignFormExpr
1394 # A complex attribute assignment. eg `x._a+=y`
1395 class AAttrReassignExpr
1397 super AReassignFormExpr
1400 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1401 # 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`.
1402 # Semantic analysis have to transform them to instance of `AVarExpr`.
1407 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1408 # 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`.
1409 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1410 class ACallAssignExpr
1412 super AAssignFormExpr
1415 # 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.
1416 # 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`.
1417 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1418 class ACallReassignExpr
1420 super ASendReassignFormExpr
1423 # A call to `super`. OR a call of a super-constructor
1426 readable writable var _n_qualified
: nullable AQualified = null
1427 readable writable var _n_kwsuper
: TKwsuper
1428 readable writable var _n_args
: AExprs
1431 # A call to the `init` constructor.
1432 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr.
1435 readable writable var _n_kwinit
: TKwinit
1436 readable writable var _n_args
: AExprs
1439 # Whatever looks-like a call of the brackets `[]` operator.
1440 abstract class ABraFormExpr
1442 readable writable var _n_args
: AExprs
1445 # A call of the brackets operator. eg `x[y,z]`
1450 # A setter call of the bracket operator. eg `x[y,z]=t`
1451 class ABraAssignExpr
1453 super AAssignFormExpr
1456 # Whatever is an access to a local variable
1457 abstract class AVarFormExpr
1459 readable writable var _n_id
: TId
1462 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1463 class ABraReassignExpr
1465 super ASendReassignFormExpr
1468 # A local variable read access.
1469 # The parser cannot instantiate them, see `ACallExpr`.
1474 # A local variable simple assigment access
1475 # The parser cannot instantiate them, see `ACallAssignExpr`.
1476 class AVarAssignExpr
1478 super AAssignFormExpr
1481 # A local variable complex assignment access
1482 # The parser cannot instantiate them, see `ACallReassignExpr`.
1483 class AVarReassignExpr
1485 super AReassignFormExpr
1488 # A literal range, open or closed
1489 abstract class ARangeExpr
1491 readable writable var _n_expr
: AExpr
1492 readable writable var _n_expr2
: AExpr
1495 # A closed literal range. eg `[x..y]`
1498 readable writable var _n_obra
: TObra
1499 readable writable var _n_cbra
: TCbra
1502 # An open literal range. eg `[x..y[`
1505 readable writable var _n_obra
: TObra
1506 readable writable var _n_cbra
: TObra
1509 # A literal array. eg. `[x,y,z]`
1512 readable writable var _n_exprs
: AExprs
1518 readable writable var _n_kwself
: nullable TKwself
1521 # When there is no explicit receiver, `self` is implicit
1522 class AImplicitSelfExpr
1526 # A `true` boolean literal constant
1529 readable writable var _n_kwtrue
: TKwtrue
1531 # A `false` boolean literal constant
1534 readable writable var _n_kwfalse
: TKwfalse
1536 # A `null` literal constant
1539 readable writable var _n_kwnull
: TKwnull
1541 # An integer literal
1545 # An integer literal in decimal format
1548 readable writable var _n_number
: TNumber
1550 # An integer literal in hexadecimal format
1553 readable writable var _n_hex_number
: THexNumber
1558 readable writable var _n_float
: TFloat
1560 # A character literal
1563 readable writable var _n_char
: TChar
1566 abstract class AStringFormExpr
1568 readable writable var _n_string
: Token
1571 # A simple string. eg. `"abc"`
1573 super AStringFormExpr
1576 # The start of a superstring. eg `"abc{`
1577 class AStartStringExpr
1578 super AStringFormExpr
1581 # The middle of a superstring. eg `}abc{`
1582 class AMidStringExpr
1583 super AStringFormExpr
1586 # The end of a superstrng. eg `}abc"`
1587 class AEndStringExpr
1588 super AStringFormExpr
1591 # A superstring literal. eg `"a{x}b{y}c"`
1592 # Each part is modelized a sequence of expression. eg. `["a{, x, }b{, y, }c"]`
1593 class ASuperstringExpr
1595 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1598 # A simple parenthesis. eg `(x)`
1601 readable writable var _n_opar
: TOpar
1602 readable writable var _n_cpar
: TCpar
1605 # Whatevej just contains (and mimic) an other expression
1606 abstract class AProxyExpr
1608 readable writable var _n_expr
: AExpr
1611 # A type cast. eg `x.as(T)`
1614 readable writable var _n_expr
: AExpr
1615 readable writable var _n_kwas
: TKwas
1616 readable writable var _n_opar
: nullable TOpar = null
1617 readable writable var _n_type
: AType
1618 readable writable var _n_cpar
: nullable TCpar = null
1621 # A as-not-null cast. eg `x.as(not null)`
1622 class AAsNotnullExpr
1624 readable writable var _n_expr
: AExpr
1625 readable writable var _n_kwas
: TKwas
1626 readable writable var _n_opar
: nullable TOpar = null
1627 readable writable var _n_kwnot
: TKwnot
1628 readable writable var _n_kwnull
: TKwnull
1629 readable writable var _n_cpar
: nullable TCpar = null
1632 # A is-set check of old-style attributes. eg `isset x._a`
1633 class AIssetAttrExpr
1635 readable writable var _n_kwisset
: TKwisset
1638 # A list of expression separated with commas (arguments for instance)
1639 abstract class AExprs
1641 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1644 class ADebugTypeExpr
1646 readable writable var _n_kwdebug
: TKwdebug
1647 readable writable var _n_kwtype
: TKwtype
1648 readable writable var _n_expr
: AExpr
1649 readable writable var _n_type
: AType
1652 # A simple list of expressions
1657 # A list of expressions enclosed in parentheses
1660 readable writable var _n_opar
: TOpar
1661 readable writable var _n_cpar
: TCpar
1664 # A list of expressions enclosed in brackets
1667 readable writable var _n_obra
: TObra
1668 readable writable var _n_cbra
: TCbra
1671 # A complex assignment operator. eg `+=`
1672 abstract class AAssignOp
1677 readable writable var _n_pluseq
: TPluseq
1679 class AMinusAssignOp
1681 readable writable var _n_minuseq
: TMinuseq
1686 readable writable var _n_quad
: nullable TQuad = null
1687 readable var _n_path
: ANodes[TId] = new ANodes[TId](self)
1688 readable writable var _n_id
: TId
1692 readable writable var _n_kwin
: TKwin
1693 readable writable var _n_string
: TString
1695 class AExternCodeBlock
1697 readable writable var _n_in_language
: nullable AInLanguage = null
1698 readable writable var _n_extern_code_segment
: TExternCodeSegment
1702 readable writable var _n_quad
: nullable TQuad = null
1703 readable var _n_id
: ANodes[TId] = new ANodes[TId](self)
1704 readable writable var _n_classid
: nullable TClassid = null
1707 # A documentation of a definition
1708 # It contains the block of comments just above the declaration
1711 readable var _n_comment
: ANodes[TComment] = new ANodes[TComment](self)
1716 readable writable var _n_at
: nullable TAt = null
1717 readable writable var _n_opar
: nullable TOpar = null
1718 readable var _n_items
: ANodes[AAnnotation] = new ANodes[AAnnotation](self)
1719 readable writable var _n_cpar
: nullable TCpar = null
1723 readable writable var _n_atid
: AAtid
1724 readable writable var _n_opar
: nullable TOpar = null
1725 readable var _n_args
: ANodes[AAtArg] = new ANodes[AAtArg](self)
1726 readable writable var _n_cpar
: nullable TCpar = null
1728 abstract class AAtArg
1733 readable writable var _n_type
: AType
1737 readable writable var _n_expr
: AExpr
1742 abstract class AAtid
1744 readable writable var _n_id
: Token
1755 class AKwreadableAtid
1758 class AKwwritableAtid
1765 # The root of the AST
1768 readable writable var _n_base
: nullable AModule
1769 readable writable var _n_eof
: EOF
1770 init(n_base
: nullable AModule, n_eof
: EOF)
1772 self._n_base
= n_base