Skip to main content

AstConfigBuilder

Struct AstConfigBuilder 

Source
pub struct AstConfigBuilder { /* private fields */ }
Expand description

Builder for AST configuration

Implementations§

Source§

impl AstConfigBuilder

Source

pub fn new() -> Self

Source

pub fn import(self, import_path: &str) -> Self

Add an import statement (e.g., “crate::ast::*”)

Source

pub fn result_type(self, result_type: &str) -> Self

Set the return type of the parse() function

Source

pub fn span_type(self, span_type: &str) -> Self

Set the external span type (disables internal Span generation)

Source

pub fn string_type(self, string_type: &str) -> Self

Set the external string type (e.g., “JsString”)

Source

pub fn error_type(self, error_type: &str) -> Self

Set the external error type (disables internal ParseError generation)

Source

pub fn no_parse_result(self) -> Self

Disable ParseResult enum generation

Source

pub fn apply_mappings(self) -> Self

Enable AST mapping application

Source

pub fn string_dict(self, dict_type: &str) -> Self

Enable string dictionary integration for string interning

Source

pub fn string_dict_method(self, method: &str) -> Self

Set custom method name for string interning (default: “get_or_insert”)

Source

pub fn helper(self, code: &str) -> Self

Add helper code (functions, constants) to be included in the generated parser

Source

pub fn result_variant(self, name: &str, rust_type: &str) -> Self

Add a custom ParseResult variant for typed AST nodes

Source

pub fn result_variant_with_span( self, name: &str, rust_type: &str, span_expr: &str, ) -> Self

Add a custom ParseResult variant with custom span extraction

Source

pub fn build(self) -> AstConfig

Build the final AstConfig

Trait Implementations§

Source§

impl Debug for AstConfigBuilder

Source§

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

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

impl Default for AstConfigBuilder

Source§

fn default() -> AstConfigBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.