Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[haskell mode] Improve tokeniziation of '[1..100]'

Closes #2099
  • Loading branch information...
commit 5eb4cda909bcc9d9411f12f00a2669d0bd005360 1 parent e4236a1
@marijnh marijnh authored
Showing with 5 additions and 3 deletions.
  1. +5 −3 mode/haskell/haskell.js
View
8 mode/haskell/haskell.js
@@ -8,7 +8,7 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
// These should all be Unicode extended, as per the Haskell 2010 report
var smallRE = /[a-z_]/;
var largeRE = /[A-Z]/;
- var digitRE = /[0-9]/;
+ var digitRE = /\d/;
var hexitRE = /[0-9A-Fa-f]/;
var octitRE = /[0-7]/;
var idRE = /[a-z_A-Z0-9']/;
@@ -76,9 +76,8 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
}
source.eatWhile(digitRE);
var t = "number";
- if (source.eat('.')) {
+ if (source.match(/^\.\d+/)) {
t = "number";
- source.eatWhile(digitRE); // should require at least 1
}
if (source.eat(/[eE]/)) {
t = "number";
@@ -88,6 +87,9 @@ CodeMirror.defineMode("haskell", function(_config, modeConfig) {
return t;
}
+ if (ch == "." && source.eat("."))
+ return "keyword";
+
if (symbolRE.test(ch)) {
if (ch == '-' && source.eat(/-/)) {
source.eatWhile(/-/);
Please sign in to comment.
Something went wrong with that request. Please try again.