#[non_exhaustive]pub enum ParserError {
SyntaxError {
status: GqlStatus,
message: String,
span: SourceSpan,
hint: Option<String>,
},
UnsupportedFeature {
feature_id: FeatureId,
display_name: &'static str,
span: SourceSpan,
hint: &'static str,
},
NestingLimitExceeded {
limit: u32,
span: SourceSpan,
},
ComplexityLimitExceeded {
limit: u32,
span: SourceSpan,
},
NotImplemented {
message: String,
span: SourceSpan,
hint: Option<String>,
},
}Expand description
GQL parser and flagger error.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
SyntaxError
Source text did not parse as supported GQL syntax.
Fields
span: SourceSpanSource span for the parse failure.
UnsupportedFeature
Parsed syntax requires a feature outside the current support set.
Fields
span: SourceSpanSource span requiring the feature.
NestingLimitExceeded
Query nesting exceeded the parser’s recursion cap.
Fields
span: SourceSpanSource span that crossed the limit.
ComplexityLimitExceeded
Query exceeded a parser complexity cap that bounds pest’s recursive descent before it begins.
Maps to GQLSTATUS 5GQL1 (PROGRAM_LIMIT_EXCEEDED), a selene-db
implementation-defined class per ISO/IEC 39075:2024 section 23.1 (see
GqlStatus::PROGRAM_LIMIT_EXCEEDED).
Distinct from Self::NestingLimitExceeded, which bounds all-bracket
net delimiter nesting depth at a looser cap. This variant covers the
parser’s complexity guards, each of which would otherwise drive
pathological pest behavior or overflow the native stack on a small
hostile input:
[-depth (pre-pest byte scan). pest is not packrat-memoized, so a run of unclosed[nests the three ambiguous[-prefixed grammar rules and recomputes their failed branches at every level, driving super-linear backtracking. Balanced, promptly closed[(an edge pattern, a flat list) never accrue depth, so legitimate wide paths and lists are unaffected.- Zero-delimiter recursion depth (pre-pest byte scan). A long run of
leading unary signs (
unary),NOTkeywords (not_expr), or nestedCASE … ENDexpressions (case_expr) recurses pest’s descent one stack frame per level with no(/[/{delimiter to bound it, overflowing the native stack (a non-unwindable crash) on a small input. Signs andNOTare bounded as runs;CASEis bounded by a monotone over-approximation — a real opener (counted only outside identifier positions: property names, map keys, aliases,YIELDcolumns, params) adds 1 plus its wrapping run and never decrements, because an identifierENDcannot be soundly distinguished from the keyword closer. The conformant cost is that a statement whose combinedCASE-count and nesting pressure exceeds the ceiling (256) is rejected. - Expression nesting depth (post-build, iterative scan). A flat
left-associative operator fold (
a OR a OR …) or postfix chain (a.b.c.…) parses and builds iteratively but yields a depth-NBox<ValueExpr>tree whose recursive consumers (the Flagger,Drop, the analyzer) overflow the native stack at ~130k deep. The parser rejects any expression deeper than the shared recursion ceiling (256) before the Flagger walks it.
The pre-pest guards reject before recursive descent begins; the expression-depth guard runs after AST construction and before the Flagger. All are deterministic and cheap.
Fields
span: SourceSpanSource span of the token that crossed the limit.
NotImplemented
Source parsed at the grammar level, but no AST builder is implemented yet.
Distinct from Self::SyntaxError (parse failed) and
Self::UnsupportedFeature (specific ISO feature not in the claim list).
This variant covers grammar surfaces selene-db will support but whose
builders land in a later brief.
Implementations§
Trait Implementations§
Source§impl Debug for ParserError
impl Debug for ParserError
Source§impl Diagnostic for ParserError
impl Diagnostic for ParserError
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeSource§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic.Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Diagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Display for ParserError
impl Display for ParserError
Source§impl Error for ParserError
impl Error for ParserError
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()
Auto Trait Implementations§
impl Freeze for ParserError
impl RefUnwindSafe for ParserError
impl Send for ParserError
impl Sync for ParserError
impl Unpin for ParserError
impl UnsafeUnpin for ParserError
impl UnwindSafe for ParserError
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> 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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.