Skip to main content

ScanLexer

Struct ScanLexer 

Source
pub struct ScanLexer<'l, 'a> {
    pub result: u16,
    /* private fields */
}
Expand description

交给扫描器的词法器视图。输入不可信:操作次数有上限,超限后表现为输入结束,保证扫描一定终止。

Fields§

§result: u16

Implementations§

Source§

impl<'l, 'a> ScanLexer<'l, 'a>

Source

pub fn new(lx: &'l mut Lexer<'a>) -> ScanLexer<'l, 'a>

Source

pub fn lookahead(&self) -> char

当前前瞻字符,输入结束返回 ‘\0’。

Source

pub fn eof(&self) -> bool

Source

pub fn advance(&mut self, skip: bool)

前进一个字符;skip 为真时该字符算作记号前的空白。

Source

pub fn skip(&mut self)

Source

pub fn next(&mut self)

Source

pub fn mark_end(&mut self)

Source

pub fn set_result(&mut self, sym: u16)

Source

pub fn column(&mut self) -> u32

当前位置在行内的列号(按字符计)。

Auto Trait Implementations§

§

impl<'l, 'a> !UnwindSafe for ScanLexer<'l, 'a>

§

impl<'l, 'a> Forget for ScanLexer<'l, 'a>

§

impl<'l, 'a> Freeze for ScanLexer<'l, 'a>

§

impl<'l, 'a> Move for ScanLexer<'l, 'a>

§

impl<'l, 'a> RefUnwindSafe for ScanLexer<'l, 'a>

§

impl<'l, 'a> Send for ScanLexer<'l, 'a>

§

impl<'l, 'a> Sync for ScanLexer<'l, 'a>

§

impl<'l, 'a> Unpin for ScanLexer<'l, 'a>

§

impl<'l, 'a> UnsafeUnpin for ScanLexer<'l, '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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.