openjava.syntax
Class JavaSyntaxRules

java.lang.Object
  |
  +--openjava.syntax.JavaSyntaxRules
All Implemented Interfaces:
TokenID

public class JavaSyntaxRules
extends Object
implements TokenID

Utility methods for syntax rules.

Since:
%SOFTWARE% 1.0
Version:
1.0
Author:
Michiaki Tatsubori
See Also:
Object

Field Summary
private static ParseException lastException
           
 
Fields inherited from interface openjava.syntax.TokenID
ABSTRACT, ANDASSIGN, ASSIGN, BANG, BIT_AND, BIT_OR, BOOLEAN, BREAK, BYTE, CASE, CATCH, CHAR, CHARACTER_LITERAL, CLASS, COLON, COMMA, CONDITIONAL_AND, CONDITIONAL_OR, CONTINUE, DECREMENT, DEFAULT, DO, DOT, DOUBLE, DOUBLE_LITERAL, ELSE, EOF, EQUAL, EXTENDS, FALSE, FINAL, FINALLY, FLOAT, FLOAT_LITERAL, FOR, GREATER, GREATER_EQUAL, HOOK, IDENTIFIER, IF, IMPLEMENTS, IMPORT, INCREMENT, INSTANCEOF, INSTANTIATES, INT, INTEGER_LITERAL, INTERFACE, LBRACE, LBRACKET, LESS, LESS_EQUAL, LONG, LONG_LITERAL, LPAREN, LSHIFT, LSHIFTASSIGN, METACLASS, MINUS, MINUSASSIGN, NATIVE, NEW, NOT_EQUAL, NULL, ORASSIGN, PACKAGE, PLUS, PLUSASSIGN, PRIVATE, PROTECTED, PUBLIC, RBRACE, RBRACKET, REM, REMASSIGN, RETURN, RPAREN, RSIGNEDSHIFT, RSIGNEDSHIFTASSIGN, RUNSIGNEDSHIFT, RUNSIGNEDSHIFTASSIGN, SEMICOLON, SHORT, SLASH, SLASHASSIGN, STAR, STARASSIGN, STATIC, STRING_LITERAL, SUPER, SWITCH, SYNCHRONIZED, THIS, THROW, THROWS, TILDE, TRANSIENT, TRUE, TRY, VOID, VOLATILE, WHILE, XOR, XORASSIGN
 
Constructor Summary
private JavaSyntaxRules()
           
 
Method Summary
private static void adjustTokenSource(TokenSource token_src, Token last_token)
           
static Block consumeBlock(TokenSource token_src)
           
static Block consumeBlock(TokenSource token_src, Environment env)
          Consumes a block.
static Expression consumeExpression(TokenSource token_src)
           
static Expression consumeExpression(TokenSource token_src, Environment env)
          Consumes a single expression from given token source.
static Statement consumeStatement(TokenSource token_src)
           
static Statement consumeStatement(TokenSource token_src, Environment env)
          Consumes a statement.
static TypeName consumeTypeName(TokenSource token_src)
          Consumes a type name.
private static ParseTree correct(ParseTree ptree, Environment env)
           
static SyntaxException getLastException()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastException

private static ParseException lastException
Constructor Detail

JavaSyntaxRules

private JavaSyntaxRules()
Method Detail

getLastException

public static SyntaxException getLastException()

correct

private static ParseTree correct(ParseTree ptree,
                                 Environment env)

adjustTokenSource

private static void adjustTokenSource(TokenSource token_src,
                                      Token last_token)

consumeExpression

public static final Expression consumeExpression(TokenSource token_src,
                                                 Environment env)
Consumes a single expression from given token source.

Parameters:
token_src - token source
env - environment
Returns:
null if this fail, otherwise an expression.

consumeExpression

public static final Expression consumeExpression(TokenSource token_src)

consumeStatement

public static final Statement consumeStatement(TokenSource token_src,
                                               Environment env)
Consumes a statement. This consumes only a pure statement excluding local variable declarations and local class declarations.

Parameters:
token_src - token source
Returns:
null if this fail, otherwise a statement.

consumeStatement

public static final Statement consumeStatement(TokenSource token_src)

consumeBlock

public static final Block consumeBlock(TokenSource token_src,
                                       Environment env)
Consumes a block.

Parameters:
token_src - token source
Returns:
null if this fail, otherwise a block.

consumeBlock

public static final Block consumeBlock(TokenSource token_src)

consumeTypeName

public static final TypeName consumeTypeName(TokenSource token_src)
Consumes a type name. Including primitive type and reference type.

Parameters:
token_src - token source
Returns:
null if this fail, otherwise a block.

SourceForge.net_Logo