0af05c6e35b608754601fbfa162d6e97137c0aea
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 readable writable var _parent
: nullable ANode = null
41 # Protect form invalid instantiation of nodes
44 # Remove a child from the AST
45 fun remove_child
(child
: ANode)
47 replace_child
(child
, null)
50 # Replace a child with an other node in the AST
51 fun replace_child
(old_child
: ANode, new_child
: nullable ANode) is abstract
53 # Replace itself with an other node in the AST
54 fun replace_with
(node
: ANode)
56 if _parent
!= null then
57 _parent
.replace_child
(self, node
)
61 # Visit all nodes in order.
62 # Thus, call `v.enter_visit(e)` for each child `e`
63 fun visit_all
(v
: Visitor) is abstract
66 # Ancestor of all tokens
67 # A token is a node that has a `text` but no children.
71 # The raw content on the token
72 fun text
: String is abstract
73 fun text
=(text
: String) is abstract
75 redef fun to_s
: String do
79 redef fun visit_all
(v
: Visitor) do end
80 redef fun replace_child
(old_child
: ANode, new_child
: nullable ANode) do end
83 # Ancestor of all productions
84 # A production is a node without text but that usually has children.
88 fun location
=(l
: Location) do _location
= l
90 # All the annotations attached directly to the node
91 readable var _n_annotations
: nullable AAnnotations = null
93 redef fun replace_with
(n
: ANode)
101 # Abstract standard visitor on the AST
102 abstract class Visitor
103 # What the visitor do when a node is visited
104 # Concrete visitors should implement this method.
106 protected fun visit
(e
: nullable ANode) is abstract
108 # Ask the visitor to visit a given node.
109 # Usually automatically called by visit_all* methods.
110 # This method should not be redefined
111 fun enter_visit
(e
: nullable ANode)
113 var old
= _current_node
119 # The current visited node
120 readable var _current_node
: nullable ANode = null
123 # Token of end of line (basically `\n`)
132 # Token of a line of comments
133 # Starts with the `#` and contains the final end-of-line (if any)
138 # A token associated with a keyword
139 abstract class TokenKeyword
143 return "keyword '{text}'"
318 # A token associated with an operator (and other lookalike symbols)
319 abstract class TokenOperator
323 return "operator '{text}'"
390 # A class (or formal type) identifier. They start with an uppercase.
395 do return "type identifier '{text}'"
399 # A standard identifier (variable, method...). They start with a lowercase.
404 do return "identifier '{text}'"
408 # An attribute identifier. They start with an underscore.
413 do return "attribute '{text}'"
417 # A token of a literal value (string, integer, etc).
418 abstract class TokenLiteral
422 do return "literal value '{text}'"
452 do return "malformed string {text}"
461 do return "malformed character {text}"
465 class TExternCodeSegment
489 # The main node of a Nit source-file
493 readable var _n_moduledecl
: nullable AModuledecl = null
494 readable var _n_imports
: List[AImport] = new List[AImport]
495 readable var _n_extern_code_blocks
: List[AExternCodeBlock] = new List[AExternCodeBlock]
496 readable var _n_classdefs
: List[AClassdef] = new List[AClassdef]
499 # The declaration of the module with the documentation, name, and annotations
502 readable var _n_doc
: nullable ADoc = null
503 readable var _n_kwmodule
: TKwmodule
504 readable var _n_name
: AModuleName
507 # A import clause of a module
508 abstract class AImport
512 # A standard import clause. eg `import x`
515 readable var _n_visibility
: AVisibility
516 readable var _n_kwimport
: TKwimport
517 readable var _n_name
: AModuleName
520 # The special import clause of the kernel module. eg `import end`
523 readable var _n_visibility
: AVisibility
524 readable var _n_kwimport
: TKwimport
525 readable var _n_kwend
: TKwend
528 # A visibility modifier
530 # The public visibility is an empty production (no keyword).
532 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
533 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
534 abstract class AVisibility
537 class APublicVisibility
540 class APrivateVisibility
542 readable var _n_kwprivate
: TKwprivate
544 class AProtectedVisibility
546 readable var _n_kwprotected
: TKwprotected
548 class AIntrudeVisibility
550 readable var _n_kwintrude
: TKwintrude
554 # While most definition are `AStdClassdef`
555 # There is tow special case of class definition
556 abstract class AClassdef super Prod
557 readable var _n_propdefs
: List[APropdef] = new List[APropdef]
560 # A standard class definition with a name, superclasses and properties
563 readable var _n_doc
: nullable ADoc = null
564 readable var _n_kwredef
: nullable TKwredef = null
565 readable var _n_visibility
: AVisibility
566 readable var _n_classkind
: AClasskind
567 readable var _n_id
: nullable TClassid = null
568 readable var _n_formaldefs
: List[AFormaldef] = new List[AFormaldef]
569 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
570 readable var _n_superclasses
: List[ASuperclass] = new List[ASuperclass]
571 readable var _n_kwend
: TKwend
572 redef fun hot_location
do return n_id
.location
575 # The implicit class definition of the implicit main method
580 # The implicit class definition of the top-level methods
585 # The modifier for the kind of class (abstract, interface, etc.)
586 abstract class AClasskind
589 class AConcreteClasskind
591 readable var _n_kwclass
: TKwclass
593 class AAbstractClasskind
595 readable var _n_kwabstract
: TKwabstract
596 readable var _n_kwclass
: TKwclass
598 class AInterfaceClasskind
600 readable var _n_kwinterface
: TKwinterface
604 readable var _n_kwenum
: TKwenum
606 class AExternClasskind
608 readable var _n_kwextern
: TKwextern
609 readable var _n_kwclass
: nullable TKwclass = null
612 # The definition of a formal generic parameter type. eg `X: Y`
615 readable var _n_id
: TClassid
616 # The bound of the parameter type
617 readable var _n_type
: nullable AType = null
620 # A super-class. eg `super X`
623 readable var _n_kwsuper
: TKwsuper
624 readable var _n_type
: AType
627 # The definition of a property
628 abstract class APropdef
630 readable var _n_doc
: nullable ADoc = null
633 # A definition of an attribute
634 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
637 readable var _n_kwredef
: nullable TKwredef = null
638 readable var _n_visibility
: AVisibility
639 readable var _n_kwvar
: TKwvar
641 # The identifier for an old-style attribute (null if new-style)
642 readable var _n_id
: nullable TAttrid
644 # The identifier for a new-style attribute (null if old-style)
645 readable var _n_id2
: nullable TId
647 readable var _n_type
: nullable AType = null
648 readable var _n_readable
: nullable AAble = null
649 readable var _n_writable
: nullable AAble = null
651 # The initial value, if any
652 readable var _n_expr
: nullable AExpr = null
653 redef fun hot_location
655 if n_id
!= null then return n_id
.location
else return n_id2
.location
659 # A definition of all kind of method (including constructors)
660 abstract class AMethPropdef
662 readable var _n_kwredef
: nullable TKwredef = null
663 readable var _n_visibility
: nullable AVisibility
664 readable var _n_methid
: nullable AMethid = null
665 readable var _n_signature
: nullable ASignature
666 redef fun hot_location
668 if n_methid
!= null then
669 return n_methid
.location
676 # A method marked abstract
677 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
678 class ADeferredMethPropdef
680 readable var _n_kwmeth
: TKwmeth
683 # A method marked intern
684 class AInternMethPropdef
686 readable var _n_kwmeth
: TKwmeth
689 # A method of a constructor marked extern
690 abstract class AExternPropdef
692 readable var _n_extern
: nullable TString = null
693 readable var _n_extern_calls
: nullable AExternCalls = null
694 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
697 # A method marked extern
698 class AExternMethPropdef
700 readable var _n_kwmeth
: TKwmeth
703 # A method with a body
704 class AConcreteMethPropdef
706 readable var _n_kwmeth
: nullable TKwmeth
707 readable var _n_block
: nullable AExpr = null
711 abstract class AInitPropdef
715 # A constructor with a body
716 class AConcreteInitPropdef
717 super AConcreteMethPropdef
719 readable var _n_kwinit
: TKwinit
720 redef fun hot_location
do return n_kwinit
.location
723 # A constructor marked extern (defined with the `new` keyword)
724 class AExternInitPropdef
727 readable var _n_kwnew
: TKwnew
730 # The implicit main method
731 class AMainMethPropdef
732 super AConcreteMethPropdef
735 # Declaration of callbacks for extern methods
738 readable var _n_kwimport
: TKwimport
739 readable var _n_extern_calls
: List[AExternCall] = new List[AExternCall]
741 abstract class AExternCall
744 abstract class APropExternCall
747 class ALocalPropExternCall
748 super APropExternCall
749 readable var _n_methid
: AMethid
751 class AFullPropExternCall
752 super APropExternCall
753 readable var _n_classid
: TClassid
754 readable var _n_quad
: nullable TQuad = null
755 readable var _n_methid
: AMethid
757 class AInitPropExternCall
758 super APropExternCall
759 readable var _n_classid
: TClassid
761 class ASuperExternCall
763 readable var _n_kwsuper
: TKwsuper
765 abstract class ACastExternCall
768 class ACastAsExternCall
769 super ACastExternCall
770 readable var _n_from_type
: AType
771 readable var _n_kwas
: TKwas
772 readable var _n_to_type
: AType
774 class AAsNullableExternCall
775 super ACastExternCall
776 readable var _n_type
: AType
777 readable var _n_kwas
: TKwas
778 readable var _n_kwnullable
: TKwnullable
780 class AAsNotNullableExternCall
781 super ACastExternCall
782 readable var _n_type
: AType
783 readable var _n_kwas
: TKwas
784 readable var _n_kwnot
: TKwnot
785 readable var _n_kwnullable
: TKwnullable
788 # A definition of a virtual type
791 readable var _n_kwredef
: nullable TKwredef = null
792 readable var _n_visibility
: AVisibility
793 readable var _n_kwtype
: TKwtype
794 readable var _n_id
: TClassid
795 readable var _n_type
: AType
798 # A `writable` or `readable` modifier
801 readable var _n_visibility
: nullable AVisibility = null
802 readable var _n_kwredef
: nullable TKwredef = null
805 # A `readable` modifier
808 readable var _n_kwreadable
: TKwreadable
811 # A `writable` modifier
814 readable var _n_kwwritable
: TKwwritable
817 # The identifier of a method in a method declaration.
818 # There is a specific class because of operator and setters.
819 abstract class AMethid
824 readable var _n_id
: TId
828 readable var _n_plus
: TPlus
832 readable var _n_minus
: TMinus
836 readable var _n_star
: TStar
840 readable var _n_slash
: TSlash
844 readable var _n_percent
: TPercent
848 readable var _n_eq
: TEq
852 readable var _n_ne
: TNe
856 readable var _n_le
: TLe
860 readable var _n_ge
: TGe
864 readable var _n_lt
: TLt
868 readable var _n_gt
: TGt
872 readable writable var _n_ll
: TLl
876 readable writable var _n_gg
: TGg
880 readable var _n_obra
: TObra
881 readable var _n_cbra
: TCbra
883 class AStarshipMethid
885 readable var _n_starship
: TStarship
889 readable var _n_id
: TId
890 readable var _n_assign
: TAssign
892 class ABraassignMethid
894 readable var _n_obra
: TObra
895 readable var _n_cbra
: TCbra
896 readable var _n_assign
: TAssign
899 # A signature in a method definition. eg `(x,y:X,z:Z):T`
902 readable var _n_opar
: nullable TOpar = null
903 readable var _n_params
: List[AParam] = new List[AParam]
904 readable var _n_cpar
: nullable TCpar = null
905 readable var _n_type
: nullable AType = null
906 readable var _n_closure_decls
: List[AClosureDecl] = new List[AClosureDecl]
909 # A parameter definition in a signature. eg `x:X`
912 readable var _n_id
: TId
913 readable var _n_type
: nullable AType = null
914 readable var _n_dotdotdot
: nullable TDotdotdot = null
919 readable var _n_kwbreak
: nullable TKwbreak = null
920 readable var _n_bang
: TBang
921 readable var _n_id
: TId
922 readable var _n_signature
: ASignature
923 readable var _n_expr
: nullable AExpr = null
926 # A static type. eg `nullable X[Y]`
929 readable var _n_kwnullable
: nullable TKwnullable = null
931 # The name of the class or of the formal type
932 readable var _n_id
: TClassid
934 # Type arguments for a generic type
935 readable var _n_types
: List[AType] = new List[AType]
938 # A label at the end of a block or in a break/continue statement. eg `label x`
941 readable var _n_kwlabel
: TKwlabel
942 readable var _n_id
: TId
945 # Expression and statements
946 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
951 # A sequence of AExpr (usually statements)
952 # The last AExpr gives the value of the whole block
955 readable var _n_expr
: List[AExpr] = new List[AExpr]
956 readable var _n_kwend
: nullable TKwend = null
959 # A declaration of a local variable. eg `var x: X = y`
962 readable var _n_kwvar
: TKwvar
963 readable var _n_id
: TId
964 readable var _n_type
: nullable AType = null
965 readable var _n_assign
: nullable TAssign = null
967 # The initial value, if any
968 readable var _n_expr
: nullable AExpr = null
971 # A `return` statement. eg `return x`
974 readable var _n_kwreturn
: nullable TKwreturn = null
975 readable var _n_expr
: nullable AExpr = null
978 # Something that has a label.
979 abstract class ALabelable
981 readable var _n_label
: nullable ALabel = null
984 # A `break` statement.
988 readable var _n_kwbreak
: TKwbreak
989 readable var _n_expr
: nullable AExpr = null
992 # An `abort` statement
995 readable var _n_kwabort
: TKwabort
998 # A `continue` statement
1002 readable var _n_kwcontinue
: nullable TKwcontinue = null
1003 readable var _n_expr
: nullable AExpr = null
1010 readable var _n_kwdo
: TKwdo
1011 readable var _n_block
: nullable AExpr = null
1017 readable var _n_kwif
: TKwif
1018 readable var _n_expr
: AExpr
1019 readable var _n_then
: nullable AExpr = null
1020 readable var _n_else
: nullable AExpr = null
1026 readable var _n_kwif
: TKwif
1027 readable var _n_expr
: AExpr
1028 readable var _n_kwthen
: TKwthen
1029 readable var _n_then
: AExpr
1030 readable var _n_kwelse
: TKwelse
1031 readable var _n_else
: AExpr
1034 # A `while` statement
1038 readable var _n_kwwhile
: TKwwhile
1039 readable var _n_expr
: AExpr
1040 readable var _n_kwdo
: TKwdo
1041 readable var _n_block
: nullable AExpr = null
1044 # A `loop` statement
1048 readable var _n_kwloop
: TKwloop
1049 readable var _n_block
: nullable AExpr = null
1056 readable var _n_kwfor
: TKwfor
1057 readable var _n_ids
: List[TId] = new List[TId]
1058 readable var _n_expr
: AExpr
1059 readable var _n_kwdo
: TKwdo
1060 readable var _n_block
: nullable AExpr = null
1063 # An `assert` statement
1066 readable var _n_kwassert
: TKwassert
1067 readable var _n_id
: nullable TId = null
1068 readable var _n_expr
: AExpr
1069 readable var _n_else
: nullable AExpr = null
1072 # Whatever is a simple assignment. eg `= something`
1073 abstract class AAssignFormExpr
1075 readable var _n_assign
: TAssign
1076 readable var _n_value
: AExpr
1079 # Whatever is a combined assignment. eg `+= something`
1080 abstract class AReassignFormExpr
1082 readable var _n_assign_op
: AAssignOp
1083 readable var _n_value
: AExpr
1086 # A `once` expression. eg `once x`
1089 readable var _n_kwonce
: TKwonce
1092 # A polymorphic invocation of a method
1093 # The form of the invocation (name, arguments, etc) are specific
1094 abstract class ASendExpr
1096 # The receiver of the method invocation
1097 readable var _n_expr
: AExpr
1098 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1101 # A binary operation on a method
1102 abstract class ABinopExpr
1104 # The second operand of the operation
1105 # Note: the receiver (`n_expr`) is the first operand
1106 readable var _n_expr2
: AExpr
1109 # Something that is boolean expression
1110 abstract class ABoolExpr
1117 readable var _n_expr
: AExpr
1118 readable var _n_expr2
: AExpr
1121 # A `and` expression
1124 readable var _n_expr
: AExpr
1125 readable var _n_expr2
: AExpr
1128 # A `or else` expression
1131 readable var _n_expr
: AExpr
1132 readable var _n_expr2
: AExpr
1135 # A `not` expression
1138 readable var _n_kwnot
: TKwnot
1139 readable var _n_expr
: AExpr
1150 readable var _n_expr
: AExpr
1151 readable var _n_expr2
: AExpr
1189 # A type-ckeck expression. eg `x isa T`
1192 readable var _n_expr
: AExpr
1193 readable var _n_type
: AType
1206 # A `<=>` expression
1226 # A unary minus expression. eg `-x`
1229 readable var _n_minus
: TMinus
1232 # An explicit instantiation. eg `new T`
1235 readable var _n_kwnew
: TKwnew
1236 readable var _n_type
: AType
1238 # The name of the named-constructor, if any
1239 readable var _n_id
: nullable TId = null
1240 readable var _n_args
: AExprs
1243 # Whatever is a old-style attribute access
1244 abstract class AAttrFormExpr
1247 # The receiver of the attribute
1248 readable var _n_expr
: AExpr
1250 # The name of the attribute
1251 readable var _n_id
: TAttrid
1254 # The read of an attribute. eg `x._a`
1259 # The assignment of an attribute. eg `x._a=y`
1260 class AAttrAssignExpr
1262 super AAssignFormExpr
1265 # Whatever looks-like a call with a standard method and any number of arguments.
1266 abstract class ACallFormExpr
1269 # The name of the method
1270 readable var _n_id
: TId
1272 # The arguments of the call
1273 readable var _n_args
: AExprs
1276 # A complex setter call (standard or brackets)
1277 abstract class ASendReassignFormExpr
1279 super AReassignFormExpr
1282 # A complex attribute assignment. eg `x._a+=y`
1283 class AAttrReassignExpr
1285 super AReassignFormExpr
1288 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1289 # 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.
1290 # Semantic analysis have to transform them to instance of `AVarExpr`.
1295 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1296 # 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.
1297 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1298 class ACallAssignExpr
1300 super AAssignFormExpr
1303 # 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.
1304 # 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.
1305 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1306 class ACallReassignExpr
1308 super ASendReassignFormExpr
1311 # A call to `super`. OR a call of a super-constructor
1314 readable var _n_qualified
: nullable AQualified = null
1315 readable var _n_kwsuper
: TKwsuper
1316 readable var _n_args
: AExprs
1319 # A call to the `init` constructor.
1320 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr
1323 readable var _n_kwinit
: TKwinit
1324 readable var _n_args
: AExprs
1327 # Whatever looks-like a call of the brackets `[]` operator.
1328 abstract class ABraFormExpr
1330 readable var _n_args
: AExprs
1333 # A call of the brackets operator. eg `x[y,z]`
1338 # A setter call of the bracket operator. eg `x[y,z]=t`
1339 class ABraAssignExpr
1341 super AAssignFormExpr
1344 # Whatever is an access to a local variable
1345 abstract class AVarFormExpr
1347 readable var _n_id
: TId
1350 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1351 class ABraReassignExpr
1353 super ASendReassignFormExpr
1356 class AClosureCallExpr
1358 readable var _n_id
: TId
1359 readable var _n_args
: AExprs
1360 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1363 # A local variable read access.
1364 # The parser cannot instantiate them, see `ACallExpr`.
1369 # A local variable simple assigment access
1370 # The parser cannot instantiate them, see `ACallAssingExpr`.
1371 class AVarAssignExpr
1373 super AAssignFormExpr
1376 # A local variable complex assignment access
1377 # The parser cannot instantiate them, see `ACallReassingExpr`.
1378 class AVarReassignExpr
1380 super AReassignFormExpr
1383 # A literal range, open or closed
1384 abstract class ARangeExpr
1386 readable var _n_expr
: AExpr
1387 readable var _n_expr2
: AExpr
1390 # A closed literal range. eg `[x..y]`
1393 readable var _n_obra
: TObra
1394 readable var _n_cbra
: TCbra
1397 # An open literal range. eg `[x..y[`
1400 readable var _n_obra
: TObra
1401 readable var _n_cbra
: TObra
1404 # A literal array. eg. `[x,y,z]`
1407 readable var _n_exprs
: AExprs
1413 readable var _n_kwself
: nullable TKwself
1416 # When there is no explicit receiver, `self` is implicit
1417 class AImplicitSelfExpr
1421 # A `true` boolean literal constant
1424 readable var _n_kwtrue
: TKwtrue
1426 # A `false` boolean literal constant
1429 readable var _n_kwfalse
: TKwfalse
1431 # A `null` literal constant
1434 readable var _n_kwnull
: TKwnull
1436 # An integer literal
1439 readable var _n_number
: TNumber
1444 readable var _n_float
: TFloat
1446 # A character literal
1449 readable var _n_char
: TChar
1452 abstract class AStringFormExpr
1454 readable var _n_string
: Token
1457 # A simple string. eg. `"abc"`
1459 super AStringFormExpr
1462 # The start of a superstring. eg `"abc{`
1463 class AStartStringExpr
1464 super AStringFormExpr
1467 # The middle of a superstring. eg `}abc{`
1468 class AMidStringExpr
1469 super AStringFormExpr
1472 # The end of a superstrng. eg `}abc"`
1473 class AEndStringExpr
1474 super AStringFormExpr
1477 # A superstring literal. eg "a{x}b{y}c"
1478 # Each part is modelized a sequence of expression. eg. ["a{, x, }b{, y, }c"]
1479 class ASuperstringExpr
1481 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1484 # A simple parenthesis. eg `(x)`
1487 readable var _n_opar
: TOpar
1488 readable var _n_cpar
: TCpar
1491 # Whatevej just contains (and mimic) an other expression
1492 abstract class AProxyExpr
1494 readable var _n_expr
: AExpr
1497 # A type cast. eg `x.as(T)`
1500 readable var _n_expr
: AExpr
1501 readable var _n_kwas
: TKwas
1502 readable var _n_opar
: TOpar
1503 readable var _n_type
: AType
1504 readable var _n_cpar
: TCpar
1507 # A as-not-null cast. eg `x.as(not null)`
1508 class AAsNotnullExpr
1510 readable var _n_expr
: AExpr
1511 readable var _n_kwas
: TKwas
1512 readable var _n_opar
: TOpar
1513 readable var _n_kwnot
: TKwnot
1514 readable var _n_kwnull
: TKwnull
1515 readable var _n_cpar
: TCpar
1518 # A is-set check of old-style attributes. eg `isset x._a`
1519 class AIssetAttrExpr
1521 readable var _n_kwisset
: TKwisset
1524 # A list of expression separated with commas (arguments for instance)
1525 abstract class AExprs
1527 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1530 class ADebugTypeExpr
1532 readable var _n_kwdebug
: TKwdebug
1533 readable var _n_kwtype
: TKwtype
1534 readable var _n_expr
: AExpr
1535 readable var _n_type
: AType
1538 # A simple list of expressions
1543 # A list of expressions enclosed in parentheses
1546 readable var _n_opar
: TOpar
1547 readable var _n_cpar
: TCpar
1550 # A list of expressions enclosed in brackets
1553 readable var _n_obra
: TObra
1554 readable var _n_cbra
: TCbra
1557 # A complex assignment operator. eg `+=`
1558 abstract class AAssignOp
1563 readable var _n_pluseq
: TPluseq
1565 class AMinusAssignOp
1567 readable var _n_minuseq
: TMinuseq
1572 readable var _n_bang
: TBang
1573 readable var _n_id
: AClosureId
1574 readable var _n_ids
: List[TId] = new List[TId]
1575 readable var _n_kwdo
: nullable TKwdo = null
1576 readable var _n_expr
: nullable AExpr = null
1577 redef fun hot_location
do return n_id
.location
1579 abstract class AClosureId
1582 class ASimpleClosureId
1584 readable var _n_id
: TId
1586 class ABreakClosureId
1588 readable var _n_kwbreak
: TKwbreak
1592 readable var _n_quad
: nullable TQuad = null
1593 readable var _n_path
: List[TId] = new List[TId]
1594 readable var _n_id
: TId
1598 readable var _n_kwin
: TKwin
1599 readable var _n_string
: TString
1601 class AExternCodeBlock
1603 readable var _n_in_language
: nullable AInLanguage = null
1604 readable var _n_extern_code_segment
: TExternCodeSegment
1608 readable var _n_quad
: nullable TQuad = null
1609 readable var _n_id
: List[TId] = new List[TId]
1610 readable var _n_classid
: nullable TClassid = null
1613 # A documentation of a definition
1614 # It contains the block of comments just above the declaration
1617 readable var _n_comment
: List[TComment] = new List[TComment]
1622 readable var _n_at
: nullable TAt = null
1623 readable var _n_opar
: nullable TOpar = null
1624 readable var _n_items
: List[AAnnotation] = new List[AAnnotation]
1625 readable var _n_cpar
: nullable TCpar = null
1629 readable var _n_atid
: AAtid
1630 readable var _n_opar
: nullable TOpar = null
1631 readable var _n_args
: List[AAtArg] = new List[AAtArg]
1632 readable var _n_cpar
: nullable TCpar = null
1634 abstract class AAtArg
1639 readable var _n_type
: AType
1643 readable var _n_expr
: AExpr
1648 abstract class AAtid
1650 readable var _n_id
: Token
1661 class AKwreadableAtid
1664 class AKwwritableAtid
1671 # The root of the AST
1674 readable var _n_base
: nullable AModule
1675 readable var _n_eof
: EOF
1676 init(n_base
: nullable AModule, n_eof
: EOF)
1678 self._n_base
= n_base