[−][src]Struct antlr_rust::BaseParser
Main underlying Parser struct
It is a member of generated parser struct, so almost always you don't need to create it yourself. Generated parser hides complexity of this struct and expose required flexibility via generic parameters
Fields
ctx: Option<Rc<Ctx::Type>>
build_parse_trees: bool
Track the {@link ParserRuleContext} objects during the parse and hook them up using the {@link ParserRuleContext#children} list so that it forms a parse tree. The {@link ParserRuleContext} returned from the start rule represents the root of the parse tree.
Note that if we are not building parse trees, rule contexts only point upwards. When a rule exits, it returns the context bute that gets garbage collected if nobody holds a reference. It points upwards but nobody points at it.
When we build parse trees, we are adding all of these contexts to {@link ParserRuleContext#children} list. Contexts are then not candidates for garbage collection.
Returns {@code true} if a complete parse tree will be constructed while parsing, otherwise {@code false}
matched_eof: bool
input: I
Implementations
impl<'input, Ext, I, Ctx, T: ?Sized> BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
Ctx::Type: Listenable<T>,
Rc<TerminalNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
Rc<ErrorNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
Ctx::Type: Listenable<T>,
Rc<TerminalNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
Rc<ErrorNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
pub fn new_base_parser(
input: I,
interpreter: Arc<ParserATNSimulator>,
ext: Ext
) -> Self
[src]
input: I,
interpreter: Arc<ParserATNSimulator>,
ext: Ext
) -> Self
pub fn match_token(
&mut self,
ttype: isize,
err_handler: &mut dyn ErrorStrategy<'input, Self>
) -> Result<<I::TF as TokenFactory<'input>>::Tok, ANTLRError>
[src]
&mut self,
ttype: isize,
err_handler: &mut dyn ErrorStrategy<'input, Self>
) -> Result<<I::TF as TokenFactory<'input>>::Tok, ANTLRError>
pub fn match_wildcard(
&mut self,
err_handler: &mut dyn ErrorStrategy<'input, Self>
) -> Result<<I::TF as TokenFactory<'input>>::Tok, ANTLRError>
[src]
&mut self,
err_handler: &mut dyn ErrorStrategy<'input, Self>
) -> Result<<I::TF as TokenFactory<'input>>::Tok, ANTLRError>
pub fn add_parse_listener<L: Unsize<T>>(
&mut self,
listener: Box<L>
) -> ListenerId<L>
[src]
&mut self,
listener: Box<L>
) -> ListenerId<L>
Adds parse listener for this parser
returns listener_id
that can be used later to get listener back
Embedded listener currently must outlive 'input
. If you need to have arbitrary listener use ParseTreeWalker.
Example for listener usage:
todo
pub fn remove_parse_listener<L: Unsize<T>>(
&mut self,
listener_id: ListenerId<L>
) -> Box<L>
[src]
&mut self,
listener_id: ListenerId<L>
) -> Box<L>
Removes parse listener with corresponding listener_id
, casts it back to user type and returns it to the caller.
listener_id
is returned when listener is added via add_parse_listener
pub fn remove_parse_listeners(&mut self)
[src]
Removes all added parse listeners without returning them
pub fn trigger_enter_rule_event(&mut self)
[src]
pub fn trigger_exit_rule_event(&mut self)
[src]
pub fn enter_rule(
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize
)
[src]
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize
)
pub fn exit_rule(&mut self)
[src]
pub fn enter_outer_alt(
&mut self,
new_ctx: Option<Rc<Ctx::Type>>,
alt_num: isize
)
[src]
&mut self,
new_ctx: Option<Rc<Ctx::Type>>,
alt_num: isize
)
pub fn enter_recursion_rule(
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize,
precedence: isize
)
[src]
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize,
precedence: isize
)
pub fn push_new_recursion_context(
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize
)
[src]
&mut self,
localctx: Rc<Ctx::Type>,
state: isize,
_rule_index: usize
)
pub fn unroll_recursion_context(&mut self, parent_ctx: Option<Rc<Ctx::Type>>)
[src]
pub fn dump_dfa(&self)
[src]
Trait Implementations
impl<'input, Ext, I, Ctx, T: ?Sized> Deref for BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
impl<'input, Ext, I, Ctx, T: ?Sized> DerefMut for BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
impl<'input, Ext, I, Ctx, T: ?Sized> Parser<'input> for BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
Ctx::Type: Listenable<T>,
Rc<TerminalNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
Rc<ErrorNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
Ctx::Type: Listenable<T>,
Rc<TerminalNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
Rc<ErrorNode<'input, Ctx>>: CoerceUnsized<Rc<Ctx::Type>>,
fn get_interpreter(&self) -> &ParserATNSimulator
[src]
fn get_token_factory(&self) -> &'input Self::TF
[src]
fn get_parser_rule_context(&self) -> &Rc<Ctx::Type>
[src]
fn consume(&mut self, err_handler: &mut dyn ErrorStrategy<'input, Self>)
[src]
fn precpred(&self, _localctx: Option<&Ctx::Type>, precedence: isize) -> bool
[src]
fn get_input_stream_mut(
&mut self
) -> &mut dyn TokenStream<'input, TF = Self::TF>
[src]
&mut self
) -> &mut dyn TokenStream<'input, TF = Self::TF>
fn get_input_stream(&self) -> &dyn TokenStream<'input, TF = Self::TF>
[src]
fn get_current_token(&self) -> &<Self::TF as TokenFactory<'input>>::Tok
[src]
fn get_expected_tokens(&self) -> IntervalSet
[src]
fn add_error_listener(&mut self, listener: Box<dyn ErrorListener<'input, Self>>)
[src]
fn notify_error_listeners(
&self,
msg: String,
offending_token: Option<isize>,
err: Option<&ANTLRError>
)
[src]
&self,
msg: String,
offending_token: Option<isize>,
err: Option<&ANTLRError>
)
fn get_error_lister_dispatch<'a>(
&'a self
) -> Box<dyn ErrorListener<'input, Self> + 'a>
[src]
&'a self
) -> Box<dyn ErrorListener<'input, Self> + 'a>
fn is_expected_token(&self, _symbol: isize) -> bool
[src]
fn get_precedence(&self) -> isize
[src]
fn get_state(&self) -> isize
[src]
fn set_state(&mut self, v: isize)
[src]
fn get_rule_invocation_stack(&self) -> Vec<String>
[src]
impl<'input, Ext, I, Ctx, T: ?Sized> Recognizer<'input> for BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
type Node = Ctx
fn sempred(
&mut self,
localctx: Option<&Ctx::Type>,
rule_index: isize,
action_index: isize
) -> bool
[src]
&mut self,
localctx: Option<&Ctx::Type>,
rule_index: isize,
action_index: isize
) -> bool
fn get_rule_names(&self) -> &[&str]
[src]
fn get_vocabulary(&self) -> &dyn Vocabulary
[src]
fn get_grammar_file_name(&self) -> &str
[src]
fn get_atn(&self) -> &ATN
[src]
fn action(
&mut self,
localctx: Option<&<Self::Node as ParserNodeType<'input>>::Type>,
rule_index: isize,
action_index: isize
) where
Self: Sized,
[src]
&mut self,
localctx: Option<&<Self::Node as ParserNodeType<'input>>::Type>,
rule_index: isize,
action_index: isize
) where
Self: Sized,
impl<'input, Ext: 'static, I: TokenStream<'input>, Ctx: ParserNodeType<'input, TF = I::TF>, T: ParseTreeListener<'input, Ctx> + ?Sized> TidAble<'input> for BaseParser<'input, Ext, I, Ctx, T> where
I: TidAble<'input>,
Ctx: TidAble<'input>,
T: TidAble<'input>,
[src]
I: TidAble<'input>,
Ctx: TidAble<'input>,
T: TidAble<'input>,
impl<'input, Ext, I, Ctx, T: ?Sized> TokenAware<'input> for BaseParser<'input, Ext, I, Ctx, T> where
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
[src]
Ext: ParserRecog<'input, Self> + 'static,
I: TokenStream<'input>,
Ctx: ParserNodeType<'input, TF = I::TF>,
T: ParseTreeListener<'input, Ctx>,
Auto Trait Implementations
impl<'input, Ext, I, Ctx, T = dyn ParseTreeListener<'input, Ctx> + 'static> !RefUnwindSafe for BaseParser<'input, Ext, I, Ctx, T>
impl<'input, Ext, I, Ctx, T = dyn ParseTreeListener<'input, Ctx> + 'static> !Send for BaseParser<'input, Ext, I, Ctx, T>
impl<'input, Ext, I, Ctx, T = dyn ParseTreeListener<'input, Ctx> + 'static> !Sync for BaseParser<'input, Ext, I, Ctx, T>
impl<'input, Ext, I, Ctx, T: ?Sized> Unpin for BaseParser<'input, Ext, I, Ctx, T> where
Ext: Unpin,
I: Unpin,
Ext: Unpin,
I: Unpin,
impl<'input, Ext, I, Ctx, T = dyn ParseTreeListener<'input, Ctx> + 'static> !UnwindSafe for BaseParser<'input, Ext, I, Ctx, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> NodeText for T
[src]
impl<'input, T> NodeText for T where
T: CustomRuleContext<'input>,
[src]
T: CustomRuleContext<'input>,
impl<'a, T> Tid<'a> for T where
T: TidAble<'a> + ?Sized,
[src]
T: TidAble<'a> + ?Sized,
impl<'a, X> TidExt<'a> for X where
X: Tid<'a> + ?Sized,
[src]
X: Tid<'a> + ?Sized,
pub fn is<T>(&self) -> bool where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_ref<T>(&'b self) -> Option<&'b T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_mut<T>(&'b mut self) -> Option<&'b mut T> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_rc<T>(self: Rc<X>) -> Result<Rc<T>, Rc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_arc<T>(self: Arc<X>) -> Result<Arc<T>, Arc<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
pub fn downcast_box<T>(self: Box<X>) -> Result<Box<T>, Box<X>> where
T: Tid<'a>,
[src]
T: Tid<'a>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,