Skip to main content

SaveOptions

Struct SaveOptions 

pub struct SaveOptions {
    pub parser: &'static str,
    pub lexer_type: String,
    pub ambiguity: &'static str,
    pub priority: Option<&'static str>,
    pub keep_all_tokens: bool,
    pub maybe_placeholders: bool,
    pub ordered_sets: bool,
    pub use_bytes: bool,
    pub g_regex_flags: u32,
    pub translate_python_regex: bool,
    pub propagate_positions: bool,
    pub start: Vec<String>,
}
Expand description

The scalar, compile-invariant options that populate data.options. The callable/hook options (transformer, postlex, lexer_callbacks, edit_terminals) are deliberately absent — they are re-supplied at load (Lark’s _LOAD_ALLOWED_OPTIONS) and cannot cross a portable JSON boundary; the Python binding layers them into a pickle envelope wrapping this JSON.

Fields§

§parser: &'static str

"lalr" — the only parser save supports (non-LALR is rejected by Lark).

§lexer_type: String

The resolved lexer name (Lark round-trips the resolved value, not auto).

§ambiguity: &'static str

"auto" / "resolve" / "explicit" (Lark serializes Resolve as auto).

§priority: Option<&'static str>

"auto" / "normal" / "invert", or None for Lark’s priority=None.

§keep_all_tokens: bool§maybe_placeholders: bool§ordered_sets: bool§use_bytes: bool§g_regex_flags: u32§translate_python_regex: bool

Whether the terminals are read in Python’s re dialect. Rides the wire beside g_regex_flags for the same reason: it decides what the saved patterns MEAN, and a load that guessed it would compile a different language from the one that was saved.

§propagate_positions: bool§start: Vec<String>

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 = !

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.