mindustry logic execution, map- and schematic- parsing and rendering
fix print_stream
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | lemu/Cargo.toml | 2 | ||||
| -rw-r--r-- | lemu/src/lexer.rs | 8 |
3 files changed, 6 insertions, 5 deletions
@@ -1,6 +1,7 @@ # rustc/cargo outputs Cargo.lock target +rustc-ice-*.txt # Visual Studio Code /.vscode diff --git a/lemu/Cargo.toml b/lemu/Cargo.toml index 7c643d5..458452c 100644 --- a/lemu/Cargo.toml +++ b/lemu/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lemu" -version = "0.2.4" +version = "0.2.5" edition = "2021" description = "M-LOG runner" authors = ["bend-n <[email protected]>"] diff --git a/lemu/src/lexer.rs b/lemu/src/lexer.rs index 57b0239..1592514 100644 --- a/lemu/src/lexer.rs +++ b/lemu/src/lexer.rs @@ -20,7 +20,7 @@ macro_rules! instrs { #[regex(r#"@[^ "\n]*"#, |lex| Cow::from(&lex.slice()[1..]))] #[regex(r#""[^"]*""#, |lex| Cow::from(lex.slice()[1..lex.slice().len()-1].replace(r"\n", "\n")))] String(Cow<'strings, str>), - #[regex("[^0-9 \t\n]+")] + #[regex("[^0-9 \t\n]+", priority = 9)] Ident(&'strings str), $(#[token($z)] $v,)+ @@ -118,15 +118,15 @@ impl<'s> Lexer<'s> { } #[allow(dead_code)] -pub fn print_stream<'s>(mut stream: impl Iterator<Item = Token<'s>>) { +pub fn print_stream<'s>(mut stream: Lexer) { print!("["); let Some(tok) = stream.next() else { println!("]"); return; }; print!("{tok:?}"); - for token in stream { - print!(", {token:?}"); + while let Some(tok) = stream.next() { + print!(", {tok:?}"); } println!("]"); } |