pub struct Parser {
pub options: Arc<Options>,
pub actions: HashMap<String, Action>,
pub context_actions: HashMap<String, ContextAction>,
pub matched_actions: HashMap<String, AltAction>,
pub state_actions: HashMap<String, StateAction>,
pub token_subscribers: Vec<TokenSubscriber>,
pub lex_subscribers: Vec<LexSubscriber>,
pub rule_subscribers: Vec<RuleSubscriber>,
pub rule_done_subscribers: Vec<RuleDoneSubscriber>,
pub parse_guards: Vec<ParseGuard>,
pub instance: InstanceInfo,
/* private fields */
}Fields§
§options: Arc<Options>Shared with the lexer, which never writes to them. Cloning a
whole Options was 22% of a small parse, and it was happening
twice.
actions: HashMap<String, Action>§context_actions: HashMap<String, ContextAction>§matched_actions: HashMap<String, AltAction>§state_actions: HashMap<String, StateAction>§token_subscribers: Vec<TokenSubscriber>§lex_subscribers: Vec<LexSubscriber>§rule_subscribers: Vec<RuleSubscriber>§rule_done_subscribers: Vec<RuleDoneSubscriber>§parse_guards: Vec<ParseGuard>§instance: InstanceInfoImplementations§
Source§impl Parser
impl Parser
pub fn new(options: Options) -> Self
Parse against a configuration that is already prepared and ordered, shared with every other parse of the same grammar.
Sourcepub fn rules(&self) -> &IndexMap<String, Arc<RuleSpec>>
pub fn rules(&self) -> &IndexMap<String, Arc<RuleSpec>>
The installed rules, in declaration order.
Read-only: every write goes through Parser::add_rule, which is
what keeps the derived tables in step with it.
pub fn add_rule(&mut self, spec: RuleSpec)
pub fn add_action(&mut self, name: String, action: Action)
pub fn add_context_action(&mut self, name: String, action: ContextAction)
pub fn add_matched_action(&mut self, name: String, action: AltAction)
pub fn add_state_action(&mut self, name: String, action: StateAction)
pub fn add_token_subscriber(&mut self, subscriber: TokenSubscriber)
pub fn add_lex_subscriber(&mut self, subscriber: LexSubscriber)
pub fn add_rule_subscriber(&mut self, subscriber: RuleSubscriber)
pub fn add_parse_guard(&mut self, guard: ParseGuard)
pub fn add_rule_done_subscriber(&mut self, subscriber: RuleDoneSubscriber)
pub fn set_instance_info(&mut self, instance: InstanceInfo)
pub fn parse(&self, src: &str) -> Result<Value, TabnasError>
pub fn parse_with_meta( &self, src: &str, meta: Value, ) -> Result<Value, TabnasError>
pub fn parse_recover(&self, src: &str) -> ParseRecovery
pub fn parse_recover_with_meta(&self, src: &str, meta: Value) -> ParseRecovery
Sourcepub fn continuations(&self, src: &str) -> Continuations
pub fn continuations(&self, src: &str) -> Continuations
Return the token kinds that can legally follow src when it is
treated as a prefix. The result is an intentional over-approximation:
runtime conditions and counters may still reject a listed token.
Auto Trait Implementations§
impl !RefUnwindSafe for Parser
impl !UnwindSafe for Parser
impl Freeze for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more