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
137 # Ancestor of all tokens
138 # A token is a node that has a `text` but no children.
142 # The raw content on the token
143 fun text
: String is abstract
144 fun text
=(text
: String) is abstract
146 # The previous token in the Lexer.
147 # May have disapeared in the AST
148 var prev_token
: nullable Token
150 # The next token in the Lexer.
151 # May have disapeared in the AST
152 var next_token
: nullable Token
154 redef fun to_s
: String do
158 redef fun visit_all
(v
: Visitor) do end
159 redef fun replace_child
(old_child
: ANode, new_child
: nullable ANode) do end
162 # Ancestor of all productions
163 # A production is a node without text but that usually has children.
167 fun location
=(l
: Location) do _location
= l
169 # All the annotations attached directly to the node
170 readable writable var _n_annotations
: nullable AAnnotations = null
172 redef fun replace_with
(n
: ANode)
176 if n
._location
== null then n
._location
= _location
180 # Abstract standard visitor on the AST
181 abstract class Visitor
182 # What the visitor do when a node is visited
183 # Concrete visitors should implement this method.
185 protected fun visit
(e
: ANode) is abstract
187 # Ask the visitor to visit a given node.
188 # Usually automatically called by visit_all* methods.
189 # This method should not be redefined
190 fun enter_visit
(e
: nullable ANode)
192 if e
== null then return
193 var old
= _current_node
199 # The current visited node
200 readable writable var _current_node
: nullable ANode = null
203 # Token of end of line (basically `\n`)
212 # Token of a line of comments
213 # Starts with the `#` and contains the final end-of-line (if any)
218 # A token associated with a keyword
219 abstract class TokenKeyword
223 return "keyword '{text}'"
404 # A token associated with an operator (and other lookalike symbols)
405 abstract class TokenOperator
409 return "operator '{text}'"
476 # A class (or formal type) identifier. They start with an uppercase.
481 do return "type identifier '{text}'"
485 # A standard identifier (variable, method...). They start with a lowercase.
490 do return "identifier '{text}'"
494 # An attribute identifier. They start with an underscore.
499 do return "attribute '{text}'"
503 # A token of a literal value (string, integer, etc).
504 abstract class TokenLiteral
508 do return "literal value '{text}'"
538 do return "malformed string {text}"
547 do return "malformed character {text}"
551 class TExternCodeSegment
575 # The main node of a Nit source-file
579 readable writable var _n_moduledecl
: nullable AModuledecl = null
580 readable var _n_imports
: ANodes[AImport] = new ANodes[AImport](self)
581 readable var _n_extern_code_blocks
: ANodes[AExternCodeBlock] = new ANodes[AExternCodeBlock](self)
582 readable var _n_classdefs
: ANodes[AClassdef] = new ANodes[AClassdef](self)
585 # The declaration of the module with the documentation, name, and annotations
588 readable writable var _n_doc
: nullable ADoc = null
589 readable writable var _n_kwmodule
: TKwmodule
590 readable writable var _n_name
: AModuleName
593 # A import clause of a module
594 abstract class AImport
598 # A standard import clause. eg `import x`
601 readable writable var _n_visibility
: AVisibility
602 readable writable var _n_kwimport
: TKwimport
603 readable writable var _n_name
: AModuleName
606 # The special import clause of the kernel module. eg `import end`
609 readable writable var _n_visibility
: AVisibility
610 readable writable var _n_kwimport
: TKwimport
611 readable writable var _n_kwend
: TKwend
614 # A visibility modifier
616 # The public visibility is an empty production (no keyword).
618 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
619 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
620 abstract class AVisibility
623 class APublicVisibility
626 class APrivateVisibility
628 readable writable var _n_kwprivate
: TKwprivate
630 class AProtectedVisibility
632 readable writable var _n_kwprotected
: TKwprotected
634 class AIntrudeVisibility
636 readable writable var _n_kwintrude
: TKwintrude
640 # While most definition are `AStdClassdef`
641 # There is tow special case of class definition
642 abstract class AClassdef super Prod
643 readable var _n_propdefs
: ANodes[APropdef] = new ANodes[APropdef](self)
646 # A standard class definition with a name, superclasses and properties
649 readable writable var _n_doc
: nullable ADoc = null
650 readable writable var _n_kwredef
: nullable TKwredef = null
651 readable writable var _n_visibility
: AVisibility
652 readable writable var _n_classkind
: AClasskind
653 readable writable var _n_id
: nullable TClassid = null
654 readable var _n_formaldefs
: ANodes[AFormaldef] = new ANodes[AFormaldef](self)
655 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
656 readable var _n_superclasses
: ANodes[ASuperclass] = new ANodes[ASuperclass](self)
657 readable writable var _n_kwend
: TKwend
658 redef fun hot_location
do return n_id
.location
661 # The implicit class definition of the implicit main method
666 # The implicit class definition of the top-level methods
671 # The modifier for the kind of class (abstract, interface, etc.)
672 abstract class AClasskind
675 class AConcreteClasskind
677 readable writable var _n_kwclass
: TKwclass
679 class AAbstractClasskind
681 readable writable var _n_kwabstract
: TKwabstract
682 readable writable var _n_kwclass
: TKwclass
684 class AInterfaceClasskind
686 readable writable var _n_kwinterface
: TKwinterface
690 readable writable var _n_kwenum
: TKwenum
692 class AExternClasskind
694 readable writable var _n_kwextern
: TKwextern
695 readable writable var _n_kwclass
: nullable TKwclass = null
698 # The definition of a formal generic parameter type. eg `X: Y`
701 readable writable var _n_id
: TClassid
702 # The bound of the parameter type
703 readable writable var _n_type
: nullable AType = null
706 # A super-class. eg `super X`
709 readable writable var _n_kwsuper
: TKwsuper
710 readable writable var _n_type
: AType
713 # The definition of a property
714 abstract class APropdef
716 readable writable var _n_doc
: nullable ADoc = null
719 # A definition of an attribute
720 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
723 readable writable var _n_kwredef
: nullable TKwredef = null
724 readable writable var _n_visibility
: AVisibility
725 readable writable var _n_kwvar
: TKwvar
727 # The identifier for an old-style attribute (null if new-style)
728 readable writable var _n_id
: nullable TAttrid
730 # The identifier for a new-style attribute (null if old-style)
731 readable writable var _n_id2
: nullable TId
733 readable writable var _n_type
: nullable AType = null
734 readable writable var _n_readable
: nullable AAble = null
735 readable writable var _n_writable
: nullable AAble = null
737 # The initial value, if any
738 readable writable var _n_expr
: nullable AExpr = null
739 redef fun hot_location
741 if n_id
!= null then return n_id
.location
else return n_id2
.location
745 # A definition of all kind of method (including constructors)
746 abstract class AMethPropdef
748 readable writable var _n_kwredef
: nullable TKwredef = null
749 readable writable var _n_visibility
: nullable AVisibility
750 readable writable var _n_methid
: nullable AMethid = null
751 readable writable var _n_signature
: nullable ASignature
752 redef fun hot_location
754 if n_methid
!= null then
755 return n_methid
.location
762 # A method marked abstract
763 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
764 class ADeferredMethPropdef
766 readable writable var _n_kwmeth
: TKwmeth
769 # A method marked intern
770 class AInternMethPropdef
772 readable writable var _n_kwmeth
: TKwmeth
775 # A method of a constructor marked extern
776 abstract class AExternPropdef
778 readable writable var _n_extern
: nullable TString = null
779 readable writable var _n_extern_calls
: nullable AExternCalls = null
780 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
783 # A method marked extern
784 class AExternMethPropdef
786 readable writable var _n_kwmeth
: TKwmeth
789 # A method with a body
790 class AConcreteMethPropdef
792 readable writable var _n_kwmeth
: nullable TKwmeth
793 readable writable var _n_block
: nullable AExpr = null
797 abstract class AInitPropdef
801 # A constructor with a body
802 class AConcreteInitPropdef
803 super AConcreteMethPropdef
805 readable writable var _n_kwinit
: TKwinit
806 redef fun hot_location
do return n_kwinit
.location
809 # A constructor marked extern (defined with the `new` keyword)
810 class AExternInitPropdef
813 readable writable var _n_kwnew
: TKwnew
816 # The implicit main method
817 class AMainMethPropdef
818 super AConcreteMethPropdef
821 # Declaration of callbacks for extern methods
824 readable writable var _n_kwimport
: TKwimport
825 readable var _n_extern_calls
: ANodes[AExternCall] = new ANodes[AExternCall](self)
827 abstract class AExternCall
830 abstract class APropExternCall
833 class ALocalPropExternCall
834 super APropExternCall
835 readable writable var _n_methid
: AMethid
837 class AFullPropExternCall
838 super APropExternCall
839 readable writable var _n_type
: AType
840 readable writable var _n_dot
: nullable TDot = null
841 readable writable var _n_methid
: AMethid
843 class AInitPropExternCall
844 super APropExternCall
845 readable writable var _n_type
: AType
847 class ASuperExternCall
849 readable writable var _n_kwsuper
: TKwsuper
851 abstract class ACastExternCall
854 class ACastAsExternCall
855 super ACastExternCall
856 readable writable var _n_from_type
: AType
857 readable writable var _n_dot
: nullable TDot = null
858 readable writable var _n_kwas
: TKwas
859 readable writable var _n_to_type
: AType
861 class AAsNullableExternCall
862 super ACastExternCall
863 readable writable var _n_type
: AType
864 readable writable var _n_kwas
: TKwas
865 readable writable var _n_kwnullable
: TKwnullable
867 class AAsNotNullableExternCall
868 super ACastExternCall
869 readable writable var _n_type
: AType
870 readable writable var _n_kwas
: TKwas
871 readable writable var _n_kwnot
: TKwnot
872 readable writable var _n_kwnullable
: TKwnullable
875 # A definition of a virtual type
878 readable writable var _n_kwredef
: nullable TKwredef = null
879 readable writable var _n_visibility
: AVisibility
880 readable writable var _n_kwtype
: TKwtype
881 readable writable var _n_id
: TClassid
882 readable writable var _n_type
: AType
885 # A `writable` or `readable` modifier
888 readable writable var _n_visibility
: nullable AVisibility = null
889 readable writable var _n_kwredef
: nullable TKwredef = null
892 # A `readable` modifier
895 readable writable var _n_kwreadable
: TKwreadable
898 # A `writable` modifier
901 readable writable var _n_kwwritable
: TKwwritable
904 # The identifier of a method in a method declaration.
905 # There is a specific class because of operator and setters.
906 abstract class AMethid
911 readable writable var _n_id
: TId
915 readable writable var _n_plus
: TPlus
919 readable writable var _n_minus
: TMinus
923 readable writable var _n_star
: TStar
927 readable writable var _n_slash
: TSlash
931 readable writable var _n_percent
: TPercent
935 readable writable var _n_eq
: TEq
939 readable writable var _n_ne
: TNe
943 readable writable var _n_le
: TLe
947 readable writable var _n_ge
: TGe
951 readable writable var _n_lt
: TLt
955 readable writable var _n_gt
: TGt
959 readable writable var _n_ll
: TLl
963 readable writable var _n_gg
: TGg
967 readable writable var _n_obra
: TObra
968 readable writable var _n_cbra
: TCbra
970 class AStarshipMethid
972 readable writable var _n_starship
: TStarship
976 readable writable var _n_id
: TId
977 readable writable var _n_assign
: TAssign
979 class ABraassignMethid
981 readable writable var _n_obra
: TObra
982 readable writable var _n_cbra
: TCbra
983 readable writable var _n_assign
: TAssign
986 # A signature in a method definition. eg `(x,y:X,z:Z):T`
989 readable writable var _n_opar
: nullable TOpar = null
990 readable var _n_params
: ANodes[AParam] = new ANodes[AParam](self)
991 readable writable var _n_cpar
: nullable TCpar = null
992 readable writable var _n_type
: nullable AType = null
995 # A parameter definition in a signature. eg `x:X`
998 readable writable var _n_id
: TId
999 readable writable var _n_type
: nullable AType = null
1000 readable writable var _n_dotdotdot
: nullable TDotdotdot = null
1003 # A static type. eg `nullable X[Y]`
1006 readable writable var _n_kwnullable
: nullable TKwnullable = null
1008 # The name of the class or of the formal type
1009 readable writable var _n_id
: TClassid
1011 # Type arguments for a generic type
1012 readable var _n_types
: ANodes[AType] = new ANodes[AType](self)
1015 # A label at the end of a block or in a break/continue statement. eg `label x`
1018 readable writable var _n_kwlabel
: TKwlabel
1019 readable writable var _n_id
: TId
1022 # Expression and statements
1023 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
1024 abstract class AExpr
1028 # A sequence of AExpr (usually statements)
1029 # The last AExpr gives the value of the whole block
1032 readable var _n_expr
: ANodes[AExpr] = new ANodes[AExpr](self)
1033 readable writable var _n_kwend
: nullable TKwend = null
1036 # A declaration of a local variable. eg `var x: X = y`
1039 readable writable var _n_kwvar
: TKwvar
1040 readable writable var _n_id
: TId
1041 readable writable var _n_type
: nullable AType = null
1042 readable writable var _n_assign
: nullable TAssign = null
1044 # The initial value, if any
1045 readable writable var _n_expr
: nullable AExpr = null
1048 # A `return` statement. eg `return x`
1051 readable writable var _n_kwreturn
: nullable TKwreturn = null
1052 readable writable var _n_expr
: nullable AExpr = null
1055 # Something that has a label.
1056 abstract class ALabelable
1058 readable writable var _n_label
: nullable ALabel = null
1061 # A `break` statement.
1065 readable writable var _n_kwbreak
: TKwbreak
1066 readable writable var _n_expr
: nullable AExpr = null
1069 # An `abort` statement
1072 readable writable var _n_kwabort
: TKwabort
1075 # A `continue` statement
1079 readable writable var _n_kwcontinue
: nullable TKwcontinue = null
1080 readable writable var _n_expr
: nullable AExpr = null
1087 readable writable var _n_kwdo
: TKwdo
1088 readable writable var _n_block
: nullable AExpr = null
1094 readable writable var _n_kwif
: TKwif
1095 readable writable var _n_expr
: AExpr
1096 readable writable var _n_then
: nullable AExpr = null
1097 readable writable var _n_else
: nullable AExpr = null
1103 readable writable var _n_kwif
: TKwif
1104 readable writable var _n_expr
: AExpr
1105 readable writable var _n_kwthen
: TKwthen
1106 readable writable var _n_then
: AExpr
1107 readable writable var _n_kwelse
: TKwelse
1108 readable writable var _n_else
: AExpr
1111 # A `while` statement
1115 readable writable var _n_kwwhile
: TKwwhile
1116 readable writable var _n_expr
: AExpr
1117 readable writable var _n_kwdo
: TKwdo
1118 readable writable var _n_block
: nullable AExpr = null
1121 # A `loop` statement
1125 readable writable var _n_kwloop
: TKwloop
1126 readable writable var _n_block
: nullable AExpr = null
1133 readable writable var _n_kwfor
: TKwfor
1134 readable var _n_ids
: ANodes[TId] = new ANodes[TId](self)
1135 readable writable var _n_expr
: AExpr
1136 readable writable var _n_kwdo
: TKwdo
1137 readable writable var _n_block
: nullable AExpr = null
1140 # An `assert` statement
1143 readable writable var _n_kwassert
: TKwassert
1144 readable writable var _n_id
: nullable TId = null
1145 readable writable var _n_expr
: AExpr
1146 readable writable var _n_else
: nullable AExpr = null
1149 # Whatever is a simple assignment. eg `= something`
1150 abstract class AAssignFormExpr
1152 readable writable var _n_assign
: TAssign
1153 readable writable var _n_value
: AExpr
1156 # Whatever is a combined assignment. eg `+= something`
1157 abstract class AReassignFormExpr
1159 readable writable var _n_assign_op
: AAssignOp
1160 readable writable var _n_value
: AExpr
1163 # A `once` expression. eg `once x`
1166 readable writable var _n_kwonce
: TKwonce
1169 # A polymorphic invocation of a method
1170 # The form of the invocation (name, arguments, etc) are specific
1171 abstract class ASendExpr
1173 # The receiver of the method invocation
1174 readable writable var _n_expr
: AExpr
1177 # A binary operation on a method
1178 abstract class ABinopExpr
1180 # The second operand of the operation
1181 # Note: the receiver (`n_expr`) is the first operand
1182 readable writable var _n_expr2
: AExpr
1185 # Something that is boolean expression
1186 abstract class ABoolExpr
1193 readable writable var _n_expr
: AExpr
1194 readable writable var _n_expr2
: AExpr
1197 # A `and` expression
1200 readable writable var _n_expr
: AExpr
1201 readable writable var _n_expr2
: AExpr
1204 # A `or else` expression
1207 readable writable var _n_expr
: AExpr
1208 readable writable var _n_expr2
: AExpr
1211 # A `implies` expression
1214 readable writable var _n_expr
: AExpr
1215 readable writable var _n_expr2
: AExpr
1218 # A `not` expression
1221 readable writable var _n_kwnot
: TKwnot
1222 readable writable var _n_expr
: AExpr
1265 # A type-ckeck expression. eg `x isa T`
1268 readable writable var _n_expr
: AExpr
1269 readable writable var _n_type
: AType
1282 # A `<=>` expression
1302 # A unary minus expression. eg `-x`
1305 readable writable var _n_minus
: TMinus
1308 # An explicit instantiation. eg `new T`
1311 readable writable var _n_kwnew
: TKwnew
1312 readable writable var _n_type
: AType
1314 # The name of the named-constructor, if any
1315 readable writable var _n_id
: nullable TId = null
1316 readable writable var _n_args
: AExprs
1319 # Whatever is a old-style attribute access
1320 abstract class AAttrFormExpr
1323 # The receiver of the attribute
1324 readable writable var _n_expr
: AExpr
1326 # The name of the attribute
1327 readable writable var _n_id
: TAttrid
1330 # The read of an attribute. eg `x._a`
1335 # The assignment of an attribute. eg `x._a=y`
1336 class AAttrAssignExpr
1338 super AAssignFormExpr
1341 # Whatever looks-like a call with a standard method and any number of arguments.
1342 abstract class ACallFormExpr
1345 # The name of the method
1346 readable writable var _n_id
: TId
1348 # The arguments of the call
1349 readable writable var _n_args
: AExprs
1352 # A complex setter call (standard or brackets)
1353 abstract class ASendReassignFormExpr
1355 super AReassignFormExpr
1358 # A complex attribute assignment. eg `x._a+=y`
1359 class AAttrReassignExpr
1361 super AReassignFormExpr
1364 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1365 # 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`.
1366 # Semantic analysis have to transform them to instance of `AVarExpr`.
1371 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1372 # 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`.
1373 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1374 class ACallAssignExpr
1376 super AAssignFormExpr
1379 # 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.
1380 # 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`.
1381 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1382 class ACallReassignExpr
1384 super ASendReassignFormExpr
1387 # A call to `super`. OR a call of a super-constructor
1390 readable writable var _n_qualified
: nullable AQualified = null
1391 readable writable var _n_kwsuper
: TKwsuper
1392 readable writable var _n_args
: AExprs
1395 # A call to the `init` constructor.
1396 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr.
1399 readable writable var _n_kwinit
: TKwinit
1400 readable writable var _n_args
: AExprs
1403 # Whatever looks-like a call of the brackets `[]` operator.
1404 abstract class ABraFormExpr
1406 readable writable var _n_args
: AExprs
1409 # A call of the brackets operator. eg `x[y,z]`
1414 # A setter call of the bracket operator. eg `x[y,z]=t`
1415 class ABraAssignExpr
1417 super AAssignFormExpr
1420 # Whatever is an access to a local variable
1421 abstract class AVarFormExpr
1423 readable writable var _n_id
: TId
1426 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1427 class ABraReassignExpr
1429 super ASendReassignFormExpr
1432 # A local variable read access.
1433 # The parser cannot instantiate them, see `ACallExpr`.
1438 # A local variable simple assigment access
1439 # The parser cannot instantiate them, see `ACallAssignExpr`.
1440 class AVarAssignExpr
1442 super AAssignFormExpr
1445 # A local variable complex assignment access
1446 # The parser cannot instantiate them, see `ACallReassignExpr`.
1447 class AVarReassignExpr
1449 super AReassignFormExpr
1452 # A literal range, open or closed
1453 abstract class ARangeExpr
1455 readable writable var _n_expr
: AExpr
1456 readable writable var _n_expr2
: AExpr
1459 # A closed literal range. eg `[x..y]`
1462 readable writable var _n_obra
: TObra
1463 readable writable var _n_cbra
: TCbra
1466 # An open literal range. eg `[x..y[`
1469 readable writable var _n_obra
: TObra
1470 readable writable var _n_cbra
: TObra
1473 # A literal array. eg. `[x,y,z]`
1476 readable writable var _n_exprs
: AExprs
1482 readable writable var _n_kwself
: nullable TKwself
1485 # When there is no explicit receiver, `self` is implicit
1486 class AImplicitSelfExpr
1490 # A `true` boolean literal constant
1493 readable writable var _n_kwtrue
: TKwtrue
1495 # A `false` boolean literal constant
1498 readable writable var _n_kwfalse
: TKwfalse
1500 # A `null` literal constant
1503 readable writable var _n_kwnull
: TKwnull
1505 # An integer literal
1508 readable writable var _n_number
: TNumber
1513 readable writable var _n_float
: TFloat
1515 # A character literal
1518 readable writable var _n_char
: TChar
1521 abstract class AStringFormExpr
1523 readable writable var _n_string
: Token
1526 # A simple string. eg. `"abc"`
1528 super AStringFormExpr
1531 # The start of a superstring. eg `"abc{`
1532 class AStartStringExpr
1533 super AStringFormExpr
1536 # The middle of a superstring. eg `}abc{`
1537 class AMidStringExpr
1538 super AStringFormExpr
1541 # The end of a superstrng. eg `}abc"`
1542 class AEndStringExpr
1543 super AStringFormExpr
1546 # A superstring literal. eg `"a{x}b{y}c"`
1547 # Each part is modelized a sequence of expression. eg. `["a{, x, }b{, y, }c"]`
1548 class ASuperstringExpr
1550 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1553 # A simple parenthesis. eg `(x)`
1556 readable writable var _n_opar
: TOpar
1557 readable writable var _n_cpar
: TCpar
1560 # Whatevej just contains (and mimic) an other expression
1561 abstract class AProxyExpr
1563 readable writable var _n_expr
: AExpr
1566 # A type cast. eg `x.as(T)`
1569 readable writable var _n_expr
: AExpr
1570 readable writable var _n_kwas
: TKwas
1571 readable writable var _n_opar
: TOpar
1572 readable writable var _n_type
: AType
1573 readable writable var _n_cpar
: TCpar
1576 # A as-not-null cast. eg `x.as(not null)`
1577 class AAsNotnullExpr
1579 readable writable var _n_expr
: AExpr
1580 readable writable var _n_kwas
: TKwas
1581 readable writable var _n_opar
: TOpar
1582 readable writable var _n_kwnot
: TKwnot
1583 readable writable var _n_kwnull
: TKwnull
1584 readable writable var _n_cpar
: TCpar
1587 # A is-set check of old-style attributes. eg `isset x._a`
1588 class AIssetAttrExpr
1590 readable writable var _n_kwisset
: TKwisset
1593 # A list of expression separated with commas (arguments for instance)
1594 abstract class AExprs
1596 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1599 class ADebugTypeExpr
1601 readable writable var _n_kwdebug
: TKwdebug
1602 readable writable var _n_kwtype
: TKwtype
1603 readable writable var _n_expr
: AExpr
1604 readable writable var _n_type
: AType
1607 # A simple list of expressions
1612 # A list of expressions enclosed in parentheses
1615 readable writable var _n_opar
: TOpar
1616 readable writable var _n_cpar
: TCpar
1619 # A list of expressions enclosed in brackets
1622 readable writable var _n_obra
: TObra
1623 readable writable var _n_cbra
: TCbra
1626 # A complex assignment operator. eg `+=`
1627 abstract class AAssignOp
1632 readable writable var _n_pluseq
: TPluseq
1634 class AMinusAssignOp
1636 readable writable var _n_minuseq
: TMinuseq
1641 readable writable var _n_quad
: nullable TQuad = null
1642 readable var _n_path
: ANodes[TId] = new ANodes[TId](self)
1643 readable writable var _n_id
: TId
1647 readable writable var _n_kwin
: TKwin
1648 readable writable var _n_string
: TString
1650 class AExternCodeBlock
1652 readable writable var _n_in_language
: nullable AInLanguage = null
1653 readable writable var _n_extern_code_segment
: TExternCodeSegment
1657 readable writable var _n_quad
: nullable TQuad = null
1658 readable var _n_id
: ANodes[TId] = new ANodes[TId](self)
1659 readable writable var _n_classid
: nullable TClassid = null
1662 # A documentation of a definition
1663 # It contains the block of comments just above the declaration
1666 readable var _n_comment
: ANodes[TComment] = new ANodes[TComment](self)
1671 readable writable var _n_at
: nullable TAt = null
1672 readable writable var _n_opar
: nullable TOpar = null
1673 readable var _n_items
: ANodes[AAnnotation] = new ANodes[AAnnotation](self)
1674 readable writable var _n_cpar
: nullable TCpar = null
1678 readable writable var _n_atid
: AAtid
1679 readable writable var _n_opar
: nullable TOpar = null
1680 readable var _n_args
: ANodes[AAtArg] = new ANodes[AAtArg](self)
1681 readable writable var _n_cpar
: nullable TCpar = null
1683 abstract class AAtArg
1688 readable writable var _n_type
: AType
1692 readable writable var _n_expr
: AExpr
1697 abstract class AAtid
1699 readable writable var _n_id
: Token
1710 class AKwreadableAtid
1713 class AKwwritableAtid
1720 # The root of the AST
1723 readable writable var _n_base
: nullable AModule
1724 readable writable var _n_eof
: EOF
1725 init(n_base
: nullable AModule, n_eof
: EOF)
1727 self._n_base
= n_base