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.

Property definitions

nitc $ Token :: is_loose
	# 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
src/parser/parser_nodes.nit:364,2--381,21