Skip to content
Snippets Groups Projects
Commit bec0e095 authored by Michael Aaron Murphy's avatar Michael Aaron Murphy
Browse files

Fix issues caused by last commit

parent cdb6a6cd
No related branches found
No related tags found
No related merge requests found
......@@ -3,4 +3,4 @@ echo Hello world # End of line comments are ignored
#echo Goodbye world
#echo Nada
echo tabs ok #comment
echo not#a#comment
\ No newline at end of file
echo not#a#comment
......@@ -78,8 +78,16 @@ impl QuoteTerminator {
self.flags -= ARRAY;
}
b'#' if !self.flags.intersects(DQUOTE | SQUOTE) => {
comment = true;
break
if self.read > 1 {
let character = self.buffer.as_bytes().get(self.read - 2).unwrap();
if [b' ', b'\n'].contains(character) {
comment = true;
break
}
} else {
comment = true;
break
}
}
_ => (),
}
......@@ -90,7 +98,7 @@ impl QuoteTerminator {
return false;
} else if comment {
self.buffer.truncate(self.read - 1);
return false;
return !self.flags.intersects(SQUOTE | DQUOTE | ARRAY);
}
}
......
......@@ -279,6 +279,7 @@ impl<'a> Iterator for StatementSplitter<'a> {
}
None => {
let output = self.data[start..].trim();
if output.is_empty() { return Some(Ok(output)); }
match output.as_bytes()[0] {
b'>' | b'<' | b'^' => {
Some(Err(StatementError::ExpectedCommandButFound("redirection")))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment