edu.mit.ai.psg.jeva
Class JevaParser

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.JevaParser

public class JevaParser
extends Object
implements JevaParserTreeConstants, JevaParserConstants

JevaParser: parse Java Expressions and Statements.

Includes minor Java syntax amendment for Jeva: Allow package statement with no name, for specifying an unnamed package.

JevaParser was generated by Sun's free Java parser generator JavaCC/JJTree (now maintained by the spinoff Metamata), using a modified version of the example Java grammar.


Field Summary
static int dbgLev
           
 Token jj_nt
           
protected  edu.mit.ai.psg.jeva.JJTJevaParserState jjtree
           
 boolean lookingAhead
           
 Token token
           
 JevaParserTokenManager token_source
           
 
Fields inherited from interface edu.mit.ai.psg.jeva.JevaParserTreeConstants
JJTCOMPILATIONUNIT, JJTDCLASSBODY, JJTDCLASSDECLARATION, JJTDCONSTRUCTORDECLARATION, JJTDFIELDDECLARATION, JJTDIMPORTDECLARATION, JJTDINITIALIZER, JJTDMETHODDECLARATION, JJTDPACKAGEDECLARATION, JJTEADDITIVEEXPRESSION, JJTEANDEXPRESSION, JJTEARGUMENTS, JJTEARRAYACCESSEXPRESSION, JJTEARRAYCREATIONEXPRESSION, JJTEARRAYDIMENSIONS, JJTEARRAYINITIALIZER, JJTEASSIGNMENTEXPRESSION, JJTEASSIGNMENTOPERATOR, JJTECASTEXPRESSION, JJTECONDITIONALANDEXPRESSION, JJTECONDITIONALEXPRESSION, JJTECONDITIONALOREXPRESSION, JJTEEQUALITYEXPRESSION, JJTEEXCLUSIVEOREXPRESSION, JJTEINCLUSIVEOREXPRESSION, JJTEINSTANCECREATIONEXPRESSION, JJTEINSTANCEOFEXPRESSION, JJTELITERALEXPRESSION, JJTEMETHODINVOCATIONEXPRESSION, JJTEMULTIPLICATIVEEXPRESSION, JJTEPARENTHESIZEDEXPRESSION, JJTEPOSTFIXEXPRESSION, JJTEPREDECREMENTEXPRESSION, JJTEPREINCREMENTEXPRESSION, JJTERELATIONALEXPRESSION, JJTESHIFTEXPRESSION, JJTEUNARYEXPRESSION, JJTFORMALPARAMETER, JJTFORMALPARAMETERLIST, JJTNAME, JJTNAMELIST, jjtNodeName, JJTPRIMITIVETYPE, JJTRESULTTYPE, JJTSBLOCK, JJTSBREAKSTATEMENT, JJTSCONTINUESTATEMENT, JJTSDOSTATEMENT, JJTSEMPTYSTATEMENT, JJTSEXPLICITCONSTRUCTORINVOCATION, JJTSEXPRESSIONSTATEMENT, JJTSEXPRESSIONSTATEMENTLIST, JJTSFORSTATEMENT, JJTSIFSTATEMENT, JJTSLABELEDSTATEMENT, JJTSLOCALVARIABLEDECLARATION, JJTSRETURNSTATEMENT, JJTSSWITCHLABEL, JJTSSWITCHSTATEMENT, JJTSSYNCHRONIZEDSTATEMENT, JJTSTHROWSTATEMENT, JJTSTRYSTATEMENT, JJTSVARIABLEDECLARATOR, JJTSWHILESTATEMENT, JJTTYPE, JJTVOID
 
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
 
Constructor Summary
JevaParser(InputStream stream)
           
JevaParser(JevaParserTokenManager tm)
           
 
Method Summary
 void AdditiveExpression()
           
 void AllocationExpression()
           
 void AndExpression()
           
 void ArgumentList()
           
 void Arguments()
           
 void ArrayDimensions()
           
 void ArrayInitializer()
           
 void Assignment()
           
 void AssignmentOperator()
           
 void Block()
           
 void BlockStatement()
           
 void BooleanLiteral()
           
 void BreakStatement()
           
 void CastExpression()
           
 void CastLookahead()
           
 void CharacterLiteral()
           
 void ClassBody()
           
 void ClassBodyDeclaration()
           
 void ClassDeclaration()
           
 void CompilationUnit()
          THE JAVA LANGUAGE GRAMMAR STARTS HERE *
 void ConditionalAndExpression()
           
 void ConditionalExpression()
           
 void ConditionalOrExpression()
           
 void ConstructorDeclaration()
           
 void ContinueStatement()
           
static void dbgOut(String s)
           
 void Declaration()
           
 void disable_tracing()
           
 void DoStatement()
           
 void EmptyStatement()
           
 void enable_tracing()
           
 void EqualityExpression()
           
 void ExclusiveOrExpression()
           
 void ExplicitConstructorInvocation()
           
 void Expression()
           
 void ExpressionStatement()
           
 void ExpressionStatementExpression()
           
 void ExpressionStatementList()
           
 void FieldDeclaration()
           
 void FloatingPointLiteral()
           
 void ForInit()
           
 void FormalParameter()
           
 void FormalParameterList()
           
 void ForStatement()
           
 void ForUpdate()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void IfStatement()
           
 void ImportDeclaration()
           
 void InclusiveOrExpression()
           
 void Initializer()
           
 void InstanceOfExpression()
           
 void IntegerLiteral()
           
 void InterfaceDeclaration()
           
 void InterfaceMemberDeclaration()
           
 void LabeledStatement()
           
 void Literal()
           
 void LocalForVariableDeclaration()
           
 void LocalVariableDeclaration()
           
 void LocalVariableDeclarationStatement()
           
 void MethodDeclaration()
           
 void MethodDeclarationLookahead()
           
 void MethodDeclarator()
           
 void MultiplicativeExpression()
           
 void Name()
           
 void NameList()
           
 void NestedClassDeclaration()
           
 void NestedInterfaceDeclaration()
           
 void NullLiteral()
           
 void PackageDeclaration()
           
static JNCompilationUnit parseStreamCompilationUnit(InputStream stream)
           
static IDeclarationNode parseStreamDeclaration(InputStream stream)
           
static IExpressionNode parseStreamExpression(InputStream stream)
           
static JNName parseStreamName(InputStream stream)
           
static IStatementNode parseStreamStatement(InputStream stream)
           
static JNCompilationUnit parseStringCompilationUnit(String s)
           
static IDeclarationNode parseStringDeclaration(String s)
           
static IExpressionNode parseStringExpression(String s)
           
static JNName parseStringName(String s)
           
static IStatementNode parseStringStatement(String s)
           
 void PostfixExpression()
           
 void PreDecrementExpression()
           
 void PreIncrementExpression()
           
 void PrimaryExpression()
           
 void PrimaryPrefix()
           
 void PrimarySuffix()
           
 void PrimitiveType()
           
 void ReInit(InputStream stream)
           
 void ReInit(JevaParserTokenManager tm)
           
 void RelationalExpression()
           
 void ResultType()
           
 void ReturnStatement()
           
 void ShiftExpression()
           
 void Statement()
           
 void StringLiteral()
           
 void SwitchLabel()
           
 void SwitchStatement()
           
 void SynchronizedStatement()
           
 void ThrowStatement()
           
 void TryStatement()
           
 void Type()
           
 void TypeDeclaration()
           
 void UnaryExpression()
           
 void UnaryExpressionNotPlusMinus()
           
 void UnmodifiedClassDeclaration()
           
 void UnmodifiedInterfaceDeclaration()
           
 void VariableDeclarator()
           
 void VariableDeclaratorId()
           
 void VariableInitializer()
           
 void WhileStatement()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected edu.mit.ai.psg.jeva.JJTJevaParserState jjtree

dbgLev

public static int dbgLev

token_source

public JevaParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

JevaParser

public JevaParser(InputStream stream)

JevaParser

public JevaParser(JevaParserTokenManager tm)
Method Detail

parseStringCompilationUnit

public static JNCompilationUnit parseStringCompilationUnit(String s)
                                                    throws ParseException

parseStreamCompilationUnit

public static JNCompilationUnit parseStreamCompilationUnit(InputStream stream)
                                                    throws ParseException

parseStringExpression

public static IExpressionNode parseStringExpression(String s)
                                             throws ParseException

parseStreamExpression

public static IExpressionNode parseStreamExpression(InputStream stream)
                                             throws ParseException

parseStringStatement

public static IStatementNode parseStringStatement(String s)
                                           throws ParseException

parseStreamStatement

public static IStatementNode parseStreamStatement(InputStream stream)
                                           throws ParseException

parseStringDeclaration

public static IDeclarationNode parseStringDeclaration(String s)
                                               throws ParseException

parseStreamDeclaration

public static IDeclarationNode parseStreamDeclaration(InputStream stream)
                                               throws ParseException

parseStringName

public static JNName parseStringName(String s)
                              throws ParseException

parseStreamName

public static JNName parseStreamName(InputStream stream)
                              throws ParseException

dbgOut

public static void dbgOut(String s)

CompilationUnit

public final void CompilationUnit()
                           throws ParseException
THE JAVA LANGUAGE GRAMMAR STARTS HERE *

Declaration

public final void Declaration()
                       throws ParseException

PackageDeclaration

public final void PackageDeclaration()
                              throws ParseException

ImportDeclaration

public final void ImportDeclaration()
                             throws ParseException

TypeDeclaration

public final void TypeDeclaration()
                           throws ParseException

ClassDeclaration

public final void ClassDeclaration()
                            throws ParseException

UnmodifiedClassDeclaration

public final void UnmodifiedClassDeclaration()
                                      throws ParseException

ClassBody

public final void ClassBody()
                     throws ParseException

NestedClassDeclaration

public final void NestedClassDeclaration()
                                  throws ParseException

ClassBodyDeclaration

public final void ClassBodyDeclaration()
                                throws ParseException

MethodDeclarationLookahead

public final void MethodDeclarationLookahead()
                                      throws ParseException

InterfaceDeclaration

public final void InterfaceDeclaration()
                                throws ParseException

NestedInterfaceDeclaration

public final void NestedInterfaceDeclaration()
                                      throws ParseException

UnmodifiedInterfaceDeclaration

public final void UnmodifiedInterfaceDeclaration()
                                          throws ParseException

InterfaceMemberDeclaration

public final void InterfaceMemberDeclaration()
                                      throws ParseException

FieldDeclaration

public final void FieldDeclaration()
                            throws ParseException

VariableDeclarator

public final void VariableDeclarator()
                              throws ParseException

VariableDeclaratorId

public final void VariableDeclaratorId()
                                throws ParseException

VariableInitializer

public final void VariableInitializer()
                               throws ParseException

ArrayInitializer

public final void ArrayInitializer()
                            throws ParseException

MethodDeclaration

public final void MethodDeclaration()
                             throws ParseException

MethodDeclarator

public final void MethodDeclarator()
                            throws ParseException

FormalParameterList

public final void FormalParameterList()
                               throws ParseException

FormalParameter

public final void FormalParameter()
                           throws ParseException

ConstructorDeclaration

public final void ConstructorDeclaration()
                                  throws ParseException

ExplicitConstructorInvocation

public final void ExplicitConstructorInvocation()
                                         throws ParseException

Initializer

public final void Initializer()
                       throws ParseException

Type

public final void Type()
                throws ParseException

PrimitiveType

public final void PrimitiveType()
                         throws ParseException

ResultType

public final void ResultType()
                      throws ParseException

Name

public final void Name()
                throws ParseException

NameList

public final void NameList()
                    throws ParseException

Expression

public final void Expression()
                      throws ParseException

Assignment

public final void Assignment()
                      throws ParseException

AssignmentOperator

public final void AssignmentOperator()
                              throws ParseException

ConditionalExpression

public final void ConditionalExpression()
                                 throws ParseException

ConditionalOrExpression

public final void ConditionalOrExpression()
                                   throws ParseException

ConditionalAndExpression

public final void ConditionalAndExpression()
                                    throws ParseException

InclusiveOrExpression

public final void InclusiveOrExpression()
                                 throws ParseException

ExclusiveOrExpression

public final void ExclusiveOrExpression()
                                 throws ParseException

AndExpression

public final void AndExpression()
                         throws ParseException

EqualityExpression

public final void EqualityExpression()
                              throws ParseException

InstanceOfExpression

public final void InstanceOfExpression()
                                throws ParseException

RelationalExpression

public final void RelationalExpression()
                                throws ParseException

ShiftExpression

public final void ShiftExpression()
                           throws ParseException

AdditiveExpression

public final void AdditiveExpression()
                              throws ParseException

MultiplicativeExpression

public final void MultiplicativeExpression()
                                    throws ParseException

UnaryExpression

public final void UnaryExpression()
                           throws ParseException

PreIncrementExpression

public final void PreIncrementExpression()
                                  throws ParseException

PreDecrementExpression

public final void PreDecrementExpression()
                                  throws ParseException

UnaryExpressionNotPlusMinus

public final void UnaryExpressionNotPlusMinus()
                                       throws ParseException

CastLookahead

public final void CastLookahead()
                         throws ParseException

PostfixExpression

public final void PostfixExpression()
                             throws ParseException

CastExpression

public final void CastExpression()
                          throws ParseException

PrimaryExpression

public final void PrimaryExpression()
                             throws ParseException

PrimaryPrefix

public final void PrimaryPrefix()
                         throws ParseException

PrimarySuffix

public final void PrimarySuffix()
                         throws ParseException

Literal

public final void Literal()
                   throws ParseException

IntegerLiteral

public final void IntegerLiteral()
                          throws ParseException

FloatingPointLiteral

public final void FloatingPointLiteral()
                                throws ParseException

CharacterLiteral

public final void CharacterLiteral()
                            throws ParseException

StringLiteral

public final void StringLiteral()
                         throws ParseException

BooleanLiteral

public final void BooleanLiteral()
                          throws ParseException

NullLiteral

public final void NullLiteral()
                       throws ParseException

Arguments

public final void Arguments()
                     throws ParseException

ArgumentList

public final void ArgumentList()
                        throws ParseException

AllocationExpression

public final void AllocationExpression()
                                throws ParseException

ArrayDimensions

public final void ArrayDimensions()
                           throws ParseException

Statement

public final void Statement()
                     throws ParseException

LabeledStatement

public final void LabeledStatement()
                            throws ParseException

Block

public final void Block()
                 throws ParseException

BlockStatement

public final void BlockStatement()
                          throws ParseException

LocalVariableDeclarationStatement

public final void LocalVariableDeclarationStatement()
                                             throws ParseException

LocalForVariableDeclaration

public final void LocalForVariableDeclaration()
                                       throws ParseException

LocalVariableDeclaration

public final void LocalVariableDeclaration()
                                    throws ParseException

EmptyStatement

public final void EmptyStatement()
                          throws ParseException

ExpressionStatement

public final void ExpressionStatement()
                               throws ParseException

ExpressionStatementExpression

public final void ExpressionStatementExpression()
                                         throws ParseException

SwitchStatement

public final void SwitchStatement()
                           throws ParseException

SwitchLabel

public final void SwitchLabel()
                       throws ParseException

IfStatement

public final void IfStatement()
                       throws ParseException

WhileStatement

public final void WhileStatement()
                          throws ParseException

DoStatement

public final void DoStatement()
                       throws ParseException

ForStatement

public final void ForStatement()
                        throws ParseException

ForInit

public final void ForInit()
                   throws ParseException

ExpressionStatementList

public final void ExpressionStatementList()
                                   throws ParseException

ForUpdate

public final void ForUpdate()
                     throws ParseException

BreakStatement

public final void BreakStatement()
                          throws ParseException

ContinueStatement

public final void ContinueStatement()
                             throws ParseException

ReturnStatement

public final void ReturnStatement()
                           throws ParseException

ThrowStatement

public final void ThrowStatement()
                          throws ParseException

SynchronizedStatement

public final void SynchronizedStatement()
                                 throws ParseException

TryStatement

public final void TryStatement()
                        throws ParseException

ReInit

public void ReInit(InputStream stream)

ReInit

public void ReInit(JevaParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu