Skip to main content

Lexer

Struct Lexer 

Source
pub struct Lexer<'a, R: IdentResolver> { /* private fields */ }
Expand description

Lexer(ジェネリック版)

Implementations§

Source§

impl<'a> Lexer<'a, Interning<'a>>

Source

pub fn new( source: &'a [u8], file_id: FileId, interner: &'a mut StringInterner, ) -> Self

新しいLexerを作成(通常モード)

Source§

impl<'a> Lexer<'a, LookupOnly<'a>>

Source

pub fn new_readonly( source: &'a [u8], file_id: FileId, interner: &'a StringInterner, ) -> Self

新しいLexerを作成(読み取り専用モード)

このモードでは、既に intern 済みの識別子のみを認識する。 未知の識別子を検出した場合は LexError::UnknownIdentifier を返す。

Source§

impl<'a, R: IdentResolver> Lexer<'a, R>

Source

pub fn set_return_spaces(&mut self, enabled: bool)

スペースをトークンとして返すかどうかを設定

Source

pub fn return_spaces(&self) -> bool

現在のスペース返却モードを取得

Source

pub fn current_location(&self) -> SourceLocation

現在位置を取得

Source

pub fn file_id(&self) -> FileId

ファイルIDを取得

Source

pub fn next_token(&mut self) -> Result<Token>

次のトークンを取得

Auto Trait Implementations§

§

impl<'a, R> Freeze for Lexer<'a, R>
where R: Freeze,

§

impl<'a, R> RefUnwindSafe for Lexer<'a, R>
where R: RefUnwindSafe,

§

impl<'a, R> Send for Lexer<'a, R>
where R: Send,

§

impl<'a, R> Sync for Lexer<'a, R>
where R: Sync,

§

impl<'a, R> Unpin for Lexer<'a, R>
where R: Unpin,

§

impl<'a, R> UnsafeUnpin for Lexer<'a, R>
where R: UnsafeUnpin,

§

impl<'a, R> UnwindSafe for Lexer<'a, R>
where R: UnwindSafe,

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> 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, 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.