1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:57:35 +00:00

LibJS: Add a mode to parse JS as a module

In a module strict mode should be enabled at the start of parsing and we
allow import and export statements.
This commit is contained in:
davidot 2021-08-14 17:30:37 +02:00 committed by Linus Groh
parent d6d7d11590
commit 7613c22b06
8 changed files with 38 additions and 15 deletions

View file

@ -23,6 +23,8 @@ public:
const StringView& source() const { return m_source; };
const StringView& filename() const { return m_filename; };
void disallow_html_comments() { m_allow_html_comments = false; };
private:
void consume();
bool consume_exponent();
@ -63,6 +65,8 @@ private:
};
Vector<TemplateState> m_template_states;
bool m_allow_html_comments { true };
static HashMap<String, TokenType> s_keywords;
static HashMap<String, TokenType> s_three_char_tokens;
static HashMap<String, TokenType> s_two_char_tokens;