upper comments get attached to command

This commit is contained in:
Fernando Herrera
2021-09-01 21:05:37 +01:00
parent 5da2ab1b7d
commit 73f6a57b12
2 changed files with 94 additions and 28 deletions

View File

@ -98,15 +98,17 @@ pub fn lite_parse(tokens: &[Token]) -> (LiteBlock, Option<ParseError>) {
}
}
TokenContents::Eol | TokenContents::Semicolon => {
if !curr_command.is_empty() || !curr_command.is_empty_comments() {
if !curr_command.is_empty() {
curr_pipeline.push(curr_command);
curr_command = LiteCommand::new();
}
curr_command = LiteCommand::new();
if !curr_pipeline.is_empty() {
block.push(curr_pipeline);
curr_pipeline = LiteStatement::new();
}
curr_pipeline = LiteStatement::new();
}
TokenContents::Comment => {
curr_command.comments.push(token.span);