mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
LibJS: Implement the 'Hashbang Grammar for JS' proposal
Stage 3 since August 2019 - we already have shebang stripping implemented in js(1), so this removes it from there in favor of adding support to the lexer directly. Most straightforward proposal and implementation I've ever seen :^) https://github.com/tc39/proposal-hashbang
This commit is contained in:
parent
299c3069c1
commit
597cf88c08
3 changed files with 14 additions and 28 deletions
|
@ -308,7 +308,9 @@ bool Lexer::is_line_comment_start(bool line_has_token_yet) const
|
|||
// "-->" is considered a line comment start if the current line is only whitespace and/or
|
||||
// other block comment(s); or in other words: the current line does not have a token or
|
||||
// ongoing line comment yet
|
||||
|| (match('-', '-', '>') && !line_has_token_yet);
|
||||
|| (match('-', '-', '>') && !line_has_token_yet)
|
||||
// https://tc39.es/proposal-hashbang/out.html#sec-updated-syntax
|
||||
|| (match('#', '!') && m_position == 1);
|
||||
}
|
||||
|
||||
bool Lexer::is_block_comment_start() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue