openjava.syntax
Interface SyntaxRule

All Superinterfaces:
TokenID
All Known Implementing Classes:
AbstractSyntaxRule

public interface SyntaxRule
extends TokenID

The interface SyntaxRule represents a syntax rule.

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

Field Summary
 
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
 
Method Summary
 ParseTree consume(TokenSource token_src)
          Consumes tokens from the given token source following the rule.
 SyntaxException getSyntaxException()
          Returns the last syntax exception in consuming token source through the method consume(TokenSource).
 boolean lookahead(TokenSource token_src)
          Tests if the given token source follows this rule.
 

Method Detail

consume

public ParseTree consume(TokenSource token_src)
                  throws SyntaxException
Consumes tokens from the given token source following the rule.

Parameters:
token_src - token source to consume.
Returns:
null in case of fail to consume, otherwise a parse tree object consumed following this rule.
Throws:
SyntaxException - in case to fail to consume.

lookahead

public boolean lookahead(TokenSource token_src)
Tests if the given token source follows this rule.

Parameters:
token_src - token source to consume.
Returns:
true if the given token source can be consumed safely.

getSyntaxException

public SyntaxException getSyntaxException()
Returns the last syntax exception in consuming token source through the method consume(TokenSource).

Returns:
the syntax exception.

SourceForge.net_Logo