Trait Parser

Source
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§

Source

type Token: Debug + Clone + TokenFactory<'a, Self::TokenAndSpan, Self::I, Buffer = Self::Buffer>

Source

type Next: NextTokenAndSpan<Token = Self::Token>

Source

type TokenAndSpan: TokenAndSpan<Token = Self::Token>

Source

type I: Tokens<Self::TokenAndSpan>

Source

type Buffer: Buffer<'a, Token = Self::Token, TokenAndSpan = Self::TokenAndSpan, I = Self::I>

Source

type Checkpoint

Required Methods§

Source

fn input(&self) -> &Self::Buffer

Source

fn input_mut(&mut self) -> &mut Self::Buffer

Source

fn state(&self) -> &State

Source

fn state_mut(&mut self) -> &mut State

Source

fn checkpoint_save(&self) -> Self::Checkpoint

Source

fn checkpoint_load(&mut self, checkpoint: Self::Checkpoint)

Source

fn mark_found_module_item(&mut self)

Source

fn ts_in_no_context<T>( &mut self, op: impl FnOnce(&mut Self) -> PResult<T>, ) -> PResult<T>

Source

fn parse_jsx_element( &mut self, in_expr_context: bool, ) -> PResult<Either<JSXFragment, JSXElement>>

Source

fn parse_primary_expr(&mut self) -> PResult<Box<Expr>>

Source

fn parse_unary_expr(&mut self) -> PResult<Box<Expr>>

Source

fn parse_tagged_tpl( &mut self, tag: Box<Expr>, type_params: Option<Box<TsTypeParamInstantiation>>, ) -> PResult<TaggedTpl>

Source

fn parse_tagged_tpl_ty(&mut self) -> PResult<TsLitType>

Source

fn parse_lhs_expr(&mut self) -> PResult<Box<Expr>>

Provided Methods§

Source

fn with_state<'w>(&'w mut self, state: State) -> WithState<'a, 'w, Self>

Source

fn ctx(&self) -> Context

Source

fn set_ctx(&mut self, ctx: Context)

Source

fn do_inside_of_context<T>( &mut self, context: Context, f: impl FnOnce(&mut Self) -> T, ) -> T

Source

fn do_outside_of_context<T>( &mut self, context: Context, f: impl FnOnce(&mut Self) -> T, ) -> T

Source

fn strict_mode<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T

Source

fn in_type<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T

Original context is restored when returned guard is dropped.

Source

fn allow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T

Source

fn disallow_in_expr<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T

Source

fn syntax(&self) -> SyntaxFlags

Source

fn emit_err(&mut self, span: Span, error: SyntaxError)

Source

fn emit_error(&mut self, error: Error)

Source

fn emit_strict_mode_err(&mut self, span: Span, error: SyntaxError)

Source

fn verify_expr(&mut self, expr: Box<Expr>) -> PResult<Box<Expr>>

Source

fn cur_pos(&self) -> BytePos

Source

fn last_pos(&self) -> BytePos

Source

fn is_general_semi(&mut self) -> bool

Source

fn eat_general_semi(&mut self) -> bool

Source

fn expect_general_semi(&mut self) -> PResult<()>

Source

fn expect(&mut self, t: &Self::Token) -> PResult<()>

Source

fn expect_without_advance(&mut self, t: &Self::Token) -> PResult<()>

Source

fn bump(&mut self)

Source

fn span(&self, start: BytePos) -> Span

Source

fn assert_and_bump(&mut self, token: &Self::Token)

Source

fn check_assign_target(&mut self, expr: &Expr, deny_call: bool)

Source

fn parse_tpl_element(&mut self, is_tagged_tpl: bool) -> PResult<TplElement>

Source

fn parse_prop_name(&mut self) -> PResult<PropName>

spec: ‘PropertyName’

Source

fn parse_expr_or_spread(&mut self) -> PResult<ExprOrSpread>

AssignmentExpression[+In, ?Yield, ?Await] …AssignmentExpression[+In, ?Yield, ?Await]

Source

fn parse_expr(&mut self) -> PResult<Box<Expr>>

Source

fn is_ident_ref(&mut self) -> bool

Source

fn peek_is_ident_ref(&mut self) -> bool

Source

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.

Implementors§