codemirror-rails 5.4 → 5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/codemirror/rails/version.rb +2 -2
- data/vendor/assets/javascripts/codemirror.js +88 -35
- data/vendor/assets/javascripts/codemirror/addons/hint/show-hint.js +10 -7
- data/vendor/assets/javascripts/codemirror/addons/search/search.js +52 -17
- data/vendor/assets/javascripts/codemirror/addons/tern/tern.js +1 -1
- data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +1 -1
- data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +4 -2
- data/vendor/assets/javascripts/codemirror/keymaps/vim.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/brainfuck.js +85 -0
- data/vendor/assets/javascripts/codemirror/modes/clike.js +13 -0
- data/vendor/assets/javascripts/codemirror/modes/css.js +2 -0
- data/vendor/assets/javascripts/codemirror/modes/erlang.js +0 -4
- data/vendor/assets/javascripts/codemirror/modes/gfm.js +3 -2
- data/vendor/assets/javascripts/codemirror/modes/markdown.js +7 -7
- data/vendor/assets/javascripts/codemirror/modes/ruby.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/rust.js +1 -1
- data/vendor/assets/javascripts/codemirror/modes/vhdl.js +189 -0
- data/vendor/assets/javascripts/codemirror/modes/xml.js +1 -0
- data/vendor/assets/stylesheets/codemirror.css +19 -12
- data/vendor/assets/stylesheets/codemirror/addons/tern/tern.css +1 -0
- data/vendor/assets/stylesheets/codemirror/themes/3024-day.css +3 -2
- data/vendor/assets/stylesheets/codemirror/themes/3024-night.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/ambiance.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/base16-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/base16-light.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/blackboard.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/cobalt.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/dracula.css +87 -0
- data/vendor/assets/stylesheets/codemirror/themes/erlang-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/icecoder.css +42 -0
- data/vendor/assets/stylesheets/codemirror/themes/lesser-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/material.css +105 -0
- data/vendor/assets/stylesheets/codemirror/themes/mbo.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/mdn-like.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/midnight.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/monokai.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/night.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/paraiso-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/paraiso-light.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/pastel-on-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/rubyblue.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/seti.css +88 -0
- data/vendor/assets/stylesheets/codemirror/themes/solarized.css +3 -3
- data/vendor/assets/stylesheets/codemirror/themes/the-matrix.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/tomorrow-night-eighties.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/twilight.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/vibrant-ink.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/xq-dark.css +2 -2
- data/vendor/assets/stylesheets/codemirror/themes/yeti.css +86 -0
- metadata +8 -1
| @@ -216,7 +216,7 @@ | |
| 216 216 | 
             
                    var completion = data.completions[i], className = typeToIcon(completion.type);
         | 
| 217 217 | 
             
                    if (data.guess) className += " " + cls + "guess";
         | 
| 218 218 | 
             
                    completions.push({text: completion.name + after,
         | 
| 219 | 
            -
                                      displayText: completion.name,
         | 
| 219 | 
            +
                                      displayText: completion.displayName || completion.name,
         | 
| 220 220 | 
             
                                      className: className,
         | 
| 221 221 | 
             
                                      data: completion});
         | 
| 222 222 | 
             
                  }
         | 
| @@ -55,7 +55,9 @@ | |
| 55 55 | 
             
              cmds[map["Alt-Left"] = "goSubwordLeft"] = function(cm) { moveSubword(cm, -1); };
         | 
| 56 56 | 
             
              cmds[map["Alt-Right"] = "goSubwordRight"] = function(cm) { moveSubword(cm, 1); };
         | 
| 57 57 |  | 
| 58 | 
            -
               | 
| 58 | 
            +
              var scrollLineCombo = mac ? "Ctrl-Alt-" : "Ctrl-";
         | 
| 59 | 
            +
             | 
| 60 | 
            +
              cmds[map[scrollLineCombo + "Up"] = "scrollLineUp"] = function(cm) {
         | 
| 59 61 | 
             
                var info = cm.getScrollInfo();
         | 
| 60 62 | 
             
                if (!cm.somethingSelected()) {
         | 
| 61 63 | 
             
                  var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, "local");
         | 
| @@ -64,7 +66,7 @@ | |
| 64 66 | 
             
                }
         | 
| 65 67 | 
             
                cm.scrollTo(null, info.top - cm.defaultTextHeight());
         | 
| 66 68 | 
             
              };
         | 
| 67 | 
            -
              cmds[map[ | 
| 69 | 
            +
              cmds[map[scrollLineCombo + "Down"] = "scrollLineDown"] = function(cm) {
         | 
| 68 70 | 
             
                var info = cm.getScrollInfo();
         | 
| 69 71 | 
             
                if (!cm.somethingSelected()) {
         | 
| 70 72 | 
             
                  var visibleTopLine = cm.lineAtHeight(info.top, "local")+1;
         | 
| @@ -4308,7 +4308,7 @@ | |
| 4308 4308 | 
             
                          if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
         | 
| 4309 4309 | 
             
                          number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
         | 
| 4310 4310 | 
             
                        }
         | 
| 4311 | 
            -
                        if (args. | 
| 4311 | 
            +
                        if (args.match(/\/.*\//)) { return 'patterns not supported'; }
         | 
| 4312 4312 | 
             
                      }
         | 
| 4313 4313 | 
             
                    }
         | 
| 4314 4314 | 
             
                    var err = parseArgs();
         | 
| @@ -0,0 +1,85 @@ | |
| 1 | 
            +
            // CodeMirror, copyright (c) by Marijn Haverbeke and others
         | 
| 2 | 
            +
            // Distributed under an MIT license: http://codemirror.net/LICENSE
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            // Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            (function(mod) {
         | 
| 7 | 
            +
              if (typeof exports == "object" && typeof module == "object")
         | 
| 8 | 
            +
                mod(require("../../lib/codemirror"))
         | 
| 9 | 
            +
              else if (typeof define == "function" && define.amd)
         | 
| 10 | 
            +
                define(["../../lib/codemirror"], mod)
         | 
| 11 | 
            +
              else
         | 
| 12 | 
            +
                mod(CodeMirror)
         | 
| 13 | 
            +
            })(function(CodeMirror) {
         | 
| 14 | 
            +
              "use strict"
         | 
| 15 | 
            +
              var reserve = "><+-.,[]".split("");
         | 
| 16 | 
            +
              /*
         | 
| 17 | 
            +
              comments can be either:
         | 
| 18 | 
            +
              placed behind lines
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                    +++    this is a comment
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              where reserved characters cannot be used
         | 
| 23 | 
            +
              or in a loop
         | 
| 24 | 
            +
              [
         | 
| 25 | 
            +
                this is ok to use [ ] and stuff
         | 
| 26 | 
            +
              ]
         | 
| 27 | 
            +
              or preceded by #
         | 
| 28 | 
            +
              */
         | 
| 29 | 
            +
              CodeMirror.defineMode("brainfuck", function() {
         | 
| 30 | 
            +
                return {
         | 
| 31 | 
            +
                  startState: function() {
         | 
| 32 | 
            +
                    return {
         | 
| 33 | 
            +
                      commentLine: false,
         | 
| 34 | 
            +
                      left: 0,
         | 
| 35 | 
            +
                      right: 0,
         | 
| 36 | 
            +
                      commentLoop: false
         | 
| 37 | 
            +
                    }
         | 
| 38 | 
            +
                  },
         | 
| 39 | 
            +
                  token: function(stream, state) {
         | 
| 40 | 
            +
                    if (stream.eatSpace()) return null
         | 
| 41 | 
            +
                    if(stream.sol()){
         | 
| 42 | 
            +
                      state.commentLine = false;
         | 
| 43 | 
            +
                    }
         | 
| 44 | 
            +
                    var ch = stream.next().toString();
         | 
| 45 | 
            +
                    if(reserve.indexOf(ch) !== -1){
         | 
| 46 | 
            +
                      if(state.commentLine === true){
         | 
| 47 | 
            +
                        if(stream.eol()){
         | 
| 48 | 
            +
                          state.commentLine = false;
         | 
| 49 | 
            +
                        }
         | 
| 50 | 
            +
                        return "comment";
         | 
| 51 | 
            +
                      }
         | 
| 52 | 
            +
                      if(ch === "]" || ch === "["){
         | 
| 53 | 
            +
                        if(ch === "["){
         | 
| 54 | 
            +
                          state.left++;
         | 
| 55 | 
            +
                        }
         | 
| 56 | 
            +
                        else{
         | 
| 57 | 
            +
                          state.right++;
         | 
| 58 | 
            +
                        }
         | 
| 59 | 
            +
                        return "bracket";
         | 
| 60 | 
            +
                      }
         | 
| 61 | 
            +
                      else if(ch === "+" || ch === "-"){
         | 
| 62 | 
            +
                        return "keyword";
         | 
| 63 | 
            +
                      }
         | 
| 64 | 
            +
                      else if(ch === "<" || ch === ">"){
         | 
| 65 | 
            +
                        return "atom";
         | 
| 66 | 
            +
                      }
         | 
| 67 | 
            +
                      else if(ch === "." || ch === ","){
         | 
| 68 | 
            +
                        return "def";
         | 
| 69 | 
            +
                      }
         | 
| 70 | 
            +
                    }
         | 
| 71 | 
            +
                    else{
         | 
| 72 | 
            +
                      state.commentLine = true;
         | 
| 73 | 
            +
                      if(stream.eol()){
         | 
| 74 | 
            +
                        state.commentLine = false;
         | 
| 75 | 
            +
                      }
         | 
| 76 | 
            +
                      return "comment";
         | 
| 77 | 
            +
                    }
         | 
| 78 | 
            +
                    if(stream.eol()){
         | 
| 79 | 
            +
                      state.commentLine = false;
         | 
| 80 | 
            +
                    }
         | 
| 81 | 
            +
                  }
         | 
| 82 | 
            +
                };
         | 
| 83 | 
            +
              });
         | 
| 84 | 
            +
            CodeMirror.defineMIME("text/x-brainfuck","brainfuck")
         | 
| 85 | 
            +
            });
         | 
| @@ -588,4 +588,17 @@ CodeMirror.defineMode("clike", function(config, parserConfig) { | |
| 588 588 | 
             
                modeProps: {fold: "brace"}
         | 
| 589 589 | 
             
              });
         | 
| 590 590 |  | 
| 591 | 
            +
              def("text/x-squirrel", {
         | 
| 592 | 
            +
                name: "clike",
         | 
| 593 | 
            +
                keywords: words("base break clone continue const default delete enum extends function in class" +
         | 
| 594 | 
            +
                                " foreach local resume return this throw typeof yield constructor instanceof static"),
         | 
| 595 | 
            +
                types: words(cTypes),
         | 
| 596 | 
            +
                blockKeywords: words("case catch class else for foreach if switch try while"),
         | 
| 597 | 
            +
                defKeywords: words("function local class"),
         | 
| 598 | 
            +
                typeFirstDefinitions: true,
         | 
| 599 | 
            +
                atoms: words("true false null"),
         | 
| 600 | 
            +
                hooks: {"#": cppHook},
         | 
| 601 | 
            +
                modeProps: {fold: ["brace", "include"]}
         | 
| 602 | 
            +
              });
         | 
| 603 | 
            +
             | 
| 591 604 | 
             
            });
         | 
| @@ -273,6 +273,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) { | |
| 273 273 | 
             
                    override = "string-2";
         | 
| 274 274 | 
             
                  else if (valueKeywords.hasOwnProperty(word))
         | 
| 275 275 | 
             
                    override = "atom";
         | 
| 276 | 
            +
                  else if (colorKeywords.hasOwnProperty(word))
         | 
| 277 | 
            +
                    override = "keyword";
         | 
| 276 278 | 
             
                  else
         | 
| 277 279 | 
             
                    override = "error";
         | 
| 278 280 | 
             
                }
         | 
| @@ -220,8 +220,6 @@ CodeMirror.defineMode("erlang", function(cmCfg) { | |
| 220 220 | 
             
                    }else{
         | 
| 221 221 | 
             
                      return rval(state,stream,"function");
         | 
| 222 222 | 
             
                    }
         | 
| 223 | 
            -
                  }else if (is_member(w,operatorAtomWords)) {
         | 
| 224 | 
            -
                    return rval(state,stream,"operator");
         | 
| 225 223 | 
             
                  }else if (lookahead(stream) == ":") {
         | 
| 226 224 | 
             
                    if (w == "erlang") {
         | 
| 227 225 | 
             
                      return rval(state,stream,"builtin");
         | 
| @@ -230,8 +228,6 @@ CodeMirror.defineMode("erlang", function(cmCfg) { | |
| 230 228 | 
             
                    }
         | 
| 231 229 | 
             
                  }else if (is_member(w,["true","false"])) {
         | 
| 232 230 | 
             
                    return rval(state,stream,"boolean");
         | 
| 233 | 
            -
                  }else if (is_member(w,["true","false"])) {
         | 
| 234 | 
            -
                    return rval(state,stream,"boolean");
         | 
| 235 231 | 
             
                  }else{
         | 
| 236 232 | 
             
                    return rval(state,stream,"atom");
         | 
| 237 233 | 
             
                  }
         | 
| @@ -116,8 +116,9 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) { | |
| 116 116 | 
             
                markdownConfig[attr] = modeConfig[attr];
         | 
| 117 117 | 
             
              }
         | 
| 118 118 | 
             
              markdownConfig.name = "markdown";
         | 
| 119 | 
            -
              CodeMirror. | 
| 120 | 
            -
             | 
| 119 | 
            +
              return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
         | 
| 120 | 
            +
             | 
| 121 121 | 
             
            }, "markdown");
         | 
| 122 122 |  | 
| 123 | 
            +
              CodeMirror.defineMIME("text/x-gfm", "gfm");
         | 
| 123 124 | 
             
            });
         | 
| @@ -202,7 +202,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { | |
| 202 202 |  | 
| 203 203 | 
             
              function htmlBlock(stream, state) {
         | 
| 204 204 | 
             
                var style = htmlMode.token(stream, state.htmlState);
         | 
| 205 | 
            -
                if ((htmlFound && state.htmlState.tagStart === null && | 
| 205 | 
            +
                if ((htmlFound && state.htmlState.tagStart === null &&
         | 
| 206 | 
            +
                     (!state.htmlState.context && state.htmlState.tokenize.isInText)) ||
         | 
| 206 207 | 
             
                    (state.md_inside && stream.current().indexOf(">") > -1)) {
         | 
| 207 208 | 
             
                  state.f = inlineNormal;
         | 
| 208 209 | 
             
                  state.block = blockNormal;
         | 
| @@ -446,12 +447,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) { | |
| 446 447 | 
             
                  return type + linkemail;
         | 
| 447 448 | 
             
                }
         | 
| 448 449 |  | 
| 449 | 
            -
                if (ch === '<' && stream.match( | 
| 450 | 
            -
                   | 
| 451 | 
            -
             | 
| 452 | 
            -
                     | 
| 453 | 
            -
             | 
| 454 | 
            -
                    }
         | 
| 450 | 
            +
                if (ch === '<' && stream.match(/^(!--|\w)/, false)) {
         | 
| 451 | 
            +
                  var end = stream.string.indexOf(">", stream.pos);
         | 
| 452 | 
            +
                  if (end != -1) {
         | 
| 453 | 
            +
                    var atts = stream.string.substring(stream.start, end);
         | 
| 454 | 
            +
                    if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
         | 
| 455 455 | 
             
                  }
         | 
| 456 456 | 
             
                  stream.backUp(1);
         | 
| 457 457 | 
             
                  state.htmlState = CodeMirror.startState(htmlMode);
         | 
| @@ -37,7 +37,6 @@ CodeMirror.defineMode("ruby", function(config) { | |
| 37 37 | 
             
              }
         | 
| 38 38 |  | 
| 39 39 | 
             
              function tokenBase(stream, state) {
         | 
| 40 | 
            -
                curPunc = null;
         | 
| 41 40 | 
             
                if (stream.sol() && stream.match("=begin") && stream.eol()) {
         | 
| 42 41 | 
             
                  state.tokenize.push(readBlockComment);
         | 
| 43 42 | 
             
                  return "comment";
         | 
| @@ -232,6 +231,7 @@ CodeMirror.defineMode("ruby", function(config) { | |
| 232 231 | 
             
                },
         | 
| 233 232 |  | 
| 234 233 | 
             
                token: function(stream, state) {
         | 
| 234 | 
            +
                  curPunc = null;
         | 
| 235 235 | 
             
                  if (stream.sol()) state.indented = stream.indentation();
         | 
| 236 236 | 
             
                  var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
         | 
| 237 237 | 
             
                  var thisTok = curPunc;
         | 
| @@ -26,7 +26,7 @@ CodeMirror.defineMode("rust", function() { | |
| 26 26 | 
             
              };
         | 
| 27 27 | 
             
              var typeKeywords = function() {
         | 
| 28 28 | 
             
                var keywords = {"fn": "fn", "block": "fn", "obj": "obj"};
         | 
| 29 | 
            -
                var atoms = "bool  | 
| 29 | 
            +
                var atoms = "bool i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 str char isize usize".split(" ");
         | 
| 30 30 | 
             
                for (var i = 0, e = atoms.length; i < e; ++i) keywords[atoms[i]] = "atom";
         | 
| 31 31 | 
             
                return keywords;
         | 
| 32 32 | 
             
              }();
         | 
| @@ -0,0 +1,189 @@ | |
| 1 | 
            +
            // CodeMirror, copyright (c) by Marijn Haverbeke and others
         | 
| 2 | 
            +
            // Distributed under an MIT license: http://codemirror.net/LICENSE
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            // Originall written by Alf Nielsen, re-written by Michael Zhou
         | 
| 5 | 
            +
            (function(mod) {
         | 
| 6 | 
            +
              if (typeof exports == "object" && typeof module == "object") // CommonJS
         | 
| 7 | 
            +
                mod(require("../../lib/codemirror"));
         | 
| 8 | 
            +
              else if (typeof define == "function" && define.amd) // AMD
         | 
| 9 | 
            +
                define(["../../lib/codemirror"], mod);
         | 
| 10 | 
            +
              else // Plain browser env
         | 
| 11 | 
            +
                mod(CodeMirror);
         | 
| 12 | 
            +
            })(function(CodeMirror) {
         | 
| 13 | 
            +
            "use strict";
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            function words(str) {
         | 
| 16 | 
            +
              var obj = {}, words = str.split(",");
         | 
| 17 | 
            +
              for (var i = 0; i < words.length; ++i) {
         | 
| 18 | 
            +
                var allCaps = words[i].toUpperCase();
         | 
| 19 | 
            +
                var firstCap = words[i].charAt(0).toUpperCase() + words[i].slice(1);
         | 
| 20 | 
            +
                obj[words[i]] = true;
         | 
| 21 | 
            +
                obj[allCaps] = true;
         | 
| 22 | 
            +
                obj[firstCap] = true;
         | 
| 23 | 
            +
              }
         | 
| 24 | 
            +
              return obj;
         | 
| 25 | 
            +
            }
         | 
| 26 | 
            +
             | 
| 27 | 
            +
            function metaHook(stream) {
         | 
| 28 | 
            +
              stream.eatWhile(/[\w\$_]/);
         | 
| 29 | 
            +
              return "meta";
         | 
| 30 | 
            +
            }
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            CodeMirror.defineMode("vhdl", function(config, parserConfig) {
         | 
| 33 | 
            +
              var indentUnit = config.indentUnit,
         | 
| 34 | 
            +
                  atoms = parserConfig.atoms || words("null"),
         | 
| 35 | 
            +
                  hooks = parserConfig.hooks || {"`": metaHook, "$": metaHook},
         | 
| 36 | 
            +
                  multiLineStrings = parserConfig.multiLineStrings;
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
         | 
| 39 | 
            +
                  "body,buffer,bus,case,component,configuration,constant,disconnent,downto,else,elsif,end,end block,end case," +
         | 
| 40 | 
            +
                  "end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for," +
         | 
| 41 | 
            +
                  "function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage," +
         | 
| 42 | 
            +
                  "literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map," +
         | 
| 43 | 
            +
                  "postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal," +
         | 
| 44 | 
            +
                  "sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor");
         | 
| 45 | 
            +
             | 
| 46 | 
            +
              var blockKeywords = words("architecture,entity,begin,case,port,else,elsif,end,for,function,if");
         | 
| 47 | 
            +
             | 
| 48 | 
            +
              var isOperatorChar = /[&|~><!\)\(*#%@+\/=?\:;}{,\.\^\-\[\]]/;
         | 
| 49 | 
            +
              var curPunc;
         | 
| 50 | 
            +
             | 
| 51 | 
            +
              function tokenBase(stream, state) {
         | 
| 52 | 
            +
                var ch = stream.next();
         | 
| 53 | 
            +
                if (hooks[ch]) {
         | 
| 54 | 
            +
                  var result = hooks[ch](stream, state);
         | 
| 55 | 
            +
                  if (result !== false) return result;
         | 
| 56 | 
            +
                }
         | 
| 57 | 
            +
                if (ch == '"') {
         | 
| 58 | 
            +
                  state.tokenize = tokenString2(ch);
         | 
| 59 | 
            +
                  return state.tokenize(stream, state);
         | 
| 60 | 
            +
                }
         | 
| 61 | 
            +
                if (ch == "'") {
         | 
| 62 | 
            +
                  state.tokenize = tokenString(ch);
         | 
| 63 | 
            +
                  return state.tokenize(stream, state);
         | 
| 64 | 
            +
                }
         | 
| 65 | 
            +
                if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
         | 
| 66 | 
            +
                  curPunc = ch;
         | 
| 67 | 
            +
                  return null;
         | 
| 68 | 
            +
                }
         | 
| 69 | 
            +
                if (/[\d']/.test(ch)) {
         | 
| 70 | 
            +
                  stream.eatWhile(/[\w\.']/);
         | 
| 71 | 
            +
                  return "number";
         | 
| 72 | 
            +
                }
         | 
| 73 | 
            +
                if (ch == "-") {
         | 
| 74 | 
            +
                  if (stream.eat("-")) {
         | 
| 75 | 
            +
                    stream.skipToEnd();
         | 
| 76 | 
            +
                    return "comment";
         | 
| 77 | 
            +
                  }
         | 
| 78 | 
            +
                }
         | 
| 79 | 
            +
                if (isOperatorChar.test(ch)) {
         | 
| 80 | 
            +
                  stream.eatWhile(isOperatorChar);
         | 
| 81 | 
            +
                  return "operator";
         | 
| 82 | 
            +
                }
         | 
| 83 | 
            +
                stream.eatWhile(/[\w\$_]/);
         | 
| 84 | 
            +
                var cur = stream.current();
         | 
| 85 | 
            +
                if (keywords.propertyIsEnumerable(cur.toLowerCase())) {
         | 
| 86 | 
            +
                  if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
         | 
| 87 | 
            +
                  return "keyword";
         | 
| 88 | 
            +
                }
         | 
| 89 | 
            +
                if (atoms.propertyIsEnumerable(cur)) return "atom";
         | 
| 90 | 
            +
                return "variable";
         | 
| 91 | 
            +
              }
         | 
| 92 | 
            +
             | 
| 93 | 
            +
              function tokenString(quote) {
         | 
| 94 | 
            +
                return function(stream, state) {
         | 
| 95 | 
            +
                  var escaped = false, next, end = false;
         | 
| 96 | 
            +
                  while ((next = stream.next()) != null) {
         | 
| 97 | 
            +
                    if (next == quote && !escaped) {end = true; break;}
         | 
| 98 | 
            +
                    escaped = !escaped && next == "--";
         | 
| 99 | 
            +
                  }
         | 
| 100 | 
            +
                  if (end || !(escaped || multiLineStrings))
         | 
| 101 | 
            +
                    state.tokenize = tokenBase;
         | 
| 102 | 
            +
                  return "string";
         | 
| 103 | 
            +
                };
         | 
| 104 | 
            +
              }
         | 
| 105 | 
            +
              function tokenString2(quote) {
         | 
| 106 | 
            +
                return function(stream, state) {
         | 
| 107 | 
            +
                  var escaped = false, next, end = false;
         | 
| 108 | 
            +
                  while ((next = stream.next()) != null) {
         | 
| 109 | 
            +
                    if (next == quote && !escaped) {end = true; break;}
         | 
| 110 | 
            +
                    escaped = !escaped && next == "--";
         | 
| 111 | 
            +
                  }
         | 
| 112 | 
            +
                  if (end || !(escaped || multiLineStrings))
         | 
| 113 | 
            +
                    state.tokenize = tokenBase;
         | 
| 114 | 
            +
                  return "string-2";
         | 
| 115 | 
            +
                };
         | 
| 116 | 
            +
              }
         | 
| 117 | 
            +
             | 
| 118 | 
            +
              function Context(indented, column, type, align, prev) {
         | 
| 119 | 
            +
                this.indented = indented;
         | 
| 120 | 
            +
                this.column = column;
         | 
| 121 | 
            +
                this.type = type;
         | 
| 122 | 
            +
                this.align = align;
         | 
| 123 | 
            +
                this.prev = prev;
         | 
| 124 | 
            +
              }
         | 
| 125 | 
            +
              function pushContext(state, col, type) {
         | 
| 126 | 
            +
                return state.context = new Context(state.indented, col, type, null, state.context);
         | 
| 127 | 
            +
              }
         | 
| 128 | 
            +
              function popContext(state) {
         | 
| 129 | 
            +
                var t = state.context.type;
         | 
| 130 | 
            +
                if (t == ")" || t == "]" || t == "}")
         | 
| 131 | 
            +
                  state.indented = state.context.indented;
         | 
| 132 | 
            +
                return state.context = state.context.prev;
         | 
| 133 | 
            +
              }
         | 
| 134 | 
            +
             | 
| 135 | 
            +
              // Interface
         | 
| 136 | 
            +
              return {
         | 
| 137 | 
            +
                startState: function(basecolumn) {
         | 
| 138 | 
            +
                  return {
         | 
| 139 | 
            +
                    tokenize: null,
         | 
| 140 | 
            +
                    context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
         | 
| 141 | 
            +
                    indented: 0,
         | 
| 142 | 
            +
                    startOfLine: true
         | 
| 143 | 
            +
                  };
         | 
| 144 | 
            +
                },
         | 
| 145 | 
            +
             | 
| 146 | 
            +
                token: function(stream, state) {
         | 
| 147 | 
            +
                  var ctx = state.context;
         | 
| 148 | 
            +
                  if (stream.sol()) {
         | 
| 149 | 
            +
                    if (ctx.align == null) ctx.align = false;
         | 
| 150 | 
            +
                    state.indented = stream.indentation();
         | 
| 151 | 
            +
                    state.startOfLine = true;
         | 
| 152 | 
            +
                  }
         | 
| 153 | 
            +
                  if (stream.eatSpace()) return null;
         | 
| 154 | 
            +
                  curPunc = null;
         | 
| 155 | 
            +
                  var style = (state.tokenize || tokenBase)(stream, state);
         | 
| 156 | 
            +
                  if (style == "comment" || style == "meta") return style;
         | 
| 157 | 
            +
                  if (ctx.align == null) ctx.align = true;
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                  if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
         | 
| 160 | 
            +
                  else if (curPunc == "{") pushContext(state, stream.column(), "}");
         | 
| 161 | 
            +
                  else if (curPunc == "[") pushContext(state, stream.column(), "]");
         | 
| 162 | 
            +
                  else if (curPunc == "(") pushContext(state, stream.column(), ")");
         | 
| 163 | 
            +
                  else if (curPunc == "}") {
         | 
| 164 | 
            +
                    while (ctx.type == "statement") ctx = popContext(state);
         | 
| 165 | 
            +
                    if (ctx.type == "}") ctx = popContext(state);
         | 
| 166 | 
            +
                    while (ctx.type == "statement") ctx = popContext(state);
         | 
| 167 | 
            +
                  }
         | 
| 168 | 
            +
                  else if (curPunc == ctx.type) popContext(state);
         | 
| 169 | 
            +
                  else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
         | 
| 170 | 
            +
                    pushContext(state, stream.column(), "statement");
         | 
| 171 | 
            +
                  state.startOfLine = false;
         | 
| 172 | 
            +
                  return style;
         | 
| 173 | 
            +
                },
         | 
| 174 | 
            +
             | 
| 175 | 
            +
                indent: function(state, textAfter) {
         | 
| 176 | 
            +
                  if (state.tokenize != tokenBase && state.tokenize != null) return 0;
         | 
| 177 | 
            +
                  var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
         | 
| 178 | 
            +
                  if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
         | 
| 179 | 
            +
                  else if (ctx.align) return ctx.column + (closing ? 0 : 1);
         | 
| 180 | 
            +
                  else return ctx.indented + (closing ? 0 : indentUnit);
         | 
| 181 | 
            +
                },
         | 
| 182 | 
            +
             | 
| 183 | 
            +
                electricChars: "{}"
         | 
| 184 | 
            +
              };
         | 
| 185 | 
            +
            });
         | 
| 186 | 
            +
             | 
| 187 | 
            +
            CodeMirror.defineMIME("text/x-vhdl", "vhdl");
         | 
| 188 | 
            +
             | 
| 189 | 
            +
            });
         |