antlraux package
v0.2.1

antlraux.context.asts
Class ScopeAST

java.lang.Object
  |
  +--antlr.BaseAST
        |
        +--antlr.CommonAST
              |
              +--antlraux.util.LexInfoAST
                    |
                    +--antlraux.context.asts.ScopeAST
All Implemented Interfaces:
antlr.collections.AST, LexInfo, java.io.Serializable

public class ScopeAST
extends LexInfoAST

This AST implementation is very useful when modelling ASTs that store a declaration that has a scope, like a class or method.

ScopeAST is capable of showing some additional information in toString() if LexInfoAST.verboseStringConversion is set to true using setVerboseStringConversion(boolean):

    ScopeAST ast = new ScopeAST(
 
Warning: TypeAST, ExpressionAST and ScopeAST copy first child and sibling with their only constructor. See their constructor's comments for details.

See Also:
Serialized Form

Field Summary
protected  Scope scope
           
 
Fields inherited from class antlraux.util.LexInfoAST
verboseStringConversion
 
Fields inherited from class antlr.BaseAST
down, right
 
Fields inherited from interface antlraux.util.LexInfo
DEFAULT_COLUMN, DEFAULT_FILENAME, DEFAULT_LINE
 
Constructor Summary
ScopeAST()
           
ScopeAST(antlr.collections.AST ast, Scope scope)
          This constructors calls initialize(AST), so it copies next sibling and first child.
 
Method Summary
 Scope getScope()
           
 void initialize(antlr.collections.AST ast)
          Warning: this implementation of initialize copies ast's first child and next sibling.
 void setScope(Scope s)
           
static void setVerboseStringConversion(boolean b)
          If set to true, this adds some additional information to the string generated by toString() (shows the AST's scope's name)
 java.lang.String toString()
          Returns a String representing the information in the root of the node.
 
Methods inherited from class antlraux.util.LexInfoAST
addChildLeft, addChildLeftWithSiblings, addSibling, copyLexInfo, getColumn, getFilename, getLastChild, getLastSibling, getLexInfoString, getLine, getPrevChild, initialize, replaceChild, replaceChildWithSiblings, setColumn, setFilename, setLine, tabulate, toStringList, toStringList, toStringTree
 
Methods inherited from class antlr.CommonAST
getText, getType, initialize, setText, setType
 
Methods inherited from class antlr.BaseAST
addChild, decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, getNumberOfChildren, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

scope

protected Scope scope
Constructor Detail

ScopeAST

public ScopeAST()

ScopeAST

public ScopeAST(antlr.collections.AST ast,
                Scope scope)
This constructors calls initialize(AST), so it copies next sibling and first child.

Method Detail

setScope

public void setScope(Scope s)

getScope

public Scope getScope()

setVerboseStringConversion

public static void setVerboseStringConversion(boolean b)
If set to true, this adds some additional information to the string generated by toString() (shows the AST's scope's name)


toString

public java.lang.String toString()
Description copied from class: LexInfoAST
Returns a String representing the information in the root of the node. If LexInfoAST.setVerboseStringConversion(boolean) has been set to true, it adds the lex information of the AST (using LexInfoAST.getLexInfoString())

Specified by:
toString in interface antlr.collections.AST
Overrides:
toString in class LexInfoAST

initialize

public void initialize(antlr.collections.AST ast)
Warning: this implementation of initialize copies ast's first child and next sibling.

Specified by:
initialize in interface antlr.collections.AST
Overrides:
initialize in class LexInfoAST
Parameters:
ast - The AST whose information is to be copied

antlraux package
v0.2.1

Created by Enrique José García Cota