pub struct ParseError {
pub message: String,
pub position: Position,
pub expected: Vec<String>,
pub kind: ParseErrorKind,
}Expand description
Parse error
Fields§
§message: StringError message
position: PositionPosition where error occurred
expected: Vec<String>Expected tokens (for better error messages)
kind: ParseErrorKindOptional structured kind for hardening / DoS errors
Implementations§
Source§impl ParseError
impl ParseError
Sourcepub fn new(message: impl Into<String>, position: Position) -> ParseError
pub fn new(message: impl Into<String>, position: Position) -> ParseError
Create a new parse error
Sourcepub fn expected(
expected: Vec<&str>,
found: &Token,
position: Position,
) -> ParseError
pub fn expected( expected: Vec<&str>, found: &Token, position: Position, ) -> ParseError
Create error with expected tokens
found is rendered through SafeTokenDisplay so caller-controlled
bytes inside Token::Ident / Token::String / Token::JsonLiteral /
Token::Float / Token::Integer payloads are escaped via Rust’s
escape_debug rules (CR / LF / NUL / quote bytes become \n,
\r, \0, \", …). Static keyword and punctuation arms keep their
existing UPPER-CASE rendering so error messages and snapshot tests
stay readable. This prevents F-05 smuggling through the downstream
JSON / audit / log / gRPC sinks that embed ParseError::message.
Sourcepub fn unsupported_recognized_token(
found: &Token,
position: Position,
) -> Option<ParseError>
pub fn unsupported_recognized_token( found: &Token, position: Position, ) -> Option<ParseError>
Create an error when a lexer-known keyword appears in a parser position where that keyword has no supported production.
Sourcepub fn depth_limit(
limit_name: &'static str,
value: usize,
position: Position,
) -> ParseError
pub fn depth_limit( limit_name: &'static str, value: usize, position: Position, ) -> ParseError
Recursion depth limit hit. The structured kind carries the
name + numeric value so the snapshot/property harness can
pattern-match without string slicing.
Sourcepub fn input_too_large(
limit_name: &'static str,
value: usize,
position: Position,
) -> ParseError
pub fn input_too_large( limit_name: &'static str, value: usize, position: Position, ) -> ParseError
Input bytes exceeded the configured cap.
Sourcepub fn identifier_too_long(
limit_name: &'static str,
value: usize,
position: Position,
) -> ParseError
pub fn identifier_too_long( limit_name: &'static str, value: usize, position: Position, ) -> ParseError
Identifier exceeded the configured character cap.
Sourcepub fn token_limit(
limit_name: &'static str,
value: usize,
position: Position,
) -> ParseError
pub fn token_limit( limit_name: &'static str, value: usize, position: Position, ) -> ParseError
Token budget exceeded during parsing.
Sourcepub fn value_out_of_range(
field: &'static str,
constraint: &'static str,
position: Position,
) -> ParseError
pub fn value_out_of_range( field: &'static str, constraint: &'static str, position: Position, ) -> ParseError
A literal value lies outside the allowed range for its slot.
The free-text constraint is included verbatim in the message
so callers can render a single line without re-formatting.
Sourcepub fn document_create_table(position: Position) -> ParseError
pub fn document_create_table(position: Position) -> ParseError
Didactic (#1704): a document-model newcomer wrote the Postgres
CREATE TABLE <name> DOCUMENT (…) form. Documents are schemaless
and have no column list — the native form is CREATE DOCUMENT.
Sourcepub fn generated_column_unneeded(position: Position) -> ParseError
pub fn generated_column_unneeded(position: Position) -> ParseError
Didactic (#1704): a document-model newcomer reached for a Postgres
GENERATED ALWAYS AS (…) STORED column. In the document model,
top-level body fields already auto-flatten into queryable columns.
Sourcepub fn json_arrow_operator(position: Position) -> ParseError
pub fn json_arrow_operator(position: Position) -> ParseError
Didactic (#1704): a document-model newcomer used the Postgres JSON
operators -> / ->> in a query. The native idiom is the dotted
path. (Graph-mode -> / <- traversal is parsed elsewhere and is
unaffected.)
Sourcepub fn document_insert_column_list(position: Position) -> ParseError
pub fn document_insert_column_list(position: Position) -> ParseError
Didactic (#1709 / ADR 0067): the document INSERT column list is
removed. Documents are written with a bare inline JSON literal, so
the old ceremonial (body) column list no longer exists.
Sourcepub fn document_insert_ttl_column(position: Position) -> ParseError
pub fn document_insert_ttl_column(position: Position) -> ParseError
Didactic (#1709 / ADR 0067): legacy _ttl / _ttl_ms /
_expires_at document INSERT columns are removed; expiry is set
with the WITH TTL clause instead.
Sourcepub fn document_insert_quoted_body(position: Position) -> ParseError
pub fn document_insert_quoted_body(position: Position) -> ParseError
Didactic (#1709 / ADR 0067): the quoted-string body coercion
(VALUES ('{…}')) is removed. JSON is written as an inline literal;
JSON_PARSE(<expr>) converts a runtime string.
Trait Implementations§
Source§impl Clone for ParseError
impl Clone for ParseError
Source§fn clone(&self) -> ParseError
fn clone(&self) -> ParseError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ParseError
impl Debug for ParseError
Source§impl Display for ParseError
impl Display for ParseError
Source§impl Error for ParseError
impl Error for ParseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<LexerError> for ParseError
impl From<LexerError> for ParseError
Source§fn from(e: LexerError) -> ParseError
fn from(e: LexerError) -> ParseError
Auto Trait Implementations§
impl Freeze for ParseError
impl RefUnwindSafe for ParseError
impl Send for ParseError
impl Sync for ParseError
impl Unpin for ParseError
impl UnsafeUnpin for ParseError
impl UnwindSafe for ParseError
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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