nitc :: AAnnotations
This same class is used for the 3 kind of annotations:
module foo is bar
.foo@bar
or foo@(bar,baz)
.nitc :: AAnnotations :: _n_cpar
The closing parenthesis in at annotationsnitc :: AAnnotations :: _n_kwend
Theend
keyword, for is annotations
nitc :: AAnnotations :: _n_kwis
Theis
keyword, for is annotations
nitc :: AAnnotations :: _n_opar
The opening parenthesis in at annotationsnitc :: AAnnotations :: defaultinit
nitc :: AAnnotations :: n_cpar=
The closing parenthesis in at annotationsnitc :: AAnnotations :: n_items=
The list of annotationsnitc :: AAnnotations :: n_kwend=
Theend
keyword, for is annotations
nitc :: AAnnotations :: n_kwis=
Theis
keyword, for is annotations
nitc :: AAnnotations :: n_opar=
The opening parenthesis in at annotationsnitc $ AAnnotations :: SELF
Type of this instance, automatically specialized in every classnitc :: pretty $ AAnnotations :: accept_pretty_printer
Start visit ofself
using a PrettyPrinterVisitor
nitc :: pretty $ AAnnotations :: is_inlinable
Isself
printable in one line?
nitc :: parser_prod $ AAnnotations :: n_at=
The@
symbol, for at annotations
nitc :: parser_prod $ AAnnotations :: n_cpar=
The closing parenthesis in at annotationsnitc :: parser_prod $ AAnnotations :: n_kwend=
Theend
keyword, for is annotations
nitc :: parser_prod $ AAnnotations :: n_kwis=
Theis
keyword, for is annotations
nitc :: parser_prod $ AAnnotations :: n_opar=
The opening parenthesis in at annotationsnitc :: parser_prod $ AAnnotations :: replace_child
Replace a child with an other node in the ASTnitc :: parser_prod $ AAnnotations :: visit_all
Visit all nodes in order.nitc :: Prod :: _first_location
Location on the first token after the start of a productionnitc :: Prod :: _first_token
The first token of the production in the ASTnitc :: ANode :: _is_broken
The indication that the node did not pass some semantic verifications.nitc :: Prod :: _last_token
The last token of the production in the ASTnitc :: Prod :: _n_annotations
All the annotations attached directly to the nodenitc :: AAnnotations :: _n_cpar
The closing parenthesis in at annotationsnitc :: AAnnotations :: _n_kwend
Theend
keyword, for is annotations
nitc :: AAnnotations :: _n_kwis
Theis
keyword, for is annotations
nitc :: AAnnotations :: _n_opar
The opening parenthesis in at annotationsnitc :: 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 :: 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 :: Prod :: collect_comments
Collect allTComment
contained in the production
nitc :: 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 :: ANode :: defaultinit
core :: Cloneable :: defaultinit
core :: Object :: defaultinit
nitc :: Prod :: defaultinit
nitc :: AAnnotations :: defaultinit
nitc :: ANode :: do_cloneable
nitc :: Prod :: first_location
Location on the first token after the start of a productionnitc :: Prod :: first_location=
Location on the first token after the start of a productionnitc :: Prod :: first_token
The first token of the production in the ASTnitc :: Prod :: first_token=
The first token of the production in the ASTnitc :: 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 :: Prod :: get_annotations
Return all its annotations of a given name in the order of their declarationnitc :: Prod :: get_single_annotation
Try to get its single annotation with a given namenitc :: 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 :: 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 :: ANode :: is_structural
Isself
a token or a pure-structural production like AQId
?
nitc :: Prod :: last_token
The last token of the production in the ASTnitc :: Prod :: last_token=
The last token of the production in the ASTnitc :: ANode :: must_be_block
Doesself
have to be rendered as a block?
nitc :: ANode :: must_be_inline
Doesself
have be rendered as a line?
nitc :: Prod :: n_annotations
All the annotations attached directly to the nodenitc :: Prod :: n_annotations=
All the annotations attached directly to the nodenitc :: AAnnotations :: n_cpar=
The closing parenthesis in at annotationsnitc :: AAnnotations :: n_items=
The list of annotationsnitc :: AAnnotations :: n_kwend=
Theend
keyword, for is annotations
nitc :: AAnnotations :: n_kwis=
Theis
keyword, for is annotations
nitc :: AAnnotations :: n_opar=
The opening parenthesis in at annotationscore :: Object :: native_class_name
The class name of the object in CString format.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 :: 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 :: Prod :: start_token
The token where the production really start (skipping ADoc).nitc :: ANode :: was_inline
Doesself
was written in one line before transformation?
# A group of annotation on a node
#
# This same class is used for the 3 kind of annotations:
#
# * *is* annotations. eg `module foo is bar`.
# * *at* annotations. eg `foo@bar` or `foo@(bar,baz)`.
# * *class* annotations, defined in classes.
class AAnnotations
super Prod
# The `is` keyword, for *is* annotations
var n_kwis: nullable TKwis = null is writable
# The `@` symbol, for *at* annotations
var n_at: nullable TAt = null is writable
# The opening parenthesis in *at* annotations
var n_opar: nullable TOpar = null is writable
# The list of annotations
var n_items = new ANodes[AAnnotation](self)
# The closing parenthesis in *at* annotations
var n_cpar: nullable TCpar = null is writable
# The `end` keyword, for *is* annotations
var n_kwend: nullable TKwend = null is writable
end
src/parser/parser_nodes.nit:3048,1--3075,3
redef class AAnnotations
init init_aannotations (
n_kwis: nullable TKwis,
n_at: nullable TAt,
n_opar: nullable TOpar,
n_items: Collection[Object], # Should be Collection[AAnnotation]
n_cpar: nullable TCpar,
n_kwend: nullable TKwend
)
do
_n_kwis = n_kwis
if n_kwis != null then n_kwis.parent = self
_n_at = n_at
if n_at != null then n_at.parent = self
_n_opar = n_opar
if n_opar != null then n_opar.parent = self
self.n_items.unsafe_add_all(n_items)
_n_cpar = n_cpar
if n_cpar != null then n_cpar.parent = self
_n_kwend = n_kwend
if n_kwend != null then n_kwend.parent = self
end
redef fun replace_child(old_child: ANode, new_child: nullable ANode)
do
if _n_kwis == old_child then
n_kwis = new_child.as(nullable TKwis)
return
end
if _n_at == old_child then
n_at = new_child.as(nullable TAt)
return
end
if _n_opar == old_child then
n_opar = new_child.as(nullable TOpar)
return
end
if n_items.replace_child(old_child, new_child) then return
if _n_cpar == old_child then
n_cpar = new_child.as(nullable TCpar)
return
end
if _n_kwend == old_child then
n_kwend = new_child.as(nullable TKwend)
return
end
end
redef fun n_kwis=(node)
do
_n_kwis = node
if node != null then node.parent = self
end
redef fun n_at=(node)
do
_n_at = node
if node != null then node.parent = self
end
redef fun n_opar=(node)
do
_n_opar = node
if node != null then node.parent = self
end
redef fun n_cpar=(node)
do
_n_cpar = node
if node != null then node.parent = self
end
redef fun n_kwend=(node)
do
_n_kwend = node
if node != null then node.parent = self
end
redef fun visit_all(v: Visitor)
do
v.enter_visit(_n_kwis)
v.enter_visit(_n_at)
v.enter_visit(_n_opar)
n_items.visit_all(v)
v.enter_visit(_n_cpar)
v.enter_visit(_n_kwend)
end
end
src/parser/parser_prod.nit:8613,1--8697,3
redef class AAnnotations
redef fun accept_pretty_printer(v) do
v.adds
v.consume "is"
if v.can_inline(self) then
v.adds
for n_item in n_items do
v.visit n_item
if n_item != n_items.last then
v.add ", "
end
end
if not was_inline then
v.finish_line
if v.current_token isa TKwend then v.skip
end
else
v.forcen
v.indent += 1
for n_item in n_items do
v.addt
v.visit n_item
v.finish_line
if n_item != n_items.last then
if was_inline then
v.forcen
else
v.addn
end
end
end
v.indent -= 1
end
end
redef fun is_inlinable do
if not super then return false
for annot in n_items do if not annot.is_inlinable then return false
return true
end
end
src/pretty.nit:493,1--533,3