/** * Combines this parser position with another to create a position which * spans from the first point in the first to the last point in the other. */ public SqlParserPos plus(SqlParserPos pos) { return new SqlParserPos( getLineNum(), getColumnNum(), pos.getEndLineNum(), pos.getEndColumnNum()); }
/** * Combines this parser position with a list of positions. */ public SqlParserPos plusAll(Collection<SqlNode> nodeList) { final SqlNode [] nodes = nodeList.toArray(new SqlNode[nodeList.size()]); return plusAll(nodes); }
/** * Combines an array of parser positions to create a position which spans * from the beginning of the first to the end of the last. */ public static SqlParserPos sum( SqlParserPos[] poses) { return sum(poses, Integer.MAX_VALUE, Integer.MAX_VALUE, -1, -1); }
SqlParserPos lastPos = ((SqlNode) list.get(list.size() - 1)).getParserPosition(); final int line = lastPos.getEndLineNum(); final int col = lastPos.getEndColumnNum() + 1; SqlParserPos errPos = new SqlParserPos(line, col, line, col); throw SqlUtil.newContextException(errPos, RESOURCE.betweenWithoutAnd());
@Override public int reduceExpr(int ordinal, List<Object> list) { SqlNode left = (SqlNode) list.get(ordinal - 1); SqlNode right = (SqlNode) list.get(ordinal + 1); final SqlParserUtil.ToTreeListItem treeListItem = (SqlParserUtil.ToTreeListItem) list.get(ordinal); SqlParserUtil.replaceSublist( list, ordinal - 1, ordinal + 2, createCall( left.getParserPosition() .plus(right.getParserPosition()) .plus(treeListItem.getPos()), left, right)); return ordinal - 1; }
public int compare(SqlNode o1, SqlNode o2) { final SqlParserPos pos0 = o1.getParserPosition(); final SqlParserPos pos1 = o2.getParserPosition(); int c = -Utilities.compare( pos0.getLineNum(), pos1.getLineNum()); if (c != 0) { return c; } return -Utilities.compare( pos0.getColumnNum(), pos1.getColumnNum()); } });
public SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos) { final String posString = pos.toString(); IdInfo info = idPositions.get(posString); if (info != null) { return new SqlIdentifierMoniker(info.scope.fullyQualify(info.id)); } else { return null; } }
SqlParserPos getPos() throws ParseException { return new SqlParserPos( token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { // per the SQL std, each string fragment must be on a different line final List<SqlNode> operandList = call.getOperandList(); for (int i = 1; i < operandList.size(); i++) { SqlParserPos prevPos = operandList.get(i - 1).getParserPosition(); final SqlNode operand = operandList.get(i); SqlParserPos pos = operand.getParserPosition(); if (pos.getLineNum() <= prevPos.getLineNum()) { throw validator.newValidationError(operand, RESOURCE.stringFragsOnSameLine()); } } }
{if (true) return SqlStdOperatorTable.selectOperator.createCall( new SqlNodeList(keywords, pos), new SqlNodeList(selectList, selectListPos.plusAll(selectList)), fromClause, where, groupBy, having, windowDecls, null, null, null, pos.plus(getPos()));} throw new Error("Missing return statement in function");
final int x = pos.getColumnNum() - 1; sql = sql.substring(0, x) + " \07"
SqlParserPos lastPos = ((SqlNode) list.get(list.size() - 1)).getParserPosition(); final int line = lastPos.getEndLineNum(); final int col = lastPos.getEndColumnNum() + 1; SqlParserPos errPos = new SqlParserPos(line, col, line, col); throw SqlUtil.newContextException( errPos,
@Override public int reduceExpr(int ordinal, List<Object> list) { SqlNode left = (SqlNode) list.get(ordinal - 1); SqlNode right = (SqlNode) list.get(ordinal + 1); final SqlParserUtil.ToTreeListItem treeListItem = (SqlParserUtil.ToTreeListItem) list.get(ordinal); SqlParserUtil.replaceSublist( list, ordinal - 1, ordinal + 2, createCall( left.getParserPosition() .plus(right.getParserPosition()) .plus(treeListItem.getPos()), left, right)); return ordinal - 1; }
public SqlMoniker lookupQualifiedName(SqlNode topNode, SqlParserPos pos) { final String posString = pos.toString(); IdInfo info = idPositions.get(posString); if (info != null) { return new SqlIdentifierMoniker(info.scope.fullyQualify(info.id)); } else { return null; } }
SqlParserPos getPos() throws ParseException { return new SqlParserPos( token.beginLine, token.beginColumn, token.endLine, token.endColumn); }
public void validateCall( SqlCall call, SqlValidator validator, SqlValidatorScope scope, SqlValidatorScope operandScope) { // per the SQL std, each string fragment must be on a different line for (int i = 1; i < call.operands.length; i++) { SqlParserPos prevPos = call.operands[i - 1].getParserPosition(); final SqlNode operand = call.operands[i]; SqlParserPos pos = operand.getParserPosition(); if (pos.getLineNum() <= prevPos.getLineNum()) { throw validator.newValidationError( operand, EigenbaseResource.instance().StringFragsOnSameLine.ex()); } } }
selectItem = (SqlNode)selectList.get(0); selectListPos = selectItem.getParserPosition(); {if (true) return new SqlSelect(pos.plus(getPos()), new SqlNodeList(keywords, pos), new SqlNodeList(selectList, selectListPos.plusAll(selectList)), fromClause, where, groupBy, having, windowDecls, null, null, null);} throw new Error("Missing return statement in function");
final int x = pos.getColumnNum() - 1; sql = sql.substring(0, x) + " \07"
/** * Combines this parser position with an array of positions to create a * position which spans from the first point in the first to the last point * in the other. */ public SqlParserPos plusAll(SqlNode [] nodes) { int line = getLineNum(); int column = getColumnNum(); int endLine = getEndLineNum(); int endColumn = getEndColumnNum(); return sum(nodes, line, column, endLine, endColumn); }
/** * Parses one or more rows in a VALUES expression. */ final public SqlNodeList RowConstructorList(SqlParserPos pos) throws ParseException { List<SqlNode> list = new ArrayList<SqlNode>(); SqlNode rowConstructor; rowConstructor = RowConstructor(); list.add(rowConstructor); label_7: while (true) { if (jj_2_101(2)) { ; } else { break label_7; } jj_consume_token(COMMA); rowConstructor = RowConstructor(); list.add(rowConstructor); } {if (true) return new SqlNodeList(list, pos.plus(getPos()));} throw new Error("Missing return statement in function"); }