Sha256: 6eca4976b051d2793c8f4e07b39694b7b3ab894ef9bf69a6e8b523d8ca5206ef

Contents?: true

Size: 1.69 KB

Versions: 264

Compression:

Stored size: 1.69 KB

Contents

CodeMirror.defineMode("properties", function() {
  return {
    token: function(stream, state) {
      var sol = stream.sol() || state.afterSection;
      var eol = stream.eol();

      state.afterSection = false;

      if (sol) {
        if (state.nextMultiline) {
          state.inMultiline = true;
          state.nextMultiline = false;
        } else {
          state.position = "def";
        }
      }

      if (eol && ! state.nextMultiline) {
        state.inMultiline = false;
        state.position = "def";
      }

      if (sol) {
        while(stream.eatSpace());
      }

      var ch = stream.next();

      if (sol && (ch === "#" || ch === "!" || ch === ";")) {
        state.position = "comment";
        stream.skipToEnd();
        return "comment";
      } else if (sol && ch === "[") {
        state.afterSection = true;
        stream.skipTo("]"); stream.eat("]");
        return "header";
      } else if (ch === "=" || ch === ":") {
        state.position = "quote";
        return null;
      } else if (ch === "\\" && state.position === "quote") {
        if (stream.next() !== "u") {    // u = Unicode sequence \u1234
          // Multiline value
          state.nextMultiline = true;
        }
      }

      return state.position;
    },

    startState: function() {
      return {
        position : "def",       // Current position, "def", "quote" or "comment"
        nextMultiline : false,  // Is the next line multiline value
        inMultiline : false,    // Is the current line a multiline value
        afterSection : false    // Did we just open a section
      };
    }

  };
});

CodeMirror.defineMIME("text/x-properties", "properties");
CodeMirror.defineMIME("text/x-ini", "properties");

Version data entries

264 entries across 262 versions & 12 rubygems

Version Path
marty-2.4.7 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.6 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.5 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.4 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.3 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.2 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.1 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.4.0 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.15 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.14 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.13 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.12 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.11 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.10 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.9 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.8 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.7 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.5 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.3.4 app/components/marty/script_form/client/mode/properties/properties.js
marty-2.1.5 app/components/marty/script_form/client/mode/properties/properties.js