pub struct AltSpec {Show 31 fields
pub s: Vec<Vec<Tin>>,
pub s_names: Vec<Vec<String>>,
pub s_bound: Vec<Vec<Tin>>,
pub p: Option<String>,
pub p_fn: Option<AltNext>,
pub p_match: Option<AltNextWithMatch>,
pub r: Option<String>,
pub r_fn: Option<AltNext>,
pub r_match: Option<AltNextWithMatch>,
pub b: usize,
pub b_fn: Option<AltBack>,
pub b_match: Option<AltBackWithMatch>,
pub a: Vec<String>,
pub action_fns: Vec<ContextAction>,
pub action_order: Vec<AltActionBinding>,
pub matched_action_fns: Vec<AltAction>,
pub action_configs: HashMap<String, Value>,
pub c: Vec<Condition>,
pub c_ref: Option<String>,
pub c_fn: Option<AltCondition>,
pub c_match: Option<AltConditionWithMatch>,
pub c_lex: Option<AltConditionWithLexer>,
pub c_lex_match: Option<AltConditionWithLexerAndMatch>,
pub n: HashMap<String, i32>,
pub u: HashMap<String, Value>,
pub k: HashMap<String, Value>,
pub g: String,
pub h: Option<AltModifier>,
pub h_match: Option<AltModifierWithMatch>,
pub e: Option<AltError>,
pub e_match: Option<AltErrorWithMatch>,
}Fields§
§s: Vec<Vec<Tin>>§s_names: Vec<Vec<String>>The token names each s slot was declared with, when the
alternate came from a serialized grammar; empty for an alternate
built from tins directly. A slot naming a token set (#KEY,
#VAL, a custom set) is resolved again against the instance’s
options whenever the parser is rebuilt, so a set overridden after
the alternate was installed still reaches it, as in TypeScript and
Go (tabnas/parser#217).
s_bound: Vec<Vec<Tin>>What s_names last resolved to, slot by slot. A slot whose s
no longer equals this was set by hand after the alternate was
installed, and that edit wins: the names are not applied over it.
p: Option<String>§p_fn: Option<AltNext>§p_match: Option<AltNextWithMatch>§r: Option<String>§r_fn: Option<AltNext>§r_match: Option<AltNextWithMatch>§b: usize§b_fn: Option<AltBack>§b_match: Option<AltBackWithMatch>§a: Vec<String>§action_fns: Vec<ContextAction>Imperative actions installed directly by a native Rust plugin.
Named actions in a remain the serialized grammar representation;
action_order retains their exact interleaving with direct callbacks.
action_order: Vec<AltActionBinding>§matched_action_fns: Vec<AltAction>§action_configs: HashMap<String, Value>§c: Vec<Condition>§c_ref: Option<String>§c_fn: Option<AltCondition>§c_match: Option<AltConditionWithMatch>§c_lex: Option<AltConditionWithLexer>§c_lex_match: Option<AltConditionWithLexerAndMatch>§n: HashMap<String, i32>§u: HashMap<String, Value>§k: HashMap<String, Value>§g: String§h: Option<AltModifier>§h_match: Option<AltModifierWithMatch>§e: Option<AltError>§e_match: Option<AltErrorWithMatch>Implementations§
Source§impl AltSpec
impl AltSpec
Sourcepub fn add_action(
&mut self,
action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static,
) -> &mut Self
pub fn add_action( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self
Append an imperative Rust action to this alternate.
Sourcepub fn prepend_action(
&mut self,
action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static,
) -> &mut Self
pub fn prepend_action( &mut self, action: impl Fn(&mut Rule, &mut Context) + Send + Sync + 'static, ) -> &mut Self
Prepend an imperative Rust action ahead of existing named or direct actions.
Sourcepub fn add_action_result(&mut self, action: ContextAction) -> &mut Self
pub fn add_action_result(&mut self, action: ContextAction) -> &mut Self
Append a fallible imperative Rust action to this alternate.
pub fn prepend_action_result(&mut self, action: ContextAction) -> &mut Self
Sourcepub fn add_action_with_match(
&mut self,
action: impl Fn(&mut Rule, &mut Context, &AltMatch) -> Option<Token> + Send + Sync + 'static,
) -> &mut Self
pub fn add_action_with_match( &mut self, action: impl Fn(&mut Rule, &mut Context, &AltMatch) -> Option<Token> + Send + Sync + 'static, ) -> &mut Self
Append an action with the complete matched-alternate argument.