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 redef fun to_s
: String do
150 redef fun visit_all
(v
: Visitor) do end
151 redef fun replace_child
(old_child
: ANode, new_child
: nullable ANode) do end
154 # Ancestor of all productions
155 # A production is a node without text but that usually has children.
159 fun location
=(l
: Location) do _location
= l
161 # All the annotations attached directly to the node
162 readable writable var _n_annotations
: nullable AAnnotations = null
164 redef fun replace_with
(n
: ANode)
168 if n
._location
== null then n
._location
= _location
172 # Abstract standard visitor on the AST
173 abstract class Visitor
174 # What the visitor do when a node is visited
175 # Concrete visitors should implement this method.
177 protected fun visit
(e
: ANode) is abstract
179 # Ask the visitor to visit a given node.
180 # Usually automatically called by visit_all* methods.
181 # This method should not be redefined
182 fun enter_visit
(e
: nullable ANode)
184 if e
== null then return
185 var old
= _current_node
191 # The current visited node
192 readable writable var _current_node
: nullable ANode = null
195 # Token of end of line (basically `\n`)
204 # Token of a line of comments
205 # Starts with the `#` and contains the final end-of-line (if any)
210 # A token associated with a keyword
211 abstract class TokenKeyword
215 return "keyword '{text}'"
390 # A token associated with an operator (and other lookalike symbols)
391 abstract class TokenOperator
395 return "operator '{text}'"
462 # A class (or formal type) identifier. They start with an uppercase.
467 do return "type identifier '{text}'"
471 # A standard identifier (variable, method...). They start with a lowercase.
476 do return "identifier '{text}'"
480 # An attribute identifier. They start with an underscore.
485 do return "attribute '{text}'"
489 # A token of a literal value (string, integer, etc).
490 abstract class TokenLiteral
494 do return "literal value '{text}'"
524 do return "malformed string {text}"
533 do return "malformed character {text}"
537 class TExternCodeSegment
561 # The main node of a Nit source-file
565 readable writable var _n_moduledecl
: nullable AModuledecl = null
566 readable var _n_imports
: ANodes[AImport] = new ANodes[AImport](self)
567 readable var _n_extern_code_blocks
: ANodes[AExternCodeBlock] = new ANodes[AExternCodeBlock](self)
568 readable var _n_classdefs
: ANodes[AClassdef] = new ANodes[AClassdef](self)
571 # The declaration of the module with the documentation, name, and annotations
574 readable writable var _n_doc
: nullable ADoc = null
575 readable writable var _n_kwmodule
: TKwmodule
576 readable writable var _n_name
: AModuleName
579 # A import clause of a module
580 abstract class AImport
584 # A standard import clause. eg `import x`
587 readable writable var _n_visibility
: AVisibility
588 readable writable var _n_kwimport
: TKwimport
589 readable writable var _n_name
: AModuleName
592 # The special import clause of the kernel module. eg `import end`
595 readable writable var _n_visibility
: AVisibility
596 readable writable var _n_kwimport
: TKwimport
597 readable writable var _n_kwend
: TKwend
600 # A visibility modifier
602 # The public visibility is an empty production (no keyword).
604 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
605 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
606 abstract class AVisibility
609 class APublicVisibility
612 class APrivateVisibility
614 readable writable var _n_kwprivate
: TKwprivate
616 class AProtectedVisibility
618 readable writable var _n_kwprotected
: TKwprotected
620 class AIntrudeVisibility
622 readable writable var _n_kwintrude
: TKwintrude
626 # While most definition are `AStdClassdef`
627 # There is tow special case of class definition
628 abstract class AClassdef super Prod
629 readable var _n_propdefs
: ANodes[APropdef] = new ANodes[APropdef](self)
632 # A standard class definition with a name, superclasses and properties
635 readable writable var _n_doc
: nullable ADoc = null
636 readable writable var _n_kwredef
: nullable TKwredef = null
637 readable writable var _n_visibility
: AVisibility
638 readable writable var _n_classkind
: AClasskind
639 readable writable var _n_id
: nullable TClassid = null
640 readable var _n_formaldefs
: ANodes[AFormaldef] = new ANodes[AFormaldef](self)
641 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
642 readable var _n_superclasses
: ANodes[ASuperclass] = new ANodes[ASuperclass](self)
643 readable writable var _n_kwend
: TKwend
644 redef fun hot_location
do return n_id
.location
647 # The implicit class definition of the implicit main method
652 # The implicit class definition of the top-level methods
657 # The modifier for the kind of class (abstract, interface, etc.)
658 abstract class AClasskind
661 class AConcreteClasskind
663 readable writable var _n_kwclass
: TKwclass
665 class AAbstractClasskind
667 readable writable var _n_kwabstract
: TKwabstract
668 readable writable var _n_kwclass
: TKwclass
670 class AInterfaceClasskind
672 readable writable var _n_kwinterface
: TKwinterface
676 readable writable var _n_kwenum
: TKwenum
678 class AExternClasskind
680 readable writable var _n_kwextern
: TKwextern
681 readable writable var _n_kwclass
: nullable TKwclass = null
684 # The definition of a formal generic parameter type. eg `X: Y`
687 readable writable var _n_id
: TClassid
688 # The bound of the parameter type
689 readable writable var _n_type
: nullable AType = null
692 # A super-class. eg `super X`
695 readable writable var _n_kwsuper
: TKwsuper
696 readable writable var _n_type
: AType
699 # The definition of a property
700 abstract class APropdef
702 readable writable var _n_doc
: nullable ADoc = null
705 # A definition of an attribute
706 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
709 readable writable var _n_kwredef
: nullable TKwredef = null
710 readable writable var _n_visibility
: AVisibility
711 readable writable var _n_kwvar
: TKwvar
713 # The identifier for an old-style attribute (null if new-style)
714 readable writable var _n_id
: nullable TAttrid
716 # The identifier for a new-style attribute (null if old-style)
717 readable writable var _n_id2
: nullable TId
719 readable writable var _n_type
: nullable AType = null
720 readable writable var _n_readable
: nullable AAble = null
721 readable writable var _n_writable
: nullable AAble = null
723 # The initial value, if any
724 readable writable var _n_expr
: nullable AExpr = null
725 redef fun hot_location
727 if n_id
!= null then return n_id
.location
else return n_id2
.location
731 # A definition of all kind of method (including constructors)
732 abstract class AMethPropdef
734 readable writable var _n_kwredef
: nullable TKwredef = null
735 readable writable var _n_visibility
: nullable AVisibility
736 readable writable var _n_methid
: nullable AMethid = null
737 readable writable var _n_signature
: nullable ASignature
738 redef fun hot_location
740 if n_methid
!= null then
741 return n_methid
.location
748 # A method marked abstract
749 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
750 class ADeferredMethPropdef
752 readable writable var _n_kwmeth
: TKwmeth
755 # A method marked intern
756 class AInternMethPropdef
758 readable writable var _n_kwmeth
: TKwmeth
761 # A method of a constructor marked extern
762 abstract class AExternPropdef
764 readable writable var _n_extern
: nullable TString = null
765 readable writable var _n_extern_calls
: nullable AExternCalls = null
766 readable writable var _n_extern_code_block
: nullable AExternCodeBlock = null
769 # A method marked extern
770 class AExternMethPropdef
772 readable writable var _n_kwmeth
: TKwmeth
775 # A method with a body
776 class AConcreteMethPropdef
778 readable writable var _n_kwmeth
: nullable TKwmeth
779 readable writable var _n_block
: nullable AExpr = null
783 abstract class AInitPropdef
787 # A constructor with a body
788 class AConcreteInitPropdef
789 super AConcreteMethPropdef
791 readable writable var _n_kwinit
: TKwinit
792 redef fun hot_location
do return n_kwinit
.location
795 # A constructor marked extern (defined with the `new` keyword)
796 class AExternInitPropdef
799 readable writable var _n_kwnew
: TKwnew
802 # The implicit main method
803 class AMainMethPropdef
804 super AConcreteMethPropdef
807 # Declaration of callbacks for extern methods
810 readable writable var _n_kwimport
: TKwimport
811 readable var _n_extern_calls
: ANodes[AExternCall] = new ANodes[AExternCall](self)
813 abstract class AExternCall
816 abstract class APropExternCall
819 class ALocalPropExternCall
820 super APropExternCall
821 readable writable var _n_methid
: AMethid
823 class AFullPropExternCall
824 super APropExternCall
825 readable writable var _n_classid
: TClassid
826 readable writable var _n_quad
: nullable TQuad = null
827 readable writable var _n_methid
: AMethid
829 class AInitPropExternCall
830 super APropExternCall
831 readable writable var _n_classid
: TClassid
833 class ASuperExternCall
835 readable writable var _n_kwsuper
: TKwsuper
837 abstract class ACastExternCall
840 class ACastAsExternCall
841 super ACastExternCall
842 readable writable var _n_from_type
: AType
843 readable writable var _n_kwas
: TKwas
844 readable writable var _n_to_type
: AType
846 class AAsNullableExternCall
847 super ACastExternCall
848 readable writable var _n_type
: AType
849 readable writable var _n_kwas
: TKwas
850 readable writable var _n_kwnullable
: TKwnullable
852 class AAsNotNullableExternCall
853 super ACastExternCall
854 readable writable var _n_type
: AType
855 readable writable var _n_kwas
: TKwas
856 readable writable var _n_kwnot
: TKwnot
857 readable writable var _n_kwnullable
: TKwnullable
860 # A definition of a virtual type
863 readable writable var _n_kwredef
: nullable TKwredef = null
864 readable writable var _n_visibility
: AVisibility
865 readable writable var _n_kwtype
: TKwtype
866 readable writable var _n_id
: TClassid
867 readable writable var _n_type
: AType
870 # A `writable` or `readable` modifier
873 readable writable var _n_visibility
: nullable AVisibility = null
874 readable writable var _n_kwredef
: nullable TKwredef = null
877 # A `readable` modifier
880 readable writable var _n_kwreadable
: TKwreadable
883 # A `writable` modifier
886 readable writable var _n_kwwritable
: TKwwritable
889 # The identifier of a method in a method declaration.
890 # There is a specific class because of operator and setters.
891 abstract class AMethid
896 readable writable var _n_id
: TId
900 readable writable var _n_plus
: TPlus
904 readable writable var _n_minus
: TMinus
908 readable writable var _n_star
: TStar
912 readable writable var _n_slash
: TSlash
916 readable writable var _n_percent
: TPercent
920 readable writable var _n_eq
: TEq
924 readable writable var _n_ne
: TNe
928 readable writable var _n_le
: TLe
932 readable writable var _n_ge
: TGe
936 readable writable var _n_lt
: TLt
940 readable writable var _n_gt
: TGt
944 readable writable var _n_ll
: TLl
948 readable writable var _n_gg
: TGg
952 readable writable var _n_obra
: TObra
953 readable writable var _n_cbra
: TCbra
955 class AStarshipMethid
957 readable writable var _n_starship
: TStarship
961 readable writable var _n_id
: TId
962 readable writable var _n_assign
: TAssign
964 class ABraassignMethid
966 readable writable var _n_obra
: TObra
967 readable writable var _n_cbra
: TCbra
968 readable writable var _n_assign
: TAssign
971 # A signature in a method definition. eg `(x,y:X,z:Z):T`
974 readable writable var _n_opar
: nullable TOpar = null
975 readable var _n_params
: ANodes[AParam] = new ANodes[AParam](self)
976 readable writable var _n_cpar
: nullable TCpar = null
977 readable writable var _n_type
: nullable AType = null
978 readable var _n_closure_decls
: ANodes[AClosureDecl] = new ANodes[AClosureDecl](self)
981 # A parameter definition in a signature. eg `x:X`
984 readable writable var _n_id
: TId
985 readable writable var _n_type
: nullable AType = null
986 readable writable var _n_dotdotdot
: nullable TDotdotdot = null
991 readable writable var _n_kwbreak
: nullable TKwbreak = null
992 readable writable var _n_bang
: TBang
993 readable writable var _n_id
: TId
994 readable writable var _n_signature
: ASignature
995 readable writable var _n_expr
: nullable AExpr = null
998 # A static type. eg `nullable X[Y]`
1001 readable writable var _n_kwnullable
: nullable TKwnullable = null
1003 # The name of the class or of the formal type
1004 readable writable var _n_id
: TClassid
1006 # Type arguments for a generic type
1007 readable var _n_types
: ANodes[AType] = new ANodes[AType](self)
1010 # A label at the end of a block or in a break/continue statement. eg `label x`
1013 readable writable var _n_kwlabel
: TKwlabel
1014 readable writable var _n_id
: TId
1017 # Expression and statements
1018 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
1019 abstract class AExpr
1023 # A sequence of AExpr (usually statements)
1024 # The last AExpr gives the value of the whole block
1027 readable var _n_expr
: ANodes[AExpr] = new ANodes[AExpr](self)
1028 readable writable var _n_kwend
: nullable TKwend = null
1031 # A declaration of a local variable. eg `var x: X = y`
1034 readable writable var _n_kwvar
: TKwvar
1035 readable writable var _n_id
: TId
1036 readable writable var _n_type
: nullable AType = null
1037 readable writable var _n_assign
: nullable TAssign = null
1039 # The initial value, if any
1040 readable writable var _n_expr
: nullable AExpr = null
1043 # A `return` statement. eg `return x`
1046 readable writable var _n_kwreturn
: nullable TKwreturn = null
1047 readable writable var _n_expr
: nullable AExpr = null
1050 # Something that has a label.
1051 abstract class ALabelable
1053 readable writable var _n_label
: nullable ALabel = null
1056 # A `break` statement.
1060 readable writable var _n_kwbreak
: TKwbreak
1061 readable writable var _n_expr
: nullable AExpr = null
1064 # An `abort` statement
1067 readable writable var _n_kwabort
: TKwabort
1070 # A `continue` statement
1074 readable writable var _n_kwcontinue
: nullable TKwcontinue = null
1075 readable writable var _n_expr
: nullable AExpr = null
1082 readable writable var _n_kwdo
: TKwdo
1083 readable writable var _n_block
: nullable AExpr = null
1089 readable writable var _n_kwif
: TKwif
1090 readable writable var _n_expr
: AExpr
1091 readable writable var _n_then
: nullable AExpr = null
1092 readable writable var _n_else
: nullable AExpr = null
1098 readable writable var _n_kwif
: TKwif
1099 readable writable var _n_expr
: AExpr
1100 readable writable var _n_kwthen
: TKwthen
1101 readable writable var _n_then
: AExpr
1102 readable writable var _n_kwelse
: TKwelse
1103 readable writable var _n_else
: AExpr
1106 # A `while` statement
1110 readable writable var _n_kwwhile
: TKwwhile
1111 readable writable var _n_expr
: AExpr
1112 readable writable var _n_kwdo
: TKwdo
1113 readable writable var _n_block
: nullable AExpr = null
1116 # A `loop` statement
1120 readable writable var _n_kwloop
: TKwloop
1121 readable writable var _n_block
: nullable AExpr = null
1128 readable writable var _n_kwfor
: TKwfor
1129 readable var _n_ids
: ANodes[TId] = new ANodes[TId](self)
1130 readable writable var _n_expr
: AExpr
1131 readable writable var _n_kwdo
: TKwdo
1132 readable writable var _n_block
: nullable AExpr = null
1135 # An `assert` statement
1138 readable writable var _n_kwassert
: TKwassert
1139 readable writable var _n_id
: nullable TId = null
1140 readable writable var _n_expr
: AExpr
1141 readable writable var _n_else
: nullable AExpr = null
1144 # Whatever is a simple assignment. eg `= something`
1145 abstract class AAssignFormExpr
1147 readable writable var _n_assign
: TAssign
1148 readable writable var _n_value
: AExpr
1151 # Whatever is a combined assignment. eg `+= something`
1152 abstract class AReassignFormExpr
1154 readable writable var _n_assign_op
: AAssignOp
1155 readable writable var _n_value
: AExpr
1158 # A `once` expression. eg `once x`
1161 readable writable var _n_kwonce
: TKwonce
1164 # A polymorphic invocation of a method
1165 # The form of the invocation (name, arguments, etc) are specific
1166 abstract class ASendExpr
1168 # The receiver of the method invocation
1169 readable writable var _n_expr
: AExpr
1170 readable var _n_closure_defs
: ANodes[AClosureDef] = new ANodes[AClosureDef](self)
1173 # A binary operation on a method
1174 abstract class ABinopExpr
1176 # The second operand of the operation
1177 # Note: the receiver (`n_expr`) is the first operand
1178 readable writable var _n_expr2
: AExpr
1181 # Something that is boolean expression
1182 abstract class ABoolExpr
1189 readable writable var _n_expr
: AExpr
1190 readable writable var _n_expr2
: AExpr
1193 # A `and` expression
1196 readable writable var _n_expr
: AExpr
1197 readable writable var _n_expr2
: AExpr
1200 # A `or else` expression
1203 readable writable var _n_expr
: AExpr
1204 readable writable var _n_expr2
: AExpr
1207 # A `not` expression
1210 readable writable var _n_kwnot
: TKwnot
1211 readable writable var _n_expr
: AExpr
1222 readable writable var _n_expr
: AExpr
1223 readable writable var _n_expr2
: AExpr
1261 # A type-ckeck expression. eg `x isa T`
1264 readable writable var _n_expr
: AExpr
1265 readable writable var _n_type
: AType
1278 # A `<=>` expression
1298 # A unary minus expression. eg `-x`
1301 readable writable var _n_minus
: TMinus
1304 # An explicit instantiation. eg `new T`
1307 readable writable var _n_kwnew
: TKwnew
1308 readable writable var _n_type
: AType
1310 # The name of the named-constructor, if any
1311 readable writable var _n_id
: nullable TId = null
1312 readable writable var _n_args
: AExprs
1315 # Whatever is a old-style attribute access
1316 abstract class AAttrFormExpr
1319 # The receiver of the attribute
1320 readable writable var _n_expr
: AExpr
1322 # The name of the attribute
1323 readable writable var _n_id
: TAttrid
1326 # The read of an attribute. eg `x._a`
1331 # The assignment of an attribute. eg `x._a=y`
1332 class AAttrAssignExpr
1334 super AAssignFormExpr
1337 # Whatever looks-like a call with a standard method and any number of arguments.
1338 abstract class ACallFormExpr
1341 # The name of the method
1342 readable writable var _n_id
: TId
1344 # The arguments of the call
1345 readable writable var _n_args
: AExprs
1348 # A complex setter call (standard or brackets)
1349 abstract class ASendReassignFormExpr
1351 super AReassignFormExpr
1354 # A complex attribute assignment. eg `x._a+=y`
1355 class AAttrReassignExpr
1357 super AReassignFormExpr
1360 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1361 # 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`.
1362 # Semantic analysis have to transform them to instance of `AVarExpr`.
1367 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1368 # 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`.
1369 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1370 class ACallAssignExpr
1372 super AAssignFormExpr
1375 # 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.
1376 # 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`.
1377 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1378 class ACallReassignExpr
1380 super ASendReassignFormExpr
1383 # A call to `super`. OR a call of a super-constructor
1386 readable writable var _n_qualified
: nullable AQualified = null
1387 readable writable var _n_kwsuper
: TKwsuper
1388 readable writable var _n_args
: AExprs
1391 # A call to the `init` constructor.
1392 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr.
1395 readable writable var _n_kwinit
: TKwinit
1396 readable writable var _n_args
: AExprs
1399 # Whatever looks-like a call of the brackets `[]` operator.
1400 abstract class ABraFormExpr
1402 readable writable var _n_args
: AExprs
1405 # A call of the brackets operator. eg `x[y,z]`
1410 # A setter call of the bracket operator. eg `x[y,z]=t`
1411 class ABraAssignExpr
1413 super AAssignFormExpr
1416 # Whatever is an access to a local variable
1417 abstract class AVarFormExpr
1419 readable writable var _n_id
: TId
1422 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1423 class ABraReassignExpr
1425 super ASendReassignFormExpr
1428 class AClosureCallExpr
1430 readable writable var _n_id
: TId
1431 readable writable var _n_args
: AExprs
1432 readable var _n_closure_defs
: ANodes[AClosureDef] = new ANodes[AClosureDef](self)
1435 # A local variable read access.
1436 # The parser cannot instantiate them, see `ACallExpr`.
1441 # A local variable simple assigment access
1442 # The parser cannot instantiate them, see `ACallAssignExpr`.
1443 class AVarAssignExpr
1445 super AAssignFormExpr
1448 # A local variable complex assignment access
1449 # The parser cannot instantiate them, see `ACallReassignExpr`.
1450 class AVarReassignExpr
1452 super AReassignFormExpr
1455 # A literal range, open or closed
1456 abstract class ARangeExpr
1458 readable writable var _n_expr
: AExpr
1459 readable writable var _n_expr2
: AExpr
1462 # A closed literal range. eg `[x..y]`
1465 readable writable var _n_obra
: TObra
1466 readable writable var _n_cbra
: TCbra
1469 # An open literal range. eg `[x..y[`
1472 readable writable var _n_obra
: TObra
1473 readable writable var _n_cbra
: TObra
1476 # A literal array. eg. `[x,y,z]`
1479 readable writable var _n_exprs
: AExprs
1485 readable writable var _n_kwself
: nullable TKwself
1488 # When there is no explicit receiver, `self` is implicit
1489 class AImplicitSelfExpr
1493 # A `true` boolean literal constant
1496 readable writable var _n_kwtrue
: TKwtrue
1498 # A `false` boolean literal constant
1501 readable writable var _n_kwfalse
: TKwfalse
1503 # A `null` literal constant
1506 readable writable var _n_kwnull
: TKwnull
1508 # An integer literal
1511 readable writable var _n_number
: TNumber
1516 readable writable var _n_float
: TFloat
1518 # A character literal
1521 readable writable var _n_char
: TChar
1524 abstract class AStringFormExpr
1526 readable writable var _n_string
: Token
1529 # A simple string. eg. `"abc"`
1531 super AStringFormExpr
1534 # The start of a superstring. eg `"abc{`
1535 class AStartStringExpr
1536 super AStringFormExpr
1539 # The middle of a superstring. eg `}abc{`
1540 class AMidStringExpr
1541 super AStringFormExpr
1544 # The end of a superstrng. eg `}abc"`
1545 class AEndStringExpr
1546 super AStringFormExpr
1549 # A superstring literal. eg `"a{x}b{y}c"`
1550 # Each part is modelized a sequence of expression. eg. `["a{, x, }b{, y, }c"]`
1551 class ASuperstringExpr
1553 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1556 # A simple parenthesis. eg `(x)`
1559 readable writable var _n_opar
: TOpar
1560 readable writable var _n_cpar
: TCpar
1563 # Whatevej just contains (and mimic) an other expression
1564 abstract class AProxyExpr
1566 readable writable var _n_expr
: AExpr
1569 # A type cast. eg `x.as(T)`
1572 readable writable var _n_expr
: AExpr
1573 readable writable var _n_kwas
: TKwas
1574 readable writable var _n_opar
: TOpar
1575 readable writable var _n_type
: AType
1576 readable writable var _n_cpar
: TCpar
1579 # A as-not-null cast. eg `x.as(not null)`
1580 class AAsNotnullExpr
1582 readable writable var _n_expr
: AExpr
1583 readable writable var _n_kwas
: TKwas
1584 readable writable var _n_opar
: TOpar
1585 readable writable var _n_kwnot
: TKwnot
1586 readable writable var _n_kwnull
: TKwnull
1587 readable writable var _n_cpar
: TCpar
1590 # A is-set check of old-style attributes. eg `isset x._a`
1591 class AIssetAttrExpr
1593 readable writable var _n_kwisset
: TKwisset
1596 # A list of expression separated with commas (arguments for instance)
1597 abstract class AExprs
1599 readable var _n_exprs
: ANodes[AExpr] = new ANodes[AExpr](self)
1602 class ADebugTypeExpr
1604 readable writable var _n_kwdebug
: TKwdebug
1605 readable writable var _n_kwtype
: TKwtype
1606 readable writable var _n_expr
: AExpr
1607 readable writable var _n_type
: AType
1610 # A simple list of expressions
1615 # A list of expressions enclosed in parentheses
1618 readable writable var _n_opar
: TOpar
1619 readable writable var _n_cpar
: TCpar
1622 # A list of expressions enclosed in brackets
1625 readable writable var _n_obra
: TObra
1626 readable writable var _n_cbra
: TCbra
1629 # A complex assignment operator. eg `+=`
1630 abstract class AAssignOp
1635 readable writable var _n_pluseq
: TPluseq
1637 class AMinusAssignOp
1639 readable writable var _n_minuseq
: TMinuseq
1644 readable writable var _n_bang
: TBang
1645 readable writable var _n_id
: AClosureId
1646 readable var _n_ids
: ANodes[TId] = new ANodes[TId](self)
1647 readable writable var _n_kwdo
: nullable TKwdo = null
1648 readable writable var _n_expr
: nullable AExpr = null
1649 redef fun hot_location
do return n_id
.location
1651 abstract class AClosureId
1654 class ASimpleClosureId
1656 readable writable var _n_id
: TId
1658 class ABreakClosureId
1660 readable writable var _n_kwbreak
: TKwbreak
1664 readable writable var _n_quad
: nullable TQuad = null
1665 readable var _n_path
: ANodes[TId] = new ANodes[TId](self)
1666 readable writable var _n_id
: TId
1670 readable writable var _n_kwin
: TKwin
1671 readable writable var _n_string
: TString
1673 class AExternCodeBlock
1675 readable writable var _n_in_language
: nullable AInLanguage = null
1676 readable writable var _n_extern_code_segment
: TExternCodeSegment
1680 readable writable var _n_quad
: nullable TQuad = null
1681 readable var _n_id
: ANodes[TId] = new ANodes[TId](self)
1682 readable writable var _n_classid
: nullable TClassid = null
1685 # A documentation of a definition
1686 # It contains the block of comments just above the declaration
1689 readable var _n_comment
: ANodes[TComment] = new ANodes[TComment](self)
1694 readable writable var _n_at
: nullable TAt = null
1695 readable writable var _n_opar
: nullable TOpar = null
1696 readable var _n_items
: ANodes[AAnnotation] = new ANodes[AAnnotation](self)
1697 readable writable var _n_cpar
: nullable TCpar = null
1701 readable writable var _n_atid
: AAtid
1702 readable writable var _n_opar
: nullable TOpar = null
1703 readable var _n_args
: ANodes[AAtArg] = new ANodes[AAtArg](self)
1704 readable writable var _n_cpar
: nullable TCpar = null
1706 abstract class AAtArg
1711 readable writable var _n_type
: AType
1715 readable writable var _n_expr
: AExpr
1720 abstract class AAtid
1722 readable writable var _n_id
: Token
1733 class AKwreadableAtid
1736 class AKwwritableAtid
1743 # The root of the AST
1746 readable writable var _n_base
: nullable AModule
1747 readable writable var _n_eof
: EOF
1748 init(n_base
: nullable AModule, n_eof
: EOF)
1750 self._n_base
= n_base