protobuf_support::lexer::tokenizer

Struct Tokenizer

source
pub struct Tokenizer<'a> { /* private fields */ }

Implementations§

source§

impl<'a> Tokenizer<'a>

source

pub fn new(input: &'a str, comment_style: ParserLanguage) -> Tokenizer<'a>

source

pub fn loc(&self) -> Loc

source

pub fn lookahead_loc(&mut self) -> Loc

source

pub fn lookahead_some(&mut self) -> TokenizerResult<&Token>

source

pub fn next_some(&mut self) -> TokenizerResult<Token>

source

pub fn advance(&mut self) -> TokenizerResult<Token>

Can be called only after lookahead, otherwise it’s error

source

pub fn syntax_eof(&mut self) -> TokenizerResult<bool>

No more tokens

source

pub fn next_token_if_map<P, R>(&mut self, p: P) -> TokenizerResult<Option<R>>
where P: FnOnce(&Token) -> Option<R>,

source

pub fn next_token_check_map<P, R, E>(&mut self, p: P) -> Result<R, E>
where P: FnOnce(&Token) -> Result<R, E>, E: From<TokenizerError>,

source

pub fn next_ident_if_in( &mut self, idents: &[&str], ) -> TokenizerResult<Option<String>>

source

pub fn next_ident_if_eq(&mut self, word: &str) -> TokenizerResult<bool>

source

pub fn next_ident_expect_eq(&mut self, word: &str) -> TokenizerResult<()>

source

pub fn next_ident_if_eq_error( &mut self, word: &'static str, ) -> TokenizerResult<()>

source

pub fn next_symbol_if_in(&mut self, symbols: &[char]) -> TokenizerResult<bool>

source

pub fn next_symbol_if_eq(&mut self, symbol: char) -> TokenizerResult<bool>

source

pub fn next_symbol_expect_eq( &mut self, symbol: char, desc: &'static str, ) -> TokenizerResult<()>

source

pub fn next_symbol_expect_eq_oneof( &mut self, symbols: &[char], ) -> TokenizerResult<char>

source

pub fn lookahead_is_str_lit(&mut self) -> TokenizerResult<bool>

source

pub fn lookahead_is_int_lit(&mut self) -> TokenizerResult<bool>

source

pub fn lookahead_is_json_number(&mut self) -> TokenizerResult<bool>

source

pub fn lookahead_if_symbol(&mut self) -> TokenizerResult<Option<char>>

source

pub fn lookahead_is_symbol(&mut self, symbol: char) -> TokenizerResult<bool>

source

pub fn lookahead_is_ident(&mut self, ident: &str) -> TokenizerResult<bool>

source

pub fn next_ident(&mut self) -> TokenizerResult<String>

source

pub fn next_str_lit(&mut self) -> TokenizerResult<StrLit>

source

pub fn next_int_lit(&mut self) -> TokenizerResult<u64>

source

pub fn next_float_lit(&mut self) -> TokenizerResult<f64>

Trait Implementations§

source§

impl<'a> Clone for Tokenizer<'a>

source§

fn clone(&self) -> Tokenizer<'a>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Tokenizer<'a>

§

impl<'a> RefUnwindSafe for Tokenizer<'a>

§

impl<'a> Send for Tokenizer<'a>

§

impl<'a> Sync for Tokenizer<'a>

§

impl<'a> Unpin for Tokenizer<'a>

§

impl<'a> UnwindSafe for Tokenizer<'a>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.