pub trait Parser<'a>: Sized + Clone {
type Token: Debug + Clone + TokenFactory<'a, Self::TokenAndSpan, Self::I, Buffer = Self::Buffer>;
type Next: NextTokenAndSpan<Token = Self::Token>;
type TokenAndSpan: TokenAndSpan<Token = Self::Token>;
type I: Tokens<Self::TokenAndSpan>;
type Buffer: Buffer<'a, Token = Self::Token, TokenAndSpan = Self::TokenAndSpan, I = Self::I>;
type Checkpoint;
Show 46 methods
// Required methods
fn input(&self) -> &Self::Buffer;
fn input_mut(&mut self) -> &mut Self::Buffer;
fn state(&self) -> &State;
fn state_mut(&mut self) -> &mut State;
fn checkpoint_save(&self) -> Self::Checkpoint;
fn checkpoint_load(&mut self, checkpoint: Self::Checkpoint);
fn mark_found_module_item(&mut self);
fn ts_in_no_context<T>(
&mut self,
op: impl FnOnce(&mut Self) -> PResult<T>,
) -> PResult<T>;
fn parse_jsx_element(
&mut self,
in_expr_context: bool,
) -> PResult<Either<JSXFragment, JSXElement>>;
fn parse_primary_expr(&mut self) -> PResult<Box<Expr>>;
fn parse_unary_expr(&mut self) -> PResult<Box<Expr>>;
fn parse_tagged_tpl(
&mut self,
tag: Box<Expr>,
type_params: Option<Box<TsTypeParamInstantiation>>,
) -> PResult<TaggedTpl>;
fn parse_tagged_tpl_ty(&mut self) -> PResult<TsLitType>;
fn parse_lhs_expr(&mut self) -> PResult<Box<Expr>>;
// Provided methods
fn with_state<'w>(&'w mut self, state: State) -> WithState<'a, 'w, Self> { ... }
fn ctx(&self) -> Context { ... }
fn set_ctx(&mut self, ctx: Context) { ... }
fn do_inside_of_context<T>(
&mut self,
context: Context,
f: impl FnOnce(&mut Self) -> T,
) -> T { ... }
fn do_outside_of_context<T>(
&mut self,
context: Context,
f: impl FnOnce(&mut Self) -> T,
) -> T { ... }
fn strict_mode<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T { ... }
fn in_type<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T { ... }
fn allow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T { ... }
fn disallow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T { ... }
fn syntax(&self) -> SyntaxFlags { ... }
fn emit_err(&mut self, span: Span, error: SyntaxError) { ... }
fn emit_error(&mut self, error: Error) { ... }
fn emit_strict_mode_err(&mut self, span: Span, error: SyntaxError) { ... }
fn verify_expr(&mut self, expr: Box<Expr>) -> PResult<Box<Expr>> { ... }
fn cur_pos(&self) -> BytePos { ... }
fn last_pos(&self) -> BytePos { ... }
fn is_general_semi(&mut self) -> bool { ... }
fn eat_general_semi(&mut self) -> bool { ... }
fn expect_general_semi(&mut self) -> PResult<()> { ... }
fn expect(&mut self, t: &Self::Token) -> PResult<()> { ... }
fn expect_without_advance(&mut self, t: &Self::Token) -> PResult<()> { ... }
fn bump(&mut self) { ... }
fn span(&self, start: BytePos) -> Span { ... }
fn assert_and_bump(&mut self, token: &Self::Token) { ... }
fn check_assign_target(&mut self, expr: &Expr, deny_call: bool) { ... }
fn parse_tpl_element(&mut self, is_tagged_tpl: bool) -> PResult<TplElement> { ... }
fn parse_prop_name(&mut self) -> PResult<PropName> { ... }
fn parse_expr_or_spread(&mut self) -> PResult<ExprOrSpread> { ... }
fn parse_expr(&mut self) -> PResult<Box<Expr>> { ... }
fn is_ident_ref(&mut self) -> bool { ... }
fn peek_is_ident_ref(&mut self) -> bool { ... }
fn eat_ident_ref(&mut self) -> bool { ... }
}
Required Associated Types§
type Token: Debug + Clone + TokenFactory<'a, Self::TokenAndSpan, Self::I, Buffer = Self::Buffer>
type Next: NextTokenAndSpan<Token = Self::Token>
type TokenAndSpan: TokenAndSpan<Token = Self::Token>
type I: Tokens<Self::TokenAndSpan>
type Buffer: Buffer<'a, Token = Self::Token, TokenAndSpan = Self::TokenAndSpan, I = Self::I>
type Checkpoint
Required Methods§
fn input(&self) -> &Self::Buffer
fn input_mut(&mut self) -> &mut Self::Buffer
fn state(&self) -> &State
fn state_mut(&mut self) -> &mut State
fn checkpoint_save(&self) -> Self::Checkpoint
fn checkpoint_load(&mut self, checkpoint: Self::Checkpoint)
fn mark_found_module_item(&mut self)
fn ts_in_no_context<T>( &mut self, op: impl FnOnce(&mut Self) -> PResult<T>, ) -> PResult<T>
fn parse_jsx_element( &mut self, in_expr_context: bool, ) -> PResult<Either<JSXFragment, JSXElement>>
fn parse_primary_expr(&mut self) -> PResult<Box<Expr>>
fn parse_unary_expr(&mut self) -> PResult<Box<Expr>>
fn parse_tagged_tpl( &mut self, tag: Box<Expr>, type_params: Option<Box<TsTypeParamInstantiation>>, ) -> PResult<TaggedTpl>
fn parse_tagged_tpl_ty(&mut self) -> PResult<TsLitType>
fn parse_lhs_expr(&mut self) -> PResult<Box<Expr>>
Provided Methods§
fn with_state<'w>(&'w mut self, state: State) -> WithState<'a, 'w, Self>
fn ctx(&self) -> Context
fn set_ctx(&mut self, ctx: Context)
fn do_inside_of_context<T>( &mut self, context: Context, f: impl FnOnce(&mut Self) -> T, ) -> T
fn do_outside_of_context<T>( &mut self, context: Context, f: impl FnOnce(&mut Self) -> T, ) -> T
fn strict_mode<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
Sourcefn in_type<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
fn in_type<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
Original context is restored when returned guard is dropped.
fn allow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
fn disallow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T
fn syntax(&self) -> SyntaxFlags
fn emit_err(&mut self, span: Span, error: SyntaxError)
fn emit_error(&mut self, error: Error)
fn emit_strict_mode_err(&mut self, span: Span, error: SyntaxError)
fn verify_expr(&mut self, expr: Box<Expr>) -> PResult<Box<Expr>>
fn cur_pos(&self) -> BytePos
fn last_pos(&self) -> BytePos
fn is_general_semi(&mut self) -> bool
fn eat_general_semi(&mut self) -> bool
fn expect_general_semi(&mut self) -> PResult<()>
fn expect(&mut self, t: &Self::Token) -> PResult<()>
fn expect_without_advance(&mut self, t: &Self::Token) -> PResult<()>
fn bump(&mut self)
fn span(&self, start: BytePos) -> Span
fn assert_and_bump(&mut self, token: &Self::Token)
fn check_assign_target(&mut self, expr: &Expr, deny_call: bool)
fn parse_tpl_element(&mut self, is_tagged_tpl: bool) -> PResult<TplElement>
Sourcefn parse_prop_name(&mut self) -> PResult<PropName>
fn parse_prop_name(&mut self) -> PResult<PropName>
spec: ‘PropertyName’
Sourcefn parse_expr_or_spread(&mut self) -> PResult<ExprOrSpread>
fn parse_expr_or_spread(&mut self) -> PResult<ExprOrSpread>
AssignmentExpression[+In, ?Yield, ?Await] …AssignmentExpression[+In, ?Yield, ?Await]
fn parse_expr(&mut self) -> PResult<Box<Expr>>
fn is_ident_ref(&mut self) -> bool
fn peek_is_ident_ref(&mut self) -> bool
fn eat_ident_ref(&mut self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.