From 98a9f16c8662c85cfa14928cca2bf1b1b1c97886 Mon Sep 17 00:00:00 2001 From: aztek Date: Wed, 26 Nov 2014 13:44:27 +0100 Subject: [PATCH 1/2] Treat ids with double primes correctly (fixes #11) Do not highlight identifiers with double primes as character literals in Haskell. The bug seems to be in an extra condition that checks if we are at the beginning of a character literal. The test file for Haskell looks fine after this change. --- src/lang/sunlight.haskell.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lang/sunlight.haskell.js b/src/lang/sunlight.haskell.js index 31414c3..40f2656 100644 --- a/src/lang/sunlight.haskell.js +++ b/src/lang/sunlight.haskell.js @@ -20,7 +20,7 @@ line = context.reader.getLine(), column = context.reader.getColumn(); - if (context.reader.current() !== "'" && peek !== "'") { + if (context.reader.current() !== "'") { return null; } From 5de8b7214172d623364bd2f961d4e38d1ed415cf Mon Sep 17 00:00:00 2001 From: Evgeny Kotelnikov Date: Tue, 2 Dec 2014 10:47:21 +0100 Subject: [PATCH 2/2] Add test snippet to the Haskell test file Extra code to test identifiers with single quotes in them. Only 'c' should be highlighted as a character literal, the rest are legal identifiers. --- tests/test-haskell.html | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test-haskell.html b/tests/test-haskell.html index dc048f8..7c71666 100644 --- a/tests/test-haskell.html +++ b/tests/test-haskell.html @@ -1000,6 +1000,19 @@ (TextDetails_Chr 'a') 1 Doc_Empty))))))))))) (Doc_NilAbove (Doc_Nest -} +-- Extra code to test identifiers with single quotes in them. +-- Only 'c' should be highlighted as a character literal, +-- the rest are legal identifiers. + +c :: Char +c = c' + where c' = c'' + c'' = c''' + c''' = c'c' + c'c' = c'c'' + c'c'' = c''c'' + c''c'' = 'c' + @@ -1008,4 +1021,4 @@ //assertExists("rule", "@import", "css rule declaration"); //]]> - \ No newline at end of file +