Ancestor of all productions

A production is a node without text but that usually has children.

Introduced properties

private var _first_location: nullable Location

nitc :: Prod :: _first_location

Location on the first token after the start of a production
private var _first_token: nullable Token

nitc :: Prod :: _first_token

The first token of the production in the AST
private var _last_token: nullable Token

nitc :: Prod :: _last_token

The last token of the production in the AST
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private fun collect_comments: Array[TComment]

nitc :: Prod :: collect_comments

Collect all TComment contained in the production
fun collect_text: String

nitc :: Prod :: collect_text

Join the text of all visited tokens
fun first_location: nullable Location

nitc :: Prod :: first_location

Location on the first token after the start of a production
protected fun first_location=(first_location: nullable Location)

nitc :: Prod :: first_location=

Location on the first token after the start of a production
fun first_token: nullable Token

nitc :: Prod :: first_token

The first token of the production in the AST
protected fun first_token=(first_token: nullable Token)

nitc :: Prod :: first_token=

The first token of the production in the AST
fun get_annotations(name: String): Array[AAnnotation]

nitc :: Prod :: get_annotations

Return all its annotations of a given name in the order of their declaration
fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation

nitc :: Prod :: get_single_annotation

Try to get its single annotation with a given name
fun is_block: Bool

nitc :: Prod :: is_block

Is the production contained in full block of line?
fun is_span: Bool

nitc :: Prod :: is_span

Is the production a part of a single line (without being a block)
fun last_token: nullable Token

nitc :: Prod :: last_token

The last token of the production in the AST
protected fun last_token=(last_token: nullable Token)

nitc :: Prod :: last_token=

The last token of the production in the AST
fun n_annotations: nullable AAnnotations

nitc :: Prod :: n_annotations

All the annotations attached directly to the node
fun n_annotations=(n_annotations: nullable AAnnotations)

nitc :: Prod :: n_annotations=

All the annotations attached directly to the node
private fun start_token: nullable Token

nitc :: Prod :: start_token

The token where the production really start (skipping ADoc).
fun to_xml: HTMLTag

nitc :: Prod :: to_xml

A XML representation of the AST

Redefined properties

redef type SELF: Prod

nitc $ Prod :: SELF

Type of this instance, automatically specialized in every class
redef fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: pretty $ Prod :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
redef fun collect_length: Int

nitc :: pretty $ Prod :: collect_length

Collect the length (in Char) of the node.
redef fun replace_with(n: ANode)

nitc $ Prod :: replace_with

Replace itself with an other node in the AST
redef fun was_inline: Bool

nitc :: pretty $ Prod :: was_inline

Does self was written in one line before transformation?

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _first_location: nullable Location

nitc :: Prod :: _first_location

Location on the first token after the start of a production
private var _first_token: nullable Token

nitc :: Prod :: _first_token

The first token of the production in the AST
private var _force_block: Bool

nitc :: ANode :: _force_block

Force self to be rendered as a block.
private var _force_inline: Bool

nitc :: ANode :: _force_inline

Force self to be rendered as a line.
private var _is_broken: Bool

nitc :: ANode :: _is_broken

The indication that the node did not pass some semantic verifications.
private var _last_token: nullable Token

nitc :: Prod :: _last_token

The last token of the production in the AST
private var _location: Location

nitc :: ANode :: _location

Location is set during AST building. Once built, location can not be null.
private var _n_annotations: nullable AAnnotations

nitc :: Prod :: _n_annotations

All the annotations attached directly to the node
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
fun accept_forward_analysis(v: ForwardAnalysis)

nitc :: ANode :: accept_forward_analysis

Apply the forward analysis v to self.
private abstract fun accept_pretty_printer(v: PrettyPrinterVisitor)

nitc :: ANode :: accept_pretty_printer

Start visit of self using a PrettyPrinterVisitor
fun accept_reaching_defs(v: ReachingDefsAnalysis)

nitc :: ANode :: accept_reaching_defs

Apply a ReachingDefsAnalysis to self.
private fun bad_expr_message(child: AExpr): nullable String

nitc :: ANode :: bad_expr_message

An additional information message to explain the role of a child expression.
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
abstract fun clone: SELF

core :: Cloneable :: clone

Duplicate self
fun collect_annotations_by_name(name: String): Array[AAnnotation]

nitc :: ANode :: collect_annotations_by_name

Do a deep search and return an array of node that are annotated
private fun collect_comments: Array[TComment]

nitc :: Prod :: collect_comments

Collect all TComment contained in the production
private abstract fun collect_length: Int

nitc :: ANode :: collect_length

Collect the length (in Char) of the node.
fun collect_text: String

nitc :: Prod :: collect_text

Join the text of all visited tokens
fun collect_tokens_by_text(text: String): Array[Token]

nitc :: ANode :: collect_tokens_by_text

Do a deep search and return an array of tokens that match a given text
fun common_parent(other: ANode): nullable ANode

nitc :: ANode :: common_parent

The most specific common parent between self and other
fun debug(message: String)

nitc :: ANode :: debug

Display a message for the colored location of the node
protected fun decorate_tag(v: HtmlightVisitor, res: HTMLTag, token: Token): nullable HInfoBox

nitc :: ANode :: decorate_tag

Add aditionnal information on a child-token and return an additionnal HInfoBox on it
fun depth: Int

nitc :: ANode :: depth

Number of nodes between self and the root of the AST
fun detach

nitc :: ANode :: detach

Detach a node from its parent
private fun do_cloneable(v: CloneVisitor)

nitc :: ANode :: do_cloneable

fun dump_info(v: ASTDump): String

nitc :: ANode :: dump_info

Information to display on a node
fun dump_tree(display_structural: nullable Bool, display_line: nullable Bool)

nitc :: ANode :: dump_tree

Write the subtree on stdout.
fun fatal(v: NaiveInterpreter, message: String)

nitc :: ANode :: fatal

Aborts the program with a message
fun first_location: nullable Location

nitc :: Prod :: first_location

Location on the first token after the start of a production
protected fun first_location=(first_location: nullable Location)

nitc :: Prod :: first_location=

Location on the first token after the start of a production
fun first_token: nullable Token

nitc :: Prod :: first_token

The first token of the production in the AST
protected fun first_token=(first_token: nullable Token)

nitc :: Prod :: first_token=

The first token of the production in the AST
private fun force_block: Bool

nitc :: ANode :: force_block

Force self to be rendered as a block.
private fun force_block=(force_block: Bool)

nitc :: ANode :: force_block=

Force self to be rendered as a block.
private fun force_inline: Bool

nitc :: ANode :: force_inline

Force self to be rendered as a line.
private fun force_inline=(force_inline: Bool)

nitc :: ANode :: force_inline=

Force self to be rendered as a line.
fun get_annotations(name: String): Array[AAnnotation]

nitc :: Prod :: get_annotations

Return all its annotations of a given name in the order of their declaration
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation

nitc :: Prod :: get_single_annotation

Try to get its single annotation with a given name
fun hash: Int

core :: Object :: hash

The hash code of the object.
fun hot_location: Location

nitc :: ANode :: hot_location

The location of the important part of the node (identifier or whatever)
fun infobox(v: HtmlightVisitor): nullable HInfoBox

nitc :: ANode :: infobox

Return a optional infobox
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_block: Bool

nitc :: Prod :: is_block

Is the production contained in full block of line?
fun is_broken: Bool

nitc :: ANode :: is_broken

The indication that the node did not pass some semantic verifications.
fun is_broken=(is_broken: Bool)

nitc :: ANode :: is_broken=

The indication that the node did not pass some semantic verifications.
private fun is_inlinable: Bool

nitc :: ANode :: is_inlinable

Is self printable in one line?
private fun is_noserialize: Bool

nitc :: ANode :: is_noserialize

Is this node annotated to not be made serializable?
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_serialize: Bool

nitc :: ANode :: is_serialize

Is this node annotated to be made serializable?
fun is_span: Bool

nitc :: Prod :: is_span

Is the production a part of a single line (without being a block)
fun is_structural: Bool

nitc :: ANode :: is_structural

Is self a token or a pure-structural production like AQId?
fun last_token: nullable Token

nitc :: Prod :: last_token

The last token of the production in the AST
protected fun last_token=(last_token: nullable Token)

nitc :: Prod :: last_token=

The last token of the production in the AST
fun location: Location

nitc :: ANode :: location

Location is set during AST building. Once built, location can not be null.
fun location=(location: Location)

nitc :: ANode :: location=

Location is set during AST building. Once built, location can not be null.
protected fun make_tag(v: HtmlightVisitor): nullable HTMLTag

nitc :: ANode :: make_tag

Optionally creates a tag that encapsulate the AST element on HTML rendering
private fun must_be_block: Bool

nitc :: ANode :: must_be_block

Does self have to be rendered as a block?
private fun must_be_inline: Bool

nitc :: ANode :: must_be_inline

Does self have be rendered as a line?
fun n_annotations: nullable AAnnotations

nitc :: Prod :: n_annotations

All the annotations attached directly to the node
fun n_annotations=(n_annotations: nullable AAnnotations)

nitc :: Prod :: n_annotations=

All the annotations attached directly to the node
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
fun parent: nullable ANode

nitc :: ANode :: parent

Parent of the node in the AST
protected fun parent=(parent: nullable ANode)

nitc :: ANode :: parent=

Parent of the node in the AST
fun parentize_tokens

nitc :: ANode :: parentize_tokens

Visit the AST and computes advanced AST attributes on Tokens and Prod
private abstract fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc :: ANode :: replace_child

Replace a child with an other node in the AST
fun replace_clone

nitc :: ANode :: replace_clone

Create a new clone of self
fun replace_with(node: ANode)

nitc :: ANode :: replace_with

Replace itself with an other node in the AST
fun root: ANode

nitc :: ANode :: root

The topmost ancestor of the element
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
private fun start_token: nullable Token

nitc :: Prod :: start_token

The token where the production really start (skipping ADoc).
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
fun to_xml: HTMLTag

nitc :: Prod :: to_xml

A XML representation of the AST
fun validate

nitc :: ANode :: validate

Recursively validate a AST node.
abstract fun visit_all(v: Visitor)

nitc :: ANode :: visit_all

Visit all nodes in order.
private abstract fun was_inline: Bool

nitc :: ANode :: was_inline

Does self was written in one line before transformation?
package_diagram nitc::Prod Prod nitc::ANode ANode nitc::Prod->nitc::ANode core::Cloneable Cloneable nitc::ANode->core::Cloneable ...core::Cloneable ... ...core::Cloneable->core::Cloneable nitc::Prod... ... nitc::Prod...->nitc::Prod

Ancestors

interface Cloneable

core :: Cloneable

Something that can be cloned
interface Object

core :: Object

The root of the class hierarchy.

Parents

abstract class ANode

nitc :: ANode

Root of the AST class-hierarchy

Children

class AAnnotations

nitc :: AAnnotations

A group of annotation on a node
abstract class AAssignOp

nitc :: AAssignOp

A complex assignment operator. (+= and -=)
abstract class AAtid

nitc :: AAtid

An annotation name
abstract class AClassdef

nitc :: AClassdef

A class definition
abstract class AClasskind

nitc :: AClasskind

The modifier for the kind of class (abstract, interface, etc.)
abstract class ADefinition

nitc :: ADefinition

Abstract class for definition of entities
class ADoc

nitc :: ADoc

A documentation of a definition
abstract class AExpr

nitc :: AExpr

Expression and statements
abstract class AExprs

nitc :: AExprs

A list of expression separated with commas (arguments for instance)
abstract class AExternCall

nitc :: AExternCall

A single callback declaration
class AExternCalls

nitc :: AExternCalls

Declaration of callbacks for extern methods
class AExternCodeBlock

nitc :: AExternCodeBlock

An full extern block
class AForGroup

nitc :: AForGroup

A collection iterated by a for, its automatic variables and its implicit iterator.
class AFormaldef

nitc :: AFormaldef

The definition of a formal generic parameter type. eg X: Y
abstract class AImport

nitc :: AImport

A import clause of a module
class AInLanguage

nitc :: AInLanguage

A language declaration for an extern block
class ALabel

nitc :: ALabel

A label at the end of a block or in a break/continue statement. eg label x
abstract class ALabelable

nitc :: ALabelable

Something that has a label.
abstract class AMethid

nitc :: AMethid

The identifier of a method in a method declaration.
class AModule

nitc :: AModule

The main node of a Nit source-file
class AModuleName

nitc :: AModuleName

A possibly fully-qualified module identifier
class AParam

nitc :: AParam

A parameter definition in a signature. eg x:X
class AQclassid

nitc :: AQclassid

A potentially qualified class identifier foo::bar::Baz
class AQid

nitc :: AQid

A potentially qualified simple identifier foo::bar::baz
class AQualified

nitc :: AQualified

A possible full method qualifier.
class ASignature

nitc :: ASignature

A signature in a method definition. eg (x,y:X,z:Z):T
class AType

nitc :: AType

A static type. eg nullable X[Y]
abstract class AVisibility

nitc :: AVisibility

A visibility modifier
class Start

nitc :: Start

The root of the AST

Descendants

class AAbortExpr

nitc :: AAbortExpr

An abort statement
class AAbstractClasskind

nitc :: AAbstractClasskind

An abstract class modifier (abstract class)
class AAmpAssignOp

nitc :: AAmpAssignOp

A &= assignment operation
class AAmpExpr

nitc :: AAmpExpr

A & expression
class AAmpMethid

nitc :: AAmpMethid

A method name &
class AAndExpr

nitc :: AAndExpr

A and expression
class AAnnotation

nitc :: AAnnotation

A single annotation
class AArrayExpr

nitc :: AArrayExpr

A literal array. eg. [x,y,z]
class AAsCastExpr

nitc :: AAsCastExpr

A type cast. eg x.as(T)
class AAsCastForm

nitc :: AAsCastForm

A cast, against a type or not null
class AAsNotNullableExternCall

nitc :: AAsNotNullableExternCall

A single callback declaration on a cast to a non-nullable type
class AAsNotnullExpr

nitc :: AAsNotnullExpr

A as-not-null cast. eg x.as(not null)
class AAsNullableExternCall

nitc :: AAsNullableExternCall

A single callback declaration on a cast to a nullable type
class AAssertExpr

nitc :: AAssertExpr

An assert statement
abstract class AAssignFormExpr

nitc :: AAssignFormExpr

Whatever is a simple assignment. eg = something
class AAssignMethid

nitc :: AAssignMethid

A setter method name with a simple identifier (with a =)
class AAtExpr

nitc :: AAtExpr

A special expression that encapsulate an annotation
class AAttrAssignExpr

nitc :: AAttrAssignExpr

The assignment of an attribute. eg x._a=y
class AAttrExpr

nitc :: AAttrExpr

The read of an attribute. eg x._a
abstract class AAttrFormExpr

nitc :: AAttrFormExpr

Whatever is a old-style attribute access
class AAttrPropdef

nitc :: AAttrPropdef

A definition of an attribute
class AAttrReassignExpr

nitc :: AAttrReassignExpr

A complex attribute assignment. eg x._a+=y
abstract class ABinBoolExpr

nitc :: ABinBoolExpr

Something that is binary boolean expression
private class ABinOpHelper

nitc :: ABinOpHelper

Used to factorize work on Or, And, Implies and Binop expressions.
abstract class ABinopExpr

nitc :: ABinopExpr

A binary operation on a method
class ABlockExpr

nitc :: ABlockExpr

A sequence of AExpr (usually statements)
abstract class ABoolExpr

nitc :: ABoolExpr

Something that is boolean expression
class ABraAssignExpr

nitc :: ABraAssignExpr

A setter call of the bracket operator. eg x[y,z]=t
class ABraExpr

nitc :: ABraExpr

A call of the brackets operator. eg x[y,z]
class ABraExprs

nitc :: ABraExprs

A list of expressions enclosed in brackets
abstract class ABraFormExpr

nitc :: ABraFormExpr

Whatever looks-like a call of the brackets [] operator.
class ABraMethid

nitc :: ABraMethid

A method name []
class ABraReassignExpr

nitc :: ABraReassignExpr

A complex setter call of the bracket operator. eg x[y,z]+=t
class ABraassignMethid

nitc :: ABraassignMethid

A method name []=
class ABreakExpr

nitc :: ABreakExpr

A break statement.
class ACallAssignExpr

nitc :: ACallAssignExpr

A setter call with a standard method-name and any number of arguments. eg x.m(y)=z. OR just a simple assignment.
class ACallExpr

nitc :: ACallExpr

A call with a standard method-name and any number of arguments. eg x.m(y). OR just a simple id
abstract class ACallFormExpr

nitc :: ACallFormExpr

Whatever looks-like a call with a standard method and any number of arguments.
class ACallReassignExpr

nitc :: ACallReassignExpr

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.
class ACallrefExpr

nitc :: ACallrefExpr

A reference to a method with a captured receiver. eg. &x.foo or just &foo is self is captured.
class ACaretAssignOp

nitc :: ACaretAssignOp

A ^= assignment operation
class ACaretExpr

nitc :: ACaretExpr

A ^ expression
class ACaretMethid

nitc :: ACaretMethid

A method name ^
class ACastAsExternCall

nitc :: ACastAsExternCall

A single callback declaration on a cast to a given type
abstract class ACastExternCall

nitc :: ACastExternCall

A single callback declaration on a cast
class ACharExpr

nitc :: ACharExpr

A character literal
class AConcreteClasskind

nitc :: AConcreteClasskind

A default, or concrete class modifier (just class)
class AContinueExpr

nitc :: AContinueExpr

A continue statement
class ACrangeExpr

nitc :: ACrangeExpr

A closed literal range. eg [x..y]
class ADebugTypeExpr

nitc :: ADebugTypeExpr

A special expression to debug types
class ADoExpr

nitc :: ADoExpr

A do statement
class AEndStringExpr

nitc :: AEndStringExpr

The end of a superstrng. eg }abc"
class AEnumClasskind

nitc :: AEnumClasskind

An enum/universal class modifier (enum class)
class AEqExpr

nitc :: AEqExpr

A == expression
class AEqFormExpr

nitc :: AEqFormExpr

A == or a != expression
class AEqMethid

nitc :: AEqMethid

A method name ==
abstract class AEscapeExpr

nitc :: AEscapeExpr

A break or a continue
class AExternClasskind

nitc :: AExternClasskind

An extern class modifier (extern class)
class AFalseExpr

nitc :: AFalseExpr

A false boolean literal constant
class AFloatExpr

nitc :: AFloatExpr

A float literal
class AForExpr

nitc :: AForExpr

A for statement
class AFullPropExternCall

nitc :: AFullPropExternCall

A single callback declaration on a method on an explicit receiver type.
class AGeExpr

nitc :: AGeExpr

A >= expression
class AGeMethid

nitc :: AGeMethid

A method name >=
class AGgAssignOp

nitc :: AGgAssignOp

A >>= assignment operation
class AGgExpr

nitc :: AGgExpr

A >> expression
class AGgMethid

nitc :: AGgMethid

A method name >>
class AGtExpr

nitc :: AGtExpr

A > expression
class AGtMethid

nitc :: AGtMethid

A method name >
class AIdAtid

nitc :: AIdAtid

An annotation name based on an identifier
class AIdMethid

nitc :: AIdMethid

A method name with a simple identifier
class AIfExpr

nitc :: AIfExpr

A if statement
class AIfexprExpr

nitc :: AIfexprExpr

A if expression (ternary conditional). eg. if true then 1 else 0
class AImplicitSelfExpr

nitc :: AImplicitSelfExpr

When there is no explicit receiver, self is implicit
class AImpliesExpr

nitc :: AImpliesExpr

A implies expression
class AInitExpr

nitc :: AInitExpr

A call to the init constructor.
class AInitPropExternCall

nitc :: AInitPropExternCall

A single callback declaration on a method on a constructor
class AIntegerExpr

nitc :: AIntegerExpr

An integer literal
class AInterfaceClasskind

nitc :: AInterfaceClasskind

An interface class modifier (interface)
class AIntrudeVisibility

nitc :: AIntrudeVisibility

An explicit intrude visibility modifier
class AIsaExpr

nitc :: AIsaExpr

A type-ckeck expression. eg x isa T
class AIssetAttrExpr

nitc :: AIssetAttrExpr

A is-set check of old-style attributes. eg isset x._a
class AKwabstractAtid

nitc :: AKwabstractAtid

An annotation name based on the keyword abstract
class AKwexternAtid

nitc :: AKwexternAtid

An annotation name based on the keyword extern
class AKwimportAtid

nitc :: AKwimportAtid

An annotation name based on the keyword import
class ALeExpr

nitc :: ALeExpr

A <= expression
class ALeMethid

nitc :: ALeMethid

A method name <=
class AListExprs

nitc :: AListExprs

A simple list of expressions
class ALlAssignOp

nitc :: ALlAssignOp

A <<= assignment operation
class ALlExpr

nitc :: ALlExpr

A << expression
class ALlMethid

nitc :: ALlMethid

A method name <<
class ALocalPropExternCall

nitc :: ALocalPropExternCall

A single callback declaration on a method on the current receiver
class ALoopExpr

nitc :: ALoopExpr

A loop statement
private class ALoopHelper

nitc :: ALoopHelper

Used to factorize work on loops.
class ALtExpr

nitc :: ALtExpr

A < expression
class ALtMethid

nitc :: ALtMethid

A method name <
class AMainClassdef

nitc :: AMainClassdef

The implicit class definition of the top-level methods
class AMainMethPropdef

nitc :: AMainMethPropdef

The implicit main method
class AManyExpr

nitc :: AManyExpr

A list of expression separated with commas (arguments for instance)
class AMethPropdef

nitc :: AMethPropdef

A definition of all kind of method (including constructors)
class AMethidExpr

nitc :: AMethidExpr

A special expression that encapsulates a method identifier
class AMidStringExpr

nitc :: AMidStringExpr

The middle of a superstring. eg }abc{
class AMinusAssignOp

nitc :: AMinusAssignOp

A -= assignment operation
class AMinusExpr

nitc :: AMinusExpr

A - expression
class AMinusMethid

nitc :: AMinusMethid

A method name -
class AModuledecl

nitc :: AModuledecl

The declaration of the module with the documentation, name, and annotations
class ANamedargExpr

nitc :: ANamedargExpr

An named notation used to pass an expression by name in a parameter
class ANeExpr

nitc :: ANeExpr

A != expression
class ANeMethid

nitc :: ANeMethid

A method name !=
class ANewExpr

nitc :: ANewExpr

An explicit instantiation. eg new T
class ANoImport

nitc :: ANoImport

The special import clause of the kernel module. eg import end
class ANotExpr

nitc :: ANotExpr

A not expression
class ANullExpr

nitc :: ANullExpr

A null literal constant
class AOnceExpr

nitc :: AOnceExpr

A once expression. eg once x
class AOperatorMethid

nitc :: AOperatorMethid

A method name for an operator
class AOrElseExpr

nitc :: AOrElseExpr

A or else expression
class AOrExpr

nitc :: AOrExpr

A or expression
class AOrangeExpr

nitc :: AOrangeExpr

An open literal range. eg [x..y[
class AParExpr

nitc :: AParExpr

A simple parenthesis. eg (x)
class AParExprs

nitc :: AParExprs

A list of expressions enclosed in parentheses
class APercentAssignOp

nitc :: APercentAssignOp

A %= assignment operation
class APercentExpr

nitc :: APercentExpr

A % expression
class APercentMethid

nitc :: APercentMethid

A method name %
class APipeAssignOp

nitc :: APipeAssignOp

A |= assignment operation
class APipeExpr

nitc :: APipeExpr

A | expression
class APipeMethid

nitc :: APipeMethid

A method name |
class APlaceholderExpr

nitc :: APlaceholderExpr

A placeholder for a AExpr node
class APlusAssignOp

nitc :: APlusAssignOp

A += assignment operation
class APlusExpr

nitc :: APlusExpr

A + expression
class APlusMethid

nitc :: APlusMethid

A method name +
class APrivateVisibility

nitc :: APrivateVisibility

An explicit private visibility modifier
abstract class APropExternCall

nitc :: APropExternCall

A single callback declaration on a method
abstract class APropdef

nitc :: APropdef

The definition of a property
class AProtectedVisibility

nitc :: AProtectedVisibility

An explicit protected visibility modifier
class APublicVisibility

nitc :: APublicVisibility

An implicit or explicit public visibility modifier
abstract class ARangeExpr

nitc :: ARangeExpr

A literal range, open or closed
abstract class AReassignFormExpr

nitc :: AReassignFormExpr

Whatever is a combined assignment. eg += something
class AReturnExpr

nitc :: AReturnExpr

A return statement. eg return x
class ASafeExpr

nitc :: ASafeExpr

A receiver with a ? suffix used in safe call operator.
class ASelfExpr

nitc :: ASelfExpr

A read of self
abstract class ASendExpr

nitc :: ASendExpr

A polymorphic invocation of a method
abstract class ASendReassignFormExpr

nitc :: ASendReassignFormExpr

A complex setter call (standard or brackets)
class ASlashAssignOp

nitc :: ASlashAssignOp

A /= assignment operation
class ASlashExpr

nitc :: ASlashExpr

A / expression
class ASlashMethid

nitc :: ASlashMethid

A method name /
class AStarAssignOp

nitc :: AStarAssignOp

A *= assignment operation
class AStarExpr

nitc :: AStarExpr

A * expression
class AStarMethid

nitc :: AStarMethid

A method name *
class AStarshipExpr

nitc :: AStarshipExpr

A <=> expression
class AStarshipMethid

nitc :: AStarshipMethid

A method name <=>
class AStarstarAssignOp

nitc :: AStarstarAssignOp

A **= assignment operation
class AStarstarExpr

nitc :: AStarstarExpr

A ** expression
class AStarstarMethid

nitc :: AStarstarMethid

A method name **
class AStartStringExpr

nitc :: AStartStringExpr

The start of a superstring. eg "abc{
class AStdClassdef

nitc :: AStdClassdef

A standard class definition with a name, superclasses and properties
class AStdImport

nitc :: AStdImport

A standard import clause. eg import x
class AStringExpr

nitc :: AStringExpr

A simple string. eg. "abc"
abstract class AStringFormExpr

nitc :: AStringFormExpr

A string literal
class ASuperExpr

nitc :: ASuperExpr

A call to super. OR a call of a super-constructor
class ASuperExternCall

nitc :: ASuperExternCall

A single callback declaration on a super call
class ASuperPropdef

nitc :: ASuperPropdef

A super-class. eg super X
class ASuperstringExpr

nitc :: ASuperstringExpr

A superstring literal. eg "a{x}b{y}c"
class ATildeMethid

nitc :: ATildeMethid

A method name ~
class ATopClassdef

nitc :: ATopClassdef

The implicit class definition of the implicit main method
class ATrueExpr

nitc :: ATrueExpr

A true boolean literal constant
class ATypeExpr

nitc :: ATypeExpr

A special expression that encapsulates a static type
class ATypePropdef

nitc :: ATypePropdef

A definition of a virtual type
class AUminusExpr

nitc :: AUminusExpr

A unary minus expression. eg -x
abstract class AUnaryopExpr

nitc :: AUnaryopExpr

A unary operation on a method
class AUplusExpr

nitc :: AUplusExpr

A unary plus expression. eg +x
class AUtildeExpr

nitc :: AUtildeExpr

A unary ~ expression
class AVarAssignExpr

nitc :: AVarAssignExpr

A local variable simple assignment access
class AVarExpr

nitc :: AVarExpr

A local variable read access.
abstract class AVarFormExpr

nitc :: AVarFormExpr

Whatever is an access to a local variable
class AVarReassignExpr

nitc :: AVarReassignExpr

A local variable complex assignment access
class AVarargExpr

nitc :: AVarargExpr

An ellipsis notation used to pass an expression as it, in a vararg parameter
class AVardeclExpr

nitc :: AVardeclExpr

A declaration of a local variable. eg var x: X = y
class AWhileExpr

nitc :: AWhileExpr

A while statement
class AWithExpr

nitc :: AWithExpr

A with statement
class AYieldExpr

nitc :: AYieldExpr

A yield statement. eg yield x
class AugmentedStringFormExpr

nitc :: AugmentedStringFormExpr

Any kind of string form with augmentations from prefixes or suffixes

Class definitions

nitc $ Prod
# Ancestor of all productions
# A production is a node without text but that usually has children.
abstract class Prod
	super ANode

	# All the annotations attached directly to the node
	var n_annotations: nullable AAnnotations = null is writable

	# Return all its annotations of a given name in the order of their declaration
	# Retun an empty array if no such an annotation.
	fun get_annotations(name: String): Array[AAnnotation]
	do
		var res = new Array[AAnnotation]
		var nas = n_annotations
		if nas != null then for na in nas.n_items do
			if na.name != name then continue
			res.add(na)
		end
		if self isa AClassdef then for na in n_propdefs do
			if na isa AAnnotPropdef then
				if na.name != name then continue
				res.add na
			end
		end

		return res
	end

	redef fun replace_with(n: ANode)
	do
		super
		assert n isa Prod
		if not isset n._location and isset _location then n._location = _location
	end
end
src/parser/parser_nodes.nit:424,1--458,3

nitc :: parser_work $ Prod
redef class Prod
	# Location on the first token after the start of a production
	# So outside the production for epsilon production
	var first_location: nullable Location

	# Join the text of all visited tokens
	fun collect_text: String
	do
		var v = new TextCollectorVisitor
		v.enter_visit(self)
		assert v.text != ""
		return v.text
	end
end
src/parser/parser_work.nit:161,1--174,3

nitc :: astutil $ Prod
redef class Prod
	# The first token of the production in the AST
	# Computed by `parentize_tokens`
	var first_token: nullable Token = null

	# The last token of the production in the AST
	# Computed by `parentize_tokens`
	var last_token: nullable Token = null

	# Is the production contained in full block of line?
	# Computed by `parentize_tokens`
	fun is_block: Bool
	do
		if first_token == null or last_token == null then return false
		#sys.stderr.write "{self}@{location}: start={first_token.is_starting_line} {first_token.inspect}@{first_token.location} ; end={last_token.is_ending_line} {last_token.inspect}@{last_token.location}\n"
		return first_token.is_starting_line and last_token.is_ending_line
	end

	# Is the production a part of a single line (without being a block)
	# Computed by `parentize_tokens`
	fun is_span: Bool
	do
		if first_token == null or last_token == null then return false
		return not is_block and location.line_start == location.line_end
	end

	# A XML representation of the AST
	# Productions and token become elements
	# 
	# detached tokens and whitespaces are preserved in the XML
	# 
	# ~~~
	# import parser_util
	# var text = "y += foo"
	# var ast = (new ToolContext).parse_something(text)
	# assert ast isa AExpr
	# ast.parentize_tokens
	# assert ast.to_xml.write_to_string == """<ACallReassignExpr><AQid><TId>y</TId></AQid> <APlusAssignOp><TPluseq>+=</TPluseq></APlusAssignOp> <ACallExpr><AQid><TId>foo</TId></AQid></ACallExpr></ACallReassignExpr>"""
	# ~~~
	fun to_xml: HTMLTag
	do
		var res = new HTMLTag("AST")
		var stack = new Array[HTMLTag]
		var c = first_token
		while c != null do
			if c != first_token then res.append(c.blank_before)
			var sp = c.starting_prods
			if sp != null then for p in sp do
				var tag = new HTMLTag(p.class_name)
				res.add tag
				stack.add res
				res = tag
			end
			var tag = new HTMLTag(c.class_name)
			res.add tag
			tag.append c.text
			var ep = c.ending_prods
			if ep != null then for p in ep do
				res = stack.pop
			end

			if c == last_token then
				c = null
			else
				c = c.next_token
			end
		end
		assert stack.is_empty
		return res.children.first
	end
end
src/astutil.nit:37,1--107,3

nitc :: annotation $ Prod
redef class Prod
	super ANode

	# Try to get its single annotation with a given name
	# If there is no such an annotation, null is returned.
	# If there is more than one annotation, a error message is printed and the first annotation is returned
	fun get_single_annotation(name: String, modelbuilder: ModelBuilder): nullable AAnnotation
	do
		var res = get_annotations(name)
		if res.is_empty then return null
		if res.length > 1 then
			modelbuilder.error(res[1], "Syntax Error: multiple `{name}`. A previous one is defined line {res[0].location.line_start}.")
		end
		return res.first
	end
end
src/annotation.nit:22,1--37,3

nitc :: pretty $ Prod
redef class Prod
	redef fun accept_pretty_printer(v) do v.visit first_token

	# The token where the production really start (skipping ADoc).
	private fun start_token: nullable Token do return first_token

	# Collect all `TComment` contained in the production
	# (between `start_token` and `end_token`).
	private fun collect_comments: Array[TComment] do
		var res = new Array[TComment]
		if start_token == null or last_token == null then return res
		var token = start_token

		while token != last_token do
			if token isa TComment then res.add token
			token = token.next_token
		end

		return res
	end

	redef fun collect_length do
		var res = 0
		if start_token == null or last_token == null then return res
		var token = start_token

		while token != last_token do
			res += token.text.length
			token = token.next_token
		end

		res += token.text.length
		return res
	end

	redef fun was_inline do
		return start_token.location.line_start == last_token.location.line_end
	end
end
src/pretty.nit:370,1--408,3