Struct erg_parser::token::TokenStream
source · pub struct TokenStream(_);
Implementations§
source§impl TokenStream
impl TokenStream
pub const fn new(v: Vec<Token>) -> TokenStream
sourcepub fn empty() -> TokenStream
pub fn empty() -> TokenStream
Examples found in repository?
lex.rs (line 142)
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
pub fn lex(self) -> Result<TokenStream, LexErrors> {
let mut result = TokenStream::empty();
let mut errs = LexErrors::empty();
for i in self {
match i {
Ok(token) => result.push(token),
Err(err) => {
errs.push(err);
}
}
}
if errs.is_empty() {
Ok(result)
} else {
Err(errs)
}
}
Trait Implementations§
source§impl Clone for TokenStream
impl Clone for TokenStream
source§fn clone(&self) -> TokenStream
fn clone(&self) -> TokenStream
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more