File modules/editor/codemirror/mode/haskell-literate/haskell-literate.js
Last commit: Sun Dec 17 01:14:09 2017 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 // Distributed under an MIT license: http://codemirror.net/LICENSE 3 4 (function (mod) { 5 if (typeof exports == "object" && typeof module == "object") // CommonJS 6 mod(require("../../lib/codemirror"), require("../haskell/haskell")) 7 else if (typeof define == "function" && define.amd) // AMD 8 define(["../../lib/codemirror", "../haskell/haskell"], mod) 9 else // Plain browser env 10 mod(CodeMirror) 11 })(function (CodeMirror) { 12 "use strict" 13 14 CodeMirror.defineMode("haskell-literate", function (config, parserConfig) { 15 var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell") 16 17 return { 18 startState: function () { 19 return { 20 inCode: false, 21 baseState: CodeMirror.startState(baseMode) 22 } 23 }, 24 token: function (stream, state) { 25 if (stream.sol()) { 26 if (state.inCode = stream.eat(">")) 27 return "meta" 28 } 29 if (state.inCode) { 30 return baseMode.token(stream, state.baseState) 31 } else { 32 stream.skipToEnd() 33 return "comment" 34 } 35 }, 36 innerMode: function (state) { 37 return state.inCode ? {state: state.baseState, mode: baseMode} : null 38 } 39 } 40 }, "haskell") 41 42 CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate") 43 });
Downloadmodules/editor/codemirror/mode/haskell-literate/haskell-literate.js
History Sun, 17 Dec 2017 01:14:09 +0100 Jan Dankert Integration eines weiteren Code-Editors: Codemirror. Demnächst müssen wir hier mal aufräumen und andere Editoren rauswerfen.