nitc :: Prod :: defaultinit
# 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