Package org.apache.calcite.sql.parser
Class SqlParserPos
java.lang.Object
org.apache.calcite.sql.parser.SqlParserPos
- All Implemented Interfaces:
Serializable
SqlParserPos represents the position of a parsed token within SQL statement
text.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final SqlParserPos
Same asZERO
but always quoted.static final SqlParserPos
SqlParserPos representing line one, character one. -
Constructor Summary
ConstructorDescriptionSqlParserPos
(int lineNumber, int columnNumber) Creates a new parser position.SqlParserPos
(int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber) Creates a new parser range. -
Method Summary
Modifier and TypeMethodDescriptionboolean
int
Returns 1-based starting column number.int
Returns 1-based end column number (same as starting column number if the ParserPos is a point, not a range).int
Returns 1-based end line number (same as starting line number if the ParserPos is a point, not a range).int
Returns 1-based starting line number.int
hashCode()
boolean
isQuoted()
Returns whether this SqlParserPos is quoted.boolean
overlaps
(SqlParserPos pos) plus
(SqlParserPos pos) Combines this parser position with another to create a position that spans from the first point in the first to the last point in the other.plusAll
(Collection<? extends @Nullable SqlNode> nodes) Combines this parser position with a list of positions.Combines this parser position with an array of positions to create a position that spans from the first point in the first to the last point in the other.boolean
startsAt
(SqlParserPos pos) static SqlParserPos
sum
(Iterable<SqlParserPos> poses) Returns a position spanning the earliest position to the latest.static SqlParserPos
Combines the parser positions of a list of nodes to create a position which spans from the beginning of the first to the end of the last.static SqlParserPos
Combines the parser positions of an array of nodes to create a position which spans from the beginning of the first to the end of the last.toString()
withQuoting
(boolean quoted) Returns aSqlParserPos
the same as this but quoted.
-
Field Details
-
ZERO
SqlParserPos representing line one, character one. Use this if the node doesn't correspond to a position in piece of SQL text. -
QUOTED_ZERO
Same asZERO
but always quoted.
-
-
Constructor Details
-
SqlParserPos
public SqlParserPos(int lineNumber, int columnNumber) Creates a new parser position. -
SqlParserPos
public SqlParserPos(int startLineNumber, int startColumnNumber, int endLineNumber, int endColumnNumber) Creates a new parser range.
-
-
Method Details
-
hashCode
public int hashCode() -
equals
-
getLineNum
public int getLineNum()Returns 1-based starting line number. -
getColumnNum
public int getColumnNum()Returns 1-based starting column number. -
getEndLineNum
public int getEndLineNum()Returns 1-based end line number (same as starting line number if the ParserPos is a point, not a range). -
getEndColumnNum
public int getEndColumnNum()Returns 1-based end column number (same as starting column number if the ParserPos is a point, not a range). -
withQuoting
Returns aSqlParserPos
the same as this but quoted. -
isQuoted
public boolean isQuoted()Returns whether this SqlParserPos is quoted. -
toString
-
plus
Combines this parser position with another to create a position that spans from the first point in the first to the last point in the other. -
plusAll
Combines this parser position with an array of positions to create a position that spans from the first point in the first to the last point in the other. -
plusAll
Combines this parser position with a list of positions. -
sum
Combines the parser positions of an array of nodes to create a position which spans from the beginning of the first to the end of the last. -
sum
Combines the parser positions of a list of nodes to create a position which spans from the beginning of the first to the end of the last. -
sum
Returns a position spanning the earliest position to the latest. Does not assume that the positions are sorted. Throws if the list is empty. -
overlaps
-
startsAt
-