File tree Expand file tree Collapse file tree 4 files changed +11
-1
lines changed Expand file tree Collapse file tree 4 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -581,9 +581,13 @@ ErrorOr<Lexer::ReductionResult> Lexer::reduce_start()
581
581
m_state.on_new_line = true ;
582
582
583
583
m_state.buffer .clear ();
584
+ m_state.position .start_offset = m_state.position .end_offset ;
585
+ m_state.position .start_line = m_state.position .end_line ;
586
+
587
+ Vector<Token> tokens { move (token), Token::newline () };
584
588
585
589
return ReductionResult {
586
- .tokens = { move (token) } ,
590
+ .tokens = move (tokens) ,
587
591
.next_reduction = Reduction::Start,
588
592
};
589
593
}
Original file line number Diff line number Diff line change @@ -321,6 +321,8 @@ struct Token {
321
321
return Token::Type::Great;
322
322
if (name == " <" sv)
323
323
return Token::Type::Less;
324
+ if (name == " \n " sv)
325
+ return Token::Type::Newline;
324
326
325
327
return {};
326
328
}
Original file line number Diff line number Diff line change @@ -698,6 +698,9 @@ ErrorOr<RefPtr<AST::Node>> Parser::parse_list()
698
698
699
699
ErrorOr<RefPtr<AST::Node>> Parser::parse_and_or ()
700
700
{
701
+ while (peek ().type == Token::Type::Newline)
702
+ skip ();
703
+
701
704
auto node = TRY (parse_pipeline ());
702
705
if (!node)
703
706
return RefPtr<AST::Node> {};
Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ class Parser {
54
54
{
55
55
if (eof ())
56
56
return ;
57
+ handle_heredoc_contents ();
57
58
m_token_index++;
58
59
}
59
60
bool eof () const
You can’t perform that action at this time.
0 commit comments