pub(in front::wgsl) struct Lexer<'a> {
input: &'a str,
pub(in front::wgsl) source: &'a str,
last_end_offset: usize,
pub(in front::wgsl) enable_extensions: EnableExtensions,
}
Fields§
§input: &'a str
§source: &'a str
§last_end_offset: usize
§enable_extensions: EnableExtensions
Implementations§
source§impl<'a> Lexer<'a>
impl<'a> Lexer<'a>
pub(in front::wgsl) const fn new( input: &'a str, ) -> Self
sourcepub fn capture_span<T, E>(
&mut self,
inner: impl FnOnce(&mut Self) -> Result<T, E>,
) -> Result<(T, Span), E>
pub fn capture_span<T, E>( &mut self, inner: impl FnOnce(&mut Self) -> Result<T, E>, ) -> Result<(T, Span), E>
pub(in front::wgsl) fn start_byte_offset( &mut self, ) -> usize
fn peek_token_and_rest(&mut self) -> ((Token<'a>, Span), &'a str)
const fn current_byte_offset(&self) -> usize
pub(in front::wgsl) fn span_from( &self, offset: usize, ) -> Span
sourcepub(in front::wgsl) fn next(
&mut self,
) -> (Token<'a>, Span)
pub(in front::wgsl) fn next( &mut self, ) -> (Token<'a>, Span)
Return the next non-whitespace token from self
.
Assume we are a parse state where bit shift operators may occur, but not angle brackets.
sourcepub(in front::wgsl) fn next_generic(
&mut self,
) -> (Token<'a>, Span)
pub(in front::wgsl) fn next_generic( &mut self, ) -> (Token<'a>, Span)
Return the next non-whitespace token from self
.
Assume we are in a parse state where angle brackets may occur, but not bit shift operators.
sourcefn next_impl(&mut self, generic: bool) -> (Token<'a>, Span)
fn next_impl(&mut self, generic: bool) -> (Token<'a>, Span)
Return the next non-whitespace token from self
, with a span.
See consume_token
for the meaning of generic
.
pub(in front::wgsl) fn peek( &mut self, ) -> (Token<'a>, Span)
pub(in front::wgsl) fn expect_span( &mut self, expected: Token<'a>, ) -> Result<Span, Error<'a>>
pub(in front::wgsl) fn expect( &mut self, expected: Token<'a>, ) -> Result<(), Error<'a>>
pub(in front::wgsl) fn expect_generic_paren( &mut self, expected: char, ) -> Result<(), Error<'a>>
sourcepub(in front::wgsl) fn skip(
&mut self,
what: Token<'_>,
) -> bool
pub(in front::wgsl) fn skip( &mut self, what: Token<'_>, ) -> bool
If the next token matches it is skipped and true is returned
pub(in front::wgsl) fn next_ident_with_span( &mut self, ) -> Result<(&'a str, Span), Error<'a>>
pub(in front::wgsl) fn peek_ident_with_span( &mut self, ) -> Result<(&'a str, Span), Error<'a>>
fn word_as_ident_with_span( word: &'a str, span: Span, ) -> Result<(&'a str, Span), Error<'a>>
pub(in front::wgsl) fn next_ident( &mut self, ) -> Result<Ident<'a>, Error<'a>>
fn word_as_ident( word: &'a str, span: Span, ) -> Result<(&'a str, Span), Error<'a>>
sourcepub(in front::wgsl) fn next_scalar_generic(
&mut self,
) -> Result<Scalar, Error<'a>>
pub(in front::wgsl) fn next_scalar_generic( &mut self, ) -> Result<Scalar, Error<'a>>
Parses a generic scalar type, for example <f32>
.
sourcepub(in front::wgsl) fn next_scalar_generic_with_span(
&mut self,
) -> Result<(Scalar, Span), Error<'a>>
pub(in front::wgsl) fn next_scalar_generic_with_span( &mut self, ) -> Result<(Scalar, Span), Error<'a>>
Parses a generic scalar type, for example <f32>
.
Returns the span covering the inner type, excluding the brackets.
pub(in front::wgsl) fn next_storage_access( &mut self, ) -> Result<StorageAccess, Error<'a>>
pub(in front::wgsl) fn next_format_generic( &mut self, ) -> Result<(StorageFormat, StorageAccess), Error<'a>>
pub(in front::wgsl) fn open_arguments( &mut self, ) -> Result<(), Error<'a>>
pub(in front::wgsl) fn close_arguments( &mut self, ) -> Result<(), Error<'a>>
pub(in front::wgsl) fn next_argument( &mut self, ) -> Result<bool, Error<'a>>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Lexer<'a>
impl<'a> RefUnwindSafe for Lexer<'a>
impl<'a> Send for Lexer<'a>
impl<'a> Sync for Lexer<'a>
impl<'a> Unpin for Lexer<'a>
impl<'a> UnwindSafe for Lexer<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)