1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibJS: Lex single quote strings, escaped chars and unterminated strings

This commit is contained in:
Stephan Unverwerth 2020-03-14 11:45:25 +01:00 committed by Andreas Kling
parent d439013903
commit c0e6234219
5 changed files with 33 additions and 4 deletions

View file

@ -38,6 +38,7 @@ class Lexer {
public:
explicit Lexer(StringView source);
Token next();
bool has_errors() const { return m_has_errors; }
private:
void consume();
@ -48,10 +49,13 @@ private:
bool is_block_comment_start() const;
bool is_block_comment_end() const;
void syntax_error(const char*);
StringView m_source;
size_t m_position = 0;
Token m_current_token;
int m_current_char;
bool m_has_errors = false;
static HashMap<String, TokenType> s_keywords;
static HashMap<String, TokenType> s_three_char_tokens;