Starts with the #
and contains the final end-of-line (if any)
nitc :: TComment :: defaultinit
nitc :: TComment :: is_first_in_group
Isself
the first comment of a group of comment?
nitc :: TComment :: is_last_in_group
Isself
the last comment of a group of comments?
nitc :: pretty $ TComment :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: highlight $ TComment :: ansi_colored
Return the ANSI colored textnitc :: lexer $ TComment :: parser_index
nitc :: Token :: _cached_text
nitc :: Token :: _ending_prods
The productions that ends withself
, if any
nitc :: ANode :: _is_broken
The indication that the node did not pass some semantic verifications.nitc :: Token :: _is_ending_line
Is self the last AST token on its line in the sourcenitc :: Token :: _is_starting_line
Is self the first AST token on its line in the sourcenitc :: Token :: _prev_looses
Loose tokens that precedeself
.
nitc :: Token :: _prev_token
The previous token in the Lexer.nitc :: Token :: _starting_prods
The productions that starts withself
, if any
nitc :: ANode :: accept_ast_validation
nitc :: ANode :: accept_auto_super_init
nitc :: ANode :: accept_flow_visitor
nitc :: ANode :: accept_forward_analysis
Apply the forward analysisv
to self
.
nitc :: ANode :: accept_literal
nitc :: ANode :: accept_post_typing
nitc :: ANode :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: ANode :: accept_reaching_defs
Apply a ReachingDefsAnalysis toself
.
nitc :: ANode :: accept_regex_visitor
nitc :: ANode :: accept_scope_visitor
nitc :: ANode :: accept_simple_misc
nitc :: ANode :: accept_string_finder
nitc :: ANode :: after_simple_misc
nitc :: ANode :: bad_expr_message
An additional information message to explain the role of a child expression.nitc :: Token :: blank_before
The verbatim blank text betweenprev_token
and self
nitc :: Token :: cached_text
nitc :: Token :: cached_text=
nitc :: ANode :: check_callsite
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: ANode :: collect_annotations_by_name
Do a deep search and return an array of node that are annotatednitc :: ANode :: collect_length
Collect the length (inChar
) of the node.
nitc :: ANode :: collect_tokens_by_text
Do a deep search and return an array of tokens that match a given textnitc :: ANode :: common_parent
The most specific common parent betweenself
and other
nitc :: ANode :: create_contracts
nitc :: ANode :: decorate_tag
Add aditionnal information on a child-token and return an additionnal HInfoBox on itnitc :: Token :: defaultinit
nitc :: TComment :: defaultinit
core :: Object :: defaultinit
core :: Cloneable :: defaultinit
nitc :: ANode :: defaultinit
nitc :: ANode :: do_cloneable
nitc :: Token :: ending_prods
The productions that ends withself
, if any
nitc :: Token :: ending_prods=
The productions that ends withself
, if any
nitc :: Token :: first_ast_token=
The first AST token.nitc :: Token :: first_real_token_in_line
The first real token that starts the line ofself
nitc :: Token :: first_token_in_line
The first AST token that starts the line ofself
.
nitc :: ANode :: force_block=
Forceself
to be rendered as a block.
nitc :: ANode :: force_inline=
Forceself
to be rendered as a line.
nitc :: ANode :: full_transform_visitor
nitc :: ANode :: hot_location
The location of the important part of the node (identifier or whatever)nitc :: ANode :: is_broken=
The indication that the node did not pass some semantic verifications.nitc :: Token :: is_ending_line
Is self the last AST token on its line in the sourcenitc :: Token :: is_ending_line=
Is self the last AST token on its line in the sourcenitc :: TComment :: is_first_in_group
Isself
the first comment of a group of comment?
nitc :: TComment :: is_last_in_group
Isself
the last comment of a group of comments?
nitc :: ANode :: is_noserialize
Is this node annotated to not be made serializable?core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
nitc :: ANode :: is_serialize
Is this node annotated to be made serializable?nitc :: Token :: is_starting_line
Is self the first AST token on its line in the sourcenitc :: Token :: is_starting_line=
Is self the first AST token on its line in the sourcenitc :: ANode :: is_structural
Isself
a token or a pure-structural production like AQId
?
nitc :: Token :: last_ast_token=
The last AST token.nitc :: Token :: last_real_token_in_line
The last read token that ends the line ofself
nitc :: Token :: last_token_in_line
The last AST token that starts the line ofself
nitc :: ANode :: must_be_block
Doesself
have to be rendered as a block?
nitc :: ANode :: must_be_inline
Doesself
have be rendered as a line?
core :: Object :: native_class_name
The class name of the object in CString format.nitc :: Token :: next_looses=
Loose tokens that followself
nitc :: Token :: next_token=
The next token in the Lexer.core :: Object :: output_class_name
Display class name on stdout (debug only).nitc :: ANode :: parentize_tokens
Visit the AST and computes advanced AST attributes on Tokens and Prodnitc :: Token :: parser_index
nitc :: Token :: prev_looses=
Loose tokens that precedeself
.
nitc :: Token :: prev_token=
The previous token in the Lexer.nitc :: ANode :: replace_child
Replace a child with an other node in the ASTnitc :: ANode :: replace_with
Replace itself with an other node in the ASTnitc :: Token :: starting_prods
The productions that starts withself
, if any
nitc :: Token :: starting_prods=
The productions that starts withself
, if any
nitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
redef class TComment
redef fun accept_pretty_printer(v) do
if is_adoc then
v.addt
super
v.forcen
return
end
if is_licence then
super
v.forcen
if is_last_in_group then v.addn
return
end
if is_orphan then
v.addn
v.addt
super
v.forcen
v.addn
return
end
if is_inline then
if next_token isa TComment and is_first_in_group then v.addn
v.addt
super
v.forcen
var prev_token = self.prev_token
if prev_token isa TComment and prev_token.is_inline and is_last_in_group then v.addn
return
end
super
if not v.skip_empty then v.forcen
end
# Is `self` part of an `ADoc`?
private fun is_adoc: Bool do return parent isa ADoc and parent.parent != null
# Is `self` part of a licence?
private fun is_licence: Bool do
var prev_token = self.prev_token
if prev_token == null then
return true
else if prev_token isa TComment then
return prev_token.is_licence
else
return false
end
end
# Is `self` starts and ends its line?
private fun is_inline: Bool do
return self == first_real_token_in_line and self == last_real_token_in_line
end
# Is `self` an orphan line (blank before and after)?
private fun is_orphan: Bool do
return prev_token isa TEol and
(prev_token.prev_token isa TEol or prev_token.prev_token isa TComment) and
next_token isa TEol
end
# Is `self` the first comment of a group of comment?
private fun is_first_in_group: Bool do return not prev_token isa TComment
# Is `self` the last comment of a group of comments?
private fun is_last_in_group: Bool do return not next_token isa TComment
end
src/pretty.nit:412,1--484,3