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: boolGlobal keep_all_tokens (propagates into imports; feeds per-rule
filter_out recomputation).
maybe_placeholders: boolMaterialization gate, threaded to build_rule_shape.
priority: PriorityModeLark priority=: 'auto'|'normal'|'invert'|None — invert 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: boolBuild the LALR action table (the default).
- When
false,build_lalris skipped and the emittedParseTablecarries emptytoken_actions/goto_actions/start_states/end_states— only therules+ interned id spaces (id_to_token/nonterm_names/display_names). - The Earley engine consumes only those (recognizer.rs
RecognizerTables::newnever reads the LR action table), so an ambiguous grammar thatbuild_lalrwould reject with an unresolvable reduce/reduce collision is still Earley-parseable. - LALR compilation leaves this
true.
collect_used_files: boolReport 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.