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
: 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 if e
== null then return
114 var old
= _current_node
120 # The current visited node
121 readable var _current_node
: nullable ANode = null
124 # Token of end of line (basically `\n`)
133 # Token of a line of comments
134 # Starts with the `#` and contains the final end-of-line (if any)
139 # A token associated with a keyword
140 abstract class TokenKeyword
144 return "keyword '{text}'"
319 # A token associated with an operator (and other lookalike symbols)
320 abstract class TokenOperator
324 return "operator '{text}'"
391 # A class (or formal type) identifier. They start with an uppercase.
396 do return "type identifier '{text}'"
400 # A standard identifier (variable, method...). They start with a lowercase.
405 do return "identifier '{text}'"
409 # An attribute identifier. They start with an underscore.
414 do return "attribute '{text}'"
418 # A token of a literal value (string, integer, etc).
419 abstract class TokenLiteral
423 do return "literal value '{text}'"
453 do return "malformed string {text}"
462 do return "malformed character {text}"
466 class TExternCodeSegment
490 # The main node of a Nit source-file
494 readable var _n_moduledecl
: nullable AModuledecl = null
495 readable var _n_imports
: List[AImport] = new List[AImport]
496 readable var _n_extern_code_blocks
: List[AExternCodeBlock] = new List[AExternCodeBlock]
497 readable var _n_classdefs
: List[AClassdef] = new List[AClassdef]
500 # The declaration of the module with the documentation, name, and annotations
503 readable var _n_doc
: nullable ADoc = null
504 readable var _n_kwmodule
: TKwmodule
505 readable var _n_name
: AModuleName
508 # A import clause of a module
509 abstract class AImport
513 # A standard import clause. eg `import x`
516 readable var _n_visibility
: AVisibility
517 readable var _n_kwimport
: TKwimport
518 readable var _n_name
: AModuleName
521 # The special import clause of the kernel module. eg `import end`
524 readable var _n_visibility
: AVisibility
525 readable var _n_kwimport
: TKwimport
526 readable var _n_kwend
: TKwend
529 # A visibility modifier
531 # The public visibility is an empty production (no keyword).
533 # Note: even if some visibilities are only valid on some placse (for instance, no `protected` class or no `intrude` method)
534 # the parser has no such a restriction, therefore the semantic phases has to check that the visibilities make sense.
535 abstract class AVisibility
538 class APublicVisibility
541 class APrivateVisibility
543 readable var _n_kwprivate
: TKwprivate
545 class AProtectedVisibility
547 readable var _n_kwprotected
: TKwprotected
549 class AIntrudeVisibility
551 readable var _n_kwintrude
: TKwintrude
555 # While most definition are `AStdClassdef`
556 # There is tow special case of class definition
557 abstract class AClassdef super Prod
558 readable var _n_propdefs
: List[APropdef] = new List[APropdef]
561 # A standard class definition with a name, superclasses and properties
564 readable var _n_doc
: nullable ADoc = null
565 readable var _n_kwredef
: nullable TKwredef = null
566 readable var _n_visibility
: AVisibility
567 readable var _n_classkind
: AClasskind
568 readable var _n_id
: nullable TClassid = null
569 readable var _n_formaldefs
: List[AFormaldef] = new List[AFormaldef]
570 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
571 readable var _n_superclasses
: List[ASuperclass] = new List[ASuperclass]
572 readable var _n_kwend
: TKwend
573 redef fun hot_location
do return n_id
.location
576 # The implicit class definition of the implicit main method
581 # The implicit class definition of the top-level methods
586 # The modifier for the kind of class (abstract, interface, etc.)
587 abstract class AClasskind
590 class AConcreteClasskind
592 readable var _n_kwclass
: TKwclass
594 class AAbstractClasskind
596 readable var _n_kwabstract
: TKwabstract
597 readable var _n_kwclass
: TKwclass
599 class AInterfaceClasskind
601 readable var _n_kwinterface
: TKwinterface
605 readable var _n_kwenum
: TKwenum
607 class AExternClasskind
609 readable var _n_kwextern
: TKwextern
610 readable var _n_kwclass
: nullable TKwclass = null
613 # The definition of a formal generic parameter type. eg `X: Y`
616 readable var _n_id
: TClassid
617 # The bound of the parameter type
618 readable var _n_type
: nullable AType = null
621 # A super-class. eg `super X`
624 readable var _n_kwsuper
: TKwsuper
625 readable var _n_type
: AType
628 # The definition of a property
629 abstract class APropdef
631 readable var _n_doc
: nullable ADoc = null
634 # A definition of an attribute
635 # For historical reason, old-syle and new-style attributes use the same `ANode` sub-class
638 readable var _n_kwredef
: nullable TKwredef = null
639 readable var _n_visibility
: AVisibility
640 readable var _n_kwvar
: TKwvar
642 # The identifier for an old-style attribute (null if new-style)
643 readable var _n_id
: nullable TAttrid
645 # The identifier for a new-style attribute (null if old-style)
646 readable var _n_id2
: nullable TId
648 readable var _n_type
: nullable AType = null
649 readable var _n_readable
: nullable AAble = null
650 readable var _n_writable
: nullable AAble = null
652 # The initial value, if any
653 readable var _n_expr
: nullable AExpr = null
654 redef fun hot_location
656 if n_id
!= null then return n_id
.location
else return n_id2
.location
660 # A definition of all kind of method (including constructors)
661 abstract class AMethPropdef
663 readable var _n_kwredef
: nullable TKwredef = null
664 readable var _n_visibility
: nullable AVisibility
665 readable var _n_methid
: nullable AMethid = null
666 readable var _n_signature
: nullable ASignature
667 redef fun hot_location
669 if n_methid
!= null then
670 return n_methid
.location
677 # A method marked abstract
678 # *deferred* is a old synonynmous of *abstract* that comes from PRM, that comes from Eiffel.
679 class ADeferredMethPropdef
681 readable var _n_kwmeth
: TKwmeth
684 # A method marked intern
685 class AInternMethPropdef
687 readable var _n_kwmeth
: TKwmeth
690 # A method of a constructor marked extern
691 abstract class AExternPropdef
693 readable var _n_extern
: nullable TString = null
694 readable var _n_extern_calls
: nullable AExternCalls = null
695 readable var _n_extern_code_block
: nullable AExternCodeBlock = null
698 # A method marked extern
699 class AExternMethPropdef
701 readable var _n_kwmeth
: TKwmeth
704 # A method with a body
705 class AConcreteMethPropdef
707 readable var _n_kwmeth
: nullable TKwmeth
708 readable var _n_block
: nullable AExpr = null
712 abstract class AInitPropdef
716 # A constructor with a body
717 class AConcreteInitPropdef
718 super AConcreteMethPropdef
720 readable var _n_kwinit
: TKwinit
721 redef fun hot_location
do return n_kwinit
.location
724 # A constructor marked extern (defined with the `new` keyword)
725 class AExternInitPropdef
728 readable var _n_kwnew
: TKwnew
731 # The implicit main method
732 class AMainMethPropdef
733 super AConcreteMethPropdef
736 # Declaration of callbacks for extern methods
739 readable var _n_kwimport
: TKwimport
740 readable var _n_extern_calls
: List[AExternCall] = new List[AExternCall]
742 abstract class AExternCall
745 abstract class APropExternCall
748 class ALocalPropExternCall
749 super APropExternCall
750 readable var _n_methid
: AMethid
752 class AFullPropExternCall
753 super APropExternCall
754 readable var _n_classid
: TClassid
755 readable var _n_quad
: nullable TQuad = null
756 readable var _n_methid
: AMethid
758 class AInitPropExternCall
759 super APropExternCall
760 readable var _n_classid
: TClassid
762 class ASuperExternCall
764 readable var _n_kwsuper
: TKwsuper
766 abstract class ACastExternCall
769 class ACastAsExternCall
770 super ACastExternCall
771 readable var _n_from_type
: AType
772 readable var _n_kwas
: TKwas
773 readable var _n_to_type
: AType
775 class AAsNullableExternCall
776 super ACastExternCall
777 readable var _n_type
: AType
778 readable var _n_kwas
: TKwas
779 readable var _n_kwnullable
: TKwnullable
781 class AAsNotNullableExternCall
782 super ACastExternCall
783 readable var _n_type
: AType
784 readable var _n_kwas
: TKwas
785 readable var _n_kwnot
: TKwnot
786 readable var _n_kwnullable
: TKwnullable
789 # A definition of a virtual type
792 readable var _n_kwredef
: nullable TKwredef = null
793 readable var _n_visibility
: AVisibility
794 readable var _n_kwtype
: TKwtype
795 readable var _n_id
: TClassid
796 readable var _n_type
: AType
799 # A `writable` or `readable` modifier
802 readable var _n_visibility
: nullable AVisibility = null
803 readable var _n_kwredef
: nullable TKwredef = null
806 # A `readable` modifier
809 readable var _n_kwreadable
: TKwreadable
812 # A `writable` modifier
815 readable var _n_kwwritable
: TKwwritable
818 # The identifier of a method in a method declaration.
819 # There is a specific class because of operator and setters.
820 abstract class AMethid
825 readable var _n_id
: TId
829 readable var _n_plus
: TPlus
833 readable var _n_minus
: TMinus
837 readable var _n_star
: TStar
841 readable var _n_slash
: TSlash
845 readable var _n_percent
: TPercent
849 readable var _n_eq
: TEq
853 readable var _n_ne
: TNe
857 readable var _n_le
: TLe
861 readable var _n_ge
: TGe
865 readable var _n_lt
: TLt
869 readable var _n_gt
: TGt
873 readable writable var _n_ll
: TLl
877 readable writable var _n_gg
: TGg
881 readable var _n_obra
: TObra
882 readable var _n_cbra
: TCbra
884 class AStarshipMethid
886 readable var _n_starship
: TStarship
890 readable var _n_id
: TId
891 readable var _n_assign
: TAssign
893 class ABraassignMethid
895 readable var _n_obra
: TObra
896 readable var _n_cbra
: TCbra
897 readable var _n_assign
: TAssign
900 # A signature in a method definition. eg `(x,y:X,z:Z):T`
903 readable var _n_opar
: nullable TOpar = null
904 readable var _n_params
: List[AParam] = new List[AParam]
905 readable var _n_cpar
: nullable TCpar = null
906 readable var _n_type
: nullable AType = null
907 readable var _n_closure_decls
: List[AClosureDecl] = new List[AClosureDecl]
910 # A parameter definition in a signature. eg `x:X`
913 readable var _n_id
: TId
914 readable var _n_type
: nullable AType = null
915 readable var _n_dotdotdot
: nullable TDotdotdot = null
920 readable var _n_kwbreak
: nullable TKwbreak = null
921 readable var _n_bang
: TBang
922 readable var _n_id
: TId
923 readable var _n_signature
: ASignature
924 readable var _n_expr
: nullable AExpr = null
927 # A static type. eg `nullable X[Y]`
930 readable var _n_kwnullable
: nullable TKwnullable = null
932 # The name of the class or of the formal type
933 readable var _n_id
: TClassid
935 # Type arguments for a generic type
936 readable var _n_types
: List[AType] = new List[AType]
939 # A label at the end of a block or in a break/continue statement. eg `label x`
942 readable var _n_kwlabel
: TKwlabel
943 readable var _n_id
: TId
946 # Expression and statements
947 # From a AST point of view there is no distinction between statement and expressions (even if the parser has to distinguish them)
952 # A sequence of AExpr (usually statements)
953 # The last AExpr gives the value of the whole block
956 readable var _n_expr
: List[AExpr] = new List[AExpr]
957 readable var _n_kwend
: nullable TKwend = null
960 # A declaration of a local variable. eg `var x: X = y`
963 readable var _n_kwvar
: TKwvar
964 readable var _n_id
: TId
965 readable var _n_type
: nullable AType = null
966 readable var _n_assign
: nullable TAssign = null
968 # The initial value, if any
969 readable var _n_expr
: nullable AExpr = null
972 # A `return` statement. eg `return x`
975 readable var _n_kwreturn
: nullable TKwreturn = null
976 readable var _n_expr
: nullable AExpr = null
979 # Something that has a label.
980 abstract class ALabelable
982 readable var _n_label
: nullable ALabel = null
985 # A `break` statement.
989 readable var _n_kwbreak
: TKwbreak
990 readable var _n_expr
: nullable AExpr = null
993 # An `abort` statement
996 readable var _n_kwabort
: TKwabort
999 # A `continue` statement
1003 readable var _n_kwcontinue
: nullable TKwcontinue = null
1004 readable var _n_expr
: nullable AExpr = null
1011 readable var _n_kwdo
: TKwdo
1012 readable var _n_block
: nullable AExpr = null
1018 readable var _n_kwif
: TKwif
1019 readable var _n_expr
: AExpr
1020 readable var _n_then
: nullable AExpr = null
1021 readable var _n_else
: nullable AExpr = null
1027 readable var _n_kwif
: TKwif
1028 readable var _n_expr
: AExpr
1029 readable var _n_kwthen
: TKwthen
1030 readable var _n_then
: AExpr
1031 readable var _n_kwelse
: TKwelse
1032 readable var _n_else
: AExpr
1035 # A `while` statement
1039 readable var _n_kwwhile
: TKwwhile
1040 readable var _n_expr
: AExpr
1041 readable var _n_kwdo
: TKwdo
1042 readable var _n_block
: nullable AExpr = null
1045 # A `loop` statement
1049 readable var _n_kwloop
: TKwloop
1050 readable var _n_block
: nullable AExpr = null
1057 readable var _n_kwfor
: TKwfor
1058 readable var _n_ids
: List[TId] = new List[TId]
1059 readable var _n_expr
: AExpr
1060 readable var _n_kwdo
: TKwdo
1061 readable var _n_block
: nullable AExpr = null
1064 # An `assert` statement
1067 readable var _n_kwassert
: TKwassert
1068 readable var _n_id
: nullable TId = null
1069 readable var _n_expr
: AExpr
1070 readable var _n_else
: nullable AExpr = null
1073 # Whatever is a simple assignment. eg `= something`
1074 abstract class AAssignFormExpr
1076 readable var _n_assign
: TAssign
1077 readable var _n_value
: AExpr
1080 # Whatever is a combined assignment. eg `+= something`
1081 abstract class AReassignFormExpr
1083 readable var _n_assign_op
: AAssignOp
1084 readable var _n_value
: AExpr
1087 # A `once` expression. eg `once x`
1090 readable var _n_kwonce
: TKwonce
1093 # A polymorphic invocation of a method
1094 # The form of the invocation (name, arguments, etc) are specific
1095 abstract class ASendExpr
1097 # The receiver of the method invocation
1098 readable var _n_expr
: AExpr
1099 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1102 # A binary operation on a method
1103 abstract class ABinopExpr
1105 # The second operand of the operation
1106 # Note: the receiver (`n_expr`) is the first operand
1107 readable var _n_expr2
: AExpr
1110 # Something that is boolean expression
1111 abstract class ABoolExpr
1118 readable var _n_expr
: AExpr
1119 readable var _n_expr2
: AExpr
1122 # A `and` expression
1125 readable var _n_expr
: AExpr
1126 readable var _n_expr2
: AExpr
1129 # A `or else` expression
1132 readable var _n_expr
: AExpr
1133 readable var _n_expr2
: AExpr
1136 # A `not` expression
1139 readable var _n_kwnot
: TKwnot
1140 readable var _n_expr
: AExpr
1151 readable var _n_expr
: AExpr
1152 readable var _n_expr2
: AExpr
1190 # A type-ckeck expression. eg `x isa T`
1193 readable var _n_expr
: AExpr
1194 readable var _n_type
: AType
1207 # A `<=>` expression
1227 # A unary minus expression. eg `-x`
1230 readable var _n_minus
: TMinus
1233 # An explicit instantiation. eg `new T`
1236 readable var _n_kwnew
: TKwnew
1237 readable var _n_type
: AType
1239 # The name of the named-constructor, if any
1240 readable var _n_id
: nullable TId = null
1241 readable var _n_args
: AExprs
1244 # Whatever is a old-style attribute access
1245 abstract class AAttrFormExpr
1248 # The receiver of the attribute
1249 readable var _n_expr
: AExpr
1251 # The name of the attribute
1252 readable var _n_id
: TAttrid
1255 # The read of an attribute. eg `x._a`
1260 # The assignment of an attribute. eg `x._a=y`
1261 class AAttrAssignExpr
1263 super AAssignFormExpr
1266 # Whatever looks-like a call with a standard method and any number of arguments.
1267 abstract class ACallFormExpr
1270 # The name of the method
1271 readable var _n_id
: TId
1273 # The arguments of the call
1274 readable var _n_args
: AExprs
1277 # A complex setter call (standard or brackets)
1278 abstract class ASendReassignFormExpr
1280 super AReassignFormExpr
1283 # A complex attribute assignment. eg `x._a+=y`
1284 class AAttrReassignExpr
1286 super AReassignFormExpr
1289 # A call with a standard method-name and any number of arguments. eg `x.m(y)`. OR just a simple id
1290 # 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.
1291 # Semantic analysis have to transform them to instance of `AVarExpr`.
1296 # A setter call with a standard method-name and any number of arguments. eg `x.m(y)=z`. OR just a simple assignment.
1297 # 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.
1298 # Semantic analysis have to transform them to instance of `AVarAssignExpr`.
1299 class ACallAssignExpr
1301 super AAssignFormExpr
1304 # 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.
1305 # 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.
1306 # Semantic analysis have to transform them to instance of `AVarReassignExpr`.
1307 class ACallReassignExpr
1309 super ASendReassignFormExpr
1312 # A call to `super`. OR a call of a super-constructor
1315 readable var _n_qualified
: nullable AQualified = null
1316 readable var _n_kwsuper
: TKwsuper
1317 readable var _n_args
: AExprs
1320 # A call to the `init` constructor.
1321 # Note: because `init` is a keyword and not a `TId`, the explicit call to init cannot be a ACallFormExpr
1324 readable var _n_kwinit
: TKwinit
1325 readable var _n_args
: AExprs
1328 # Whatever looks-like a call of the brackets `[]` operator.
1329 abstract class ABraFormExpr
1331 readable var _n_args
: AExprs
1334 # A call of the brackets operator. eg `x[y,z]`
1339 # A setter call of the bracket operator. eg `x[y,z]=t`
1340 class ABraAssignExpr
1342 super AAssignFormExpr
1345 # Whatever is an access to a local variable
1346 abstract class AVarFormExpr
1348 readable var _n_id
: TId
1351 # A complex setter call of the bracket operator. eg `x[y,z]+=t`
1352 class ABraReassignExpr
1354 super ASendReassignFormExpr
1357 class AClosureCallExpr
1359 readable var _n_id
: TId
1360 readable var _n_args
: AExprs
1361 readable var _n_closure_defs
: List[AClosureDef] = new List[AClosureDef]
1364 # A local variable read access.
1365 # The parser cannot instantiate them, see `ACallExpr`.
1370 # A local variable simple assigment access
1371 # The parser cannot instantiate them, see `ACallAssingExpr`.
1372 class AVarAssignExpr
1374 super AAssignFormExpr
1377 # A local variable complex assignment access
1378 # The parser cannot instantiate them, see `ACallReassingExpr`.
1379 class AVarReassignExpr
1381 super AReassignFormExpr
1384 # A literal range, open or closed
1385 abstract class ARangeExpr
1387 readable var _n_expr
: AExpr
1388 readable var _n_expr2
: AExpr
1391 # A closed literal range. eg `[x..y]`
1394 readable var _n_obra
: TObra
1395 readable var _n_cbra
: TCbra
1398 # An open literal range. eg `[x..y[`
1401 readable var _n_obra
: TObra
1402 readable var _n_cbra
: TObra
1405 # A literal array. eg. `[x,y,z]`
1408 readable var _n_exprs
: AExprs
1414 readable var _n_kwself
: nullable TKwself
1417 # When there is no explicit receiver, `self` is implicit
1418 class AImplicitSelfExpr
1422 # A `true` boolean literal constant
1425 readable var _n_kwtrue
: TKwtrue
1427 # A `false` boolean literal constant
1430 readable var _n_kwfalse
: TKwfalse
1432 # A `null` literal constant
1435 readable var _n_kwnull
: TKwnull
1437 # An integer literal
1440 readable var _n_number
: TNumber
1445 readable var _n_float
: TFloat
1447 # A character literal
1450 readable var _n_char
: TChar
1453 abstract class AStringFormExpr
1455 readable var _n_string
: Token
1458 # A simple string. eg. `"abc"`
1460 super AStringFormExpr
1463 # The start of a superstring. eg `"abc{`
1464 class AStartStringExpr
1465 super AStringFormExpr
1468 # The middle of a superstring. eg `}abc{`
1469 class AMidStringExpr
1470 super AStringFormExpr
1473 # The end of a superstrng. eg `}abc"`
1474 class AEndStringExpr
1475 super AStringFormExpr
1478 # A superstring literal. eg "a{x}b{y}c"
1479 # Each part is modelized a sequence of expression. eg. ["a{, x, }b{, y, }c"]
1480 class ASuperstringExpr
1482 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1485 # A simple parenthesis. eg `(x)`
1488 readable var _n_opar
: TOpar
1489 readable var _n_cpar
: TCpar
1492 # Whatevej just contains (and mimic) an other expression
1493 abstract class AProxyExpr
1495 readable var _n_expr
: AExpr
1498 # A type cast. eg `x.as(T)`
1501 readable var _n_expr
: AExpr
1502 readable var _n_kwas
: TKwas
1503 readable var _n_opar
: TOpar
1504 readable var _n_type
: AType
1505 readable var _n_cpar
: TCpar
1508 # A as-not-null cast. eg `x.as(not null)`
1509 class AAsNotnullExpr
1511 readable var _n_expr
: AExpr
1512 readable var _n_kwas
: TKwas
1513 readable var _n_opar
: TOpar
1514 readable var _n_kwnot
: TKwnot
1515 readable var _n_kwnull
: TKwnull
1516 readable var _n_cpar
: TCpar
1519 # A is-set check of old-style attributes. eg `isset x._a`
1520 class AIssetAttrExpr
1522 readable var _n_kwisset
: TKwisset
1525 # A list of expression separated with commas (arguments for instance)
1526 abstract class AExprs
1528 readable var _n_exprs
: List[AExpr] = new List[AExpr]
1531 class ADebugTypeExpr
1533 readable var _n_kwdebug
: TKwdebug
1534 readable var _n_kwtype
: TKwtype
1535 readable var _n_expr
: AExpr
1536 readable var _n_type
: AType
1539 # A simple list of expressions
1544 # A list of expressions enclosed in parentheses
1547 readable var _n_opar
: TOpar
1548 readable var _n_cpar
: TCpar
1551 # A list of expressions enclosed in brackets
1554 readable var _n_obra
: TObra
1555 readable var _n_cbra
: TCbra
1558 # A complex assignment operator. eg `+=`
1559 abstract class AAssignOp
1564 readable var _n_pluseq
: TPluseq
1566 class AMinusAssignOp
1568 readable var _n_minuseq
: TMinuseq
1573 readable var _n_bang
: TBang
1574 readable var _n_id
: AClosureId
1575 readable var _n_ids
: List[TId] = new List[TId]
1576 readable var _n_kwdo
: nullable TKwdo = null
1577 readable var _n_expr
: nullable AExpr = null
1578 redef fun hot_location
do return n_id
.location
1580 abstract class AClosureId
1583 class ASimpleClosureId
1585 readable var _n_id
: TId
1587 class ABreakClosureId
1589 readable var _n_kwbreak
: TKwbreak
1593 readable var _n_quad
: nullable TQuad = null
1594 readable var _n_path
: List[TId] = new List[TId]
1595 readable var _n_id
: TId
1599 readable var _n_kwin
: TKwin
1600 readable var _n_string
: TString
1602 class AExternCodeBlock
1604 readable var _n_in_language
: nullable AInLanguage = null
1605 readable var _n_extern_code_segment
: TExternCodeSegment
1609 readable var _n_quad
: nullable TQuad = null
1610 readable var _n_id
: List[TId] = new List[TId]
1611 readable var _n_classid
: nullable TClassid = null
1614 # A documentation of a definition
1615 # It contains the block of comments just above the declaration
1618 readable var _n_comment
: List[TComment] = new List[TComment]
1623 readable var _n_at
: nullable TAt = null
1624 readable var _n_opar
: nullable TOpar = null
1625 readable var _n_items
: List[AAnnotation] = new List[AAnnotation]
1626 readable var _n_cpar
: nullable TCpar = null
1630 readable var _n_atid
: AAtid
1631 readable var _n_opar
: nullable TOpar = null
1632 readable var _n_args
: List[AAtArg] = new List[AAtArg]
1633 readable var _n_cpar
: nullable TCpar = null
1635 abstract class AAtArg
1640 readable var _n_type
: AType
1644 readable var _n_expr
: AExpr
1649 abstract class AAtid
1651 readable var _n_id
: Token
1662 class AKwreadableAtid
1665 class AKwwritableAtid
1672 # The root of the AST
1675 readable var _n_base
: nullable AModule
1676 readable var _n_eof
: EOF
1677 init(n_base
: nullable AModule, n_eof
: EOF)
1679 self._n_base
= n_base