openjava.syntax
Class SelectionRule

java.lang.Object
  |
  +--openjava.syntax.AbstractSyntaxRule
        |
        +--openjava.syntax.SelectionRule
All Implemented Interfaces:
SyntaxRule, TokenID

public class SelectionRule
extends AbstractSyntaxRule

The class SelectionRule represents selective syntax rule.

Suppose there're several syntax rules; A, B, C. This class can represents the syntax ( A | B | C ). If both A and B are adaptable to token source, A is choosed since A is specified at lefter part than B's part.

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

Field Summary
protected  SyntaxRule[] elementRules
           
 
Fields inherited from class openjava.syntax.AbstractSyntaxRule
 
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
SelectionRule(SyntaxRule[] elementRules)
          Allocates a new rule representing a selection of given rules.
SelectionRule(SyntaxRule e1, SyntaxRule e2)
           
SelectionRule(SyntaxRule e1, SyntaxRule e2, SyntaxRule e3)
           
 
Method Summary
 ParseTree consume(TokenSource token_src)
          Consumes tokens from the given token source following the rule.
 
Methods inherited from class openjava.syntax.AbstractSyntaxRule
getSyntaxException, lookahead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elementRules

protected SyntaxRule[] elementRules
Constructor Detail

SelectionRule

public SelectionRule(SyntaxRule[] elementRules)
Allocates a new rule representing a selection of given rules.

Parameters:
elementRules - an array of rules

SelectionRule

public SelectionRule(SyntaxRule e1,
                     SyntaxRule e2)

SelectionRule

public SelectionRule(SyntaxRule e1,
                     SyntaxRule e2,
                     SyntaxRule e3)
Method Detail

consume

public ParseTree consume(TokenSource token_src)
                  throws SyntaxException
Description copied from class: AbstractSyntaxRule
Consumes tokens from the given token source following the rule. To be overridden.

Specified by:
consume in interface SyntaxRule
Specified by:
consume in class AbstractSyntaxRule
Parameters:
token_src - token source to consume.
Returns:
a parse tree object consumed by following this rule.
SyntaxException

SourceForge.net_Logo