// $ANTLR 2.7.4: "boolean.g" -> "BooleanAntlrParser.java"$
package org.jostraca.util;
import org.jostraca.comp.antlr.TokenBuffer;
import org.jostraca.comp.antlr.TokenStreamException;
import org.jostraca.comp.antlr.TokenStreamIOException;
import org.jostraca.comp.antlr.ANTLRException;
import org.jostraca.comp.antlr.LLkParser;
import org.jostraca.comp.antlr.Token;
import org.jostraca.comp.antlr.TokenStream;
import org.jostraca.comp.antlr.RecognitionException;
import org.jostraca.comp.antlr.NoViableAltException;
import org.jostraca.comp.antlr.MismatchedTokenException;
import org.jostraca.comp.antlr.SemanticException;
import org.jostraca.comp.antlr.ParserSharedInputState;
import org.jostraca.comp.antlr.collections.impl.BitSet;
import org.jostraca.comp.antlr.collections.AST;
import java.util.Hashtable;
import org.jostraca.comp.antlr.ASTFactory;
import org.jostraca.comp.antlr.ASTPair;
import org.jostraca.comp.antlr.collections.impl.ASTArray;
public class BooleanAntlrParser extends org.jostraca.comp.antlr.LLkParser implements BooleanAntlrLexerTokenTypes
{
public void reportError( RecognitionException re ) {
throw new RuntimeException( re.getMessage() );
}
public void reportError(String s) {
throw new RuntimeException( s );
}
public void reportWarning(String s) {
throw new RuntimeException( s );
}
protected BooleanAntlrParser(TokenBuffer tokenBuf, int k) {
super(tokenBuf,k);
tokenNames = _tokenNames;
buildTokenTypeASTClassMap();
astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}
public BooleanAntlrParser(TokenBuffer tokenBuf) {
this(tokenBuf,1);
}
protected BooleanAntlrParser(TokenStream lexer, int k) {
super(lexer,k);
tokenNames = _tokenNames;
buildTokenTypeASTClassMap();
astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}
public BooleanAntlrParser(TokenStream lexer) {
this(lexer,1);
}
public BooleanAntlrParser(ParserSharedInputState state) {
super(state,1);
tokenNames = _tokenNames;
buildTokenTypeASTClassMap();
astFactory = new ASTFactory(getTokenTypeToASTClassMap());
}
public final void expr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST expr_AST = null;
try { // for error handling
xorexpr();
astFactory.addASTChild(currentAST, returnAST);
expr_AST = (AST)currentAST.root;
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_0);
}
returnAST = expr_AST;
}
public final void xorexpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST xorexpr_AST = null;
try { // for error handling
orexpr();
astFactory.addASTChild(currentAST, returnAST);
{
_loop21:
do {
if ((LA(1)==XOR)) {
AST tmp7_AST = null;
tmp7_AST = astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp7_AST);
match(XOR);
orexpr();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop21;
}
} while (true);
}
xorexpr_AST = (AST)currentAST.root;
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_0);
}
returnAST = xorexpr_AST;
}
public final void orexpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST orexpr_AST = null;
try { // for error handling
andexpr();
astFactory.addASTChild(currentAST, returnAST);
{
_loop24:
do {
if ((LA(1)==OR)) {
AST tmp8_AST = null;
tmp8_AST = astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp8_AST);
match(OR);
andexpr();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop24;
}
} while (true);
}
orexpr_AST = (AST)currentAST.root;
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_1);
}
returnAST = orexpr_AST;
}
public final void andexpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST andexpr_AST = null;
try { // for error handling
nexpr();
astFactory.addASTChild(currentAST, returnAST);
{
_loop27:
do {
if ((LA(1)==AND)) {
AST tmp9_AST = null;
tmp9_AST = astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp9_AST);
match(AND);
nexpr();
astFactory.addASTChild(currentAST, returnAST);
}
else {
break _loop27;
}
} while (true);
}
andexpr_AST = (AST)currentAST.root;
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_2);
}
returnAST = andexpr_AST;
}
public final void nexpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST nexpr_AST = null;
try { // for error handling
switch ( LA(1)) {
case NOT:
{
AST tmp10_AST = null;
tmp10_AST = astFactory.create(LT(1));
astFactory.makeASTRoot(currentAST, tmp10_AST);
match(NOT);
pexpr();
astFactory.addASTChild(currentAST, returnAST);
nexpr_AST = (AST)currentAST.root;
break;
}
case TRUE:
case FALSE:
case LP:
{
pexpr();
astFactory.addASTChild(currentAST, returnAST);
nexpr_AST = (AST)currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_3);
}
returnAST = nexpr_AST;
}
public final void pexpr() throws RecognitionException, TokenStreamException {
returnAST = null;
ASTPair currentAST = new ASTPair();
AST pexpr_AST = null;
try { // for error handling
switch ( LA(1)) {
case LP:
{
match(LP);
expr();
astFactory.addASTChild(currentAST, returnAST);
match(RP);
pexpr_AST = (AST)currentAST.root;
break;
}
case TRUE:
{
AST tmp13_AST = null;
tmp13_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp13_AST);
match(TRUE);
pexpr_AST = (AST)currentAST.root;
break;
}
case FALSE:
{
AST tmp14_AST = null;
tmp14_AST = astFactory.create(LT(1));
astFactory.addASTChild(currentAST, tmp14_AST);
match(FALSE);
pexpr_AST = (AST)currentAST.root;
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
catch (RecognitionException ex) {
reportError(ex);
consume();
consumeUntil(_tokenSet_3);
}
returnAST = pexpr_AST;
}
public static final String[] _tokenNames = {
"<0>",
"EOF",
"<2>",
"NULL_TREE_LOOKAHEAD",
"TRUE",
"FALSE",
"AND",
"OR",
"XOR",
"NOT",
"LP",
"RP",
"WS"
};
protected void buildTokenTypeASTClassMap() {
tokenTypeToASTClassMap=null;
};
private static final long[] mk_tokenSet_0() {
long[] data = { 2048L, 0L};
return data;
}
public static final BitSet _tokenSet_0 = new BitSet(mk_tokenSet_0());
private static final long[] mk_tokenSet_1() {
long[] data = { 2304L, 0L};
return data;
}
public static final BitSet _tokenSet_1 = new BitSet(mk_tokenSet_1());
private static final long[] mk_tokenSet_2() {
long[] data = { 2432L, 0L};
return data;
}
public static final BitSet _tokenSet_2 = new BitSet(mk_tokenSet_2());
private static final long[] mk_tokenSet_3() {
long[] data = { 2496L, 0L};
return data;
}
public static final BitSet _tokenSet_3 = new BitSet(mk_tokenSet_3());
}