Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / Lexer.cpp
diff options
context:
space:
mode:
Commit1f4401a827e7711960eb704c7fb967483dee7213 (patch)
Author
 martin dobrev <martindobrev0@gmail.com>
2018-10-14 13:02:25 +0300
Committer
 martin dobrev <martindobrev0@gmail.com>
2018-10-14 13:02:25 +0300
Files5a11a11c44e6fb88e4bd94c3971cf9d8554978a7 /JSImpl/src/Lexer.cpp
IPL-1f4401a827e7711960eb704c7fb967483dee7213.tar
IPL-1f4401a827e7711960eb704c7fb967483dee7213.tar.gz
IPL-1f4401a827e7711960eb704c7fb967483dee7213.zip
Parent81297e1f7cae13d9620df902ac968046bc646b3a (diff)
Fix parsing of single quoted strings
1 files changed, 12 insertions, 0 deletions
-rw-r--r--JSImpl/src/Lexer.cpp12
diff --git a/JSImpl/src/Lexer.cpp b/JSImpl/src/Lexer.cpp
index 1d9035a..22ffab8 100644
--- a/JSImpl/src/Lexer.cpp
+++ b/JSImpl/src/Lexer.cpp
@@ -204,6 +204,18 @@ Token Tokenizer::NextToken()
return Token{ TokenType::String, m_Line, IPLString(m_Code + start, m_Code + m_Current), 0.0 };
}
+ if (c == '\'')
+ {
+ auto start = m_Current;
+ m_Current++; // skip first '
+ while (m_Code[m_Current] != '\'')
+ {
+ ++m_Current;
+ }
+ m_Current++; // skip second '
+ return Token{ TokenType::String, m_Line, IPLString(m_Code + start, m_Code + m_Current), 0.0 };
+ }
+
// Key words
if (c >= 'a' && c <= 'z')
{