Query

Struct Query 

Source
pub struct Query<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Query<'a>

Source

pub fn is_qis_trigger(&self, q: &QuantifiedExpr) -> bool

Check if a quantified expression triggers QIS.

Source

pub fn qis_trigger(&self, q: &QuantifiedExpr) -> Option<&QisTrigger<'a>>

Get QIS trigger info for a quantified expression.

Source

pub fn is_single_capture(&self, def_name: &str, capture_name: &str) -> bool

Check if this capture is the single propagating capture for its definition. Only that specific capture should unwrap (skip Field effect).

Source

pub fn is_multi_capture_def(&self, name: &str) -> bool

Check if definition has 2+ propagating captures (needs struct wrapping).

Source§

impl Query<'_>

Source

pub fn printer(&self) -> QueryPrinter<'_, '_>

Source§

impl<'a> Query<'a>

Link query against a language grammar.

Resolves node types and fields, validates structural constraints.

Source§

impl<'a> Query<'a>

Source

pub fn new(source: &'a str) -> Self

Create a new query from source text.

Call exec to run analysis passes.

Source

pub fn with_exec_fuel(self, limit: Option<u32>) -> Self

Set execution fuel limit. None = infinite.

Execution fuel never replenishes. It protects against large inputs. Returns error from exec when exhausted.

Source

pub fn with_recursion_fuel(self, limit: Option<u32>) -> Self

Set recursion depth limit. None = infinite.

Recursion fuel restores when exiting recursion. It protects against deeply nested input. Returns error from exec when exhausted.

Source

pub fn exec(self) -> Result<Self>

Run all analysis passes.

Returns Err if fuel limits are exceeded. Syntax/semantic diagnostics are collected and accessible via diagnostics.

Source

pub fn build_graph(self) -> Self

Build the transition graph for compilation.

This is an optional step after exec. It detects QIS triggers, constructs the graph, runs epsilon elimination, and infers types.

Only runs if the query is valid (no errors from previous passes).

Source

pub fn build_graph_with_pre_opt_dump( self, root_kind: Option<&'a str>, ) -> (Self, String)

Build graph and return dump of graph before optimization (for debugging).

If root_kind is provided, definitions are wrapped before dumping.

Source

pub fn graph(&self) -> &BuildGraph<'a>

Access the constructed graph.

Source

pub fn wrap_with_root(self, root_kind: &'a str) -> Self

Wrap definitions that don’t already match the root node kind.

Call this after build_graph() to allow queries like (function_declaration) to work when the interpreter starts at tree root (e.g., program).

The root_kind should be the language’s root node kind (e.g., “program” for JS).

Source

pub fn dead_nodes(&self) -> &HashSet<NodeId>

Access the set of dead nodes (eliminated by optimization).

Source

pub fn type_info(&self) -> &TypeInferenceResult<'a>

Access the type inference result.

Source

pub fn diagnostics_raw(&self) -> Diagnostics

All diagnostics combined from all passes (unfiltered).

Use this for debugging or when you need to see all diagnostics including cascading errors.

Source

pub fn diagnostics(&self) -> Diagnostics

All diagnostics combined from all passes.

Returns diagnostics with cascading errors suppressed. For raw access, use diagnostics_raw.

Source

pub fn is_valid(&self) -> bool

Query is valid if there are no error-severity diagnostics (warnings are allowed).

Source

pub fn has_type_errors(&self) -> bool

Check if graph compilation produced type errors.

Trait Implementations§

Source§

impl<'a> Debug for Query<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> TryFrom<&'a String> for Query<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(source: &'a String) -> Result<Self>

Performs the conversion.
Source§

impl<'a> TryFrom<&'a str> for Query<'a>

Source§

type Error = Error

The type returned in the event of a conversion error.
Source§

fn try_from(source: &'a str) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a> Freeze for Query<'a>

§

impl<'a> !RefUnwindSafe for Query<'a>

§

impl<'a> !Send for Query<'a>

§

impl<'a> !Sync for Query<'a>

§

impl<'a> Unpin for Query<'a>

§

impl<'a> !UnwindSafe for Query<'a>

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.