wip make sure that heredoc identifier sits on a line of its own

This commit is contained in:
mhoffm
2021-06-26 10:31:33 +02:00
parent 77b51d1b78
commit bc0b3f1eb0
2 changed files with 14 additions and 8 deletions

View File

@@ -137,8 +137,19 @@ public:
return accept_and_advance(lexer, TEMPLATE_LITERAL_CHUNK);
}
}
context_stack.pop_back();
return accept_and_advance(lexer, HEREDOC_IDENTIFIER);
// check if the identifier is on a line of its own
lexer->mark_end(lexer);
while (iswspace(lexer->lookahead) && lexer->lookahead != '\n') {
advance(lexer);
}
if (lexer->lookahead == '\n') {
context_stack.pop_back();
return accept_and_advance(lexer, HEREDOC_IDENTIFIER);
} else {
advance(lexer);
lexer->mark_end(lexer);
return accept_inplace(lexer, TEMPLATE_LITERAL_CHUNK);
}
}
// manage template literal chunks