Package org.apache.calcite.sql.parser
Class SqlAbstractParserImpl
- java.lang.Object
-
- org.apache.calcite.sql.parser.SqlAbstractParserImpl
-
public abstract class SqlAbstractParserImpl extends java.lang.Object
Abstract base for parsers generated from CommonParser.jj.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
SqlAbstractParserImpl.ExprContext
Type-safe enum for context of acceptable expressions.static interface
SqlAbstractParserImpl.Metadata
Metadata about the parser.static class
SqlAbstractParserImpl.MetadataImpl
Default implementation of theSqlAbstractParserImpl.Metadata
interface.
-
Field Summary
Fields Modifier and Type Field Description protected int
nDynamicParams
protected SqlStdOperatorTable
opTab
Operator table containing the standard SQL operators and functions.protected java.lang.String
originalSql
private static com.google.common.collect.ImmutableSet<java.lang.String>
SQL_92_RESERVED_WORD_SET
-
Constructor Summary
Constructors Constructor Description SqlAbstractParserImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected SqlCall
createCall(SqlIdentifier funName, SqlParserPos pos, SqlFunctionCategory funcType, SqlLiteral functionQualifier, java.lang.Iterable<? extends SqlNode> operands)
Creates a call.protected SqlCall
createCall(SqlIdentifier funName, SqlParserPos pos, SqlFunctionCategory funcType, SqlLiteral functionQualifier, SqlNode[] operands)
Creates a call.abstract SqlAbstractParserImpl.Metadata
getMetadata()
Returns metadata about this parser: keywords, etc.java.lang.String
getOriginalSql()
Returns the SQL text.protected abstract SqlParserPos
getPos()
static java.util.Set<java.lang.String>
getSql92ReservedWords()
Returns immutable set of all reserved words defined by SQL-92.abstract SqlParseException
normalizeException(java.lang.Throwable ex)
Removes or transforms misleading information from a parse exception or error, and converts toSqlParseException
.abstract SqlNode
parseSqlExpressionEof()
Parses a SQL expression ending with EOF and constructs a parse tree.abstract SqlNode
parseSqlStmtEof()
Parses a SQL statement ending with EOF and constructs a parse tree.abstract void
ReInit(java.io.Reader reader)
Reinitializes parser with new input.abstract void
setConformance(SqlConformance conformance)
Sets the SQL language conformance level.abstract void
setIdentifierMaxLength(int identifierMaxLength)
Sets the maximum length for sql identifier.void
setOriginalSql(java.lang.String originalSql)
Sets the SQL text that is being parsed.abstract void
setQuotedCasing(org.apache.calcite.avatica.util.Casing quotedCasing)
Sets the casing policy for quoted identifiers.abstract void
setTabSize(int tabSize)
Sets the tab stop size.abstract void
setUnquotedCasing(org.apache.calcite.avatica.util.Casing unquotedCasing)
Sets the casing policy for unquoted identifiers.abstract void
switchTo(java.lang.String stateName)
Change parser state.
-
-
-
Field Detail
-
SQL_92_RESERVED_WORD_SET
private static final com.google.common.collect.ImmutableSet<java.lang.String> SQL_92_RESERVED_WORD_SET
-
opTab
protected final SqlStdOperatorTable opTab
Operator table containing the standard SQL operators and functions.
-
nDynamicParams
protected int nDynamicParams
-
originalSql
protected java.lang.String originalSql
-
-
Method Detail
-
getSql92ReservedWords
public static java.util.Set<java.lang.String> getSql92ReservedWords()
Returns immutable set of all reserved words defined by SQL-92.- See Also:
SQL-92 Section 5.2
-
createCall
protected SqlCall createCall(SqlIdentifier funName, SqlParserPos pos, SqlFunctionCategory funcType, SqlLiteral functionQualifier, java.lang.Iterable<? extends SqlNode> operands)
Creates a call.- Parameters:
funName
- Name of functionpos
- Position in source codefuncType
- Type of functionfunctionQualifier
- Qualifieroperands
- Operands to call- Returns:
- Call
-
createCall
protected SqlCall createCall(SqlIdentifier funName, SqlParserPos pos, SqlFunctionCategory funcType, SqlLiteral functionQualifier, SqlNode[] operands)
Creates a call.- Parameters:
funName
- Name of functionpos
- Position in source codefuncType
- Type of functionfunctionQualifier
- Qualifieroperands
- Operands to call- Returns:
- Call
-
getMetadata
public abstract SqlAbstractParserImpl.Metadata getMetadata()
Returns metadata about this parser: keywords, etc.
-
normalizeException
public abstract SqlParseException normalizeException(java.lang.Throwable ex)
Removes or transforms misleading information from a parse exception or error, and converts toSqlParseException
.- Parameters:
ex
- dirty excn- Returns:
- clean excn
-
getPos
protected abstract SqlParserPos getPos() throws java.lang.Exception
- Throws:
java.lang.Exception
-
ReInit
public abstract void ReInit(java.io.Reader reader)
Reinitializes parser with new input.- Parameters:
reader
- provides new input
-
parseSqlExpressionEof
public abstract SqlNode parseSqlExpressionEof() throws java.lang.Exception
Parses a SQL expression ending with EOF and constructs a parse tree.- Returns:
- constructed parse tree.
- Throws:
java.lang.Exception
-
parseSqlStmtEof
public abstract SqlNode parseSqlStmtEof() throws java.lang.Exception
Parses a SQL statement ending with EOF and constructs a parse tree.- Returns:
- constructed parse tree.
- Throws:
java.lang.Exception
-
setTabSize
public abstract void setTabSize(int tabSize)
Sets the tab stop size.- Parameters:
tabSize
- Tab stop size
-
setQuotedCasing
public abstract void setQuotedCasing(org.apache.calcite.avatica.util.Casing quotedCasing)
Sets the casing policy for quoted identifiers.- Parameters:
quotedCasing
- Casing to set.
-
setUnquotedCasing
public abstract void setUnquotedCasing(org.apache.calcite.avatica.util.Casing unquotedCasing)
Sets the casing policy for unquoted identifiers.- Parameters:
unquotedCasing
- Casing to set.
-
setIdentifierMaxLength
public abstract void setIdentifierMaxLength(int identifierMaxLength)
Sets the maximum length for sql identifier.
-
setConformance
public abstract void setConformance(SqlConformance conformance)
Sets the SQL language conformance level.
-
setOriginalSql
public void setOriginalSql(java.lang.String originalSql)
Sets the SQL text that is being parsed.
-
getOriginalSql
public java.lang.String getOriginalSql()
Returns the SQL text.
-
switchTo
public abstract void switchTo(java.lang.String stateName)
Change parser state.- Parameters:
stateName
- new state.
-
-