Class PgParserAbstract
java.lang.Object
org.pgcodekeeper.core.parsers.antlr.base.statement.ParserAbstract<PgDatabase>
org.pgcodekeeper.core.parsers.antlr.pg.statement.PgParserAbstract
- Direct Known Subclasses:
AlterDomain,AlterFtsStatement,AlterIndex,AlterMatView,AlterOther,AlterOwner,AlterSequence,AlterView,CommentOn,CreateAggregate,CreateCast,CreateCollation,CreateDatabase,CreateDomain,CreateEventTrigger,CreateExtension,CreateFdw,CreateFtsConfiguration,CreateFtsDictionary,CreateFtsParser,CreateFtsTemplate,CreateFunction,CreateIndex,CreateOperator,CreatePolicy,CreateRule,CreateSchema,CreateSequence,CreateServer,CreateStatistics,CreateTrigger,CreateType,CreateUserMapping,CreateView,DeleteStatement,DropStatement,GrantPrivilege,InsertStatement,MergeStatement,TableAbstract,UpdateStatement
Abstract base class for PostgreSQL statement parsers that provides common
operations and utilities for parsing PostgreSQL database objects.
This class extends ParserAbstract to handle PostgreSQL-specific parsing operations such as column definitions, data types, operators, and other database constructs specific to PostgreSQL syntax.
-
Method Summary
Modifier and TypeMethodDescriptionstatic List<org.antlr.v4.runtime.ParserRuleContext>getIdentifiers(SQLParser.Operator_nameContext operQNameCtx) Extracts identifier contexts from an operator name context.static List<org.antlr.v4.runtime.ParserRuleContext>getIdentifiers(SQLParser.Schema_qualified_name_nontypeContext qNameNonTypeCtx) Extracts identifier contexts from a schema-qualified non-type name context.static List<org.antlr.v4.runtime.ParserRuleContext>Extracts identifier contexts from a schema-qualified name context.static StringgetTypeName(SQLParser.Data_typeContext datatype) Extracts the normalized type name from a data type context, converting PostgreSQL type aliases to their canonical forms.parseArguments(SQLParser.Function_argsContext argsContext) Parses function arguments from the function arguments context.static StringparseOperatorSignature(String name, SQLParser.Operator_argsContext operatorArgsCtx) Parses an operator signature from the operator name and arguments context.static StringparseSignature(String name, SQLParser.Function_argsContext argsContext) Parses a function signature from the function name and arguments context.Unquotes a string constant from a parser context and returns both the unquoted string and the corresponding token.Methods inherited from class org.pgcodekeeper.core.parsers.antlr.base.statement.ParserAbstract
fillOptionParams, fillOptionParams, getFullCtxText, getFullCtxText, getFullCtxText, getSafe, getSafe, parseArgMode, parseObject, parseObject
-
Method Details
-
unquoteQuotedString
public static Pair<String,org.antlr.v4.runtime.Token> unquoteQuotedString(SQLParser.SconstContext ctx) Unquotes a string constant from a parser context and returns both the unquoted string and the corresponding token.- Parameters:
ctx- the string constant context to unquote- Returns:
- a pair containing the unquoted string and its token
-
getIdentifiers
public static List<org.antlr.v4.runtime.ParserRuleContext> getIdentifiers(SQLParser.Schema_qualified_nameContext qNameCtx) Extracts identifier contexts from a schema-qualified name context.- Parameters:
qNameCtx- the schema-qualified name context- Returns:
- a list of parser rule contexts representing the identifiers
-
getIdentifiers
public static List<org.antlr.v4.runtime.ParserRuleContext> getIdentifiers(SQLParser.Schema_qualified_name_nontypeContext qNameNonTypeCtx) Extracts identifier contexts from a schema-qualified non-type name context.- Parameters:
qNameNonTypeCtx- the schema-qualified non-type name context- Returns:
- a list of parser rule contexts representing the identifiers
-
getIdentifiers
public static List<org.antlr.v4.runtime.ParserRuleContext> getIdentifiers(SQLParser.Operator_nameContext operQNameCtx) Extracts identifier contexts from an operator name context.- Parameters:
operQNameCtx- the operator name context- Returns:
- a list of parser rule contexts representing the operator identifiers
-
getTypeName
Extracts the normalized type name from a data type context, converting PostgreSQL type aliases to their canonical forms.- Parameters:
datatype- the data type context- Returns:
- the normalized type name string
-
parseOperatorSignature
public static String parseOperatorSignature(String name, SQLParser.Operator_argsContext operatorArgsCtx) Parses an operator signature from the operator name and arguments context.- Parameters:
name- the operator nameoperatorArgsCtx- the operator arguments context- Returns:
- the formatted operator signature string
-
parseArguments
Parses function arguments from the function arguments context.- Parameters:
argsContext- the function arguments context- Returns:
- the formatted arguments string
-
parseSignature
Parses a function signature from the function name and arguments context.- Parameters:
name- the function name (can be null for unnamed functions)argsContext- the function arguments context- Returns:
- the formatted function signature string
-