aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJonas Maier <jonas@x77.dev>2026-05-22 21:31:19 +0200
committerJonas Maier <jonas@x77.dev>2026-05-22 21:31:19 +0200
commite4132ff564c59be72c6546752077a8f33bb4c00f (patch)
tree7c9f1588a2253f152c4daa1b21df8f3d13060974 /src
parenteeb267c46340d5d47f41cc2440f0b281f9ae9261 (diff)
downloadpish-e4132ff564c59be72c6546752077a8f33bb4c00f.tar.gz
syntax highlighting fixes
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs1
-rw-r--r--src/parse/mod.rs8
2 files changed, 2 insertions, 7 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 2a9a1ee..47dbdf5 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -353,6 +353,7 @@ impl Session {
self.highlighter
.pretty_print(&buf, parser.highlights, &mut stdout)?;
cursor::fmove_cursor(cursor::Direction::Left, self.line.right_len(), &mut stdout)?;
+ stdout.flush()?;
}
}
diff --git a/src/parse/mod.rs b/src/parse/mod.rs
index 97a6e4a..1c1b184 100644
--- a/src/parse/mod.rs
+++ b/src/parse/mod.rs
@@ -1594,15 +1594,9 @@ impl Parse for If<PreExpansion> {
impl Parse for While {
fn parse(b: &mut Cursor<'_>) -> Result<Self> {
- b.spaces();
- if !b.buf.starts_with(b"while ") || b.buf.starts_with(b"while\t") {
- return Err(ParseError::NotAWhile);
- }
- b.advance(6);
- b.spaces();
+ b.consume_keyword(Keyword::While)?;
let condition = Pipes::parse(b)?;
let block = Block::parse(b)?;
-
Ok(Self { condition, block })
}
}