Skip to content

Commit 43c116d

Browse files
committed
Fix another string escaping issue
Closes: #53
1 parent d86a761 commit 43c116d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Tests/Lexer.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ testLexer = describe "Lexer:" $ do
3737
testLex "'\"'" `shouldBe` "[StringToken '\"']"
3838
testLex "\"\\\"\"" `shouldBe` "[StringToken \"\\\\\"\"]"
3939
testLex "'\\\''" `shouldBe` "[StringToken '\\\\'']"
40+
testLex "'\"'" `shouldBe` "[StringToken '\"']"
41+
testLex "\"\\'\"" `shouldBe` "[StringToken \"\\'\"]"
4042

4143
it "assignment" $ do
4244
testLex "x=1" `shouldBe` "[IdentifierToken 'x',SimpleAssignToken,DecimalToken 1]"

src/Language/JavaScript/Parser/Lexer.x

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ $not_eol_char = ~$eol_char -- anything but an end of line character
6565
$string_chars = [^ \n \r ' \" \\]
6666
6767
-- See e.g. http://es5.github.io/x7.html#x7.8.4 (Table 4)
68-
@sq_escapes = \\ ( \\ | ' | b | f | n | r | t | v | 0 | x )
69-
@dq_escapes = \\ ( \\ | \" | b | f | n | r | t | v | 0 | x )
68+
@sq_escapes = \\ ( \\ | ' | \" | b | f | n | r | t | v | 0 | x )
69+
@dq_escapes = \\ ( \\ | ' | \" | b | f | n | r | t | v | 0 | x )
7070
7171
@unicode_escape = \\ u $hex_digit{4}
7272

0 commit comments

Comments
 (0)