mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +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:
parent
d6d7d11590
commit
7613c22b06
8 changed files with 38 additions and 15 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue