Skip to content
Browse files

updated CM2 haskell mode

  • Loading branch information...
1 parent fd808a2 commit 35b7089c519c71552862cd596d8d57bdc94954d4 @mzero committed Feb 22, 2011
Showing with 28 additions and 24 deletions.
  1. +19 −20 seed/static/mode/haskell.css
  2. +9 −4 seed/static/mode/haskell.js
View
39 seed/static/mode/haskell.css
@@ -1,26 +1,25 @@
-.hs-char,
-.hs-float,
-.hs-integer,
-.hs-string { color: #7f7519;}
+span.hs-char,
+span.hs-float,
+span.hs-integer,
+span.hs-string {color: #762;}
-.hs-comment { color: #236E25; font-style: italic; }
-.hs-pragma { }
+span.hs-comment {color: #262;font-style: italic;}
+span.hs-pragma {color: #555;font-style: italic;}
-.hs-prelude-varid,
-.hs-prelude-varsym,
-.hs-special,
-.hs-varid,
-.hs-varsym { }
+span.hs-special,
+span.hs-varid,
+span.hs-varsym {color: #000;}
-.hs-conid,
-.hs-consym { color: #cc2900; }
+span.hs-conid,
+span.hs-consym {color: #b11;}
-.hs-reservedid,
-.hs-reservedop { color: #7f3500; }
+span.hs-qualifier {color: #555;}
-.hs-qualifier { color: #5e5e5e;}
-.hs-error { background-color: #ffe5e5; }
+span.hs-reservedid,
+span.hs-reservedop {color: #730;}
-.hs-prelude-varid,
-.hs-prelude-varsym,
-.hs-prelude-conid { color: #250087; }
+span.hs-prelude-varid,
+span.hs-prelude-varsym {color: #30a;}
+span.hs-prelude-conid {color: #b11;}
+
+span.hs-error {background-color: #fdd;}
View
13 seed/static/mode/haskell.js
@@ -112,18 +112,21 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
return normal;
}
return function(source, setState) {
+ var currNest = nest;
while (!source.eol()) {
ch = source.next();
if (ch == '{' && source.eat('-')) {
- return switchState(source, setState, ncomment(type, nest+1));
+ ++currNest;
}
else if (ch == '-' && source.eat('}')) {
- if (nest == 1) {
+ --currNest;
+ if (currNest == 0) {
+ setState(normal);
return type;
}
- setState(source, setState, ncomment(type, nest-1));
}
}
+ setState(ncomment(type, currNest));
return type;
}
}
@@ -219,7 +222,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
"zip3", "zipWith", "zipWith3");
return wkw;
- })()
+ })();
@@ -235,3 +238,5 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
};
});
+
+CodeMirror.defineMIME("text/x-haskell", "haskell");

0 comments on commit 35b7089

Please sign in to comment.
Something went wrong with that request. Please try again.