Define heredoc inside simple codemirror highlighting

I’m trying to add heredoc to my language, the regex works on Regex101 but fail on Codemirror:

Here is my whole file:

// Gaiman Codemirror mode using simple mode

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

    var keywordList = [
        "ask", "def", "echo", "else", "end", "false", "for", "get", "if", "in",
        "let", "not", "or", "post", "return", "sleep", "then", "true", "while",
        "throw", "lambda", "do", "continue", "break", "store", "config", "parse",
        "type", "ask*", "echo*", "input*"

     CodeMirror.defineSimpleMode("gaiman", {
         // The start state contains the rules that are initially used
         start: [
             // The regex matches the token, the token property contains the type
             { regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string" },
             { regex: /<<<([^\s\n,]+)((?:.*\n)*)\1/, token: "string" },
             // You can match multiple tokens at once. Note that the captured
             // groups must span the whole string in this case
             { regex: /(?:do|then|def|lambda)\b/, token: "keyword", indent: true },
             { regex: /(?:else(?!\b\s+if))\b/, token: "keyword", indent: true, dedent: true },
             { regex: /(?:end|else)\b/, token: "keyword", dedent: true },
             { regex: new RegExp('(?:' + keywordList.join('|') + ')\\b'), token: "keyword" },
             { regex: /(def)(\s+)([A-Za-z$][\w$]*)/,
              token: ["keyword", null, "variable-2"] },
             { regex: /true|false|null|undefined/, token: "atom" },
             { regex: /0x[A-Fa-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,
               token: "number" },
             { regex: /#.*/, token: "comment" },
             { regex: /\/(?:[^\\]|\\.)*?\//, token: "variable-3" },
             //{ regex: /[-+\/*=<>!]{1,2}/, token: "operator" },
             // indent and dedent properties guide autoindentation
             { regex: /[\{\[\(]/, indent: true },
             { regex: /[\}\]\)]/, dedent: true },
             { regex: /[_A-Za-z$][\w$]*/, token: "variable" },
             { regex: /<</, token: "meta", mode: {spec: "xml", end: />>/} }
         meta: {
             dontIndentStates: ["comment"],
             lineComment: "#"

    CodeMirror.defineMIME("text/x-gaiman", "gaiman");
    CodeMirror.registerHelper("hintWords", "gaiman", keywordList);

If I comment out operators, it marks everything til the end as a string. I’ve tried to limit operators to two characters without any effect, but heredoc doesn’t work.

{ regex: /[-+\/*=<>!]{1,2}/, token: "operator" },

This is an extension of the default simple highlighter with few tweaks. my language is simple there is no need to create real highlighters especially since they are very complex and not well documented (at last I think they are).

EDIT: Just found that simple mode is line-oriented. Is there a way to have multiline heredocs without having a whole new mode?

No, heredoc with custom end strings can’t be expressed in a simple mode. But regular modes are also pretty easy to write, so you should be able to move to one of those.