Skip to main content

CompileOptions

Struct CompileOptions 

pub struct CompileOptions<'a> {
    pub start: Vec<String>,
    pub keep_all_tokens: bool,
    pub maybe_placeholders: bool,
    pub priority: PriorityMode,
    pub terminals_to_keep: Vec<String>,
    pub import_paths: Vec<&'a dyn GrammarLoader>,
    pub source_path: Option<String>,
    pub edit_terminals: Option<&'a mut dyn FnMut(&mut TerminalDef)>,
    pub build_action_table: bool,
    pub collect_used_files: bool,
}
Expand description

Compile-time options (the facade threads Lark kwargs here; defaults match Lark’s).

Fields§

§start: Vec<String>

Declared start symbols (Lark start=, default ["start"]).

§keep_all_tokens: bool

Global keep_all_tokens (propagates into imports; feeds per-rule filter_out recomputation).

§maybe_placeholders: bool

Materialization gate, threaded to build_rule_shape.

§priority: PriorityMode

Lark priority=: 'auto'|'normal'|'invert'|Noneinvert negates every rule+terminal priority, none strips them; applied after edit_terminals.

§terminals_to_keep: Vec<String>

Terminals never pruned even when unreferenced — postlex always_accept.

§import_paths: Vec<&'a dyn GrammarLoader>

%import sources consulted before base/stdlib (first hit wins).

§source_path: Option<String>

The grammar’s origin path — the first relative-import base.

§edit_terminals: Option<&'a mut dyn FnMut(&mut TerminalDef)>

The edit_terminals hook slot: iterates compiled TerminalDefs between compile and the priority transform. The callback itself is binding-supplied.

§build_action_table: bool

Build the LALR action table (the default).

  • When false, build_lalr is skipped and the emitted ParseTable carries empty token_actions/goto_actions/start_states/ end_states — only the rules + interned id spaces (id_to_token/nonterm_names/display_names).
  • The Earley engine consumes only those (recognizer.rs RecognizerTables::new never reads the LR action table), so an ambiguous grammar that build_lalr would reject with an unresolvable reduce/reduce collision is still Earley-parseable.
  • LALR compilation leaves this true.
§collect_used_files: bool

Report every %imported file THIS compile loaded (with the text its loader served) in CompiledGrammar::used_files — the cache= invalidation side-data, taken off the build so no caller has to re-run the loaders. Off by default: an ordinary compile allocates nothing.

Trait Implementations§

§

impl Default for CompileOptions<'_>

§

fn default() -> Self

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a> Freeze for CompileOptions<'a>

§

impl<'a> Unpin for CompileOptions<'a>

§

impl<'a> UnsafeUnpin for CompileOptions<'a>

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.