edu.mit.ai.psg.jeva
Class JNName

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.SimpleNode
        |
        +--edu.mit.ai.psg.jeva.JevaNode
              |
              +--edu.mit.ai.psg.jeva.ExpressionNode
                    |
                    +--edu.mit.ai.psg.jeva.JNName

public class JNName
extends ExpressionNode
implements IExpressionStoreNode, JevaParserConstants

Jeva parse node for names (including parameters, fields, and class names); A name x.y.z is parsed with nested names as (((x).y).z). Note: does not always denote an expression (may be type or package).


Field Summary
static int AMBIGUOUS_EXPRESSION_NAME
           
static int AMBIGUOUS_NAME
           
static int ARRAY_FIELD_NAME
           
static int FIELD_NAME
           
static int PACKAGE_NAME
           
static int SPECIAL_NAME_CLASS
           
static int SPECIAL_NAME_SUPER
           
static int SPECIAL_NAME_THIS
           
static int TYPE_NAME
           
static int VARIABLE_NAME
           
 
Fields inherited from class edu.mit.ai.psg.jeva.SimpleNode
children, id, parent
 
Fields inherited from interface edu.mit.ai.psg.jeva.JevaParserConstants
_DEFAULT, ABSTRACT, ANDASSIGN, ASSIGN, BANG, BIT_AND, BIT_OR, BOOLEAN, BREAK, BYTE, CASE, CATCH, CHAR, CHARACTER_LITERAL, CLASS, COLON, COMMA, CONST, CONTINUE, DECIMAL_LITERAL, DECR, DEFAULT, DIGIT, DO, DOT, DOUBLE, ELSE, EOF, EQ, EXPONENT, EXTENDS, FALSE, FINAL, FINALLY, FLOAT, FLOATING_POINT_LITERAL, FOR, FORMAL_COMMENT, GE, GOTO, GT, HEX_LITERAL, HOOK, IDENTIFIER, IF, IMPLEMENTS, IMPORT, INCR, INSTANCEOF, INT, INTEGER_LITERAL, INTERFACE, LBRACE, LBRACKET, LE, LETTER, LONG, LPAREN, LSHIFT, LSHIFTASSIGN, LT, MINUS, MINUSASSIGN, MULTI_LINE_COMMENT, NATIVE, NE, NEW, NULL, OCTAL_LITERAL, ORASSIGN, PACKAGE, PLUS, PLUSASSIGN, PRIVATE, PROTECTED, PUBLIC, RBRACE, RBRACKET, REM, REMASSIGN, RETURN, RPAREN, RSIGNEDSHIFT, RSIGNEDSHIFTASSIGN, RUNSIGNEDSHIFT, RUNSIGNEDSHIFTASSIGN, SC_AND, SC_OR, SEMICOLON, SHORT, SINGLE_LINE_COMMENT, SLASH, SLASHASSIGN, STAR, STARASSIGN, STATIC, STRING_LITERAL, SUPER, SWITCH, SYNCHRONIZED, THIS, THROW, THROWS, TILDE, tokenImage, TRANSIENT, TRUE, TRY, VOID, VOLATILE, WHILE, WHITE_SPACE, XOR, XORASSIGN
 
Method Summary
protected  Error categorySetError(String newCategory)
           
 boolean computeIsConstant(IEnv env)
          Compute whether this expression is a constant (nodes should not call this method directly).
 IPackage computePackage(IEnv env)
           
 IPackage computeParentPackage(IEnv env)
           
 IClass computeType(IEnv env)
          Compute the static type of the expression (nodes should not call this method directly).
protected  Error ErrorNotVariableOrField()
           
 Object eval(IEnv env)
          Evaluate this expression (nodes should not call this method directly).
 IStore evalToStore(IEnv env)
           
 String getFullNameAndCurrentCategory()
          for error reports
 String getFullPackageOrClassName()
           
 String getFullPackageOrClassName(IEnv env)
           
 int getNameCategory()
           
 int getNameCategory(IEnv env)
           
 String getNameCategoryName()
           
protected  IClass getNamedClass()
           
 IClass getNamedClass(IEnv env)
           
protected  IField getNamedField()
           
protected  IPackage getNamedPackage()
           
 String getSimpleName()
           
 String getSimpleName(IEnv env)
           
 boolean isFinal(IEnv env)
          used to test whether assignable.
 Object jjtAccept(IJevaVisitor visitor, Object data)
          Accept a visitor.
protected  void reclassifyName(IEnv env)
           
 void setNameCategoryToAmbiguousExpression()
          context requires an expression; can only narrow category, not widen.
 void setNameCategoryToArrayField()
           
 void setNameCategoryToClassLiteral(IClass c)
           
 void setNameCategoryToField(IField f)
           
 void setNameCategoryToPackage(IPackage p)
           
 void setNameCategoryToSuper()
           
 void setNameCategoryToThis()
           
 void setNameCategoryToType(IClass c)
           
 void setNameCategoryToVariable()
           
 
Methods inherited from class edu.mit.ai.psg.jeva.ExpressionNode
getType, getType, getValue, isConstant
 
Methods inherited from class edu.mit.ai.psg.jeva.JevaNode
checkInsertionPoint, find2ndTokenBeforeEndBody, findChildIndex, findPrecedingToken, findTokenBeforeChild, findTokenBeforeChild, findTokenBeforeEnd, getBeginToken, getEndToken, insertChildTokens, insertNewChildAfter, insertNewChildAt, insertNewChildBefore, jnGetChild, jnGetParent, notVerified, print, print, printSpecialTokens, printToken, printToString, printToString, removeChild, removeChildTokens, replaceChild, replaceChild, setBeginToken, setEndToken, shouldNotHappen, shouldNotHappen, shouldNotHappen, updateEndTokens, updateEndTokensPriorChild, updateEndTokensPriorNode, updateEndTokensPriorNode
 
Methods inherited from class edu.mit.ai.psg.jeva.SimpleNode
dump, jjtAddChild, jjtClose, jjtGetChild, jjtGetNumChildren, jjtGetParent, jjtOpen, jjtSetParent, toString, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

AMBIGUOUS_NAME

public static final int AMBIGUOUS_NAME

AMBIGUOUS_EXPRESSION_NAME

public static final int AMBIGUOUS_EXPRESSION_NAME

VARIABLE_NAME

public static final int VARIABLE_NAME

FIELD_NAME

public static final int FIELD_NAME

ARRAY_FIELD_NAME

public static final int ARRAY_FIELD_NAME

TYPE_NAME

public static final int TYPE_NAME

PACKAGE_NAME

public static final int PACKAGE_NAME

SPECIAL_NAME_THIS

public static final int SPECIAL_NAME_THIS

SPECIAL_NAME_SUPER

public static final int SPECIAL_NAME_SUPER

SPECIAL_NAME_CLASS

public static final int SPECIAL_NAME_CLASS
Method Detail

jjtAccept

public Object jjtAccept(IJevaVisitor visitor,
                        Object data)
Description copied from interface: IJevaNode
Accept a visitor. For visitor design pattern: jjtAccept must simply
  return visitor.visit(this, data);  
which dispatches on the type of this to appropriate method of visitor
Overrides:
jjtAccept in class JevaNode

setNameCategoryToAmbiguousExpression

public void setNameCategoryToAmbiguousExpression()
context requires an expression; can only narrow category, not widen.

setNameCategoryToVariable

public void setNameCategoryToVariable()

setNameCategoryToField

public void setNameCategoryToField(IField f)

setNameCategoryToArrayField

public void setNameCategoryToArrayField()

setNameCategoryToType

public void setNameCategoryToType(IClass c)

setNameCategoryToPackage

public void setNameCategoryToPackage(IPackage p)

setNameCategoryToThis

public void setNameCategoryToThis()

setNameCategoryToSuper

public void setNameCategoryToSuper()

setNameCategoryToClassLiteral

public void setNameCategoryToClassLiteral(IClass c)

getNameCategory

public int getNameCategory(IEnv env)
                    throws VerifyingException

getNameCategory

public int getNameCategory()

categorySetError

protected Error categorySetError(String newCategory)

getFullPackageOrClassName

public String getFullPackageOrClassName(IEnv env)
                                 throws VerifyingException

getSimpleName

public String getSimpleName(IEnv env)
                     throws VerifyingException

getSimpleName

public String getSimpleName()

getFullPackageOrClassName

public String getFullPackageOrClassName()

getNamedClass

public IClass getNamedClass(IEnv env)
                     throws VerifyingException

getNamedClass

protected IClass getNamedClass()

getNamedField

protected IField getNamedField()

getNamedPackage

protected IPackage getNamedPackage()

computeType

public IClass computeType(IEnv env)
                   throws VerifyingException
Description copied from class: ExpressionNode
Compute the static type of the expression (nodes should not call this method directly). Called by getType.
Overrides:
computeType in class ExpressionNode
Tags copied from class: ExpressionNode
Parameters:
env - environment of name bindings, etc.
Returns:
the IClass of the static type.
Throws:
VerifyingException - if expression is illegal
See Also:
EvalMethods.getType(IExpressionNode, IEnv)

computeIsConstant

public boolean computeIsConstant(IEnv env)
                          throws VerifyingException
Description copied from class: ExpressionNode
Compute whether this expression is a constant (nodes should not call this method directly). Called by the isConstant method.
Overrides:
computeIsConstant in class ExpressionNode
Tags copied from class: ExpressionNode
Parameters:
env - environment of name bindings, etc.
Throws:
VerifyingException - if expression is illegal.
See Also:
ExpressionNode.isConstant(edu.mit.ai.psg.jeva.IEnv), EvalMethods.isConstant(IExpressionNode, IEnv)

ErrorNotVariableOrField

protected Error ErrorNotVariableOrField()

isFinal

public boolean isFinal(IEnv env)
                throws VerifyingException
used to test whether assignable. A name can be final but not constant if it is a final field f of a non-constant expression (expr).f

eval

public Object eval(IEnv env)
            throws ThrowException
Description copied from class: ExpressionNode
Evaluate this expression (nodes should not call this method directly). Called by the getValue method.
Overrides:
eval in class ExpressionNode
Tags copied from class: ExpressionNode
Parameters:
env - environment of name bindings, etc.
Throws:
ThrowException - if abruptly completed with an exception
See Also:
ExpressionNode.getValue(edu.mit.ai.psg.jeva.IEnv), EvalMethods.eval(IExpressionNode, IEnv)

evalToStore

public IStore evalToStore(IEnv env)
                   throws ThrowException
Specified by:
evalToStore in interface IExpressionStoreNode
Tags copied from interface: IExpressionStoreNode
Returns:
an IStore which can read and write the location to assign to.
Throws:
ThrowException - if completes abruptly with an exception

reclassifyName

protected void reclassifyName(IEnv env)
                       throws VerifyingException

computePackage

public IPackage computePackage(IEnv env)
                        throws VerifyingException

computeParentPackage

public IPackage computeParentPackage(IEnv env)
                              throws VerifyingException

getFullNameAndCurrentCategory

public String getFullNameAndCurrentCategory()
for error reports

getNameCategoryName

public String getNameCategoryName()

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu