Sha256: 3c411fd891f8b5ac3e866516281a1f0d0fe5ae58b9b506d7fb228a48cf151057

Contents?: true

Size: 1.36 KB

Versions: 9

Compression:

Stored size: 1.36 KB

Contents

// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE

(function (mod) {
  if (typeof exports == "object" && typeof module == "object") // CommonJS
    mod(require("../../lib/codemirror"), require("../haskell/haskell"))
  else if (typeof define == "function" && define.amd) // AMD
    define(["../../lib/codemirror", "../haskell/haskell"], mod)
  else // Plain browser env
    mod(CodeMirror)
})(function (CodeMirror) {
  "use strict"

  CodeMirror.defineMode("haskell-literate", function (config, parserConfig) {
    var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell")

    return {
      startState: function () {
        return {
          inCode: false,
          baseState: CodeMirror.startState(baseMode)
        }
      },
      token: function (stream, state) {
        if (stream.sol()) {
          if (state.inCode = stream.eat(">"))
            return "meta"
        }
        if (state.inCode) {
          return baseMode.token(stream, state.baseState)
        } else {
          stream.skipToEnd()
          return "comment"
        }
      },
      innerMode: function (state) {
        return state.inCode ? {state: state.baseState, mode: baseMode} : null
      }
    }
  }, "haskell")

  CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate")
});

Version data entries

9 entries across 9 versions & 6 rubygems

Version Path
locomotivecms-4.2.0.alpha2 vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js
locomotivecms-4.2.0.alpha1 vendor/assets/javascripts/locomotive/codemirror/modes/haskell-literate.js
scrivito_codemirror_editor-1.1.0 vendor/assets/javascripts/codemirror/modes/haskell-literate.js
stisla-rails-0.0.2 vendor/assets/modules/codemirror/mode/haskell-literate/haskell-literate.js
tui_editor-rails-1.0.2.0 vendor/assets/components/codemirror/mode/haskell-literate/haskell-literate.js
jekyll-theme-anc-0.1.2 assets/js/mode/haskell-literate/haskell-literate.js
codemirror-rails-5.16.0 vendor/assets/javascripts/codemirror/modes/haskell-literate.js
codemirror-rails-5.15.2 vendor/assets/javascripts/codemirror/modes/haskell-literate.js
codemirror-rails-5.13.2 vendor/assets/javascripts/codemirror/modes/haskell-literate.js