Ancestor of all tokens

A token is a node that has a text but no children.

Introduced properties

private var _cached_text: nullable String

nitc :: Token :: _cached_text

private var _ending_prods: nullable Array[Prod]

nitc :: Token :: _ending_prods

The productions that ends with self, if any
private var _first_ast_token: nullable Token

nitc :: Token :: _first_ast_token

The first AST token.
private var _is_ending_line: Bool

nitc :: Token :: _is_ending_line

Is self the last AST token on its line in the source
private var _is_loose: Bool

nitc :: Token :: _is_loose

Is self a token discarded from the AST?
private var _is_starting_line: Bool

nitc :: Token :: _is_starting_line

Is self the first AST token on its line in the source
private var _last_ast_token: nullable Token

nitc :: Token :: _last_ast_token

The last AST token.
private var _next_looses: Array[Token]

nitc :: Token :: _next_looses

Loose tokens that follow self
private var _next_token: nullable Token

nitc :: Token :: _next_token

The next token in the Lexer.
private var _prev_looses: Array[Token]

nitc :: Token :: _prev_looses

Loose tokens that precede self.
private var _prev_token: nullable Token

nitc :: Token :: _prev_token

The previous token in the Lexer.
private var _starting_prods: nullable Array[Prod]

nitc :: Token :: _starting_prods

The productions that starts with self, if any
fun ansi_colored: String

nitc :: Token :: ansi_colored

Return the ANSI colored text
fun blank_before: String

nitc :: Token :: blank_before

The verbatim blank text between prev_token and self
private fun cached_text: nullable String

nitc :: Token :: cached_text

private fun cached_text=(cached_text: nullable String)

nitc :: Token :: cached_text=

fun ending_prods: nullable Array[Prod]

nitc :: Token :: ending_prods

The productions that ends with self, if any
protected fun ending_prods=(ending_prods: nullable Array[Prod])

nitc :: Token :: ending_prods=

The productions that ends with self, if any
private fun first_ast_token: nullable Token

nitc :: Token :: first_ast_token

The first AST token.
private fun first_ast_token=(first_ast_token: nullable Token)

nitc :: Token :: first_ast_token=

The first AST token.
fun first_real_token_in_line: Token

nitc :: Token :: first_real_token_in_line

The first real token that starts the line of self
fun first_token_in_line: nullable Token

nitc :: Token :: first_token_in_line

The first AST token that starts the line of self.
fun is_ending_line: Bool

nitc :: Token :: is_ending_line

Is self the last AST token on its line in the source
protected fun is_ending_line=(is_ending_line: Bool)

nitc :: Token :: is_ending_line=

Is self the last AST token on its line in the source
fun is_loose: Bool

nitc :: Token :: is_loose

Is self a token discarded from the AST?
protected fun is_loose=(is_loose: Bool)

nitc :: Token :: is_loose=

Is self a token discarded from the AST?
fun is_starting_line: Bool

nitc :: Token :: is_starting_line

Is self the first AST token on its line in the source
protected fun is_starting_line=(is_starting_line: Bool)

nitc :: Token :: is_starting_line=

Is self the first AST token on its line in the source
private fun last_ast_token: nullable Token

nitc :: Token :: last_ast_token

The last AST token.
private fun last_ast_token=(last_ast_token: nullable Token)

nitc :: Token :: last_ast_token=

The last AST token.
fun last_real_token_in_line: Token

nitc :: Token :: last_real_token_in_line

The last read token that ends the line of self
fun last_token_in_line: nullable Token

nitc :: Token :: last_token_in_line

The last AST token that starts the line of self
fun next_looses: Array[Token]

nitc :: Token :: next_looses

Loose tokens that follow self
protected fun next_looses=(next_looses: Array[Token])

nitc :: Token :: next_looses=

Loose tokens that follow self
fun next_token: nullable Token

nitc :: Token :: next_token

The next token in the Lexer.
protected fun next_token=(next_token: nullable Token)

nitc :: Token :: next_token=

The next token in the Lexer.
abstract fun parser_index: Int

nitc :: Token :: parser_index

fun prev_looses: Array[Token]

nitc :: Token :: prev_looses

Loose tokens that precede self.
protected fun prev_looses=(prev_looses: Array[Token])

nitc :: Token :: prev_looses=

Loose tokens that precede self.
fun prev_token: nullable Token

nitc :: Token :: prev_token

The previous token in the Lexer.
protected fun prev_token=(prev_token: nullable Token)

nitc :: Token :: prev_token=

The previous token in the Lexer.
fun starting_prods: nullable Array[Prod]

nitc :: Token :: starting_prods

The productions that starts with self, if any
protected fun starting_prods=(starting_prods: nullable Array[Prod])

nitc :: Token :: starting_prods=

The productions that starts with self, if any
abstract fun text: String

nitc :: Token :: text

The raw content on the token
abstract fun text=(text: String)

nitc :: Token :: text=

The raw content on the token

Redefined properties

redef type SELF: Token

nitc $ Token :: SELF

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

nitc :: pretty $ Token :: accept_pretty_printer

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

nitc :: pretty $ Token :: collect_length

Collect the length (in Char) of the node.
redef fun dump_info(v: ASTDump): String

nitc $ Token :: dump_info

Information to display on a node
redef fun is_inlinable: Bool

nitc :: pretty $ Token :: is_inlinable

Is self printable in one line?
redef fun is_structural: Bool

nitc $ Token :: is_structural

Is self a token or a pure-structural production like AQId?
redef fun make_tag(v: HtmlightVisitor): HTMLTag

nitc :: htmlight $ Token :: make_tag

Produce an HTMLTag with the correct contents and CSS classes
redef fun replace_child(old_child: ANode, new_child: nullable ANode)

nitc $ Token :: replace_child

Replace a child with an other node in the AST
redef fun text: String

nitc :: lexer_work $ Token :: text

The raw content on the token
redef fun text=(text: String)

nitc :: lexer_work $ Token :: text=

The raw content on the token
redef fun to_s: String

nitc $ Token :: to_s

User readable representation of self.
redef fun visit_all(v: Visitor)

nitc $ Token :: visit_all

Visit all nodes in order.
redef fun was_inline: Bool

nitc :: pretty $ Token :: 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 _cached_text: nullable String

nitc :: Token :: _cached_text

private var _ending_prods: nullable Array[Prod]

nitc :: Token :: _ending_prods

The productions that ends with self, if any
private var _first_ast_token: nullable Token

nitc :: Token :: _first_ast_token

The first AST token.
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 _is_ending_line: Bool

nitc :: Token :: _is_ending_line

Is self the last AST token on its line in the source
private var _is_loose: Bool

nitc :: Token :: _is_loose

Is self a token discarded from the AST?
private var _is_starting_line: Bool

nitc :: Token :: _is_starting_line

Is self the first AST token on its line in the source
private var _last_ast_token: nullable Token

nitc :: Token :: _last_ast_token

The last AST token.
private var _location: Location

nitc :: ANode :: _location

Location is set during AST building. Once built, location can not be null.
private var _next_looses: Array[Token]

nitc :: Token :: _next_looses

Loose tokens that follow self
private var _next_token: nullable Token

nitc :: Token :: _next_token

The next token in the Lexer.
private var _parent: nullable ANode

nitc :: ANode :: _parent

Parent of the node in the AST
private var _prev_looses: Array[Token]

nitc :: Token :: _prev_looses

Loose tokens that precede self.
private var _prev_token: nullable Token

nitc :: Token :: _prev_token

The previous token in the Lexer.
private var _starting_prods: nullable Array[Prod]

nitc :: Token :: _starting_prods

The productions that starts with self, if any
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.
fun ansi_colored: String

nitc :: Token :: ansi_colored

Return the ANSI colored text
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.
fun blank_before: String

nitc :: Token :: blank_before

The verbatim blank text between prev_token and self
private fun cached_text: nullable String

nitc :: Token :: cached_text

private fun cached_text=(cached_text: nullable String)

nitc :: Token :: cached_text=

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 abstract fun collect_length: Int

nitc :: ANode :: collect_length

Collect the length (in Char) of the node.
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 ending_prods: nullable Array[Prod]

nitc :: Token :: ending_prods

The productions that ends with self, if any
protected fun ending_prods=(ending_prods: nullable Array[Prod])

nitc :: Token :: ending_prods=

The productions that ends with self, if any
fun fatal(v: NaiveInterpreter, message: String)

nitc :: ANode :: fatal

Aborts the program with a message
private fun first_ast_token: nullable Token

nitc :: Token :: first_ast_token

The first AST token.
private fun first_ast_token=(first_ast_token: nullable Token)

nitc :: Token :: first_ast_token=

The first AST token.
fun first_real_token_in_line: Token

nitc :: Token :: first_real_token_in_line

The first real token that starts the line of self
fun first_token_in_line: nullable Token

nitc :: Token :: first_token_in_line

The first AST token that starts the line of self.
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_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
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_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.
fun is_ending_line: Bool

nitc :: Token :: is_ending_line

Is self the last AST token on its line in the source
protected fun is_ending_line=(is_ending_line: Bool)

nitc :: Token :: is_ending_line=

Is self the last AST token on its line in the source
private fun is_inlinable: Bool

nitc :: ANode :: is_inlinable

Is self printable in one line?
fun is_loose: Bool

nitc :: Token :: is_loose

Is self a token discarded from the AST?
protected fun is_loose=(is_loose: Bool)

nitc :: Token :: is_loose=

Is self a token discarded from the AST?
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_starting_line: Bool

nitc :: Token :: is_starting_line

Is self the first AST token on its line in the source
protected fun is_starting_line=(is_starting_line: Bool)

nitc :: Token :: is_starting_line=

Is self the first AST token on its line in the source
fun is_structural: Bool

nitc :: ANode :: is_structural

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

nitc :: Token :: last_ast_token

The last AST token.
private fun last_ast_token=(last_ast_token: nullable Token)

nitc :: Token :: last_ast_token=

The last AST token.
fun last_real_token_in_line: Token

nitc :: Token :: last_real_token_in_line

The last read token that ends the line of self
fun last_token_in_line: nullable Token

nitc :: Token :: last_token_in_line

The last AST token that starts the line of self
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?
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
fun next_looses: Array[Token]

nitc :: Token :: next_looses

Loose tokens that follow self
protected fun next_looses=(next_looses: Array[Token])

nitc :: Token :: next_looses=

Loose tokens that follow self
fun next_token: nullable Token

nitc :: Token :: next_token

The next token in the Lexer.
protected fun next_token=(next_token: nullable Token)

nitc :: Token :: next_token=

The next token in the Lexer.
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
abstract fun parser_index: Int

nitc :: Token :: parser_index

fun prev_looses: Array[Token]

nitc :: Token :: prev_looses

Loose tokens that precede self.
protected fun prev_looses=(prev_looses: Array[Token])

nitc :: Token :: prev_looses=

Loose tokens that precede self.
fun prev_token: nullable Token

nitc :: Token :: prev_token

The previous token in the Lexer.
protected fun prev_token=(prev_token: nullable Token)

nitc :: Token :: prev_token=

The previous token in the Lexer.
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
fun starting_prods: nullable Array[Prod]

nitc :: Token :: starting_prods

The productions that starts with self, if any
protected fun starting_prods=(starting_prods: nullable Array[Prod])

nitc :: Token :: starting_prods=

The productions that starts with self, if any
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun text: String

nitc :: Token :: text

The raw content on the token
abstract fun text=(text: String)

nitc :: Token :: text=

The raw content on the token
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 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::Token Token nitc::ANode ANode nitc::Token->nitc::ANode core::Cloneable Cloneable nitc::ANode->core::Cloneable ...core::Cloneable ... ...core::Cloneable->core::Cloneable nitc::Token... ... nitc::Token...->nitc::Token

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 EOF

nitc :: EOF

A end of file
class TAssign

nitc :: TAssign

The symbol =
class TAt

nitc :: TAt

The symbol @
class TAttrid

nitc :: TAttrid

An attribute identifier. They start with an underscore.
class TBadChar

nitc :: TBadChar

A malformed char
class TBadExtern

nitc :: TBadExtern

A malformed extern code block
class TBadString

nitc :: TBadString

A malformed string
class TCbra

nitc :: TCbra

The symbol ]
class TClassid

nitc :: TClassid

A class (or formal type) identifier. They start with an uppercase.
class TColumn

nitc :: TColumn

The symbol :
class TComma

nitc :: TComma

The symbol ,
class TComment

nitc :: TComment

Token of a line of comments
class TCpar

nitc :: TCpar

The symbol )
class TDot

nitc :: TDot

The symbol .
class TDotdot

nitc :: TDotdot

The symbol ..
class TDotdotdot

nitc :: TDotdotdot

The symbol ...
class TEol

nitc :: TEol

Token of end of line (basically \n)
class TExternCodeSegment

nitc :: TExternCodeSegment

A extern code block
class TId

nitc :: TId

A standard identifier (variable, method...). They start with a lowercase.
class TKwdebug

nitc :: TKwdebug

The special keyword __DEBUG__
class TObra

nitc :: TObra

The symbol [
class TOpar

nitc :: TOpar

The symbol (
class TQuad

nitc :: TQuad

The symbol ::
class TSemi

nitc :: TSemi

The symbol ;
abstract class TokenKeyword

nitc :: TokenKeyword

A token associated with a keyword
abstract class TokenLiteral

nitc :: TokenLiteral

A token of a literal value (string, integer, etc).
abstract class TokenOperator

nitc :: TokenOperator

A token associated with an operator (and other lookalike symbols)

Descendants

class AError

nitc :: AError

A mark of an error
class ALexerError

nitc :: ALexerError

A lexical error (unexpected character)
class AParserError

nitc :: AParserError

A syntactic error (unexpected token)
class TAmp

nitc :: TAmp

The operator &
class TAmpeq

nitc :: TAmpeq

The operator &=
class TBadTString

nitc :: TBadTString

A malformed triple quoted string
class TBang

nitc :: TBang

The operator !
class TCaret

nitc :: TCaret

The operator ^
class TCareteq

nitc :: TCareteq

The operator ^=
class TChar

nitc :: TChar

A literal character
class TEndString

nitc :: TEndString

The final part of a super string (between } and ")
class TEq

nitc :: TEq

The operator ==
class TFloat

nitc :: TFloat

A literal floating point number
class TGe

nitc :: TGe

The operator >=
class TGg

nitc :: TGg

The operator >>
class TGgeq

nitc :: TGgeq

The operator >>=
class TGt

nitc :: TGt

The operator >
class TInteger

nitc :: TInteger

A literal integer
class TKwabort

nitc :: TKwabort

The keyword abort
class TKwabstract

nitc :: TKwabstract

The keyword abstract
class TKwand

nitc :: TKwand

The keyword and
class TKwas

nitc :: TKwas

The keyword as
class TKwassert

nitc :: TKwassert

The keyword assert
class TKwbreak

nitc :: TKwbreak

The keyword break
class TKwcatch

nitc :: TKwcatch

The keyword catch
class TKwclass

nitc :: TKwclass

The keyword class
class TKwcontinue

nitc :: TKwcontinue

The keyword continue
class TKwdo

nitc :: TKwdo

The keyword do
class TKwelse

nitc :: TKwelse

The keyword else
class TKwend

nitc :: TKwend

The keyword end
class TKwenum

nitc :: TKwenum

The keywords enum and universal
class TKwextern

nitc :: TKwextern

The keyword extern
class TKwfalse

nitc :: TKwfalse

The keyword false
class TKwfor

nitc :: TKwfor

The keyword for
class TKwif

nitc :: TKwif

The keyword if
class TKwimplies

nitc :: TKwimplies

The keyword implies
class TKwimport

nitc :: TKwimport

The keyword import
class TKwin

nitc :: TKwin

The keyword in
class TKwinit

nitc :: TKwinit

The keyword init
class TKwinterface

nitc :: TKwinterface

The keyword interface
class TKwintrude

nitc :: TKwintrude

The keyword intrude
class TKwis

nitc :: TKwis

The keyword is
class TKwisa

nitc :: TKwisa

The keyword isa
class TKwisset

nitc :: TKwisset

The keyword isset
class TKwlabel

nitc :: TKwlabel

The keyword label
class TKwloop

nitc :: TKwloop

The keyword loop
class TKwmeth

nitc :: TKwmeth

The keyword fun
class TKwmodule

nitc :: TKwmodule

The keyword module
class TKwnew

nitc :: TKwnew

The keyword new
class TKwnot

nitc :: TKwnot

The keyword not
class TKwnull

nitc :: TKwnull

The keyword null
class TKwnullable

nitc :: TKwnullable

The keyword nullable
class TKwonce

nitc :: TKwonce

The keyword once
class TKwor

nitc :: TKwor

The keyword or
class TKwpackage

nitc :: TKwpackage

The deprecated keyword package.
class TKwprivate

nitc :: TKwprivate

The keyword private
class TKwprotected

nitc :: TKwprotected

The keyword protected
class TKwpublic

nitc :: TKwpublic

The keyword public
class TKwredef

nitc :: TKwredef

The keyword redef
class TKwreturn

nitc :: TKwreturn

The keyword return
class TKwself

nitc :: TKwself

The keyword self
class TKwsubset

nitc :: TKwsubset

The keyword subset
class TKwsuper

nitc :: TKwsuper

The keyword super
class TKwthen

nitc :: TKwthen

The keyword then
class TKwtrue

nitc :: TKwtrue

The keyword true
class TKwtype

nitc :: TKwtype

The keyword type
class TKwvar

nitc :: TKwvar

The keyword var
class TKwwhile

nitc :: TKwwhile

The keyword while
class TKwwith

nitc :: TKwwith

The keyword with
class TKwyield

nitc :: TKwyield

The keyword yield
class TLe

nitc :: TLe

The operator <=
class TLl

nitc :: TLl

The operator <<
class TLleq

nitc :: TLleq

The operator <<=
class TLt

nitc :: TLt

The operator <
class TMidString

nitc :: TMidString

The middle part of a super string (between } and {)
class TMinus

nitc :: TMinus

The operator -
class TMinuseq

nitc :: TMinuseq

The operator -=
class TNe

nitc :: TNe

The operator !=
class TPercent

nitc :: TPercent

The operator %
class TPercenteq

nitc :: TPercenteq

The operator %=
class TPipe

nitc :: TPipe

The operator |
class TPipeeq

nitc :: TPipeeq

The operator |=
class TPlus

nitc :: TPlus

The operator +
class TPluseq

nitc :: TPluseq

The operator +=
class TQuest

nitc :: TQuest

The operator ?
class TSlash

nitc :: TSlash

The operator /
class TSlasheq

nitc :: TSlasheq

The operator /=
class TStar

nitc :: TStar

The operator *
class TStareq

nitc :: TStareq

The operator *=
class TStarship

nitc :: TStarship

The operator <=>
class TStarstar

nitc :: TStarstar

The operator **
class TStarstareq

nitc :: TStarstareq

The operator **=
class TStartString

nitc :: TStartString

The starting part of a super string (between " and {)
class TString

nitc :: TString

A literal string
class TTilde

nitc :: TTilde

The operator ~

Class definitions

nitc $ Token
# Ancestor of all tokens
# A token is a node that has a `text` but no children.
abstract class Token
	super ANode

	# The raw content on the token
	fun text: String is abstract

	# The raw content on the token
	fun text=(text: String) is abstract

	# The previous token in the Lexer.
	# May have disappeared in the AST
	var prev_token: nullable Token = null

	# The next token in the Lexer.
	# May have disappeared in the AST
	var next_token: nullable Token = null

	# Is `self` a token discarded from the AST?
	#
	# Loose tokens are not present in the AST.
	# It means they were identified by the lexer but were discarded by the parser.
	# It also means that they are not visited or manipulated by AST-related functions.
	#
	# Each loose token is attached to the non-loose token that precedes or follows it.
	# The rules are the following:
	#
	# * tokens that follow a non-loose token on a same line are attached to it.
	#   See `next_looses`.
	# * other tokens, thus that precede a non-loose token on the same line or the next one,
	# are attached to this one. See `prev_looses`.
	#
	# Loose tokens are mostly end of lines (`TEol`) and comments (`TComment`).
	# Whitespace are ignored by the lexer, so they are not even considered as loose tokens.
	# See `blank_before` to get the whitespace that separate tokens.
	var is_loose = false

	redef fun is_structural do return true

	redef fun dump_info(v) do return " {text.escape_to_c}"

	# Loose tokens that precede `self`.
	#
	# These tokens start the line or belong to a line with only loose tokens.
	var prev_looses = new Array[Token] is lazy

	# Loose tokens that follow `self`
	#
	# These tokens are on the same line than `self`.
	var next_looses = new Array[Token] is lazy

	# The verbatim blank text between `prev_token` and `self`
	fun blank_before: String
	do
		if prev_token == null then return ""
		var from = prev_token.location.pend+1
		var to = location.pstart
		return location.file.string.substring(from,to-from)
	end

	redef fun to_s: String do
		return "'{text}'"
	end

	redef fun visit_all(v: Visitor) do end
	redef fun replace_child(old_child: ANode, new_child: nullable ANode) do end
end
src/parser/parser_nodes.nit:345,1--412,3

nitc :: lexer_work $ Token
redef class Token
    private var cached_text: nullable String

    redef fun text
    do
        var res = _cached_text
        if res != null then return res
        res = location.text
	_cached_text = res
	return res
    end

    redef fun text=(text)
    do
        _cached_text = text
    end

    fun parser_index: Int is abstract
end
src/parser/lexer_work.nit:21,1--39,3

nitc :: astutil $ Token
redef class Token
	# Is self the first AST token on its line in the source
	# Computed by `parentize_tokens`
	#
	# Note, some tokens detached from the AST
	# may precede `self` even if `is_starting_line` is true
	# One can use `first_real_token_in_line` to get the real starting token
	var is_starting_line = false

	# Is self the last AST token on its line in the source
	# Computed by `parentize_tokens`
	#
	# Note, some tokens detached from the AST (like comments)
	# may follow `self` even if `is_ending_line` is true.
	# One can use `last_real_token_in_line` to get the real ending token
	var is_ending_line = false

	# The first real token that starts the line of `self`
	#
	# This could return a token that is detached from the AST.
	# See `first_token_in_line` if a AST token is required.
	fun first_real_token_in_line: Token
	do
		var line = location.line_start
		var t = self
		loop
			var p = t.prev_token
			if p == null or p.location.line_start != line then
				return t
			end
			t = p
		end
	end

	# The first AST token that starts the line of `self`.
	# May be null is the line contains only detached tokens (only comment)
	#
	# Computed by `parentize_tokens`
	#
	# ENSURE `result != null implies result.is_starting_line`
	fun first_token_in_line: nullable Token
	do
		return first_real_token_in_line.first_ast_token
	end

	# The first AST token.
	# This only work on the `first_real_token_in_line`
	private var first_ast_token: nullable Token

	# The last read token that ends the line of `self`
	#
	# This usually return a detached token lake a TEol or a comment.
	# See `last_token_in_line` if a AST token is required.
	fun last_real_token_in_line: Token
	do
		var line = location.line_start
		var t = self
		loop
			var p = t.next_token
			if p == null or p.location.line_start != line then
				return t
			end
			t = p
		end
	end

	# The last AST token that starts the line of `self`
	# May be null is the line contains only detached tokens (only comment)
	#
	# Computed by `parentize_tokens`
	#
	# ENSURE `result.is_ending_line`
	fun last_token_in_line: nullable Token
	do
		return last_real_token_in_line.last_ast_token
	end

	# The last AST token.
	# This only work on the `last_real_token_in_line`
	private var last_ast_token: nullable Token

	# The productions that starts with `self`, if any
	# Productions goes from the most general to the most specific
	#
	# Computed by `parentize_tokens`
	var starting_prods: nullable Array[Prod]

	# The productions that ends with `self`, if any
	# Productions goes from the most specific to the most general
	#
	# Computed by `parentize_tokens`
	var ending_prods: nullable Array[Prod]
end
src/astutil.nit:109,1--201,3

nitc :: simple_misc_analysis $ Token
redef class Token
	private fun accept_simple_misc_token(v: SimpleMiscVisitor)
	do
	end
end
src/frontend/simple_misc_analysis.nit:90,1--94,3

nitc :: pretty $ Token
redef class Token
	redef fun accept_pretty_printer(v) do
		v.add text.trim
		v.current_token = next_token
	end

	redef fun collect_length do return text.length
	redef fun is_inlinable do return true
	redef fun was_inline do return true
end
src/pretty.nit:348,1--357,3

nitc :: highlight $ Token
redef class Token
	# Return the ANSI colored text
	fun ansi_colored: String do return text
end
src/highlight.nit:138,1--141,3

nitc :: htmlight $ Token
redef class Token
	# Produce an HTMLTag with the correct contents and CSS classes
	# Subclasses can redefine it to decorate the tag
	redef fun make_tag(v): HTMLTag
	do
		var res = new HTMLTag("span")
		res.text(text)
		return res
	end
end
src/htmlight.nit:807,1--816,3