use of antlr.NoViableAltException in project ili2db by claeis.
the class SqlSyntax method select_sublist.
public final void select_sublist() throws RecognitionException, TokenStreamException {
if ((_tokenSet_1.member(LA(1)))) {
expression();
{
if ((LA(1) == NAME || LA(1) == LITERAL_AS)) {
{
if ((LA(1) == LITERAL_AS)) {
match(LITERAL_AS);
} else if ((LA(1) == NAME)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
columnalias();
} else if ((LA(1) == EOF || LA(1) == COMMA)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
} else if ((LA(1) == NAME)) {
{
{
if ((LA(1) == NAME)) {
tablename();
} else if ((LA(1) == NAME)) {
correlationname();
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
match(DOT);
match(45);
}
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
use of antlr.NoViableAltException in project ili2db by claeis.
the class SqlSyntax method select_sublist_ce.
public final SelectValue select_sublist_ce() throws RecognitionException, TokenStreamException {
SelectValue c;
Token t = null;
Token n1 = null;
Token n2 = null;
c = null;
SqlQname n0 = null;
switch(LA(1)) {
case NAME:
{
n0 = sqlqname();
c = new SelectValueField(n0);
break;
}
case STRING:
{
t = LT(1);
match(STRING);
{
if ((LA(1) == LITERAL_AS)) {
match(LITERAL_AS);
} else if ((LA(1) == NAME)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
n1 = LT(1);
match(NAME);
c = new SelectValueString(n1.getText(), t.getText());
break;
}
case LITERAL_NULL:
{
match(LITERAL_NULL);
{
if ((LA(1) == LITERAL_AS)) {
match(LITERAL_AS);
} else if ((LA(1) == NAME)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
n2 = LT(1);
match(NAME);
c = new SelectValueNull(n2.getText());
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
return c;
}
use of antlr.NoViableAltException in project ili2db by claeis.
the class SqlSyntax method from_item.
public final AbstractSelectStmt from_item(List<SelectValue> fv) throws RecognitionException, TokenStreamException {
AbstractSelectStmt stmt;
Token t = null;
Token ta = null;
Token t2 = null;
stmt = null;
AbstractSelectStmt subselect = null;
if ((LA(1) == NAME)) {
{
t = LT(1);
match(NAME);
{
if ((LA(1) == NAME || LA(1) == LITERAL_AS)) {
{
if ((LA(1) == LITERAL_AS)) {
match(LITERAL_AS);
} else if ((LA(1) == NAME)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
ta = LT(1);
match(NAME);
} else if ((_tokenSet_0.member(LA(1)))) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
stmt = new FgdbSelectStmt();
stmt.setTableName(t.getText());
if (ta != null) {
stmt.setTableAlias(ta.getText());
}
for (SelectValue f : fv) {
AbstractSelectStmt.addField(stmt, f);
}
}
} else if ((LA(1) == LPAREN)) {
{
match(LPAREN);
subselect = select_statement();
match(RPAREN);
{
if ((LA(1) == LITERAL_AS)) {
match(LITERAL_AS);
} else if ((LA(1) == NAME)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
t2 = LT(1);
match(NAME);
stmt = new ComplexSelectStmt(subselect);
stmt.setTableName(t2.getText());
for (SelectValue f : fv) {
AbstractSelectStmt.addField(stmt, f);
}
}
} else {
throw new NoViableAltException(LT(1), getFilename());
}
return stmt;
}
use of antlr.NoViableAltException in project ili2db by claeis.
the class SqlSyntax method select_statement.
public final AbstractSelectStmt select_statement() throws RecognitionException, TokenStreamException {
AbstractSelectStmt stmt;
Token n = null;
Token s = null;
stmt = null;
AbstractSelectStmt stmt2 = null;
List<SelectValue> fv = null;
SqlQname w0 = null;
SqlQname w1 = null;
SqlQname c = null;
int paramIdx = 0;
Value v0 = null;
JoinStmt jstmt = null;
match(LITERAL_SELECT);
fv = select_list_ce();
match(LITERAL_FROM);
{
stmt = from_item(fv);
{
_loop16: do {
if ((LA(1) == LITERAL_LEFT)) {
match(LITERAL_LEFT);
match(LITERAL_JOIN);
stmt2 = from_item(fv);
match(LITERAL_ON);
w0 = sqlqname();
match(EQUALS);
w1 = sqlqname();
if (jstmt == null) {
jstmt = new JoinStmt(stmt, w0);
stmt = jstmt;
}
jstmt.addRight(stmt2, w1);
} else {
break _loop16;
}
} while (true);
}
if (jstmt != null) {
for (SelectValue f : fv) {
stmt.addField(f);
}
}
}
{
if ((LA(1) == LITERAL_WHERE)) {
match(LITERAL_WHERE);
w0 = sqlqname();
{
if ((LA(1) == LITERAL_IS)) {
{
match(LITERAL_IS);
match(LITERAL_NULL);
stmt.addCond(new ColRef(w0.getLocalName()), new IsNull());
}
} else if ((LA(1) == EQUALS)) {
{
match(EQUALS);
{
switch(LA(1)) {
case QUESTION:
{
{
match(QUESTION);
v0 = new Param(paramIdx++);
}
break;
}
case NUMBER:
{
{
n = LT(1);
match(NUMBER);
v0 = new IntConst(Integer.valueOf(n.getText()));
}
break;
}
case STRING:
{
{
s = LT(1);
match(STRING);
v0 = new StringConst(s.getText());
}
break;
}
default:
{
throw new NoViableAltException(LT(1), getFilename());
}
}
}
stmt.addCond(new ColRef(w0.getLocalName()), v0);
}
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
_loop26: do {
if ((LA(1) == LITERAL_AND)) {
match(LITERAL_AND);
w1 = sqlqname();
match(EQUALS);
match(QUESTION);
stmt.addCond(new ColRef(w1.getLocalName()), new Param(paramIdx++));
} else {
break _loop26;
}
} while (true);
}
} else if ((LA(1) == EOF || LA(1) == RPAREN || LA(1) == LITERAL_ORDER)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
if ((LA(1) == LITERAL_ORDER)) {
match(LITERAL_ORDER);
match(LITERAL_BY);
c = sqlqname();
stmt.orderBy(c.getLocalName());
{
if ((LA(1) == LITERAL_ASC)) {
match(LITERAL_ASC);
stmt.orderAsc();
} else if ((LA(1) == EOF || LA(1) == RPAREN)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
} else if ((LA(1) == EOF || LA(1) == RPAREN)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
return stmt;
}
use of antlr.NoViableAltException in project ili2db by claeis.
the class SqlSyntax method insert_statement.
public final InsertStmt insert_statement() throws RecognitionException, TokenStreamException {
InsertStmt s;
Token t = null;
Token c0 = null;
Token c1 = null;
s = new InsertStmt();
int paramIdx = 0;
match(LITERAL_INSERT);
match(LITERAL_INTO);
t = LT(1);
match(NAME);
s.setTableName(t.getText());
{
if ((LA(1) == LPAREN)) {
match(LPAREN);
c0 = LT(1);
match(NAME);
s.addField(c0.getText());
{
_loop7: do {
if ((LA(1) == COMMA)) {
match(COMMA);
c1 = LT(1);
match(NAME);
s.addField(c1.getText());
} else {
break _loop7;
}
} while (true);
}
match(RPAREN);
} else if ((LA(1) == LITERAL_VALUES)) {
} else {
throw new NoViableAltException(LT(1), getFilename());
}
}
{
match(LITERAL_VALUES);
match(LPAREN);
{
match(QUESTION);
s.addValue(new Param(paramIdx++));
}
{
_loop12: do {
if ((LA(1) == COMMA)) {
match(COMMA);
{
match(QUESTION);
s.addValue(new Param(paramIdx++));
}
} else {
break _loop12;
}
} while (true);
}
match(RPAREN);
}
return s;
}
Aggregations