foundation.jpa.querydsl.where.PredicateLexer Maven / Gradle / Ivy
package foundation.jpa.querydsl.where;
import foundation.rpg.parser.Element;
import foundation.rpg.parser.Lexer;
import foundation.rpg.parser.Input;
import foundation.rpg.parser.Position;
import foundation.rpg.parser.End;
import java.io.IOException;
import foundation.rpg.parser.TokenBuilder;
public class PredicateLexer implements Lexer {
private final foundation.jpa.querydsl.where.QueryFactory factory;
public PredicateLexer(foundation.jpa.querydsl.where.QueryFactory factory) {
this.factory = factory;
}
public foundation.jpa.querydsl.where.QueryFactory getFactory() {
return factory;
}
public Element next(Input input) throws IOException {
int state = 0;
int symbol = input.lookahead();
TokenBuilder builder = new TokenBuilder(input);
if(symbol < 0) return new ElementEnd(new End(builder.build()));
for(; true; symbol = builder.next()) {
switch(state) {
case 0:
switch(symbol) {
case 'a': state = 1; break;
case '!': state = 2; break;
case '%': state = 3; break;
case '\'': state = 4; break;
case '(': state = 5; break;
case ')': state = 6; break;
case 'i': state = 7; break;
case '*': state = 8; break;
case '+': state = 9; break;
case ',': state = 10; break;
case '-': state = 11; break;
case 'n': state = 12; break;
case '.': state = 13; break;
case 'o': state = 14; break;
case '/': state = 15; break;
case '<': state = 16; break;
case '=': state = 17; break;
case '~': state = 18; break;
case '>': state = 19; break;
default:
if(Lexer.matchesGroup('s', symbol)) { state = 20; break; }
if(Lexer.matchesGroup('d', symbol)) { state = 21; break; }
if(Lexer.matchesGroup('i', symbol)) { state = 22; break; }
input.error("Unexpected character: '" + (char) symbol + "'");
}
break;
case 1:
if(symbol == 'n') { state = 23; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 2:
if(symbol == '=') { state = 25; break; }
input.error("Unexpected character: '" + (char) symbol + "'");
case 3:
return new ElementToken(builder.build());
case 4:
switch(symbol) {
case '\'': state = 26; break;
case '\\': state = 27; break;
default:
if(symbol < 0) input.error("Unexpected end of input");
state = 28; break;
}
break;
case 5:
return new ElementLPar(new foundation.rpg.common.symbols.LPar(builder.build()));
case 6:
return new ElementRPar(new foundation.rpg.common.symbols.RPar(builder.build()));
case 7:
switch(symbol) {
case 's': state = 29; break;
case 'n': state = 30; break;
default:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
}
break;
case 8:
return new ElementStar(new foundation.rpg.common.symbols.Star(builder.build()));
case 9:
return new ElementPlus(new foundation.rpg.common.symbols.Plus(builder.build()));
case 10:
return new ElementComma(new foundation.rpg.common.symbols.Comma(builder.build()));
case 11:
return new ElementMinus(new foundation.rpg.common.symbols.Minus(builder.build()));
case 12:
switch(symbol) {
case 'u': state = 31; break;
case 'o': state = 32; break;
default:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
}
break;
case 13:
return new ElementDot(new foundation.rpg.common.symbols.Dot(builder.build()));
case 14:
if(symbol == 'r') { state = 33; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 15:
return new ElementSl(new foundation.rpg.common.symbols.Sl(builder.build()));
case 16:
if(symbol == '=') { state = 34; break; }
return new ElementLt(new foundation.rpg.common.symbols.Lt(builder.build()));
case 17:
return new ElementEqual(new foundation.rpg.common.symbols.Equal(builder.build()));
case 18:
return new ElementTilda(new foundation.rpg.common.symbols.Tilda(builder.build()));
case 19:
return new ElementGt(new foundation.rpg.common.symbols.Gt(builder.build()));
case 20:
if(Lexer.matchesGroup('s', symbol)) { state = 20; break; }
return new ElementWhiteSpace(new foundation.rpg.common.symbols.WhiteSpace(builder.build()));
case 21:
switch(symbol) {
case 'e': state = 35; break;
case 'E': state = 35; break;
case '.': state = 35; break;
default:
if(Lexer.matchesGroup('d', symbol)) { state = 21; break; }
return new ElementLong(new java.lang.Long(builder.build().getContent()));
}
break;
case 22:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 23:
if(symbol == 'd') { state = 36; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 24:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 25:
return new ElementExclEqual(new foundation.rpg.common.symbols.ExclEqual(builder.build()));
case 26:
return new ElementString(new java.lang.String(builder.build().getContent()));
case 27:
switch(symbol) {
case 'r': state = 37; break;
case 't': state = 37; break;
case '\'': state = 37; break;
case '\\': state = 37; break;
case 'n': state = 37; break;
default:
input.error("Unexpected character: '" + (char) symbol + "'");
}
break;
case 28:
switch(symbol) {
case '\'': state = 26; break;
case '\\': state = 27; break;
default:
if(symbol < 0) input.error("Unexpected end of input");
state = 28; break;
}
break;
case 29:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIs(new foundation.rpg.common.symbols.Is(builder.build()));
case 30:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIn(new foundation.rpg.common.symbols.In(builder.build()));
case 31:
if(symbol == 'l') { state = 38; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 32:
if(symbol == 't') { state = 39; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 33:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementOr(new foundation.rpg.common.symbols.Or(builder.build()));
case 34:
return new ElementLtEqual(new foundation.rpg.common.symbols.LtEqual(builder.build()));
case 35:
if(Lexer.matchesGroup('d', symbol)) { state = 40; break; }
input.error("Unexpected character: '" + (char) symbol + "'");
case 36:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementAnd(new foundation.rpg.common.symbols.And(builder.build()));
case 37:
switch(symbol) {
case '\'': state = 26; break;
case '\\': state = 27; break;
default:
if(symbol < 0) input.error("Unexpected end of input");
state = 28; break;
}
break;
case 38:
if(symbol == 'l') { state = 41; break; }
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementIdentifier(new foundation.rpg.common.symbols.Identifier(builder.build()));
case 39:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementNot(new foundation.rpg.common.symbols.Not(builder.build()));
case 40:
if(Lexer.matchesGroup('d', symbol)) { state = 40; break; }
return new ElementDouble(new java.lang.Double(builder.build().getContent()));
case 41:
if(Lexer.matchesGroup('w', symbol)) { state = 24; break; }
return new ElementNull(new foundation.rpg.common.symbols.Null(builder.build()));
}
}
}
}