Trait Buffer

Source
pub trait Buffer<'a> {
    type Token: Debug + PartialEq + Clone + TokenFactory<'a, Self::TokenAndSpan, Self::I>;
    type Next: NextTokenAndSpan<Token = Self::Token>;
    type TokenAndSpan: TokenAndSpanTrait<Token = Self::Token>;
    type I: Tokens<Self::TokenAndSpan>;

Show 45 methods // Required methods fn new(lexer: Self::I) -> Self; fn iter(&self) -> &Self::I; fn iter_mut(&mut self) -> &mut Self::I; fn set_cur(&mut self, token: Self::TokenAndSpan); fn next(&self) -> Option<&Self::Next>; fn set_next(&mut self, token: Option<Self::Next>); fn next_mut(&mut self) -> &mut Option<Self::Next>; fn cur(&self) -> &Self::Token; fn get_cur(&self) -> &Self::TokenAndSpan; fn prev_span(&self) -> Span; fn peek<'b>(&'b mut self) -> Option<&'b Self::Token> where Self::TokenAndSpan: 'b; fn dump_cur(&self) -> String; fn bump(&mut self); fn expect_word_token_and_bump(&mut self) -> Atom; fn expect_number_token_and_bump(&mut self) -> (f64, Atom); fn expect_string_token_and_bump(&mut self) -> (Atom, Atom); fn expect_bigint_token_and_bump(&mut self) -> (Box<BigInt>, Atom); fn expect_regex_token_and_bump(&mut self) -> (Atom, Atom); fn expect_template_token_and_bump(&mut self) -> (LexResult<Atom>, Atom); fn expect_error_token_and_bump(&mut self) -> Error; fn expect_jsx_name_token_and_bump(&mut self) -> Atom; fn expect_jsx_text_token_and_bump(&mut self) -> (Atom, Atom); fn expect_shebang_token_and_bump(&mut self) -> Atom; // Provided methods fn store(&mut self, token: Self::Token) { ... } fn had_line_break_before_cur(&self) -> bool { ... } fn has_linebreak_between_cur_and_peeked(&mut self) -> bool { ... } fn cut_lshift(&mut self) { ... } fn merge_lt_gt(&mut self) { ... } fn is(&self, expected: &Self::Token) -> bool { ... } fn eat(&mut self, expected: &Self::Token) -> bool { ... } fn cur_pos(&self) -> BytePos { ... } fn cur_span(&self) -> Span { ... } fn last_pos(&self) -> BytePos { ... } fn get_ctx(&self) -> Context { ... } fn update_ctx(&mut self, f: impl FnOnce(&mut Context)) { ... } fn set_ctx(&mut self, ctx: Context) { ... } fn syntax(&self) -> SyntaxFlags { ... } fn target(&self) -> EsVersion { ... } fn set_expr_allowed(&mut self, allow: bool) { ... } fn set_next_regexp(&mut self, start: Option<BytePos>) { ... } fn token_context<'b>(&'b self) -> &'b TokenContexts where Self::I: 'b { ... } fn token_context_mut<'b>(&'b mut self) -> &'b mut TokenContexts where Self::I: 'b { ... } fn set_token_context(&mut self, c: TokenContexts) { ... } fn end_pos(&self) -> BytePos { ... } fn token_flags(&self) -> TokenFlags { ... }
}

Required Associated Types§

Required Methods§

Source

fn new(lexer: Self::I) -> Self

Source

fn iter(&self) -> &Self::I

Source

fn iter_mut(&mut self) -> &mut Self::I

Source

fn set_cur(&mut self, token: Self::TokenAndSpan)

Source

fn next(&self) -> Option<&Self::Next>

Source

fn set_next(&mut self, token: Option<Self::Next>)

Source

fn next_mut(&mut self) -> &mut Option<Self::Next>

Source

fn cur(&self) -> &Self::Token

Source

fn get_cur(&self) -> &Self::TokenAndSpan

Source

fn prev_span(&self) -> Span

Source

fn peek<'b>(&'b mut self) -> Option<&'b Self::Token>
where Self::TokenAndSpan: 'b,

Source

fn dump_cur(&self) -> String

Source

fn bump(&mut self)

find next token.

Source

fn expect_word_token_and_bump(&mut self) -> Atom

Source

fn expect_number_token_and_bump(&mut self) -> (f64, Atom)

Source

fn expect_string_token_and_bump(&mut self) -> (Atom, Atom)

Source

fn expect_bigint_token_and_bump(&mut self) -> (Box<BigInt>, Atom)

Source

fn expect_regex_token_and_bump(&mut self) -> (Atom, Atom)

Source

fn expect_template_token_and_bump(&mut self) -> (LexResult<Atom>, Atom)

Source

fn expect_error_token_and_bump(&mut self) -> Error

Source

fn expect_jsx_name_token_and_bump(&mut self) -> Atom

Source

fn expect_jsx_text_token_and_bump(&mut self) -> (Atom, Atom)

Source

fn expect_shebang_token_and_bump(&mut self) -> Atom

Provided Methods§

Source

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

Source

fn had_line_break_before_cur(&self) -> bool

Source

fn has_linebreak_between_cur_and_peeked(&mut self) -> bool

This returns true on eof.

Source

fn cut_lshift(&mut self)

Source

fn merge_lt_gt(&mut self)

Source

fn is(&self, expected: &Self::Token) -> bool

Source

fn eat(&mut self, expected: &Self::Token) -> bool

Source

fn cur_pos(&self) -> BytePos

Returns start of current token.

Source

fn cur_span(&self) -> Span

Source

fn last_pos(&self) -> BytePos

Returns last byte position of previous token.

Source

fn get_ctx(&self) -> Context

Source

fn update_ctx(&mut self, f: impl FnOnce(&mut Context))

Source

fn set_ctx(&mut self, ctx: Context)

Source

fn syntax(&self) -> SyntaxFlags

Source

fn target(&self) -> EsVersion

Source

fn set_expr_allowed(&mut self, allow: bool)

Source

fn set_next_regexp(&mut self, start: Option<BytePos>)

Source

fn token_context<'b>(&'b self) -> &'b TokenContexts
where Self::I: 'b,

Source

fn token_context_mut<'b>(&'b mut self) -> &'b mut TokenContexts
where Self::I: 'b,

Source

fn set_token_context(&mut self, c: TokenContexts)

Source

fn end_pos(&self) -> BytePos

Source

fn token_flags(&self) -> TokenFlags

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§