Struct pddl_parser::lexer::TokenStream
source · pub struct TokenStream<'a> { /* private fields */ }Expand description
A stream of tokens. This is a wrapper around a logos::Lexer. It implements Clone, so it can be cloned and used to peek ahead. It also implements Iterator, so it can be used to iterate over the tokens.
Implementations§
source§impl<'a> TokenStream<'a>
impl<'a> TokenStream<'a>
sourcepub fn new(input: &'a str) -> Self
pub fn new(input: &'a str) -> Self
Creates a new token stream from the given input string. The input string is not copied, so it must outlive the token stream.
sourcepub fn peek(&self) -> Option<(Result<Token, ParserError>, &'a str)>
pub fn peek(&self) -> Option<(Result<Token, ParserError>, &'a str)>
Returns the next token in the stream, or None if the stream is empty.
Trait Implementations§
source§impl Clone for TokenStream<'_>
impl Clone for TokenStream<'_>
source§impl<'a> From<&'a String> for TokenStream<'a>
impl<'a> From<&'a String> for TokenStream<'a>
source§impl<'a> From<&'a str> for TokenStream<'a>
impl<'a> From<&'a str> for TokenStream<'a>
source§impl InputLength for TokenStream<'_>
impl InputLength for TokenStream<'_>
source§impl<'a> Parser<TokenStream<'a>, &'a str, ParserError> for Token
impl<'a> Parser<TokenStream<'a>, &'a str, ParserError> for Token
source§fn parse(
&mut self,
input: TokenStream<'a>
) -> IResult<TokenStream<'a>, &'a str, ParserError>
fn parse( &mut self, input: TokenStream<'a> ) -> IResult<TokenStream<'a>, &'a str, ParserError>
A parser takes in input type, and returns a
Result containing
either the remaining input and the output value, or an errorsource§fn map<G, O2>(self, g: G) -> Map<Self, G, O>where
G: Fn(O) -> O2,
Self: Sized,
fn map<G, O2>(self, g: G) -> Map<Self, G, O>where G: Fn(O) -> O2, Self: Sized,
Maps a function over the result of a parser
source§fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where
G: FnMut(O) -> H,
H: Parser<I, O2, E>,
Self: Sized,
fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,
Creates a second parser from the output of the first one, then apply over the rest of the input
source§fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where
G: Parser<O, O2, E>,
Self: Sized,
fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where G: Parser<O, O2, E>, Self: Sized,
Applies a second parser over the output of the first one
source§fn and<G, O2>(self, g: G) -> And<Self, G>where
G: Parser<I, O2, E>,
Self: Sized,
fn and<G, O2>(self, g: G) -> And<Self, G>where G: Parser<I, O2, E>, Self: Sized,
Applies a second parser after the first one, return their results as a tuple
Auto Trait Implementations§
impl<'a> RefUnwindSafe for TokenStream<'a>
impl<'a> Send for TokenStream<'a>
impl<'a> Sync for TokenStream<'a>
impl<'a> Unpin for TokenStream<'a>
impl<'a> UnwindSafe for TokenStream<'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