openjava.syntax
Class AbstractSyntaxRule

java.lang.Object
  |
  +--openjava.syntax.AbstractSyntaxRule
All Implemented Interfaces:
SyntaxRule, TokenID
Direct Known Subclasses:
BlockRule, CompositeRule, ExpressionRule, IdentifierRule, IterationRule, NameRule, PrepPhraseRule, SelectionRule, SeparatedListRule, StatementRule, TokenRule, TypeNameRule

public abstract class AbstractSyntaxRule
extends java.lang.Object
implements SyntaxRule

The interface AbstractSyntaxRule represents a syntax rule.

Since:
%SOFTWARE% 1.0
See Also:
Object

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
AbstractSyntaxRule()
           
 
Method Summary
abstract  ParseTree consume(TokenSource token_src)
          Consumes tokens from the given token source following the rule.
 SyntaxException getSyntaxException()
          Obtains the syntax exception at the last lookahead. through the method lookahead(TokenSource).
 boolean lookahead(TokenSource token_src)
          Tests if the given token source follows this rule.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSyntaxRule

public AbstractSyntaxRule()
Method Detail

consume

public abstract ParseTree consume(TokenSource token_src)
                           throws SyntaxException
Consumes tokens from the given token source following the rule. To be overridden.
Specified by:
consume in interface SyntaxRule
Parameters:
token_src - token source to consume.
Returns:
a parse tree object consumed by following this rule.

lookahead

public final boolean lookahead(TokenSource token_src)
Tests if the given token source follows this rule.
Specified by:
lookahead in interface SyntaxRule
Parameters:
token_src - token source to consume.
Returns:
true if the given token source can be consumed safely.

getSyntaxException

public final SyntaxException getSyntaxException()
Obtains the syntax exception at the last lookahead. through the method lookahead(TokenSource).
Specified by:
getSyntaxException in interface SyntaxRule
Returns:
the syntax exception.