Struct wast::parser::Cursor [−][src]
pub struct Cursor<'a> { /* fields omitted */ }Expand description
An immutable cursor into a list of tokens.
This cursor cannot be mutated but can be used to parse more tokens in a list
of tokens. Cursors are created from the Parser::step method. This is a
very low-level parsing structure and you likely won’t use it much.
Implementations
Returns the span of the next Token token.
Does not take into account whitespace or comments.
Same as Parser::error, but works with the current token in this
Cursor instead.
Attempts to advance this cursor if the current token is a (.
If the current token is (, returns a new Cursor pointing at the
rest of the tokens in the stream. Otherwise returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a ).
If the current token is ), returns a new Cursor pointing at the
rest of the tokens in the stream. Otherwise returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Id
If the current token is Id, returns the identifier minus the leading
$ character as well as a new Cursor pointing at the rest of the
tokens in the stream. Otherwise returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Keyword
If the current token is Keyword, returns the keyword as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Reserved
If the current token is Reserved, returns the reserved token as well
as a new Cursor pointing at the rest of the tokens in the stream.
Otherwise returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Integer
If the current token is Integer, returns the integer as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Float
If the current token is Float, returns the float as well as a new
Cursor pointing at the rest of the tokens in the stream. Otherwise
returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::String
If the current token is String, returns the byte value of the string
as well as a new Cursor pointing at the rest of the tokens in the
stream. Otherwise returns None.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::Reserved and looks like the start of an
annotation.
Annotations are a WebAssembly proposal for the text format which allows placing structured text inside of a text file, for example to specify the name section or other custom sections.
This function will attempt to see if the current token is the @foo
part of the annotation. This requires the previous token to be ( and
the current token is Reserved which starts with @ and has a nonzero
length for the following name.
Note that this will skip unknown annoations. Only pre-registered annotations will be returned here.
This function will automatically skip over any comments, whitespace, or unknown annotations.
Attempts to advance this cursor if the current token is a
Token::LineComment or a
Token::BlockComment
This function will only skip whitespace, no other tokens.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for Cursor<'a>
impl<'a> !UnwindSafe for Cursor<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more