kiama.attribution

trait Attributable

[source: kiama/attribution/Attributable.scala]

trait Attributable
extends scala.Product with scala.util.parsing.input.Positional
Common functionality for all classes that are to be attributed. This trait must be extended by all classes for which the node properties such as parent and the attribute shorthand notation -> are desired.
Direct Known Subclasses:
AST.Exp, AST.Statement, AST.Declaration, AST.Type, AST.Exp, DataflowAST.Program, DataflowAST.Stm, AbstractSyntax.Program, AbstractSyntax.Block, AbstractSyntax.BlockStmt, AbstractSyntax.Exp, Tree

Value Summary
var _next : Attributable
Private field backing next to make the types work correctly.
var index : Int
If this node is in a sequence, which child number is it (counting from zero)? Otherwise, zero.
var parent : Attributable
A link to the parent Attributable node of this node or null if this node has no parent. Note that this link will skip intervening non-Attributable ancestors, such as Option or Seq nodes.
Values and Variables inherited from scala.util.parsing.input.Positional
scala.util.parsing.input.Positional.pos
Method Summary
final def -> [T](attr : (Attributable) => T) : T
Reference an attribute or function that can be applied to this node. this->attribute is equivalent to attribute(this).
def children : scala.Iterator[Attributable]
This node's attributable children in left-to-right order. Children that are not Attributable are ignored, except for sequences (Seq[_]) and optional children (Option[_]). In the case of sequences and options, their contents are processed and any immediate Attributable contents are included in the sequence.
def isFirst : Boolean
If this node is in a sequence, is it the first element? Otherwise, true.
def isLast : Boolean
If this node is in a sequence, is it the last element? Otherwise, true.
def isRoot : Boolean
Is this node the root of the hierarchy?
def next : Attributable
If this node is a member of a sequence, a link to the next node in the sequence. Null if this is the first node of the sequence, or if it is not a member of a sequence.
def parent [T] : T
A short-hand for parent.asInstanceOf[T], which is useful in cases a T-specific operation is applied to the parent, which otherwise would be Attributable.
def prev : Attributable
If this node is a member of a sequence, a link to the previous node in the sequence. Null if this is the first node of the sequence, or if it is not a member of a sequence.
Methods inherited from scala.util.parsing.input.Positional
scala.util.parsing.input.Positional.setPos
Methods inherited from scala.Product
scala.Product.productElement (abstract), scala.Product.productArity (abstract), scala.Product.productPrefix
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Value Details
var parent : Attributable
A link to the parent Attributable node of this node or null if this node has no parent. Note that this link will skip intervening non-Attributable ancestors, such as Option or Seq nodes.

var _next : Attributable
Private field backing next to make the types work correctly.

var index : Int
If this node is in a sequence, which child number is it (counting from zero)? Otherwise, zero.

Method Details
def parent[T] : T
A short-hand for parent.asInstanceOf[T], which is useful in cases a T-specific operation is applied to the parent, which otherwise would be Attributable.

def isRoot : Boolean
Is this node the root of the hierarchy?

def prev : Attributable
If this node is a member of a sequence, a link to the previous node in the sequence. Null if this is the first node of the sequence, or if it is not a member of a sequence.

def next : Attributable
If this node is a member of a sequence, a link to the next node in the sequence. Null if this is the first node of the sequence, or if it is not a member of a sequence.

def isFirst : Boolean
If this node is in a sequence, is it the first element? Otherwise, true.

def isLast : Boolean
If this node is in a sequence, is it the last element? Otherwise, true.

def children : scala.Iterator[Attributable]
This node's attributable children in left-to-right order. Children that are not Attributable are ignored, except for sequences (Seq[_]) and optional children (Option[_]). In the case of sequences and options, their contents are processed and any immediate Attributable contents are included in the sequence.

@scala.inline

final def ->[T](attr : (Attributable) => T) : T
Reference an attribute or function that can be applied to this node. this->attribute is equivalent to attribute(this).