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 # 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
54 assert _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)
65 assert _parent
!= null
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
75 # Ancestor of all tokens
76 # A token is a node that has a `text` but no children.
80 # The raw content on the token
81 fun text
: String is abstract
82 fun text
=(text
: String) is abstract
84 redef fun to_s
: String do
88 redef fun visit_all
(v
: Visitor) do end
89 redef fun replace_child
(old_child
: ANode, new_child
: nullable ANode) do end
92 # Ancestor of all productions
93 # A production is a node without text but that usually has children.
97 fun location
=(l
: Location) do _location
= l
99 # All the annotations attached directly to the node
100 readable var _n_annotations
: nullable AAnnotations = null
102 redef fun replace_with
(n
: ANode)
106 if n
._location
== null then n
._location
= _location
110 # Abstract standard visitor on the AST
111 abstract class Visitor
112 # What the visitor do when a node is visited
113 # Concrete visitors should implement this method.
115 protected fun visit
(e
: ANode) is abstract
117 # Ask the visitor to visit a given node.
118 # Usually automatically called by visit_all* methods.
119 # This method should not be redefined
120 fun enter_visit
(e
: nullable ANode)
122 if e
== null then return
123 var old
= _current_node
129 # The current visited node
130 readable var _current_node
: nullable ANode = null
133 # Token of end of line (basically `\n`)
142 # Token of a line of comments
143 # Starts with the `#` and contains the final end-of-line (if any)
148 # A token associated with a keyword
149 abstract class TokenKeyword
153 return "keyword '{text}'"
328 # A token associated with an operator (and other lookalike symbols)
329 abstract class TokenOperator
333 return "operator '{text}'"
400 # A class (or formal type) identifier. They start with an uppercase.
405 do return "type identifier '{text}'"
409 # A standard identifier (variable, method...). They start with a lowercase.
414 do return "identifier '{text}'"
418 # An attribute identifier. They start with an underscore.
423 do return "attribute '{text}'"
427 # A token of a literal value (string, integer, etc).
428 abstract class TokenLiteral
432 do return "literal value '{text}'"
462 do return "malformed string {text}"
471 do return "malformed character {text}"
475 class TExternCodeSegment
499 # The main node of a Nit source-file
503 readable var _n_moduledecl
: nullable AModuledecl = null
504 readable var _n_imports
: List[AImport] = new List[AImport]
505 readable var _n_extern_code_blocks
: List[AExternCodeBlock] = new List[AExternCodeBlock]
506 readable var _n_classdefs
: List[AClassdef] = new List[AClassdef]
509 # The declaration of the module with the documentation, name, and annotations
512 readable var _n_doc
: nullable ADoc = null
513 readable var _n_kwmodule
: TKwmodule
514 readable var _n_name
: AModuleName
517 # A import clause of a module
518 abstract class AImport
522 # A standard import clause. eg `import x`
525 readable var _n_visibility
: AVisibility
526 readable var _n_kwimport
: TKwimport
527 readable var _n_name
: AModuleName
530 # The special import clause of the kernel module. eg `import end`
533 readable var _n_visibility
: AVisibility
534 readable var _n_kwimport
: TKwimport
535 readable var _n_kwend
: TKwend
538 # A visibility modifier
540 # The public visibility is an empty production (no keyword).
542 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
543 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
544 abstract class AVisibility
547 class APublicVisibility
550 class APrivateVisibility
552 readable var _n_kwprivate
: TKwprivate
554 class AProtectedVisibility
556 readable var _n_kwprotected
: TKwprotected
558 class AIntrudeVisibility
560 readable var _n_kwintrude
: TKwintrude
564 # While most definition are `AStdClassdef`
565 # There is tow special case of class definition
566 abstract class AClassdef super Prod
567 readable var _n_propdefs
: List[APropdef] = new List[APropdef]
570 # A standard class definition with a name, superclasses and properties
573 readable var _n_doc
: nullable ADoc = null
574 readable var _n_kwredef
: nullable TKwredef = null
575 readable var _n_visibility
: AVisibility
576 readable var _n_classkind
: AClasskind
577 readable var _n_id
: nullable TClassid = null
578 readable var _n_formaldefs
: List[AFormaldef] = new List[AFormaldef]
579 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
580 readable var _n_superclasses
: List[ASuperclass] = new List[ASuperclass]
581 readable var _n_kwend
: TKwend
582 redef fun hot_location
do return n_id
.location
585 # The implicit class definition of the implicit main method
590 # The implicit class definition of the top-level methods
595 # The modifier for the kind of class (abstract, interface, etc.)
596 abstract class AClasskind
599 class AConcreteClasskind
601 readable var _n_kwclass
: TKwclass
603 class AAbstractClasskind
605 readable var _n_kwabstract
: TKwabstract
606 readable var _n_kwclass
: TKwclass
608 class AInterfaceClasskind
610 readable var _n_kwinterface
: TKwinterface
614 readable var _n_kwenum
: TKwenum
616 class AExternClasskind
618 readable var _n_kwextern
: TKwextern
619 readable var _n_kwclass
: nullable TKwclass = null
622 # The definition of a formal generic parameter type. eg `X: Y`
625 readable var _n_id
: TClassid
626 # The bound of the parameter type
627 readable var _n_type
: nullable AType = null
630 # A super-class. eg `super X`
633 readable var _n_kwsuper
: TKwsuper
634 readable var _n_type
: AType
637 # The definition of a property
638 abstract class APropdef
640 readable var _n_doc
: nullable ADoc = null
643 # A definition of an attribute
644 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
647 readable var _n_kwredef
: nullable TKwredef = null
648 readable var _n_visibility
: AVisibility
649 readable var _n_kwvar
: TKwvar
651 # The identifier for an old-style attribute (null if new-style)
652 readable var _n_id
: nullable TAttrid
654 # The identifier for a new-style attribute (null if old-style)
655 readable var _n_id2
: nullable TId
657 readable var _n_type
: nullable AType = null
658 readable var _n_readable
: nullable AAble = null
659 readable var _n_writable
: nullable AAble = null
661 # The initial value, if any
662 readable var _n_expr
: nullable AExpr = null
663 redef fun hot_location
665 if n_id
!= null then return n_id
.location
else return n_id2
.location
669 # A definition of all kind of method (including constructors)
670 abstract class AMethPropdef
672 readable var _n_kwredef
: nullable TKwredef = null
673 readable var _n_visibility
: nullable AVisibility
674 readable var _n_methid
: nullable AMethid = null
675 readable var _n_signature
: nullable ASignature
676 redef fun hot_location
678 if n_methid
!= null then
679 return n_methid
.location
686 # A method marked abstract
687 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
688 class ADeferredMethPropdef
690 readable var _n_kwmeth
: TKwmeth
693 # A method marked intern
694 class AInternMethPropdef
696 readable var _n_kwmeth
: TKwmeth
699 # A method of a constructor marked extern
700 abstract class AExternPropdef
702 readable var _n_extern
: nullable TString = null
703 readable var _n_extern_calls
: nullable AExternCalls = null
704 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
707 # A method marked extern
708 class AExternMethPropdef
710 readable var _n_kwmeth
: TKwmeth
713 # A method with a body
714 class AConcreteMethPropdef
716 readable var _n_kwmeth
: nullable TKwmeth
717 readable var _n_block
: nullable AExpr = null
721 abstract class AInitPropdef
725 # A constructor with a body
726 class AConcreteInitPropdef
727 super AConcreteMethPropdef
729 readable var _n_kwinit
: TKwinit
730 redef fun hot_location
do return n_kwinit
.location
733 # A constructor marked extern (defined with the `new` keyword)
734 class AExternInitPropdef
737 readable var _n_kwnew
: TKwnew
740 # The implicit main method
741 class AMainMethPropdef
742 super AConcreteMethPropdef
745 # Declaration of callbacks for extern methods
748 readable var _n_kwimport
: TKwimport
749 readable var _n_extern_calls
: List[AExternCall] = new List[AExternCall]
751 abstract class AExternCall
754 abstract class APropExternCall
757 class ALocalPropExternCall
758 super APropExternCall
759 readable var _n_methid
: AMethid
761 class AFullPropExternCall
762 super APropExternCall
763 readable var _n_classid
: TClassid
764 readable var _n_quad
: nullable TQuad = null
765 readable var _n_methid
: AMethid
767 class AInitPropExternCall
768 super APropExternCall
769 readable var _n_classid
: TClassid
771 class ASuperExternCall
773 readable var _n_kwsuper
: TKwsuper
775 abstract class ACastExternCall
778 class ACastAsExternCall
779 super ACastExternCall
780 readable var _n_from_type
: AType
781 readable var _n_kwas
: TKwas
782 readable var _n_to_type
: AType
784 class AAsNullableExternCall
785 super ACastExternCall
786 readable var _n_type
: AType
787 readable var _n_kwas
: TKwas
788 readable var _n_kwnullable
: TKwnullable
790 class AAsNotNullableExternCall
791 super ACastExternCall
792 readable var _n_type
: AType
793 readable var _n_kwas
: TKwas
794 readable var _n_kwnot
: TKwnot
795 readable var _n_kwnullable
: TKwnullable
798 # A definition of a virtual type
801 readable var _n_kwredef
: nullable TKwredef = null
802 readable var _n_visibility
: AVisibility
803 readable var _n_kwtype
: TKwtype
804 readable var _n_id
: TClassid
805 readable var _n_type
: AType
808 # A `writable` or `readable` modifier
811 readable var _n_visibility
: nullable AVisibility = null
812 readable var _n_kwredef
: nullable TKwredef = null
815 # A `readable` modifier
818 readable var _n_kwreadable
: TKwreadable
821 # A `writable` modifier
824 readable var _n_kwwritable
: TKwwritable
827 # The identifier of a method in a method declaration.
828 # There is a specific class because of operator and setters.
829 abstract class AMethid
834 readable var _n_id
: TId
838 readable var _n_plus
: TPlus
842 readable var _n_minus
: TMinus
846 readable var _n_star
: TStar
850 readable var _n_slash
: TSlash
854 readable var _n_percent
: TPercent
858 readable var _n_eq
: TEq
862 readable var _n_ne
: TNe
866 readable var _n_le
: TLe
870 readable var _n_ge
: TGe
874 readable var _n_lt
: TLt
878 readable var _n_gt
: TGt
882 readable writable var _n_ll
: TLl
886 readable writable var _n_gg
: TGg
890 readable var _n_obra
: TObra
891 readable var _n_cbra
: TCbra
893 class AStarshipMethid
895 readable var _n_starship
: TStarship
899 readable var _n_id
: TId
900 readable var _n_assign
: TAssign
902 class ABraassignMethid
904 readable var _n_obra
: TObra
905 readable var _n_cbra
: TCbra
906 readable var _n_assign
: TAssign
909 # A signature in a method definition. eg `(x,y:X,z:Z):T`
912 readable var _n_opar
: nullable TOpar = null
913 readable var _n_params
: List[AParam] = new List[AParam]
914 readable var _n_cpar
: nullable TCpar = null
915 readable var _n_type
: nullable AType = null
916 readable var _n_closure_decls
: List[AClosureDecl] = new List[AClosureDecl]
919 # A parameter definition in a signature. eg `x:X`
922 readable var _n_id
: TId
923 readable var _n_type
: nullable AType = null
924 readable var _n_dotdotdot
: nullable TDotdotdot = null
929 readable var _n_kwbreak
: nullable TKwbreak = null
930 readable var _n_bang
: TBang
931 readable var _n_id
: TId
932 readable var _n_signature
: ASignature
933 readable var _n_expr
: nullable AExpr = null
936 # A static type. eg `nullable X[Y]`
939 readable var _n_kwnullable
: nullable TKwnullable = null
941 # The name of the class or of the formal type
942 readable var _n_id
: TClassid
944 # Type arguments for a generic type
945 readable var _n_types
: List[AType] = new List[AType]
948 # A label at the end of a block or in a break/continue statement. eg `label x`
951 readable var _n_kwlabel
: TKwlabel
952 readable var _n_id
: TId
955 # Expression and statements
956 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
961 # A sequence of AExpr (usually statements)
962 # The last AExpr gives the value of the whole block
965 readable var _n_expr
: List[AExpr] = new List[AExpr]
966 readable var _n_kwend
: nullable TKwend = null
969 # A declaration of a local variable. eg `var x: X = y`
972 readable var _n_kwvar
: TKwvar
973 readable var _n_id
: TId
974 readable var _n_type
: nullable AType = null
975 readable var _n_assign
: nullable TAssign = null
977 # The initial value, if any
978 readable var _n_expr
: nullable AExpr = null
981 # A `return` statement. eg `return x`
984 readable var _n_kwreturn
: nullable TKwreturn = null
985 readable var _n_expr
: nullable AExpr = null
988 # Something that has a label.
989 abstract class ALabelable
991 readable var _n_label
: nullable ALabel = null
994 # A `break` statement.
998 readable var _n_kwbreak
: TKwbreak
999 readable var _n_expr
: nullable AExpr = null
1002 # An `abort` statement
1005 readable var _n_kwabort
: TKwabort
1008 # A `continue` statement
1012 readable var _n_kwcontinue
: nullable TKwcontinue = null
1013 readable var _n_expr
: nullable AExpr = null
1020 readable var _n_kwdo
: TKwdo
1021 readable var _n_block
: nullable AExpr = null
1027 readable var _n_kwif
: TKwif
1028 readable var _n_expr
: AExpr
1029 readable var _n_then
: nullable AExpr = null
1030 readable var _n_else
: nullable AExpr = null
1036 readable var _n_kwif
: TKwif
1037 readable var _n_expr
: AExpr
1038 readable var _n_kwthen
: TKwthen
1039 readable var _n_then
: AExpr
1040 readable var _n_kwelse
: TKwelse
1041 readable var _n_else
: AExpr
1044 # A `while` statement
1048 readable var _n_kwwhile
: TKwwhile
1049 readable var _n_expr
: AExpr
1050 readable var _n_kwdo
: TKwdo
1051 readable var _n_block
: nullable AExpr = null
1054 # A `loop` statement
1058 readable var _n_kwloop
: TKwloop
1059 readable var _n_block
: nullable AExpr = null
1066 readable var _n_kwfor
: TKwfor
1067 readable var _n_ids
: List[TId] = new List[TId]
1068 readable var _n_expr
: AExpr
1069 readable var _n_kwdo
: TKwdo
1070 readable var _n_block
: nullable AExpr = null
1073 # An `assert` statement
1076 readable var _n_kwassert
: TKwassert
1077 readable var _n_id
: nullable TId = null
1078 readable var _n_expr
: AExpr
1079 readable var _n_else
: nullable AExpr = null
1082 # Whatever is a simple assignment. eg `= something`
1083 abstract class AAssignFormExpr
1085 readable var _n_assign
: TAssign
1086 readable var _n_value
: AExpr
1089 # Whatever is a combined assignment. eg `+= something`
1090 abstract class AReassignFormExpr
1092 readable var _n_assign_op
: AAssignOp
1093 readable var _n_value
: AExpr
1096 # A `once` expression. eg `once x`
1099 readable var _n_kwonce
: TKwonce
1102 # A polymorphic invocation of a method
1103 # The form of the invocation (name, arguments, etc) are specific
1104 abstract class ASendExpr
1106 # The receiver of the method invocation
1107 readable var _n_expr
: AExpr
1108 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1111 # A binary operation on a method
1112 abstract class ABinopExpr
1114 # The second operand of the operation
1115 # Note: the receiver (`n_expr`) is the first operand
1116 readable var _n_expr2
: AExpr
1119 # Something that is boolean expression
1120 abstract class ABoolExpr
1127 readable var _n_expr
: AExpr
1128 readable var _n_expr2
: AExpr
1131 # A `and` expression
1134 readable var _n_expr
: AExpr
1135 readable var _n_expr2
: AExpr
1138 # A `or else` expression
1141 readable var _n_expr
: AExpr
1142 readable var _n_expr2
: AExpr
1145 # A `not` expression
1148 readable var _n_kwnot
: TKwnot
1149 readable var _n_expr
: AExpr
1160 readable var _n_expr
: AExpr
1161 readable var _n_expr2
: AExpr
1199 # A type-ckeck expression. eg `x isa T`
1202 readable var _n_expr
: AExpr
1203 readable var _n_type
: AType
1216 # A `<=>` expression
1236 # A unary minus expression. eg `-x`
1239 readable var _n_minus
: TMinus
1242 # An explicit instantiation. eg `new T`
1245 readable var _n_kwnew
: TKwnew
1246 readable var _n_type
: AType
1248 # The name of the named-constructor, if any
1249 readable var _n_id
: nullable TId = null
1250 readable var _n_args
: AExprs
1253 # Whatever is a old-style attribute access
1254 abstract class AAttrFormExpr
1257 # The receiver of the attribute
1258 readable var _n_expr
: AExpr
1260 # The name of the attribute
1261 readable var _n_id
: TAttrid
1264 # The read of an attribute. eg `x._a`
1269 # The assignment of an attribute. eg `x._a=y`
1270 class AAttrAssignExpr
1272 super AAssignFormExpr
1275 # Whatever looks-like a call with a standard method and any number of arguments.
1276 abstract class ACallFormExpr
1279 # The name of the method
1280 readable var _n_id
: TId
1282 # The arguments of the call
1283 readable var _n_args
: AExprs
1286 # A complex setter call (standard or brackets)
1287 abstract class ASendReassignFormExpr
1289 super AReassignFormExpr
1292 # A complex attribute assignment. eg `x._a+=y`
1293 class AAttrReassignExpr
1295 super AReassignFormExpr
1298 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1299 # 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.
1300 # Semantic analysis have to transform them to instance of `AVarExpr`.
1305 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1306 # 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.
1307 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1308 class ACallAssignExpr
1310 super AAssignFormExpr
1313 # 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.
1314 # 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.
1315 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1316 class ACallReassignExpr
1318 super ASendReassignFormExpr
1321 # A call to `super`. OR a call of a super-constructor
1324 readable var _n_qualified
: nullable AQualified = null
1325 readable var _n_kwsuper
: TKwsuper
1326 readable var _n_args
: AExprs
1329 # A call to the `init` constructor.
1330 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr
1333 readable var _n_kwinit
: TKwinit
1334 readable var _n_args
: AExprs
1337 # Whatever looks-like a call of the brackets `[]` operator.
1338 abstract class ABraFormExpr
1340 readable var _n_args
: AExprs
1343 # A call of the brackets operator. eg `x[y,z]`
1348 # A setter call of the bracket operator. eg `x[y,z]=t`
1349 class ABraAssignExpr
1351 super AAssignFormExpr
1354 # Whatever is an access to a local variable
1355 abstract class AVarFormExpr
1357 readable var _n_id
: TId
1360 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1361 class ABraReassignExpr
1363 super ASendReassignFormExpr
1366 class AClosureCallExpr
1368 readable var _n_id
: TId
1369 readable var _n_args
: AExprs
1370 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1373 # A local variable read access.
1374 # The parser cannot instantiate them, see `ACallExpr`.
1379 # A local variable simple assigment access
1380 # The parser cannot instantiate them, see `ACallAssingExpr`.
1381 class AVarAssignExpr
1383 super AAssignFormExpr
1386 # A local variable complex assignment access
1387 # The parser cannot instantiate them, see `ACallReassingExpr`.
1388 class AVarReassignExpr
1390 super AReassignFormExpr
1393 # A literal range, open or closed
1394 abstract class ARangeExpr
1396 readable var _n_expr
: AExpr
1397 readable var _n_expr2
: AExpr
1400 # A closed literal range. eg `[x..y]`
1403 readable var _n_obra
: TObra
1404 readable var _n_cbra
: TCbra
1407 # An open literal range. eg `[x..y[`
1410 readable var _n_obra
: TObra
1411 readable var _n_cbra
: TObra
1414 # A literal array. eg. `[x,y,z]`
1417 readable var _n_exprs
: AExprs
1423 readable var _n_kwself
: nullable TKwself
1426 # When there is no explicit receiver, `self` is implicit
1427 class AImplicitSelfExpr
1431 # A `true` boolean literal constant
1434 readable var _n_kwtrue
: TKwtrue
1436 # A `false` boolean literal constant
1439 readable var _n_kwfalse
: TKwfalse
1441 # A `null` literal constant
1444 readable var _n_kwnull
: TKwnull
1446 # An integer literal
1449 readable var _n_number
: TNumber
1454 readable var _n_float
: TFloat
1456 # A character literal
1459 readable var _n_char
: TChar
1462 abstract class AStringFormExpr
1464 readable var _n_string
: Token
1467 # A simple string. eg. `"abc"`
1469 super AStringFormExpr
1472 # The start of a superstring. eg `"abc{`
1473 class AStartStringExpr
1474 super AStringFormExpr
1477 # The middle of a superstring. eg `}abc{`
1478 class AMidStringExpr
1479 super AStringFormExpr
1482 # The end of a superstrng. eg `}abc"`
1483 class AEndStringExpr
1484 super AStringFormExpr
1487 # A superstring literal. eg "a{x}b{y}c"
1488 # Each part is modelized a sequence of expression. eg. ["a{, x, }b{, y, }c"]
1489 class ASuperstringExpr
1491 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1494 # A simple parenthesis. eg `(x)`
1497 readable var _n_opar
: TOpar
1498 readable var _n_cpar
: TCpar
1501 # Whatevej just contains (and mimic) an other expression
1502 abstract class AProxyExpr
1504 readable var _n_expr
: AExpr
1507 # A type cast. eg `x.as(T)`
1510 readable var _n_expr
: AExpr
1511 readable var _n_kwas
: TKwas
1512 readable var _n_opar
: TOpar
1513 readable var _n_type
: AType
1514 readable var _n_cpar
: TCpar
1517 # A as-not-null cast. eg `x.as(not null)`
1518 class AAsNotnullExpr
1520 readable var _n_expr
: AExpr
1521 readable var _n_kwas
: TKwas
1522 readable var _n_opar
: TOpar
1523 readable var _n_kwnot
: TKwnot
1524 readable var _n_kwnull
: TKwnull
1525 readable var _n_cpar
: TCpar
1528 # A is-set check of old-style attributes. eg `isset x._a`
1529 class AIssetAttrExpr
1531 readable var _n_kwisset
: TKwisset
1534 # A list of expression separated with commas (arguments for instance)
1535 abstract class AExprs
1537 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1540 class ADebugTypeExpr
1542 readable var _n_kwdebug
: TKwdebug
1543 readable var _n_kwtype
: TKwtype
1544 readable var _n_expr
: AExpr
1545 readable var _n_type
: AType
1548 # A simple list of expressions
1553 # A list of expressions enclosed in parentheses
1556 readable var _n_opar
: TOpar
1557 readable var _n_cpar
: TCpar
1560 # A list of expressions enclosed in brackets
1563 readable var _n_obra
: TObra
1564 readable var _n_cbra
: TCbra
1567 # A complex assignment operator. eg `+=`
1568 abstract class AAssignOp
1573 readable var _n_pluseq
: TPluseq
1575 class AMinusAssignOp
1577 readable var _n_minuseq
: TMinuseq
1582 readable var _n_bang
: TBang
1583 readable var _n_id
: AClosureId
1584 readable var _n_ids
: List[TId] = new List[TId]
1585 readable var _n_kwdo
: nullable TKwdo = null
1586 readable var _n_expr
: nullable AExpr = null
1587 redef fun hot_location
do return n_id
.location
1589 abstract class AClosureId
1592 class ASimpleClosureId
1594 readable var _n_id
: TId
1596 class ABreakClosureId
1598 readable var _n_kwbreak
: TKwbreak
1602 readable var _n_quad
: nullable TQuad = null
1603 readable var _n_path
: List[TId] = new List[TId]
1604 readable var _n_id
: TId
1608 readable var _n_kwin
: TKwin
1609 readable var _n_string
: TString
1611 class AExternCodeBlock
1613 readable var _n_in_language
: nullable AInLanguage = null
1614 readable var _n_extern_code_segment
: TExternCodeSegment
1618 readable var _n_quad
: nullable TQuad = null
1619 readable var _n_id
: List[TId] = new List[TId]
1620 readable var _n_classid
: nullable TClassid = null
1623 # A documentation of a definition
1624 # It contains the block of comments just above the declaration
1627 readable var _n_comment
: List[TComment] = new List[TComment]
1632 readable var _n_at
: nullable TAt = null
1633 readable var _n_opar
: nullable TOpar = null
1634 readable var _n_items
: List[AAnnotation] = new List[AAnnotation]
1635 readable var _n_cpar
: nullable TCpar = null
1639 readable var _n_atid
: AAtid
1640 readable var _n_opar
: nullable TOpar = null
1641 readable var _n_args
: List[AAtArg] = new List[AAtArg]
1642 readable var _n_cpar
: nullable TCpar = null
1644 abstract class AAtArg
1649 readable var _n_type
: AType
1653 readable var _n_expr
: AExpr
1658 abstract class AAtid
1660 readable var _n_id
: Token
1671 class AKwreadableAtid
1674 class AKwwritableAtid
1681 # The root of the AST
1684 readable var _n_base
: nullable AModule
1685 readable var _n_eof
: EOF
1686 init(n_base
: nullable AModule, n_eof
: EOF)
1688 self._n_base
= n_base