struct Parser<'a> {
sql: &'a str,
tokens: Vec<PosToken>,
index: usize,
recursion_guard: RecursionGuard,
}
Expand description
SQL Parser
Fields§
§sql: &'a str
§tokens: Vec<PosToken>
§index: usize
The index of the first unprocessed token in self.tokens
recursion_guard: RecursionGuard
Implementations§
Source§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn error(&self, pos: usize, message: String) -> ParserError
fn parse_statements( &mut self, ) -> Result<Vec<StatementParseResult<'a>>, ParserStatementError>
Sourcefn parse_statement(
&mut self,
) -> Result<StatementParseResult<'a>, ParserStatementError>
fn parse_statement( &mut self, ) -> Result<StatementParseResult<'a>, ParserStatementError>
Parse a single top-level statement (such as SELECT, INSERT, CREATE, etc.), stopping before the statement separator, if any. Returns the parsed statement and the SQL fragment corresponding to it.
Sourcefn parse_statement_inner(
&mut self,
) -> Result<Statement<Raw>, ParserStatementError>
fn parse_statement_inner( &mut self, ) -> Result<Statement<Raw>, ParserStatementError>
Parse a single top-level statement (such as SELECT, INSERT, CREATE, etc.), stopping before the statement separator, if any.
Sourcefn parse_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Parse a new expression
Sourcefn parse_subexpr(
&mut self,
precedence: Precedence,
) -> Result<Expr<Raw>, ParserError>
fn parse_subexpr( &mut self, precedence: Precedence, ) -> Result<Expr<Raw>, ParserError>
Parse tokens until the precedence decreases
fn parse_subexpr_seeded( &mut self, precedence: Precedence, expr: Expr<Raw>, ) -> Result<Expr<Raw>, ParserError>
Sourcefn parse_prefix(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_prefix(&mut self) -> Result<Expr<Raw>, ParserError>
Parse an expression prefix
Sourcefn parse_parenthesized_fragment(
&mut self,
) -> Result<ParenthesizedFragment, ParserError>
fn parse_parenthesized_fragment( &mut self, ) -> Result<ParenthesizedFragment, ParserError>
Parses an expression list that appears in parentheses, like (1 + 1)
,
(SELECT 1)
, or (1, 2)
. Assumes that the opening parenthesis has
already been parsed. Parses up to the closing parenthesis without
consuming it.
fn parse_function( &mut self, name: RawItemName, ) -> Result<Function<Raw>, ParserError>
fn parse_window_frame(&mut self) -> Result<WindowFrame, ParserError>
Sourcefn parse_window_frame_bound(&mut self) -> Result<WindowFrameBound, ParserError>
fn parse_window_frame_bound(&mut self) -> Result<WindowFrameBound, ParserError>
Parse CURRENT ROW
or { <positive number> | UNBOUNDED } { PRECEDING | FOLLOWING }
fn parse_case_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Sourcefn parse_cast_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_cast_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Parse a SQL CAST function e.g. CAST(expr AS FLOAT)
Sourcefn parse_exists_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_exists_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Parse a SQL EXISTS expression e.g. WHERE EXISTS(SELECT ...)
.
fn parse_homogenizing_function( &mut self, function: HomogenizingFunction, ) -> Result<Expr<Raw>, ParserError>
fn parse_nullif_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_extract_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_row_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_composite_type_definition( &mut self, ) -> Result<Vec<ColumnDef<Raw>>, ParserError>
fn parse_trim_expr(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_position_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Sourcefn parse_interval_value(&mut self) -> Result<IntervalValue, ParserError>
fn parse_interval_value(&mut self) -> Result<IntervalValue, ParserError>
Parse an INTERVAL literal.
Some syntactically valid intervals:
INTERVAL '1' DAY
INTERVAL '1-1' YEAR TO MONTH
INTERVAL '1' SECOND
- `INTERVAL ‘1:1’ MINUTE TO SECOND
INTERVAL '1:1:1.1' HOUR TO SECOND (5)
INTERVAL '1.111' SECOND (2)
Sourcefn parse_infix(
&mut self,
expr: Expr<Raw>,
precedence: Precedence,
) -> Result<Expr<Raw>, ParserError>
fn parse_infix( &mut self, expr: Expr<Raw>, precedence: Precedence, ) -> Result<Expr<Raw>, ParserError>
Parse an operator following an expression
Sourcefn parse_subscript(&mut self, expr: Expr<Raw>) -> Result<Expr<Raw>, ParserError>
fn parse_subscript(&mut self, expr: Expr<Raw>) -> Result<Expr<Raw>, ParserError>
Parse subscript expression, i.e. either an index value or slice range.
fn parse_substring_expr(&mut self) -> Result<Expr<Raw>, ParserError>
Sourcefn parse_operator(&mut self) -> Result<Op, ParserError>
fn parse_operator(&mut self) -> Result<Op, ParserError>
Parse an operator reference.
Examples:
+
OPERATOR(schema.+)
OPERATOR("foo"."bar"."baz".@>)
Sourcefn parse_any_all(
&mut self,
left: Expr<Raw>,
op: Op,
kw: Keyword,
) -> Result<Expr<Raw>, ParserError>
fn parse_any_all( &mut self, left: Expr<Raw>, op: Op, kw: Keyword, ) -> Result<Expr<Raw>, ParserError>
Parses an ANY
, ALL
, or SOME
operation, starting after the ANY
,
ALL
, or SOME
keyword.
Sourcefn parse_in(
&mut self,
expr: Expr<Raw>,
negated: bool,
) -> Result<Expr<Raw>, ParserError>
fn parse_in( &mut self, expr: Expr<Raw>, negated: bool, ) -> Result<Expr<Raw>, ParserError>
Parses the parens following the [ NOT ] IN
operator
Sourcefn parse_between(
&mut self,
expr: Expr<Raw>,
negated: bool,
) -> Result<Expr<Raw>, ParserError>
fn parse_between( &mut self, expr: Expr<Raw>, negated: bool, ) -> Result<Expr<Raw>, ParserError>
Parses BETWEEN <low> AND <high>
, assuming the BETWEEN
keyword was already consumed
Sourcefn parse_like(
&mut self,
expr: Expr<Raw>,
case_insensitive: bool,
negated: bool,
) -> Result<Expr<Raw>, ParserError>
fn parse_like( &mut self, expr: Expr<Raw>, case_insensitive: bool, negated: bool, ) -> Result<Expr<Raw>, ParserError>
Parses LIKE <pattern> [ ESCAPE <char> ]
, assuming the LIKE
keyword was already consumed
Sourcefn parse_pg_cast(&mut self, expr: Expr<Raw>) -> Result<Expr<Raw>, ParserError>
fn parse_pg_cast(&mut self, expr: Expr<Raw>) -> Result<Expr<Raw>, ParserError>
Parse a postgresql casting style which is in the form of expr::datatype
Sourcefn get_next_precedence(&self) -> Precedence
fn get_next_precedence(&self) -> Precedence
Get the precedence of the next token
Sourcefn peek_token(&self) -> Option<Token>
fn peek_token(&self) -> Option<Token>
Return the first non-whitespace token that has not yet been processed (or None if reached end-of-file)
fn peek_keyword(&self, kw: Keyword) -> bool
fn peek_keywords(&self, keywords: &[Keyword]) -> bool
fn peek_keywords_from(&self, start: usize, keywords: &[Keyword]) -> bool
fn peek_one_of_keywords(&self, kws: &[Keyword]) -> bool
Sourcefn peek_keywords_lookahead(&self, keywords: &[Keyword]) -> bool
fn peek_keywords_lookahead(&self, keywords: &[Keyword]) -> bool
Returns whether the sequence of keywords is found at any point before the end of the unprocessed tokens.
Sourcefn peek_nth_token(&self, n: usize) -> Option<Token>
fn peek_nth_token(&self, n: usize) -> Option<Token>
Return the nth token that has not yet been processed.
Sourcefn next_token(&mut self) -> Option<Token>
fn next_token(&mut self) -> Option<Token>
Return the next token that has not yet been processed, or None if reached end-of-file, and mark it as processed. OK to call repeatedly after reaching EOF.
Sourcefn prev_token(&mut self)
fn prev_token(&mut self)
Push back the last one non-whitespace token. Must be called after
next_token()
, otherwise might panic. OK to call after
next_token()
indicates an EOF.
Sourcefn peek_pos(&self) -> usize
fn peek_pos(&self) -> usize
Return the byte position within the query string at which the next token starts.
Sourcefn peek_prev_pos(&self) -> usize
fn peek_prev_pos(&self) -> usize
Return the byte position within the query string at which the previous token starts.
Must be called after next_token()
, otherwise might panic.
OK to call after next_token()
indicates an EOF.
Sourcefn expected<D, T>(
&self,
pos: usize,
expected: D,
found: Option<Token>,
) -> Result<T, ParserError>where
D: Display,
fn expected<D, T>(
&self,
pos: usize,
expected: D,
found: Option<Token>,
) -> Result<T, ParserError>where
D: Display,
Report unexpected token
Sourcefn parse_keyword(&mut self, kw: Keyword) -> bool
fn parse_keyword(&mut self, kw: Keyword) -> bool
Look for an expected keyword and consume it if it exists
Sourcefn parse_keywords(&mut self, keywords: &[Keyword]) -> bool
fn parse_keywords(&mut self, keywords: &[Keyword]) -> bool
Look for an expected sequence of keywords and consume them if they exist
fn parse_at_most_one_keyword( &mut self, keywords: &[Keyword], location: &str, ) -> Result<Option<Keyword>, ParserError>
Sourcefn parse_one_of_keywords(&mut self, kws: &[Keyword]) -> Option<Keyword>
fn parse_one_of_keywords(&mut self, kws: &[Keyword]) -> Option<Keyword>
Look for one of the given keywords and return the one that matches.
Sourcefn expect_one_of_keywords(
&mut self,
keywords: &[Keyword],
) -> Result<Keyword, ParserError>
fn expect_one_of_keywords( &mut self, keywords: &[Keyword], ) -> Result<Keyword, ParserError>
Bail out if the current token is not one of the expected keywords, or consume it if it is
Sourcefn expect_keyword(&mut self, expected: Keyword) -> Result<(), ParserError>
fn expect_keyword(&mut self, expected: Keyword) -> Result<(), ParserError>
Bail out if the current token is not an expected keyword, or consume it if it is
Sourcefn expect_keywords(&mut self, expected: &[Keyword]) -> Result<(), ParserError>
fn expect_keywords(&mut self, expected: &[Keyword]) -> Result<(), ParserError>
Bail out if the following tokens are not the expected sequence of keywords, or consume them if they are.
Sourcefn consume_token(&mut self, expected: &Token) -> bool
fn consume_token(&mut self, expected: &Token) -> bool
Consume the next token if it matches the expected token, otherwise return false
Sourcefn expect_token(&mut self, expected: &Token) -> Result<(), ParserError>
fn expect_token(&mut self, expected: &Token) -> Result<(), ParserError>
Bail out if the current token is not an expected token, or consume it if it is
Sourcefn expect_one_of_tokens(
&mut self,
tokens: &[Token],
) -> Result<Token, ParserError>
fn expect_one_of_tokens( &mut self, tokens: &[Token], ) -> Result<Token, ParserError>
Bail out if the current token is not one of the expected tokens, or consume it if it is
Sourcefn expect_keyword_or_token(
&mut self,
expected_keyword: Keyword,
expected_token: &Token,
) -> Result<(), ParserError>
fn expect_keyword_or_token( &mut self, expected_keyword: Keyword, expected_token: &Token, ) -> Result<(), ParserError>
Bail out if the current token is not an expected keyword or token, or consume it if it is
Sourcefn parse_comma_separated<T, F>(&mut self, f: F) -> Result<Vec<T>, ParserError>
fn parse_comma_separated<T, F>(&mut self, f: F) -> Result<Vec<T>, ParserError>
Parse a comma-separated list of 1+ items accepted by F
fn maybe_parse<T, F>(&mut self, f: F) -> Option<T>
Sourcefn parse_create(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_create(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a SQL CREATE statement
fn parse_create_database(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_schema(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_format(&mut self) -> Result<Format<Raw>, ParserError>
fn parse_avro_schema(&mut self) -> Result<AvroSchema<Raw>, ParserError>
fn parse_avro_schema_option( &mut self, ) -> Result<AvroSchemaOption<Raw>, ParserError>
fn parse_protobuf_schema(&mut self) -> Result<ProtobufSchema<Raw>, ParserError>
fn parse_csr_connection_reference( &mut self, ) -> Result<CsrConnection<Raw>, ParserError>
fn parse_csr_config_option( &mut self, ) -> Result<CsrConfigOption<Raw>, ParserError>
fn parse_avro_doc_on_option_name( &mut self, ) -> Result<DocOnIdentifier<Raw>, ParserError>
fn parse_csr_connection_avro( &mut self, ) -> Result<CsrConnectionAvro<Raw>, ParserError>
fn parse_csr_connection_proto( &mut self, ) -> Result<CsrConnectionProtobuf<Raw>, ParserError>
fn parse_source_error_policy_option( &mut self, ) -> Result<SourceErrorPolicy, ParserError>
fn parse_source_envelope(&mut self) -> Result<SourceEnvelope, ParserError>
fn parse_sink_envelope(&mut self) -> Result<SinkEnvelope, ParserError>
Sourcefn parse_validate(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_validate(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a VALIDATE
statement
fn parse_create_connection(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_connection_option_name( &mut self, ) -> Result<CreateConnectionOptionName, ParserError>
Sourcefn parse_create_connection_option(
&mut self,
) -> Result<CreateConnectionOption<Raw>, ParserError>
fn parse_create_connection_option( &mut self, ) -> Result<CreateConnectionOption<Raw>, ParserError>
Parses a single valid option in the WITH block of a create source
fn parse_default_aws_privatelink( &mut self, ) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_kafka_broker(&mut self) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_kafka_broker_aws_privatelink_option( &mut self, ) -> Result<KafkaBrokerAwsPrivatelinkOption<Raw>, ParserError>
fn parse_kafka_source_config_option( &mut self, ) -> Result<KafkaSourceConfigOption<Raw>, ParserError>
fn parse_kafka_sink_config_option( &mut self, ) -> Result<KafkaSinkConfigOption<Raw>, ParserError>
fn parse_connection_option_name( &mut self, ) -> Result<ConnectionOptionName, ParserError>
fn parse_connection_option_unified( &mut self, ) -> Result<ConnectionOption<Raw>, ParserError>
fn parse_create_subsource(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_subsource_option( &mut self, ) -> Result<CreateSubsourceOption<Raw>, ParserError>
fn parse_create_source(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_subsource_references( &mut self, ) -> Result<ExternalReferenceExport, ParserError>
Sourcefn parse_source_columns(
&mut self,
) -> Result<(Vec<Ident>, Option<KeyConstraint>), ParserError>
fn parse_source_columns( &mut self, ) -> Result<(Vec<Ident>, Option<KeyConstraint>), ParserError>
Parses the column section of a CREATE SOURCE statement which can be empty or a comma-separated list of column identifiers and a single key constraint, e.g.
(col_0, col_i, …, col_n, key_constraint)
Sourcefn parse_key_constraint(&mut self) -> Result<Option<KeyConstraint>, ParserError>
fn parse_key_constraint(&mut self) -> Result<Option<KeyConstraint>, ParserError>
Parses a key constraint.
fn parse_source_option_name( &mut self, ) -> Result<CreateSourceOptionName, ParserError>
Sourcefn parse_source_option(
&mut self,
) -> Result<CreateSourceOption<Raw>, ParserError>
fn parse_source_option( &mut self, ) -> Result<CreateSourceOption<Raw>, ParserError>
Parses a single valid option in the WITH block of a create source
fn parse_create_webhook_source( &mut self, name: UnresolvedItemName, if_not_exists: bool, in_cluster: Option<RawClusterName>, is_table: bool, ) -> Result<Statement<Raw>, ParserError>
fn parse_create_webhook_check_options( &mut self, ) -> Result<CreateWebhookSourceCheckOptions<Raw>, ParserError>
fn parse_create_kafka_sink( &mut self, name: Option<UnresolvedItemName>, in_cluster: Option<RawClusterName>, from: RawItemName, if_not_exists: bool, connection: CreateSinkConnection<Raw>, ) -> Result<CreateSinkStatement<Raw>, ParserError>
fn parse_create_sink(&mut self) -> Result<Statement<Raw>, ParserError>
Sourcefn parse_create_sink_option_name(
&mut self,
) -> Result<CreateSinkOptionName, ParserError>
fn parse_create_sink_option_name( &mut self, ) -> Result<CreateSinkOptionName, ParserError>
Parse the name of a CREATE SINK optional parameter
Sourcefn parse_create_sink_option(
&mut self,
) -> Result<CreateSinkOption<Raw>, ParserError>
fn parse_create_sink_option( &mut self, ) -> Result<CreateSinkOption<Raw>, ParserError>
Parse a NAME = VALUE parameter for CREATE SINK
fn parse_create_source_connection( &mut self, ) -> Result<CreateSourceConnection<Raw>, ParserError>
fn parse_pg_connection_option( &mut self, ) -> Result<PgConfigOption<Raw>, ParserError>
fn parse_mysql_connection_option( &mut self, ) -> Result<MySqlConfigOption<Raw>, ParserError>
fn parse_sql_server_connection_option( &mut self, ) -> Result<SqlServerConfigOption<Raw>, ParserError>
fn parse_load_generator_option( &mut self, ) -> Result<LoadGeneratorOption<Raw>, ParserError>
fn parse_create_kafka_sink_connection( &mut self, ) -> Result<CreateSinkConnection<Raw>, ParserError>
fn parse_create_sink_connection( &mut self, ) -> Result<CreateSinkConnection<Raw>, ParserError>
fn parse_create_view(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_view_definition(&mut self) -> Result<ViewDefinition<Raw>, ParserError>
fn parse_create_materialized_view( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_create_continual_task(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_continual_task_from_transform( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_create_continual_task_from_retain( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_materialized_view_option_name( &mut self, ) -> Result<MaterializedViewOptionName, ParserError>
fn parse_materialized_view_option( &mut self, ) -> Result<MaterializedViewOption<Raw>, ParserError>
fn parse_option_retain_history( &mut self, ) -> Result<Option<WithOptionValue<Raw>>, ParserError>
fn parse_retain_history(&mut self) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_materialized_view_refresh_option_value( &mut self, ) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_create_continual_task_with_options( &mut self, ) -> Result<Vec<ContinualTaskOption<Raw>>, ParserError>
fn parse_continual_task_option_name( &mut self, ) -> Result<ContinualTaskOptionName, ParserError>
fn parse_continual_task_option( &mut self, ) -> Result<ContinualTaskOption<Raw>, ParserError>
fn parse_create_index(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_table_option_name(&mut self) -> Result<TableOptionName, ParserError>
fn parse_table_option(&mut self) -> Result<TableOption<Raw>, ParserError>
fn parse_index_option_name(&mut self) -> Result<IndexOptionName, ParserError>
fn parse_index_option(&mut self) -> Result<IndexOption<Raw>, ParserError>
fn parse_raw_ident(&mut self) -> Result<RawClusterName, ParserError>
fn parse_raw_network_policy_name( &mut self, ) -> Result<RawNetworkPolicyName, ParserError>
fn parse_raw_ident_str(&mut self) -> Result<String, ParserError>
fn parse_optional_in_cluster( &mut self, ) -> Result<Option<RawClusterName>, ParserError>
fn parse_create_role(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_role_attributes(&mut self) -> Result<Vec<RoleAttribute>, ParserError>
fn parse_create_secret(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_type(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_type_list_option( &mut self, ) -> Result<CreateTypeListOption<Raw>, ParserError>
fn parse_create_type_map_option( &mut self, ) -> Result<CreateTypeMapOption<Raw>, ParserError>
fn parse_create_cluster(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_cluster_option_name( &mut self, ) -> Result<ClusterOptionName, ParserError>
fn parse_cluster_option(&mut self) -> Result<ClusterOption<Raw>, ParserError>
fn parse_alter_cluster_option( &mut self, ) -> Result<ClusterAlterOption<Raw>, ParserError>
fn parse_cluster_alter_until_ready_option( &mut self, ) -> Result<ClusterAlterUntilReadyOption<Raw>, ParserError>
fn parse_cluster_option_replicas( &mut self, ) -> Result<ClusterOption<Raw>, ParserError>
fn parse_cluster_option_schedule( &mut self, ) -> Result<ClusterOption<Raw>, ParserError>
fn parse_replica_option(&mut self) -> Result<ReplicaOption<Raw>, ParserError>
fn parse_cluster_feature(&mut self) -> Result<ClusterFeature<Raw>, ParserError>
fn parse_create_cluster_replica( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_if_exists(&mut self) -> Result<bool, ParserError>
fn parse_if_not_exists(&mut self) -> Result<bool, ParserError>
fn parse_alias(&mut self) -> Result<Option<Ident>, ParserError>
fn parse_source_include_metadata( &mut self, ) -> Result<Vec<SourceIncludeMetadata>, ParserError>
fn parse_discard(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_drop(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_drop_objects(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_drop_clusters( &mut self, if_exists: bool, ) -> Result<Statement<Raw>, ParserError>
fn parse_drop_cluster_replicas( &mut self, if_exists: bool, ) -> Result<Statement<Raw>, ParserError>
fn parse_drop_owned(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_cluster_replica_name( &mut self, ) -> Result<QualifiedReplica, ParserError>
fn parse_alter_network_policy(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_network_policy(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_network_policy_option( &mut self, ) -> Result<NetworkPolicyOption<Raw>, ParserError>
fn parse_network_policy_option_rules( &mut self, ) -> Result<NetworkPolicyOption<Raw>, ParserError>
fn parse_network_policy_rule_option( &mut self, ) -> Result<NetworkPolicyRuleOption<Raw>, ParserError>
fn parse_create_table(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_create_table_from_source( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_table_from_source_option( &mut self, ) -> Result<TableFromSourceOption<Raw>, ParserError>
fn parse_table_from_source_columns( &mut self, ) -> Result<(TableFromSourceColumns<Raw>, Vec<TableConstraint<Raw>>), ParserError>
fn parse_columns( &mut self, optional: IsOptional, ) -> Result<(Vec<ColumnDef<Raw>>, Vec<TableConstraint<Raw>>), ParserError>
fn parse_column_option_def( &mut self, ) -> Result<ColumnOptionDef<Raw>, ParserError>
fn parse_optional_table_constraint( &mut self, ) -> Result<Option<TableConstraint<Raw>>, ParserError>
fn parse_object_option_value( &mut self, ) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_optional_option_value( &mut self, ) -> Result<Option<WithOptionValue<Raw>>, ParserError>
fn parse_option_sequence<T, F>( &mut self, f: F, ) -> Result<Option<Vec<T>>, ParserError>
fn parse_option_map( &mut self, ) -> Result<Option<BTreeMap<String, WithOptionValue<Raw>>>, ParserError>
fn parse_option_value(&mut self) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_data_type_option_value( &mut self, ) -> Result<WithOptionValue<Raw>, ParserError>
fn parse_alter(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_object(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_cluster( &mut self, object_type: ObjectType, ) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_source(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_source_add_subsource_option( &mut self, ) -> Result<AlterSourceAddSubsourceOption<Raw>, ParserError>
fn parse_alter_index(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_secret(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Sourcefn parse_alter_sink(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_sink(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse an ALTER SINK statement.
Sourcefn parse_alter_system(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_system(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse an ALTER SYSTEM statement.
fn parse_alter_connection( &mut self, ) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_connection_action( &mut self, ) -> Result<AlterConnectionAction<Raw>, ParserError>
Sourcefn parse_alter_connection_option(
&mut self,
) -> Result<AlterConnectionOption<Raw>, ParserError>
fn parse_alter_connection_option( &mut self, ) -> Result<AlterConnectionOption<Raw>, ParserError>
Parses a single valid option in the WITH block of a create source
fn parse_alter_role(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_alter_default_privileges( &mut self, ) -> Result<Statement<Raw>, ParserError>
fn parse_alter_views( &mut self, object_type: ObjectType, ) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_schema( &mut self, object_type: ObjectType, ) -> Result<Statement<Raw>, ParserStatementError>
Sourcefn maybe_parse_alter_set_cluster(
&mut self,
if_exists: bool,
name: &UnresolvedItemName,
object_type: ObjectType,
) -> Option<Result<Statement<Raw>, ParserStatementError>>
fn maybe_parse_alter_set_cluster( &mut self, if_exists: bool, name: &UnresolvedItemName, object_type: ObjectType, ) -> Option<Result<Statement<Raw>, ParserStatementError>>
Parses CLUSTER name
fragments into a AlterSetClusterStatement
if CLUSTER
is found.
Sourcefn parse_alter_set_cluster(
&mut self,
if_exists: bool,
name: UnresolvedItemName,
object_type: ObjectType,
) -> Result<Statement<Raw>, ParserStatementError>
fn parse_alter_set_cluster( &mut self, if_exists: bool, name: UnresolvedItemName, object_type: ObjectType, ) -> Result<Statement<Raw>, ParserStatementError>
Parses IN CLUSTER name
fragments into a AlterSetClusterStatement
.
Sourcefn parse_copy(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_copy(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a copy statement
fn parse_copy_option(&mut self) -> Result<CopyOption<Raw>, ParserError>
Sourcefn parse_value(&mut self) -> Result<Value, ParserError>
fn parse_value(&mut self) -> Result<Value, ParserError>
Parse a literal value (numbers, strings, date/time, booleans)
fn parse_array(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_list(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_map(&mut self) -> Result<Expr<Raw>, ParserError>
fn parse_sequence<F>(&mut self, f: F) -> Result<Vec<Expr<Raw>>, ParserError>
fn parse_number_value(&mut self) -> Result<Value, ParserError>
fn parse_version(&mut self) -> Result<Version, ParserError>
Sourcefn parse_literal_int(&mut self) -> Result<i64, ParserError>
fn parse_literal_int(&mut self) -> Result<i64, ParserError>
Parse a signed literal integer.
Sourcefn parse_literal_uint(&mut self) -> Result<u64, ParserError>
fn parse_literal_uint(&mut self) -> Result<u64, ParserError>
Parse an unsigned literal integer.
Sourcefn parse_literal_string(&mut self) -> Result<String, ParserError>
fn parse_literal_string(&mut self) -> Result<String, ParserError>
Parse a literal string
Sourcefn parse_data_type(&mut self) -> Result<RawDataType, ParserError>
fn parse_data_type(&mut self) -> Result<RawDataType, ParserError>
Parse a SQL datatype (in the context of a CREATE TABLE statement for example)
fn parse_typ_mod(&mut self) -> Result<Vec<i64>, ParserError>
fn parse_timestamp_precision(&mut self) -> Result<Vec<i64>, ParserError>
Sourcefn parse_optional_alias<F>(
&mut self,
is_reserved: F,
) -> Result<Option<Ident>, ParserError>
fn parse_optional_alias<F>( &mut self, is_reserved: F, ) -> Result<Option<Ident>, ParserError>
Parse AS identifier
(or simply identifier
if it’s not a reserved keyword)
Some examples with aliases: SELECT 1 foo
, SELECT COUNT(*) AS cnt
,
SELECT ... FROM t1 foo, t2 bar
, SELECT ... FROM (...) AS bar
Sourcefn parse_optional_table_alias(
&mut self,
) -> Result<Option<TableAlias>, ParserError>
fn parse_optional_table_alias( &mut self, ) -> Result<Option<TableAlias>, ParserError>
Parse AS identifier
when the AS is describing a table-valued object,
like in ... FROM generate_series(1, 10) AS t (col)
. In this case
the alias is allowed to optionally name the columns in the table, in
addition to the table itself.
fn parse_deferred_item_name( &mut self, ) -> Result<DeferredItemName<Raw>, ParserError>
fn parse_raw_name(&mut self) -> Result<RawItemName, ParserError>
fn parse_column_name(&mut self) -> Result<ColumnName<Raw>, ParserError>
Sourcefn parse_database_name(&mut self) -> Result<UnresolvedDatabaseName, ParserError>
fn parse_database_name(&mut self) -> Result<UnresolvedDatabaseName, ParserError>
Parse a possibly quoted database identifier, e.g.
foo
or "mydatabase"
Sourcefn parse_schema_name(&mut self) -> Result<UnresolvedSchemaName, ParserError>
fn parse_schema_name(&mut self) -> Result<UnresolvedSchemaName, ParserError>
Parse a possibly qualified, possibly quoted schema identifier, e.g.
foo
or mydatabase."schema"
Sourcefn parse_item_name(&mut self) -> Result<UnresolvedItemName, ParserError>
fn parse_item_name(&mut self) -> Result<UnresolvedItemName, ParserError>
Parse a possibly qualified, possibly quoted object identifier, e.g.
foo
or myschema."table"
Sourcefn parse_object_name(
&mut self,
object_type: ObjectType,
) -> Result<UnresolvedObjectName, ParserError>
fn parse_object_name( &mut self, object_type: ObjectType, ) -> Result<UnresolvedObjectName, ParserError>
Parse an object name.
Sourcefn parse_identifiers(&mut self) -> Result<Vec<Ident>, ParserError>
fn parse_identifiers(&mut self) -> Result<Vec<Ident>, ParserError>
Parse one or more simple one-word identifiers separated by a ‘.’
Sourcefn parse_identifier(&mut self) -> Result<Ident, ParserError>
fn parse_identifier(&mut self) -> Result<Ident, ParserError>
Parse a simple one-word identifier (possibly quoted, possibly a keyword)
fn consume_identifier(&mut self) -> Result<Option<Ident>, ParserError>
fn parse_qualified_identifier( &mut self, id: Ident, ) -> Result<Expr<Raw>, ParserError>
Sourcefn parse_parenthesized_column_list(
&mut self,
optional: IsOptional,
) -> Result<Vec<Ident>, ParserError>
fn parse_parenthesized_column_list( &mut self, optional: IsOptional, ) -> Result<Vec<Ident>, ParserError>
Parse a parenthesized comma-separated list of unqualified, possibly quoted identifiers
fn parse_optional_precision(&mut self) -> Result<Option<u64>, ParserError>
fn parse_map_type(&mut self) -> Result<RawDataType, ParserError>
fn parse_delete(&mut self) -> Result<Statement<Raw>, ParserError>
Sourcefn parse_select_statement(
&mut self,
) -> Result<SelectStatement<Raw>, ParserError>
fn parse_select_statement( &mut self, ) -> Result<SelectStatement<Raw>, ParserError>
Parses a SELECT (or WITH, VALUES, TABLE) statement with optional AS OF.
Sourcefn parse_query(&mut self) -> Result<Query<Raw>, ParserError>
fn parse_query(&mut self) -> Result<Query<Raw>, ParserError>
Parse a query expression, i.e. a SELECT
statement optionally
preceded with some WITH
CTE declarations and optionally followed
by ORDER BY
. Unlike some other parse_… methods, this one doesn’t
expect the initial keyword to be already consumed
fn parse_mut_rec_block_option( &mut self, ) -> Result<MutRecBlockOption<Raw>, ParserError>
fn parse_query_tail( &mut self, ctes: CteBlock<Raw>, body: SetExpr<Raw>, ) -> Result<Query<Raw>, ParserError>
Sourcefn parse_cte(&mut self) -> Result<Cte<Raw>, ParserError>
fn parse_cte(&mut self) -> Result<Cte<Raw>, ParserError>
Parse a CTE (alias [( col1, col2, ... )] AS (subquery)
)
Sourcefn parse_cte_mut_rec(&mut self) -> Result<CteMutRec<Raw>, ParserError>
fn parse_cte_mut_rec(&mut self) -> Result<CteMutRec<Raw>, ParserError>
Parse a mutually recursive CTE (alias ( col1: typ1, col2: typ2, ... ) AS (subquery)
).
The main distinction from parse_cte
is that the column names and types are mandatory.
This is not how SQL works for WITH RECURSIVE
, but we are doing it for now to make the
query interpretation that much easier.
Sourcefn parse_query_body(
&mut self,
precedence: SetPrecedence,
) -> Result<SetExpr<Raw>, ParserError>
fn parse_query_body( &mut self, precedence: SetPrecedence, ) -> Result<SetExpr<Raw>, ParserError>
Parse a “query body”, which is an expression with roughly the following grammar:
query_body ::= restricted_select | '(' subquery ')' | set_operation
restricted_select ::= 'SELECT' [expr_list] [ from ] [ where ] [ groupby_having ]
subquery ::= query_body [ order_by_limit ]
set_operation ::= query_body { 'UNION' | 'EXCEPT' | 'INTERSECT' } [ 'ALL' ] query_body
fn parse_query_body_seeded( &mut self, precedence: SetPrecedence, expr: SetExpr<Raw>, ) -> Result<SetExpr<Raw>, ParserError>
fn parse_set_operator(&self, token: &Option<Token>) -> Option<SetOperator>
Sourcefn parse_select(&mut self) -> Result<Select<Raw>, ParserError>
fn parse_select(&mut self) -> Result<Select<Raw>, ParserError>
Parse a restricted SELECT
statement (no CTEs / UNION
/ ORDER BY
),
assuming the initial SELECT
was already consumed
fn parse_select_option(&mut self) -> Result<SelectOption<Raw>, ParserError>
fn parse_set(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_set_schema_to(&mut self) -> Result<SetVariableTo, ParserError>
fn parse_set_variable_to(&mut self) -> Result<SetVariableTo, ParserError>
fn parse_set_variable_value(&mut self) -> Result<SetVariableValue, ParserError>
fn parse_reset(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_show(&mut self) -> Result<ShowStatement<Raw>, ParserError>
fn parse_show_columns(&mut self) -> Result<ShowStatement<Raw>, ParserError>
fn parse_show_statement_filter( &mut self, ) -> Result<Option<ShowStatementFilter<Raw>>, ParserError>
fn parse_show_privileges(&mut self) -> Result<ShowStatement<Raw>, ParserError>
fn parse_show_default_privileges( &mut self, ) -> Result<ShowStatement<Raw>, ParserError>
fn parse_inspect(&mut self) -> Result<ShowStatement<Raw>, ParserError>
fn parse_table_and_joins(&mut self) -> Result<TableWithJoins<Raw>, ParserError>
Sourcefn parse_table_factor(&mut self) -> Result<TableFactor<Raw>, ParserError>
fn parse_table_factor(&mut self) -> Result<TableFactor<Raw>, ParserError>
A table name or a parenthesized subquery, followed by optional [AS] alias
fn parse_rows_from(&mut self) -> Result<TableFactor<Raw>, ParserError>
Sourcefn parse_table_function_suffix(
&mut self,
) -> Result<(bool, Option<TableAlias>), ParserError>
fn parse_table_function_suffix( &mut self, ) -> Result<(bool, Option<TableAlias>), ParserError>
Parses the things that can come after the argument list of a table function call. These are
- optional WITH ORDINALITY
- optional table alias
- optional WITH ORDINALITY again! This is allowed just to keep supporting our earlier buggy order where we allowed WITH ORDINALITY only after the table alias. (Postgres and other systems support it only before the table alias.)
fn parse_named_function(&mut self) -> Result<Function<Raw>, ParserError>
fn parse_derived_table_factor( &mut self, lateral: IsLateral, ) -> Result<TableFactor<Raw>, ParserError>
fn parse_join_constraint( &mut self, natural: bool, ) -> Result<JoinConstraint<Raw>, ParserError>
Sourcefn parse_insert(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_insert(&mut self) -> Result<Statement<Raw>, ParserError>
Parse an INSERT statement
fn parse_returning(&mut self) -> Result<Vec<SelectItem<Raw>>, ParserError>
fn parse_update(&mut self) -> Result<Statement<Raw>, ParserError>
Sourcefn parse_assignment(&mut self) -> Result<Assignment<Raw>, ParserError>
fn parse_assignment(&mut self) -> Result<Assignment<Raw>, ParserError>
Parse a var = expr
assignment, used in an UPDATE statement
fn parse_optional_args( &mut self, allow_order_by: bool, ) -> Result<FunctionArgs<Raw>, ParserError>
Sourcefn parse_optional_as_of(&mut self) -> Result<Option<AsOf<Raw>>, ParserError>
fn parse_optional_as_of(&mut self) -> Result<Option<AsOf<Raw>>, ParserError>
Parse AS OF
, if present.
Sourcefn parse_optional_up_to(&mut self) -> Result<Option<Expr<Raw>>, ParserError>
fn parse_optional_up_to(&mut self) -> Result<Option<Expr<Raw>>, ParserError>
Parse UP TO
, if present
Sourcefn parse_optional_internal_as_of(&mut self) -> Result<Option<u64>, ParserError>
fn parse_optional_internal_as_of(&mut self) -> Result<Option<u64>, ParserError>
Parse AS OF
, if present.
In contrast to parse_optional_as_of
, this parser only supports AS OF <time>
syntax and
directly returns an u64
. It is only meant to be used for internal SQL syntax.
Sourcefn parse_select_item(&mut self) -> Result<SelectItem<Raw>, ParserError>
fn parse_select_item(&mut self) -> Result<SelectItem<Raw>, ParserError>
Parse a comma-delimited list of projections after SELECT
Sourcefn parse_order_by_expr(&mut self) -> Result<OrderByExpr<Raw>, ParserError>
fn parse_order_by_expr(&mut self) -> Result<OrderByExpr<Raw>, ParserError>
Parse an expression, optionally followed by ASC or DESC,
and then [NULLS { FIRST | LAST }]
(used in ORDER BY)
fn parse_values(&mut self) -> Result<Values<Raw>, ParserError>
fn parse_start_transaction(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_begin(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_transaction_modes( &mut self, required: bool, ) -> Result<Vec<TransactionMode>, ParserError>
fn parse_commit(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_rollback(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_commit_rollback_chain(&mut self) -> Result<bool, ParserError>
fn parse_tail(&self) -> Result<Statement<Raw>, ParserError>
fn parse_subscribe(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_subscribe_option( &mut self, ) -> Result<SubscribeOption<Raw>, ParserError>
fn parse_subscribe_output( &mut self, ) -> Result<SubscribeOutput<Raw>, ParserError>
Sourcefn parse_explain(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_explain(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse an EXPLAIN
statement, assuming that the EXPLAIN
token
has already been consumed.
fn parse_explainee(&mut self) -> Result<Explainee<Raw>, ParserError>
Sourcefn parse_explain_plan(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_explain_plan(&mut self) -> Result<Statement<Raw>, ParserError>
Parse an EXPLAIN ... PLAN
statement, assuming that the EXPLAIN
token
has already been consumed.
fn parse_explain_plan_option( &mut self, ) -> Result<ExplainPlanOption<Raw>, ParserError>
Sourcefn parse_explain_pushdown(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_explain_pushdown(&mut self) -> Result<Statement<Raw>, ParserError>
Parse an EXPLAIN FILTER PUSHDOWN
statement, assuming that the EXPLAIN PUSHDOWN
tokens have already been consumed.
fn parse_explain_analyze(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_explain_analyze_computation_property( &mut self, properties: &[Keyword], ) -> Result<(Keyword, ExplainAnalyzeComputationProperty), ParserError>
Sourcefn parse_explain_timestamp(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_explain_timestamp(&mut self) -> Result<Statement<Raw>, ParserError>
Parse an EXPLAIN TIMESTAMP
statement, assuming that the EXPLAIN TIMESTAMP
tokens have already been consumed.
Sourcefn parse_explain_schema(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_explain_schema(&mut self) -> Result<Statement<Raw>, ParserError>
Parse an EXPLAIN [KEY|VALUE] SCHEMA
statement assuming that the EXPLAIN
token
have already been consumed
Sourcefn parse_declare(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_declare(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a DECLARE
statement, assuming that the DECLARE
token
has already been consumed.
Sourcefn parse_close(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_close(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a CLOSE
statement, assuming that the CLOSE
token
has already been consumed.
Sourcefn parse_prepare(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_prepare(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a PREPARE
statement, assuming that the PREPARE
token
has already been consumed.
Sourcefn parse_execute(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_execute(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a EXECUTE
statement, assuming that the EXECUTE
token
has already been consumed.
Sourcefn parse_deallocate(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_deallocate(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a DEALLOCATE
statement, assuming that the DEALLOCATE
token
has already been consumed.
Sourcefn parse_fetch(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_fetch(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a FETCH
statement, assuming that the FETCH
token
has already been consumed.
fn parse_fetch_option(&mut self) -> Result<FetchOption<Raw>, ParserError>
Sourcefn parse_raise(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_raise(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a RAISE
statement, assuming that the RAISE
token
has already been consumed.
Sourcefn parse_grant(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_grant(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a GRANT
statement, assuming that the GRANT
token
has already been consumed.
Sourcefn parse_grant_privilege(
&mut self,
privileges: PrivilegeSpecification,
) -> Result<Statement<Raw>, ParserError>
fn parse_grant_privilege( &mut self, privileges: PrivilegeSpecification, ) -> Result<Statement<Raw>, ParserError>
Parse a GRANT PRIVILEGE
statement, assuming that the GRANT
token
and all privileges have already been consumed.
Sourcefn parse_grant_role(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_grant_role(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a GRANT ROLE
statement, assuming that the GRANT
token
has already been consumed.
Sourcefn parse_revoke(&mut self) -> Result<Statement<Raw>, ParserStatementError>
fn parse_revoke(&mut self) -> Result<Statement<Raw>, ParserStatementError>
Parse a REVOKE
statement, assuming that the REVOKE
token
has already been consumed.
Sourcefn parse_revoke_privilege(
&mut self,
privileges: PrivilegeSpecification,
) -> Result<Statement<Raw>, ParserError>
fn parse_revoke_privilege( &mut self, privileges: PrivilegeSpecification, ) -> Result<Statement<Raw>, ParserError>
Parse a REVOKE PRIVILEGE
statement, assuming that the REVOKE
token
and all privileges have already been consumed.
Sourcefn parse_revoke_role(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_revoke_role(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a REVOKE ROLE
statement, assuming that the REVOKE
token
has already been consumed.
fn expect_grant_target_specification( &mut self, statement_type: &str, ) -> Result<GrantTargetSpecification<Raw>, ParserError>
Sourcefn expect_grant_revoke_object_type(
&mut self,
statement_type: &str,
) -> Result<ObjectType, ParserError>
fn expect_grant_revoke_object_type( &mut self, statement_type: &str, ) -> Result<ObjectType, ParserError>
Bail out if the current token is not an object type suitable for a GRANT/REVOKE, or consume and return it if it is.
Sourcefn expect_grant_revoke_plural_object_type(
&mut self,
statement_type: &str,
) -> Result<ObjectType, ParserError>
fn expect_grant_revoke_plural_object_type( &mut self, statement_type: &str, ) -> Result<ObjectType, ParserError>
Bail out if the current token is not a plural object type suitable for a GRANT/REVOKE, or consume and return it if it is.
fn expect_grant_revoke_object_type_inner( &self, statement_type: &str, object_type: ObjectType, ) -> Result<ObjectType, ParserError>
Sourcefn expect_object_type(&mut self) -> Result<ObjectType, ParserError>
fn expect_object_type(&mut self) -> Result<ObjectType, ParserError>
Bail out if the current token is not an object type, or consume and return it if it is.
Sourcefn parse_object_type(&mut self) -> Option<ObjectType>
fn parse_object_type(&mut self) -> Option<ObjectType>
Look for an object type and return it if it matches.
Sourcefn expect_plural_object_type(&mut self) -> Result<ObjectType, ParserError>
fn expect_plural_object_type(&mut self) -> Result<ObjectType, ParserError>
Bail out if the current token is not an object type in the plural form, or consume and return it if it is.
Sourcefn parse_plural_object_type(&mut self) -> Option<ObjectType>
fn parse_plural_object_type(&mut self) -> Option<ObjectType>
Look for an object type in the plural form and return it if it matches.
Sourcefn expect_plural_object_type_for_privileges(
&mut self,
) -> Result<ObjectType, ParserError>
fn expect_plural_object_type_for_privileges( &mut self, ) -> Result<ObjectType, ParserError>
Bail out if the current token is not a privilege object type, or consume and return it if it is.
Sourcefn expect_plural_system_object_type_for_privileges(
&mut self,
) -> Result<SystemObjectType, ParserError>
fn expect_plural_system_object_type_for_privileges( &mut self, ) -> Result<SystemObjectType, ParserError>
Bail out if the current token is not a privilege object type in the plural form, or consume and return it if it is.
Sourcefn parse_privilege(&mut self) -> Option<Privilege>
fn parse_privilege(&mut self) -> Option<Privilege>
Look for a privilege and return it if it matches.
Sourcefn parse_privilege_specification(&mut self) -> Option<PrivilegeSpecification>
fn parse_privilege_specification(&mut self) -> Option<PrivilegeSpecification>
Parse one or more privileges separated by a ‘,’.
Sourcefn expect_role_specification(&mut self) -> Result<Ident, ParserError>
fn expect_role_specification(&mut self) -> Result<Ident, ParserError>
Bail out if the current token is not a role specification, or consume and return it if it is.
Sourcefn parse_reassign_owned(&mut self) -> Result<Statement<Raw>, ParserError>
fn parse_reassign_owned(&mut self) -> Result<Statement<Raw>, ParserError>
Parse a REASSIGN OWNED
statement, assuming that the REASSIGN
token
has already been consumed.
fn parse_comment(&mut self) -> Result<Statement<Raw>, ParserError>
pub fn new_identifier<S>(&self, s: S) -> Result<Ident, ParserError>
§impl<'a> Parser<'a>
impl<'a> Parser<'a>
fn parse_explain_plan_option_name( &mut self, ) -> Result<ExplainPlanOptionName, ParserError>
fn parse_cluster_feature_name( &mut self, ) -> Result<ClusterFeatureName, ParserError>
Trait Implementations§
Source§impl CheckedRecursion for Parser<'_>
impl CheckedRecursion for Parser<'_>
Source§fn recursion_guard(&self) -> &RecursionGuard
fn recursion_guard(&self) -> &RecursionGuard
Source§fn checked_recur<F, T, E>(&self, f: F) -> Result<T, E>
fn checked_recur<F, T, E>(&self, f: F) -> Result<T, E>
f
if so. Read moreSource§fn checked_recur_mut<F, T, E>(&mut self, f: F) -> Result<T, E>
fn checked_recur_mut<F, T, E>(&mut self, f: F) -> Result<T, E>
CheckedRecursion::checked_recur
, but operates on a mutable
reference to Self
.Auto Trait Implementations§
impl<'a> !Freeze for Parser<'a>
impl<'a> !RefUnwindSafe for Parser<'a>
impl<'a> Send for Parser<'a>
impl<'a> !Sync for Parser<'a>
impl<'a> Unpin for Parser<'a>
impl<'a> UnwindSafe for Parser<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
Source§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute
value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi
Quirk
value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition
value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
Source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.