cager.jexpr
Class JExpr

java.lang.Object
  extended bycager.jexpr.JExpr
All Implemented Interfaces:
JExprConstants

public class JExpr
extends java.lang.Object
implements JExprConstants

JExpr - a parser for a very small subset of Java.

Version:
2
Author:
Paul Cager.

Field Summary
 Token jj_nt
           
 boolean lookingAhead
           
 Token token
           
 JExprTokenManager token_source
           
 
Fields inherited from interface cager.jexpr.JExprConstants
_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, IN_FORMAL_COMMENT, IN_MULTI_LINE_COMMENT, IN_SINGLE_LINE_COMMENT, 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, STRICTFP, STRING_LITERAL, SUPER, SWITCH, SYNCHRONIZED, THIS, THROW, THROWS, TILDE, tokenImage, TRANSIENT, TRUE, TRY, VOID, VOLATILE, WHILE, XOR, XORASSIGN
 
Constructor Summary
JExpr(java.io.InputStream stream)
           
JExpr(JExprTokenManager tm)
           
JExpr(java.io.Reader stream)
           
 
Method Summary
 Expression AdditiveExpression()
           
 Expression AllocationExpression()
           
 Expression AndExpression()
           
 ArgumentList ArgumentList()
           
 ArgumentList Arguments()
           
 void ArrayDimsAndInits()
           
 void ArrayInitializer()
           
 void AssignmentOperator()
           
 Block Block()
           
 Statement BlockStatement()
           
 Expression BooleanLiteral()
           
 void BreakStatement()
           
 Expression CastExpression()
           
 void CastLookahead()
           
 void ClassBody()
           
 void ClassBodyDeclaration()
           
 ClassDeclaration ClassDeclaration()
           
 CompilationUnit CompilationUnit()
          The CompilationUnit production is the top-level production.
 Expression ConditionalAndExpression()
           
 Expression ConditionalExpression()
           
 Expression ConditionalOrExpression()
           
 void ConstructorDeclaration()
          Not implemented.
 void ContinueStatement()
           
 void disable_tracing()
           
 void DoStatement()
           
 void EmptyStatement()
           
 void enable_tracing()
           
 Expression EqualityExpression()
           
 Expression ExclusiveOrExpression()
           
 void ExplicitConstructorInvocation()
          Not implemented.
 Expression Expression()
          Parse an expression returning an AST representing that expression.
 void FieldDeclaration()
          Not implemented.
 void ForInit()
           
 FormalParameter FormalParameter()
           
 FormalParameters FormalParameters()
           
 void ForStatement()
           
 void ForUpdate()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 IfStatement IfStatement()
           
 void ImportDeclaration()
          Not implemented.
 Expression InclusiveOrExpression()
           
 void Initializer()
          Not implemented.
 Expression InstanceOfExpression()
           
 void InterfaceDeclaration()
          Not implemented.
 void InterfaceMemberDeclaration()
           
 void LabeledStatement()
           
 Expression Literal()
           
 void LocalVariableDeclaration()
           
static void main(java.lang.String[] args)
           
 MethodDeclaration MethodDeclaration()
           
 void MethodDeclarationLookahead()
          This production is to determine lookahead only.
 Expression MultiplicativeExpression()
           
 java.lang.String Name()
          Parse a (qualified) Name such as a.b.c
 void NameList()
           
 void NestedClassDeclaration()
           
 void NestedInterfaceDeclaration()
           
 Expression NullLiteral()
           
 java.lang.String PackageDeclaration()
          A package declaration.
 Expression PostfixExpression()
           
 Expression PreDecrementExpression()
           
 Expression PreIncrementExpression()
           
 Expression PrimaryExpression()
           
 void PrimaryPrefix(PrimaryExpression pe)
           
 void PrimarySuffix(PrimaryExpression pe)
           
 org.apache.bcel.generic.Type PrimitiveType()
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(JExprTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
 Expression RelationalExpression()
           
 org.apache.bcel.generic.Type ResultType()
          A ResultType is either "void" or a Type.
 ReturnStatement ReturnStatement()
           
 Expression ShiftExpression()
           
 Statement Statement()
           
 void StatementExpression()
           
 void StatementExpressionList()
           
 void SwitchLabel()
           
 void SwitchStatement()
           
 void SynchronizedStatement()
           
 void ThrowStatement()
           
 void TryStatement()
           
 org.apache.bcel.generic.Type Type()
          Parse a "Type", which may be a primitive Type, a class name or an array (arrays not implemented).
 void TypeDeclaration()
           
 org.apache.bcel.generic.Type TypeName()
           
 Expression UnaryExpression()
           
 Expression UnaryExpressionNotPlusMinus()
           
 void UnmodifiedClassDeclaration()
           
 void UnmodifiedInterfaceDeclaration()
           
 void VariableDeclarator()
           
 java.lang.String 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

token_source

public JExprTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

JExpr

public JExpr(java.io.InputStream stream)

JExpr

public JExpr(java.io.Reader stream)

JExpr

public JExpr(JExprTokenManager tm)
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Throwable
Throws:
java.lang.Throwable

CompilationUnit

public final CompilationUnit CompilationUnit()
                                      throws ParseException
The CompilationUnit production is the top-level production.

Throws:
ParseException

PackageDeclaration

public final java.lang.String PackageDeclaration()
                                          throws ParseException
A package declaration.

Returns:
A string of the form "name1.name2...".
Throws:
ParseException

ImportDeclaration

public final void ImportDeclaration()
                             throws ParseException
Not implemented.

Throws:
ParseException

TypeDeclaration

public final void TypeDeclaration()
                           throws ParseException
Throws:
ParseException

ClassDeclaration

public final ClassDeclaration ClassDeclaration()
                                        throws ParseException
Throws:
ParseException

UnmodifiedClassDeclaration

public final void UnmodifiedClassDeclaration()
                                      throws ParseException
Throws:
ParseException

ClassBody

public final void ClassBody()
                     throws ParseException
Throws:
ParseException

NestedClassDeclaration

public final void NestedClassDeclaration()
                                  throws ParseException
Throws:
ParseException

ClassBodyDeclaration

public final void ClassBodyDeclaration()
                                throws ParseException
Throws:
ParseException

MethodDeclarationLookahead

public final void MethodDeclarationLookahead()
                                      throws ParseException
This production is to determine lookahead only.

Throws:
ParseException

InterfaceDeclaration

public final void InterfaceDeclaration()
                                throws ParseException
Not implemented.

Throws:
ParseException

NestedInterfaceDeclaration

public final void NestedInterfaceDeclaration()
                                      throws ParseException
Throws:
ParseException

UnmodifiedInterfaceDeclaration

public final void UnmodifiedInterfaceDeclaration()
                                          throws ParseException
Throws:
ParseException

InterfaceMemberDeclaration

public final void InterfaceMemberDeclaration()
                                      throws ParseException
Throws:
ParseException

FieldDeclaration

public final void FieldDeclaration()
                            throws ParseException
Not implemented.

Throws:
ParseException

VariableDeclarator

public final void VariableDeclarator()
                              throws ParseException
Throws:
ParseException

VariableDeclaratorId

public final java.lang.String VariableDeclaratorId()
                                            throws ParseException
Throws:
ParseException

VariableInitializer

public final void VariableInitializer()
                               throws ParseException
Throws:
ParseException

ArrayInitializer

public final void ArrayInitializer()
                            throws ParseException
Throws:
ParseException

MethodDeclaration

public final MethodDeclaration MethodDeclaration()
                                          throws ParseException
Throws:
ParseException

FormalParameters

public final FormalParameters FormalParameters()
                                        throws ParseException
Throws:
ParseException

FormalParameter

public final FormalParameter FormalParameter()
                                      throws ParseException
Throws:
ParseException

ConstructorDeclaration

public final void ConstructorDeclaration()
                                  throws ParseException
Not implemented.

Throws:
ParseException

ExplicitConstructorInvocation

public final void ExplicitConstructorInvocation()
                                         throws ParseException
Not implemented.

Throws:
ParseException

Initializer

public final void Initializer()
                       throws ParseException
Not implemented.

Throws:
ParseException

Type

public final org.apache.bcel.generic.Type Type()
                                        throws ParseException
Parse a "Type", which may be a primitive Type, a class name or an array (arrays not implemented).

Throws:
ParseException

TypeName

public final org.apache.bcel.generic.Type TypeName()
                                            throws ParseException
Throws:
ParseException

PrimitiveType

public final org.apache.bcel.generic.Type PrimitiveType()
                                                 throws ParseException
Throws:
ParseException

ResultType

public final org.apache.bcel.generic.Type ResultType()
                                              throws ParseException
A ResultType is either "void" or a Type.

Throws:
ParseException

Name

public final java.lang.String Name()
                            throws ParseException
Parse a (qualified) Name such as a.b.c

Throws:
ParseException

NameList

public final void NameList()
                    throws ParseException
Throws:
ParseException

Expression

public final Expression Expression()
                            throws ParseException
Parse an expression returning an AST representing that expression.

Throws:
ParseException

AssignmentOperator

public final void AssignmentOperator()
                              throws ParseException
Throws:
ParseException

ConditionalExpression

public final Expression ConditionalExpression()
                                       throws ParseException
Throws:
ParseException

ConditionalOrExpression

public final Expression ConditionalOrExpression()
                                         throws ParseException
Throws:
ParseException

ConditionalAndExpression

public final Expression ConditionalAndExpression()
                                          throws ParseException
Throws:
ParseException

InclusiveOrExpression

public final Expression InclusiveOrExpression()
                                       throws ParseException
Throws:
ParseException

ExclusiveOrExpression

public final Expression ExclusiveOrExpression()
                                       throws ParseException
Throws:
ParseException

AndExpression

public final Expression AndExpression()
                               throws ParseException
Throws:
ParseException

EqualityExpression

public final Expression EqualityExpression()
                                    throws ParseException
Throws:
ParseException

InstanceOfExpression

public final Expression InstanceOfExpression()
                                      throws ParseException
Throws:
ParseException

RelationalExpression

public final Expression RelationalExpression()
                                      throws ParseException
Throws:
ParseException

ShiftExpression

public final Expression ShiftExpression()
                                 throws ParseException
Throws:
ParseException

AdditiveExpression

public final Expression AdditiveExpression()
                                    throws ParseException
Throws:
ParseException

MultiplicativeExpression

public final Expression MultiplicativeExpression()
                                          throws ParseException
Throws:
ParseException

UnaryExpression

public final Expression UnaryExpression()
                                 throws ParseException
Throws:
ParseException

PreIncrementExpression

public final Expression PreIncrementExpression()
                                        throws ParseException
Throws:
ParseException

PreDecrementExpression

public final Expression PreDecrementExpression()
                                        throws ParseException
Throws:
ParseException

UnaryExpressionNotPlusMinus

public final Expression UnaryExpressionNotPlusMinus()
                                             throws ParseException
Throws:
ParseException

CastLookahead

public final void CastLookahead()
                         throws ParseException
Throws:
ParseException

PostfixExpression

public final Expression PostfixExpression()
                                   throws ParseException
Throws:
ParseException

CastExpression

public final Expression CastExpression()
                                throws ParseException
Throws:
ParseException

PrimaryExpression

public final Expression PrimaryExpression()
                                   throws ParseException
Throws:
ParseException

PrimaryPrefix

public final void PrimaryPrefix(PrimaryExpression pe)
                         throws ParseException
Throws:
ParseException

PrimarySuffix

public final void PrimarySuffix(PrimaryExpression pe)
                         throws ParseException
Throws:
ParseException

Literal

public final Expression Literal()
                         throws ParseException
Throws:
ParseException

BooleanLiteral

public final Expression BooleanLiteral()
                                throws ParseException
Throws:
ParseException

NullLiteral

public final Expression NullLiteral()
                             throws ParseException
Throws:
ParseException

Arguments

public final ArgumentList Arguments()
                             throws ParseException
Throws:
ParseException

ArgumentList

public final ArgumentList ArgumentList()
                                throws ParseException
Throws:
ParseException

AllocationExpression

public final Expression AllocationExpression()
                                      throws ParseException
Throws:
ParseException

ArrayDimsAndInits

public final void ArrayDimsAndInits()
                             throws ParseException
Throws:
ParseException

Statement

public final Statement Statement()
                          throws ParseException
Throws:
ParseException

LabeledStatement

public final void LabeledStatement()
                            throws ParseException
Throws:
ParseException

Block

public final Block Block()
                  throws ParseException
Throws:
ParseException

BlockStatement

public final Statement BlockStatement()
                               throws ParseException
Throws:
ParseException

LocalVariableDeclaration

public final void LocalVariableDeclaration()
                                    throws ParseException
Throws:
ParseException

EmptyStatement

public final void EmptyStatement()
                          throws ParseException
Throws:
ParseException

StatementExpression

public final void StatementExpression()
                               throws ParseException
Throws:
ParseException

SwitchStatement

public final void SwitchStatement()
                           throws ParseException
Throws:
ParseException

SwitchLabel

public final void SwitchLabel()
                       throws ParseException
Throws:
ParseException

IfStatement

public final IfStatement IfStatement()
                              throws ParseException
Throws:
ParseException

WhileStatement

public final void WhileStatement()
                          throws ParseException
Throws:
ParseException

DoStatement

public final void DoStatement()
                       throws ParseException
Throws:
ParseException

ForStatement

public final void ForStatement()
                        throws ParseException
Throws:
ParseException

ForInit

public final void ForInit()
                   throws ParseException
Throws:
ParseException

StatementExpressionList

public final void StatementExpressionList()
                                   throws ParseException
Throws:
ParseException

ForUpdate

public final void ForUpdate()
                     throws ParseException
Throws:
ParseException

BreakStatement

public final void BreakStatement()
                          throws ParseException
Throws:
ParseException

ContinueStatement

public final void ContinueStatement()
                             throws ParseException
Throws:
ParseException

ReturnStatement

public final ReturnStatement ReturnStatement()
                                      throws ParseException
Throws:
ParseException

ThrowStatement

public final void ThrowStatement()
                          throws ParseException
Throws:
ParseException

SynchronizedStatement

public final void SynchronizedStatement()
                                 throws ParseException
Throws:
ParseException

TryStatement

public final void TryStatement()
                        throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(JExprTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()