Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

codemirror

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codemirror - npm Package Compare versions

Comparing version 5.0.0 to 5.1.0

mode/asciiarmor/asciiarmor.js

4

addon/dialog/dialog.js

@@ -61,3 +61,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

inp.value = options.value;
inp.select();
if (options.selectValueOnOpen !== false) {
inp.select();
}
}

@@ -64,0 +66,0 @@

@@ -12,6 +12,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

})(function(CodeMirror) {
var DEFAULT_BRACKETS = "()[]{}''\"\"";
var DEFAULT_TRIPLES = "'\"";
var DEFAULT_EXPLODE_ON_ENTER = "[]{}";
var SPACE_CHAR_REGEX = /\s/;
var defaults = {
pairs: "()[]{}''\"\"",
triples: "",
explode: "[]{}"
};

@@ -21,17 +22,144 @@ var Pos = CodeMirror.Pos;

CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
if (old != CodeMirror.Init && old)
cm.removeKeyMap("autoCloseBrackets");
if (!val) return;
var pairs = DEFAULT_BRACKETS, triples = DEFAULT_TRIPLES, explode = DEFAULT_EXPLODE_ON_ENTER;
if (typeof val == "string") pairs = val;
else if (typeof val == "object") {
if (val.pairs != null) pairs = val.pairs;
if (val.triples != null) triples = val.triples;
if (val.explode != null) explode = val.explode;
if (old && old != CodeMirror.Init) {
cm.removeKeyMap(keyMap);
cm.state.closeBrackets = null;
}
var map = buildKeymap(pairs, triples);
if (explode) map.Enter = buildExplodeHandler(explode);
cm.addKeyMap(map);
if (val) {
cm.state.closeBrackets = val;
cm.addKeyMap(keyMap);
}
});
function getOption(conf, name) {
if (name == "pairs" && typeof conf == "string") return conf;
if (typeof conf == "object" && conf[name] != null) return conf[name];
return defaults[name];
}
var bind = defaults.pairs + "`";
var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
for (var i = 0; i < bind.length; i++)
keyMap["'" + bind.charAt(i) + "'"] = handler(bind.charAt(i));
function handler(ch) {
return function(cm) { return handleChar(cm, ch); };
}
function getConfig(cm) {
var deflt = cm.state.closeBrackets;
if (!deflt) return null;
var mode = cm.getModeAt(cm.getCursor());
return mode.closeBrackets || deflt;
}
function handleBackspace(cm) {
var conf = getConfig(cm);
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
var pairs = getOption(conf, "pairs");
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var around = charsAround(cm, ranges[i].head);
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
for (var i = ranges.length - 1; i >= 0; i--) {
var cur = ranges[i].head;
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
}
}
function handleEnter(cm) {
var conf = getConfig(cm);
var explode = conf && getOption(conf, "explode");
if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var around = charsAround(cm, ranges[i].head);
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
cm.operation(function() {
cm.replaceSelection("\n\n", null);
cm.execCommand("goCharLeft");
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var line = ranges[i].head.line;
cm.indentLine(line, null, true);
cm.indentLine(line + 1, null, true);
}
});
}
function handleChar(cm, ch) {
var conf = getConfig(cm);
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
var pairs = getOption(conf, "pairs");
var pos = pairs.indexOf(ch);
if (pos == -1) return CodeMirror.Pass;
var triples = getOption(conf, "triples");
var identical = pairs.charAt(pos + 1) == ch;
var ranges = cm.listSelections();
var opening = pos % 2 == 0;
var type, next;
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i], cur = range.head, curType;
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
if (opening && !range.empty()) {
curType = "surround";
} else if ((identical || !opening) && next == ch) {
if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
curType = "skipThree";
else
curType = "skip";
} else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch &&
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != ch)) {
curType = "addFour";
} else if (identical) {
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, ch)) curType = "both";
else return CodeMirror.Pass;
} else if (opening && (cm.getLine(cur.line).length == cur.ch ||
isClosingBracket(next, pairs) ||
/\s/.test(next))) {
curType = "both";
} else {
return CodeMirror.Pass;
}
if (!type) type = curType;
else if (type != curType) return CodeMirror.Pass;
}
var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
var right = pos % 2 ? ch : pairs.charAt(pos + 1);
cm.operation(function() {
if (type == "skip") {
cm.execCommand("goCharRight");
} else if (type == "skipThree") {
for (var i = 0; i < 3; i++)
cm.execCommand("goCharRight");
} else if (type == "surround") {
var sels = cm.getSelections();
for (var i = 0; i < sels.length; i++)
sels[i] = left + sels[i] + right;
cm.replaceSelections(sels, "around");
} else if (type == "both") {
cm.replaceSelection(left + right, null);
cm.execCommand("goCharLeft");
} else if (type == "addFour") {
cm.replaceSelection(left + left + left + left, "before");
cm.execCommand("goCharRight");
}
});
}
function isClosingBracket(ch, pairs) {
var pos = pairs.lastIndexOf(ch);
return pos > -1 && pos % 2 == 1;
}
function charsAround(cm, pos) {

@@ -58,107 +186,2 @@ var str = cm.getRange(Pos(pos.line, pos.ch - 1),

}
function buildKeymap(pairs, triples) {
var map = {
name : "autoCloseBrackets",
Backspace: function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var around = charsAround(cm, ranges[i].head);
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
for (var i = ranges.length - 1; i >= 0; i--) {
var cur = ranges[i].head;
cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1));
}
}
};
var closingBrackets = "";
for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
closingBrackets += right;
map["'" + left + "'"] = function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections(), type, next;
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i], cur = range.head, curType;
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
if (!range.empty()) {
curType = "surround";
} else if (left == right && next == right) {
if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left)
curType = "skipThree";
else
curType = "skip";
} else if (left == right && cur.ch > 1 && triples.indexOf(left) >= 0 &&
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left &&
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) {
curType = "addFour";
} else if (left == '"' || left == "'") {
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both";
else return CodeMirror.Pass;
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) {
curType = "both";
} else {
return CodeMirror.Pass;
}
if (!type) type = curType;
else if (type != curType) return CodeMirror.Pass;
}
cm.operation(function() {
if (type == "skip") {
cm.execCommand("goCharRight");
} else if (type == "skipThree") {
for (var i = 0; i < 3; i++)
cm.execCommand("goCharRight");
} else if (type == "surround") {
var sels = cm.getSelections();
for (var i = 0; i < sels.length; i++)
sels[i] = left + sels[i] + right;
cm.replaceSelections(sels, "around");
} else if (type == "both") {
cm.replaceSelection(left + right, null);
cm.execCommand("goCharLeft");
} else if (type == "addFour") {
cm.replaceSelection(left + left + left + left, "before");
cm.execCommand("goCharRight");
}
});
};
if (left != right) map["'" + right + "'"] = function(cm) {
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var range = ranges[i];
if (!range.empty() ||
cm.getRange(range.head, Pos(range.head.line, range.head.ch + 1)) != right)
return CodeMirror.Pass;
}
cm.execCommand("goCharRight");
};
})(pairs.charAt(i), pairs.charAt(i + 1));
return map;
}
function buildExplodeHandler(pairs) {
return function(cm) {
if (cm.getOption("disableInput")) return CodeMirror.Pass;
var ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
if (!ranges[i].empty()) return CodeMirror.Pass;
var around = charsAround(cm, ranges[i].head);
if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
cm.operation(function() {
cm.replaceSelection("\n\n", null);
cm.execCommand("goCharLeft");
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
var line = ranges[i].head.line;
cm.indentLine(line, null, true);
cm.indentLine(line + 1, null, true);
}
});
};
}
});

@@ -55,3 +55,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

for (var i = 0; i < marks.length; ++i)
if (marks[i].__isFold && marks[i].find().from.line == line) return true;
if (marks[i].__isFold && marks[i].find().from.line == line) return marks[i];
}

@@ -102,3 +102,5 @@

if (gutter != opts.gutter) return;
cm.foldCode(Pos(line, 0), opts.rangeFinder);
var folded = isFolded(cm, line);
if (folded) folded.clear();
else cm.foldCode(Pos(line, 0), opts.rangeFinder);
}

@@ -105,0 +107,0 @@

@@ -23,2 +23,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (token.type == "keyword" && "!important".indexOf(token.string) == 0)
return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),
to: CodeMirror.Pos(cur.line, token.end)};
var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);

@@ -25,0 +29,0 @@ if (/[^\w$_-]/.test(word)) {

@@ -55,8 +55,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (!wordlist.hasOwnProperty(word)) continue;
if (Array.isArray(wordlist)) {
word = wordlist[word];
}
if (match(search, word)) {
result.push(formatter(word));
}
if (wordlist.slice) word = wordlist[word];
if (match(search, word)) result.push(formatter(word));
}

@@ -124,3 +121,3 @@ }

var columns = getItem(tables, table);
if (columns && Array.isArray(tables) && columns.columns)
if (columns && columns.columns)
columns = columns.columns;

@@ -213,5 +210,13 @@

var defaultTableName = options && options.defaultTable;
defaultTable = (defaultTableName && getItem(tables, defaultTableName)) || [];
defaultTable = defaultTableName && getItem(tables, defaultTableName);
keywords = keywords || getKeywords(editor);
if (defaultTableName && !defaultTable)
defaultTable = findTableByAlias(defaultTableName, editor);
defaultTable = defaultTable || [];
if (defaultTable.columns)
defaultTable = defaultTable.columns;
var cur = editor.getCursor();

@@ -218,0 +223,0 @@ var result = [];

@@ -166,2 +166,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

var state = cm.state.lint;
if (!state) return;
clearTimeout(state.timeout);

@@ -192,2 +193,3 @@ state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);

CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
clearTimeout(cm.state.lint.timeout);
delete cm.state.lint;

@@ -194,0 +196,0 @@ }

@@ -40,3 +40,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

this.edit = this.mv.edit;
(this.edit.state.diffViews || (this.edit.state.diffViews = [])).push(this);
this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: !this.mv.options.allowEditingOriginals}, copyObj(options)));
this.orig.state.diffViews = [this];

@@ -736,2 +738,40 @@ this.diff = getDiff(asString(orig), asString(options.value));

function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
function findPrevDiff(chunks, start, isOrig) {
for (var i = chunks.length - 1; i >= 0; i--) {
var chunk = chunks[i];
var to = (isOrig ? chunk.origTo : chunk.editTo) - 1;
if (to < start) return to;
}
}
function findNextDiff(chunks, start, isOrig) {
for (var i = 0; i < chunks.length; i++) {
var chunk = chunks[i];
var from = (isOrig ? chunk.origFrom : chunk.editFrom);
if (from > start) return from;
}
}
function goNearbyDiff(cm, dir) {
var found = null, views = cm.state.diffViews, line = cm.getCursor().line;
if (views) for (var i = 0; i < views.length; i++) {
var dv = views[i], isOrig = cm == dv.orig;
ensureDiff(dv);
var pos = dir < 0 ? findPrevDiff(dv.chunks, line, isOrig) : findNextDiff(dv.chunks, line, isOrig);
if (pos != null && (found == null || (dir < 0 ? pos > found : pos < found)))
found = pos;
}
if (found != null)
cm.setCursor(found, 0);
else
return CodeMirror.Pass;
}
CodeMirror.commands.goNextDiff = function(cm) {
return goNearbyDiff(cm, 1);
};
CodeMirror.commands.goPrevDiff = function(cm) {
return goNearbyDiff(cm, -1);
};
});

@@ -72,2 +72,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

var minButtonSize = 10;
Bar.prototype.update = function(scrollSize, clientSize, barSize) {

@@ -78,5 +80,9 @@ this.screen = clientSize;

// FIXME clip to min size?
var buttonSize = this.screen * (this.size / this.total);
if (buttonSize < minButtonSize) {
this.size -= minButtonSize - buttonSize;
buttonSize = minButtonSize;
}
this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
this.screen * (this.size / this.total) + "px";
buttonSize + "px";
this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =

@@ -83,0 +89,0 @@ this.pos * (this.size / this.total) + "px";

@@ -446,3 +446,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (tok.start < pos.ch && (tok.type == "comment" || tok.type == "string")) return false;
return /\w/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
}

@@ -449,0 +449,0 @@

{
"name": "codemirror",
"version":"5.0.0",
"version":"5.1.0",
"main": ["lib/codemirror.js", "lib/codemirror.css"],

@@ -5,0 +5,0 @@ "ignore": [

@@ -412,2 +412,15 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

cmds[map["Backspace"] = "smartBackspace"] = function(cm) {
if (cm.somethingSelected()) return CodeMirror.Pass;
var cursor = cm.getCursor();
var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);
var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize"));
if (!/\S/.test(toStartOfLine) && column % cm.getOption("indentUnit") == 0)
return cm.indentSelection("subtract");
else
return CodeMirror.Pass;
};
cmds[map[cK + ctrl + "K"] = "delLineRight"] = function(cm) {

@@ -414,0 +427,0 @@ cm.operation(function() {

@@ -406,3 +406,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

}
}
},
modeProps: {closeBrackets: {triples: '"'}}
});

@@ -409,0 +410,0 @@

@@ -237,2 +237,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

closeBrackets: {pairs: "()[]{}\"\""},
lineComment: ";;"

@@ -239,0 +240,0 @@ };

@@ -114,2 +114,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

closeBrackets: {pairs: "()[]{}\"\""},
lineComment: ";;",

@@ -116,0 +117,0 @@ blockCommentStart: "#|",

@@ -242,2 +242,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (type == "(") return pushContext(state, stream, "parens");
if (type == "interpolation") return pushContext(state, stream, "interpolation");
if (type == "word") wordAsValue(stream);

@@ -244,0 +245,0 @@ return "parens";

@@ -220,2 +220,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

electricChars: "{}",
closeBrackets: {triples: "'\""},
fold: "brace"

@@ -222,0 +223,0 @@ };

@@ -6,82 +6,24 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"));
mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
require("../../addon/mode/multiplex"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod);
define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
"../../addon/mode/multiplex"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
"use strict";
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
});
}, "htmlmixed");
//config settings
var scriptStartRegex = parserConfig.scriptStartRegex || /^<%/i,
scriptEndRegex = parserConfig.scriptEndRegex || /^%>/i;
//inner modes
var scriptingMode, htmlMixedMode;
//tokenizer when in html mode
function htmlDispatch(stream, state) {
if (stream.match(scriptStartRegex, false)) {
state.token=scriptingDispatch;
return scriptingMode.token(stream, state.scriptState);
}
else
return htmlMixedMode.token(stream, state.htmlState);
}
//tokenizer when in scripting mode
function scriptingDispatch(stream, state) {
if (stream.match(scriptEndRegex, false)) {
state.token=htmlDispatch;
return htmlMixedMode.token(stream, state.htmlState);
}
else
return scriptingMode.token(stream, state.scriptState);
}
return {
startState: function() {
scriptingMode = scriptingMode || CodeMirror.getMode(config, parserConfig.scriptingModeSpec);
htmlMixedMode = htmlMixedMode || CodeMirror.getMode(config, "htmlmixed");
return {
token : parserConfig.startOpen ? scriptingDispatch : htmlDispatch,
htmlState : CodeMirror.startState(htmlMixedMode),
scriptState : CodeMirror.startState(scriptingMode)
};
},
token: function(stream, state) {
return state.token(stream, state);
},
indent: function(state, textAfter) {
if (state.token == htmlDispatch)
return htmlMixedMode.indent(state.htmlState, textAfter);
else if (scriptingMode.indent)
return scriptingMode.indent(state.scriptState, textAfter);
},
copyState: function(state) {
return {
token : state.token,
htmlState : CodeMirror.copyState(htmlMixedMode, state.htmlState),
scriptState : CodeMirror.copyState(scriptingMode, state.scriptState)
};
},
innerMode: function(state) {
if (state.token == scriptingDispatch) return {state: state.scriptState, mode: scriptingMode};
else return {state: state.htmlState, mode: htmlMixedMode};
}
};
}, "htmlmixed");
CodeMirror.defineMIME("application/x-ejs", { name: "htmlembedded", scriptingModeSpec:"javascript"});
CodeMirror.defineMIME("application/x-aspx", { name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
CodeMirror.defineMIME("application/x-jsp", { name: "htmlembedded", scriptingModeSpec:"text/x-java"});
CodeMirror.defineMIME("application/x-erb", { name: "htmlembedded", scriptingModeSpec:"ruby"});
CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
});

@@ -552,2 +552,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if (type == "variable" || cx.style == "keyword") {
if (value == "static") {
cx.marked = "keyword";
return cont(classBody);
}
cx.marked = "property";

@@ -673,2 +677,3 @@ if (value == "get" || value == "set") return cont(classGetterSetter, functiondef, classBody);

fold: "brace",
closeBrackets: "()[]{}''\"\"``",

@@ -675,0 +680,0 @@ helperType: jsonMode ? "json" : "javascript",

@@ -274,2 +274,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

closeBrackets: {triples: "'\""},
electricChars: "{}"

@@ -276,0 +277,0 @@ };

@@ -16,2 +16,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

{name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
{name: "PGP", mimes: ["application/pgp", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["pgp"]},
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},

@@ -23,2 +24,3 @@ {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]},

{name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]},
{name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists.txt$/},
{name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},

@@ -109,3 +111,2 @@ {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},

{name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
{name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"},
{name: "Solr", mime: "text/x-solr", mode: "solr"},

@@ -126,2 +127,3 @@ {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},

{name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
{name: "troff", mime: "troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
{name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},

@@ -135,3 +137,3 @@ {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},

{name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
{name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]},
{name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
{name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]}

@@ -138,0 +140,0 @@ ];

@@ -88,3 +88,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

var cur = stream.current();
return words[cur] || 'variable';
return words.hasOwnProperty(cur) ? words[cur] : 'variable';
}

@@ -91,0 +91,0 @@

@@ -54,3 +54,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

} else if (ch === "\\" && state.position === "quote") {
if (stream.next() !== "u") { // u = Unicode sequence \u1234
if (stream.eol()) { // end of line?
// Multiline value

@@ -57,0 +57,0 @@ state.nextMultiline = true;

@@ -342,2 +342,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

closeBrackets: {triples: "'\""},
lineComment: "#",

@@ -344,0 +345,0 @@ fold: "indent"

@@ -235,3 +235,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
return "propery";
return "property";
}

@@ -238,0 +238,0 @@ else if(stream.match(/ *:/,false)){

@@ -242,2 +242,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

closeBrackets: {pairs: "()[]{}\"\""},
lineComment: ";;"

@@ -244,0 +245,0 @@ };

@@ -16,88 +16,72 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("smarty", function(config) {
"use strict";
// our default settings; check to see if they're overridden
var settings = {
rightDelimiter: '}',
leftDelimiter: '{',
smartyVersion: 2 // for backward compatibility
};
if (config.hasOwnProperty("leftDelimiter")) {
settings.leftDelimiter = config.leftDelimiter;
}
if (config.hasOwnProperty("rightDelimiter")) {
settings.rightDelimiter = config.rightDelimiter;
}
if (config.hasOwnProperty("smartyVersion") && config.smartyVersion === 3) {
settings.smartyVersion = 3;
}
CodeMirror.defineMode("smarty", function(config, parserConf) {
var rightDelimiter = parserConf.rightDelimiter || "}";
var leftDelimiter = parserConf.leftDelimiter || "{";
var version = parserConf.version || 2;
var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null");
var keyFunctions = ["debug", "extends", "function", "include", "literal"];
var last;
var regs = {
operatorChars: /[+\-*&%=<>!?]/,
validIdentifier: /[a-zA-Z0-9_]/,
stringChar: /['"]/
};
var keyFunctions = ["debug", "extends", "function", "include", "literal"];
var regs = {
operatorChars: /[+\-*&%=<>!?]/,
validIdentifier: /[a-zA-Z0-9_]/,
stringChar: /['"]/
};
var helpers = {
cont: function(style, lastType) {
var last;
function cont(style, lastType) {
last = lastType;
return style;
},
chain: function(stream, state, parser) {
}
function chain(stream, state, parser) {
state.tokenize = parser;
return parser(stream, state);
}
};
// Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
function doesNotCount(stream, pos) {
if (pos == null) pos = stream.pos;
return version === 3 && leftDelimiter == "{" &&
(pos == stream.string.length || /\s/.test(stream.string.charAt(pos)));
}
// our various parsers
var parsers = {
// the main tokenizer
tokenizer: function(stream, state) {
if (stream.match(settings.leftDelimiter, true)) {
function tokenTop(stream, state) {
if (stream.match(leftDelimiter, true)) {
if (stream.eat("*")) {
return helpers.chain(stream, state, parsers.inBlock("comment", "*" + settings.rightDelimiter));
} else {
// Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter));
} else if (!doesNotCount(stream)) {
state.depth++;
var isEol = stream.eol();
var isFollowedByWhitespace = /\s/.test(stream.peek());
if (settings.smartyVersion === 3 && settings.leftDelimiter === "{" && (isEol || isFollowedByWhitespace)) {
state.depth--;
return null;
} else {
state.tokenize = parsers.smarty;
last = "startTag";
return "tag";
}
state.tokenize = tokenSmarty;
last = "startTag";
return "tag";
}
} else {
stream.next();
return null;
}
},
var token = baseMode.token(stream, state.base);
var text = stream.current();
var found = text.indexOf(leftDelimiter);
if (found > -1 && !doesNotCount(stream, stream.start + found + 1))
stream.backUp(text.length - found);
return token;
}
// parsing Smarty content
smarty: function(stream, state) {
if (stream.match(settings.rightDelimiter, true)) {
if (settings.smartyVersion === 3) {
function tokenSmarty(stream, state) {
if (stream.match(rightDelimiter, true)) {
if (version === 3) {
state.depth--;
if (state.depth <= 0) {
state.tokenize = parsers.tokenizer;
state.tokenize = tokenTop;
}
} else {
state.tokenize = parsers.tokenizer;
state.tokenize = tokenTop;
}
return helpers.cont("tag", null);
return cont("tag", null);
}
if (stream.match(settings.leftDelimiter, true)) {
if (stream.match(leftDelimiter, true)) {
state.depth++;
return helpers.cont("tag", "startTag");
return cont("tag", "startTag");
}

@@ -108,20 +92,20 @@

stream.eatWhile(regs.validIdentifier);
return helpers.cont("variable-2", "variable");
return cont("variable-2", "variable");
} else if (ch == "|") {
return helpers.cont("operator", "pipe");
return cont("operator", "pipe");
} else if (ch == ".") {
return helpers.cont("operator", "property");
return cont("operator", "property");
} else if (regs.stringChar.test(ch)) {
state.tokenize = parsers.inAttribute(ch);
return helpers.cont("string", "string");
state.tokenize = tokenAttribute(ch);
return cont("string", "string");
} else if (regs.operatorChars.test(ch)) {
stream.eatWhile(regs.operatorChars);
return helpers.cont("operator", "operator");
return cont("operator", "operator");
} else if (ch == "[" || ch == "]") {
return helpers.cont("bracket", "bracket");
return cont("bracket", "bracket");
} else if (ch == "(" || ch == ")") {
return helpers.cont("bracket", "operator");
return cont("bracket", "operator");
} else if (/\d/.test(ch)) {
stream.eatWhile(/\d/);
return helpers.cont("number", "number");
return cont("number", "number");
} else {

@@ -132,16 +116,16 @@

stream.eatWhile(regs.validIdentifier);
return helpers.cont("property", "property");
return cont("property", "property");
} else if (ch == "|") {
stream.eatWhile(regs.validIdentifier);
return helpers.cont("qualifier", "modifier");
return cont("qualifier", "modifier");
}
} else if (state.last == "pipe") {
stream.eatWhile(regs.validIdentifier);
return helpers.cont("qualifier", "modifier");
return cont("qualifier", "modifier");
} else if (state.last == "whitespace") {
stream.eatWhile(regs.validIdentifier);
return helpers.cont("attribute", "modifier");
return cont("attribute", "modifier");
} if (state.last == "property") {
stream.eatWhile(regs.validIdentifier);
return helpers.cont("property", null);
return cont("property", null);
} else if (/\s/.test(ch)) {

@@ -162,3 +146,3 @@ last = "whitespace";

if (keyFunctions[i] == str) {
return helpers.cont("keyword", "keyword");
return cont("keyword", "keyword");
}

@@ -169,7 +153,7 @@ }

}
return helpers.cont("tag", "tag");
return cont("tag", "tag");
}
},
}
inAttribute: function(quote) {
function tokenAttribute(quote) {
return function(stream, state) {

@@ -181,3 +165,3 @@ var prevChar = null;

if (stream.next() == quote && prevChar !== '\\') {
state.tokenize = parsers.smarty;
state.tokenize = tokenSmarty;
break;

@@ -189,9 +173,9 @@ }

};
},
}
inBlock: function(style, terminator) {
function tokenBlock(style, terminator) {
return function(stream, state) {
while (!stream.eol()) {
if (stream.match(terminator)) {
state.tokenize = parsers.tokenizer;
state.tokenize = tokenTop;
break;

@@ -204,26 +188,35 @@ }

}
};
return {
startState: function() {
return {
base: CodeMirror.startState(baseMode),
tokenize: tokenTop,
last: null,
depth: 0
};
},
copyState: function(state) {
return {
base: CodeMirror.copyState(baseMode, state.base),
tokenize: state.tokenize,
last: state.last,
depth: state.depth
};
},
innerMode: function(state) {
if (state.tokenize == tokenTop)
return {mode: baseMode, state: state.base};
},
token: function(stream, state) {
var style = state.tokenize(stream, state);
state.last = last;
return style;
},
blockCommentStart: leftDelimiter + "*",
blockCommentEnd: "*" + rightDelimiter
};
});
// the public API for CodeMirror
return {
startState: function() {
return {
tokenize: parsers.tokenizer,
mode: "smarty",
last: null,
depth: 0
};
},
token: function(stream, state) {
var style = state.tokenize(stream, state);
state.last = last;
return style;
},
electricChars: ""
};
CodeMirror.defineMIME("text/x-smarty", "smarty");
});
CodeMirror.defineMIME("text/x-smarty", "smarty");
});
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: http://codemirror.net/LICENSE
// Stylus mode created by Dmitry Kiselyov http://git.io/AaRB
(function(mod) {

@@ -15,431 +17,748 @@ if (typeof exports == "object" && typeof module == "object") // CommonJS

CodeMirror.defineMode("stylus", function(config) {
var indentUnit = config.indentUnit,
tagKeywords = keySet(tagKeywords_),
tagVariablesRegexp = /^(a|b|i|s|col|em)$/i,
propertyKeywords = keySet(propertyKeywords_),
nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_),
valueKeywords = keySet(valueKeywords_),
colorKeywords = keySet(colorKeywords_),
documentTypes = keySet(documentTypes_),
documentTypesRegexp = wordRegexp(documentTypes_),
mediaFeatures = keySet(mediaFeatures_),
mediaTypes = keySet(mediaTypes_),
fontProperties = keySet(fontProperties_),
operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/,
wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_),
blockKeywords = keySet(blockKeywords_),
vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i),
commonAtoms = keySet(commonAtoms_),
firstWordMatch = "",
states = {},
ch,
style,
type,
override;
var operatorsRegexp = /^(\?:?|\+[+=]?|-[\-=]?|\*[\*=]?|\/=?|[=!:\?]?=|<=?|>=?|%=?|&&|\|=?|\~|!|\^|\\)/,
delimitersRegexp = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/,
wordOperatorsRegexp = wordRegexp(wordOperators),
commonKeywordsRegexp = wordRegexp(commonKeywords),
commonAtomsRegexp = wordRegexp(commonAtoms),
commonDefRegexp = wordRegexp(commonDef),
vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/),
cssValuesWithBracketsRegexp = new RegExp("^(" + cssValuesWithBrackets_.join("|") + ")\\([\\w\-\\#\\,\\.\\%\\s\\(\\)]*\\)");
/**
* Tokenizers
*/
function tokenBase(stream, state) {
firstWordMatch = stream.string.match(/(^[\w-]+\s*=\s*$)|(^\s*[\w-]+\s*=\s*[\w-])|(^\s*(\.|#|@|\$|\&|\[|\d|\+|::?|\{|\>|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/);
state.context.line.firstWord = firstWordMatch ? firstWordMatch[0].replace(/^\s*/, "") : "";
state.context.line.indent = stream.indentation();
ch = stream.peek();
var tokenBase = function(stream, state) {
if (stream.eatSpace()) return null;
var ch = stream.peek();
// Single line Comment
if (stream.match('//')) {
// Line comment
if (stream.match("//")) {
stream.skipToEnd();
return "comment";
return ["comment", "comment"];
}
// Multiline Comment
if (stream.match('/*')) {
state.tokenizer = multilineComment;
return state.tokenizer(stream, state);
// Block comment
if (stream.match("/*")) {
state.tokenize = tokenCComment;
return tokenCComment(stream, state);
}
// Strings
if (ch === '"' || ch === "'") {
// String
if (ch == "\"" || ch == "'") {
stream.next();
state.tokenizer = buildStringTokenizer(ch);
return "string";
state.tokenize = tokenString(ch);
return state.tokenize(stream, state);
}
// Def
if (ch === "@") {
if (ch == "@") {
stream.next();
if (stream.match(/extend/)) {
dedent(state); // remove indentation after selectors
} else if (stream.match(/media[\w-\s]*[\w-]/)) {
indent(state);
} else if(stream.eatWhile(/[\w-]/)) {
if(stream.current().match(commonDefRegexp)) {
indent(state);
}
}
return "def";
stream.eatWhile(/[\w\\-]/);
return ["def", stream.current()];
}
// Number
if (stream.match(/^-?[0-9\.]/, false)) {
// Floats
if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i) || stream.match(/^-?\d+\.\d*/)) {
// Prevent from getting extra . on 1..
if (stream.peek() == ".") {
stream.backUp(1);
}
// Units
stream.eatWhile(/[a-z%]/i);
return "number";
}
// Integers
if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/) || stream.match(/^-?0(?![\dx])/i)) {
// Units
stream.eatWhile(/[a-z%]/i);
return "number";
}
}
// Hex color and id selector
if (ch === "#") {
// ID selector or Hex color
if (ch == "#") {
stream.next();
// Hex color
if (stream.match(/^[0-9a-f]{6}|[0-9a-f]{3}/i)) {
return "atom";
return ["atom", "atom"];
}
// ID selector
if (stream.match(/^[\w-]+/i)) {
indent(state);
return "builtin";
if (stream.match(/^[a-z][\w-]*/i)) {
return ["builtin", "hash"];
}
}
// Vendor prefixes
if (stream.match(vendorPrefixesRegexp)) {
return "meta";
return ["meta", "vendor-prefixes"];
}
// Gradients and animation as CSS value
if (stream.match(cssValuesWithBracketsRegexp)) {
return "atom";
// Numbers
if (stream.match(/^-?[0-9]?\.?[0-9]/)) {
stream.eatWhile(/[a-z%]/i);
return ["number", "unit"];
}
// Mixins / Functions with indentation
if (stream.sol() && stream.match(/^\.?[a-z][\w-]*\(/i)) {
stream.backUp(1);
indent(state);
return "keyword";
// !important|optional
if (ch == "!") {
stream.next();
return [stream.match(/^(important|optional)/i) ? "keyword": "operator", "important"];
}
// Class
if (ch == "." && stream.match(/^\.[a-z][\w-]*/i)) {
return ["qualifier", "qualifier"];
}
// url url-prefix domain regexp
if (stream.match(documentTypesRegexp)) {
if (stream.peek() == "(") state.tokenize = tokenParenthesized;
return ["property", "word"];
}
// Mixins / Functions
if (stream.match(/^\.?[a-z][\w-]*\(/i)) {
if (stream.match(/^[a-z][\w-]*\(/i)) {
stream.backUp(1);
return "keyword";
return ["keyword", "mixin"];
}
// +Block mixins
if (stream.match(/^(\+|\-)[a-z][\w-]+\(/i)) {
// Block mixins
if (stream.match(/^(\+|-)[a-z][\w-]*\(/i)) {
stream.backUp(1);
indent(state);
return "keyword";
return ["keyword", "block-mixin"];
}
// url tokens
if (stream.match(/^url/) && stream.peek() === "(") {
state.tokenizer = urlTokens;
if(!stream.peek()) {
state.cursorHalf = 0;
// Parent Reference BEM naming
if (stream.string.match(/^\s*&/) && stream.match(/^[-_]+[a-z][\w-]*/)) {
return ["qualifier", "qualifier"];
}
// / Root Reference & Parent Reference
if (stream.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)) {
stream.backUp(1);
return ["variable-3", "reference"];
}
if (stream.match(/^&{1}\s*$/)) {
return ["variable-3", "reference"];
}
// Variable
if (ch == "$" && stream.match(/^\$[\w-]+/i)) {
return ["variable-2", "variable-name"];
}
// Word operator
if (stream.match(wordOperatorKeywordsRegexp)) {
return ["operator", "operator"];
}
// Word
if (stream.match(/^[-_]*[a-z0-9]+[\w-]*/i)) {
if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) {
if (!wordIsTag(stream.current())) {
stream.match(/[\w-]+/);
return ["variable-2", "variable-name"];
}
}
return "atom";
return ["variable-2", "word"];
}
// Class
if (stream.match(/^\.[a-z][\w-]*/i)) {
indent(state);
return "qualifier";
// Operators
if (stream.match(operatorsRegexp)) {
return ["operator", stream.current()];
}
// & Parent Reference with BEM naming
if (stream.match(/^(_|__|-|--)[a-z0-9-]+/)) {
return "qualifier";
// Delimiters
if (/[:;,{}\[\]\(\)]/.test(ch)) {
stream.next();
return [null, ch];
}
// Non-detected items
stream.next();
return [null, null];
}
// Pseudo elements/classes
if (ch == ':' && stream.match(/^::?[\w-]+/)) {
indent(state);
return "variable-3";
/**
* Token comment
*/
function tokenCComment(stream, state) {
var maybeEnd = false, ch;
while ((ch = stream.next()) != null) {
if (maybeEnd && ch == "/") {
state.tokenize = null;
break;
}
maybeEnd = (ch == "*");
}
return ["comment", "comment"];
}
// Conditionals
if (stream.match(wordRegexp(["for", "if", "else", "unless"]))) {
indent(state);
return "keyword";
}
/**
* Token string
*/
function tokenString(quote) {
return function(stream, state) {
var escaped = false, ch;
while ((ch = stream.next()) != null) {
if (ch == quote && !escaped) {
if (quote == ")") stream.backUp(1);
break;
}
escaped = !escaped && ch == "\\";
}
if (ch == quote || !escaped && quote != ")") state.tokenize = null;
return ["string", "string"];
};
}
// Keywords
if (stream.match(commonKeywordsRegexp)) {
return "keyword";
}
/**
* Token parenthesized
*/
function tokenParenthesized(stream, state) {
stream.next(); // Must be "("
if (!stream.match(/\s*[\"\')]/, false))
state.tokenize = tokenString(")");
else
state.tokenize = null;
return [null, "("];
}
// Atoms
if (stream.match(commonAtomsRegexp)) {
return "atom";
}
/**
* Context management
*/
function Context(type, indent, prev, line) {
this.type = type;
this.indent = indent;
this.prev = prev;
this.line = line || {firstWord: "", indent: 0};
}
// Variables
if (stream.match(/^\$?[a-z][\w-]+\s?=(\s|[\w-'"\$])/i)) {
stream.backUp(2);
var cssPropertie = stream.current().toLowerCase().match(/[\w-]+/)[0];
return cssProperties[cssPropertie] === undefined ? "variable-2" : "property";
} else if (stream.match(/\$[\w-\.]+/i)) {
return "variable-2";
} else if (stream.match(/\$?[\w-]+\.[\w-]+/i)) {
var cssTypeSelector = stream.current().toLowerCase().match(/[\w]+/)[0];
if(cssTypeSelectors[cssTypeSelector] === undefined) {
return "variable-2";
} else stream.backUp(stream.current().length);
}
function pushContext(state, stream, type, indent) {
indent = indent >= 0 ? indent : indentUnit;
state.context = new Context(type, stream.indentation() + indent, state.context);
return type;
}
// !important
if (ch === "!") {
stream.next();
return stream.match(/^[\w]+/) ? "keyword": "operator";
}
function popContext(state, currentIndent) {
var contextIndent = state.context.indent - indentUnit;
currentIndent = currentIndent || false;
state.context = state.context.prev;
if (currentIndent) state.context.indent = contextIndent;
return state.context.type;
}
// / Root Reference
if (stream.match(/^\/(:|\.|#|[a-z])/)) {
stream.backUp(1);
return "variable-3";
}
function pass(type, stream, state) {
return states[state.context.type](type, stream, state);
}
// Operators and delimiters
if (stream.match(operatorsRegexp) || stream.match(wordOperatorsRegexp)) {
return "operator";
}
if (stream.match(delimitersRegexp)) {
return null;
}
function popAndPass(type, stream, state, n) {
for (var i = n || 1; i > 0; i--)
state.context = state.context.prev;
return pass(type, stream, state);
}
// & Parent Reference
if (ch === "&") {
stream.next();
return "variable-3";
}
// Font family
if (stream.match(/^[A-Z][a-z0-9-]+/)) {
return "string";
}
/**
* Parser
*/
function wordIsTag(word) {
return word.toLowerCase() in tagKeywords;
}
// CSS rule
// NOTE: Some css selectors and property values have the same name
// (embed, menu, pre, progress, sub, table),
// so they will have the same color (.cm-atom).
if (stream.match(/[\w-]*/i)) {
function wordIsProperty(word) {
word = word.toLowerCase();
return word in propertyKeywords || word in fontProperties;
}
var word = stream.current().toLowerCase();
function wordIsBlock(word) {
return word.toLowerCase() in blockKeywords;
}
if(cssProperties[word] !== undefined) {
// CSS property
if(!stream.eol())
return "property";
else
return "variable-2";
function wordIsVendorPrefix(word) {
return word.toLowerCase().match(vendorPrefixesRegexp);
}
} else if(cssValues[word] !== undefined) {
// CSS value
return "atom";
function wordAsValue(word) {
var wordLC = word.toLowerCase();
var override = "variable-2";
if (wordIsTag(word)) override = "tag";
else if (wordIsBlock(word)) override = "block-keyword";
else if (wordIsProperty(word)) override = "property";
else if (wordLC in valueKeywords || wordLC in commonAtoms) override = "atom";
else if (wordLC == "return" || wordLC in colorKeywords) override = "keyword";
} else if(cssTypeSelectors[word] !== undefined) {
// CSS type selectors
indent(state);
return "tag";
// Font family
else if (word.match(/^[A-Z]/)) override = "string";
return override;
}
} else if(word) {
// By default variable-2
return "variable-2";
}
}
function typeIsBlock(type, stream) {
return ((endOfLine(stream) && (type == "{" || type == "]" || type == "hash" || type == "qualifier")) || type == "block-mixin");
}
// Handle non-detected items
stream.next();
return null;
function typeIsInterpolation(type, stream) {
return type == "{" && stream.match(/^\s*\$?[\w-]+/i, false);
}
};
function typeIsPseudo(type, stream) {
return type == ":" && stream.match(/^[a-z-]+/, false);
}
var tokenLexer = function(stream, state) {
function startOfLine(stream) {
return stream.sol() || stream.string.match(new RegExp("^\\s*" + escapeRegExp(stream.current())));
}
if (stream.sol()) {
state.indentCount = 0;
function endOfLine(stream) {
return stream.eol() || stream.match(/^\s*$/, false);
}
function firstWordOfLine(line) {
var re = /^\s*[-_]*[a-z0-9]+[\w-]*/i;
var result = typeof line == "string" ? line.match(re) : line.string.match(re);
return result ? result[0].replace(/^\s*/, "") : "";
}
/**
* Block
*/
states.block = function(type, stream, state) {
if ((type == "comment" && startOfLine(stream)) ||
(type == "," && endOfLine(stream)) ||
type == "mixin") {
return pushContext(state, stream, "block", 0);
}
if (typeIsInterpolation(type, stream)) {
return pushContext(state, stream, "interpolation");
}
if (endOfLine(stream) && type == "]") {
if (!/^\s*(\.|#|:|\[|\*|&)/.test(stream.string) && !wordIsTag(firstWordOfLine(stream))) {
return pushContext(state, stream, "block", 0);
}
}
if (typeIsBlock(type, stream, state)) {
return pushContext(state, stream, "block");
}
if (type == "}" && endOfLine(stream)) {
return pushContext(state, stream, "block", 0);
}
if (type == "variable-name") {
return pushContext(state, stream, "variableName");
}
if (type == "=") {
if (!endOfLine(stream) && !wordIsBlock(firstWordOfLine(stream))) {
return pushContext(state, stream, "block", 0);
}
return pushContext(state, stream, "block");
}
if (type == "*") {
if (endOfLine(stream) || stream.match(/\s*(,|\.|#|\[|:|{)/,false)) {
override = "tag";
return pushContext(state, stream, "block");
}
}
if (typeIsPseudo(type, stream)) {
return pushContext(state, stream, "pseudo");
}
if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
}
if (/@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
return pushContext(state, stream, "keyframes");
}
if (/@extends?/.test(type)) {
return pushContext(state, stream, "extend", 0);
}
if (type && type.charAt(0) == "@") {
var style = state.tokenizer(stream, state);
var current = stream.current();
// Property Lookup
if (stream.indentation() > 0 && wordIsProperty(stream.current().slice(1))) {
override = "variable-2";
return "block";
}
if (/(@import|@require|@charset)/.test(type)) {
return pushContext(state, stream, "block", 0);
}
return pushContext(state, stream, "block");
}
if (type == "reference" && endOfLine(stream)) {
return pushContext(state, stream, "block");
}
if (type == "(") {
return pushContext(state, stream, "parens");
}
if (stream.eol() && (current === "}" || current === ",")) {
dedent(state);
if (type == "vendor-prefixes") {
return pushContext(state, stream, "vendorPrefixes");
}
if (type == "word") {
var word = stream.current();
override = wordAsValue(word);
if (style !== null) {
var startOfToken = stream.pos - current.length;
var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
if (override == "property") {
if (startOfLine(stream)) {
return pushContext(state, stream, "block", 0);
} else {
override = "atom";
return "block";
}
}
var newScopes = [];
if (override == "tag") {
for (var i = 0; i < state.scopes.length; i++) {
var scope = state.scopes[i];
// tag is a css value
if (/embed|menu|pre|progress|sub|table/.test(word)) {
if (wordIsProperty(firstWordOfLine(stream))) {
override = "atom";
return "block";
}
}
if (scope.offset <= withCurrentIndent) {
newScopes.push(scope);
// tag is an attribute
if (stream.string.match(new RegExp("\\[\\s*" + word + "|" + word +"\\s*\\]"))) {
override = "atom";
return "block";
}
// tag is a variable
if (tagVariablesRegexp.test(word)) {
if ((startOfLine(stream) && stream.string.match(/=/)) ||
(!startOfLine(stream) &&
!stream.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/) &&
!wordIsTag(firstWordOfLine(stream)))) {
override = "variable-2";
if (wordIsBlock(firstWordOfLine(stream))) return "block";
return pushContext(state, stream, "block", 0);
}
}
if (endOfLine(stream)) return pushContext(state, stream, "block");
}
if (override == "block-keyword") {
override = "keyword";
state.scopes = newScopes;
// Postfix conditionals
if (stream.current(/(if|unless)/) && !startOfLine(stream)) {
return "block";
}
return pushContext(state, stream, "block");
}
if (word == "return") return pushContext(state, stream, "block", 0);
}
return state.context.type;
};
return style;
/**
* Parens
*/
states.parens = function(type, stream, state) {
if (type == "(") return pushContext(state, stream, "parens");
if (type == ")") {
if (state.context.prev.type == "parens") {
return popContext(state);
}
if ((stream.string.match(/^[a-z][\w-]*\(/i) && endOfLine(stream)) ||
wordIsBlock(firstWordOfLine(stream)) ||
/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(firstWordOfLine(stream)) ||
(!stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) &&
wordIsTag(firstWordOfLine(stream)))) {
return pushContext(state, stream, "block");
}
if (stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) ||
stream.string.match(/^\s*(\(|\)|[0-9])/) ||
stream.string.match(/^\s+[a-z][\w-]*\(/i) ||
stream.string.match(/^\s+-?[a-z]/i)) {
return pushContext(state, stream, "block", 0);
}
if (endOfLine(stream)) return pushContext(state, stream, "block");
else return pushContext(state, stream, "block", 0);
}
if (type && type.charAt(0) == "@" && wordIsProperty(stream.current().slice(1))) {
override = "variable-2";
}
if (type == "word") {
var word = stream.current();
override = wordAsValue(word);
if (override == "tag" && tagVariablesRegexp.test(word)) {
override = "variable-2";
}
if (override == "property" || word == "to") override = "atom";
}
if (type == "variable-name") {
return pushContext(state, stream, "variableName");
}
if (typeIsPseudo(type, stream)) {
return pushContext(state, stream, "pseudo");
}
return state.context.type;
};
return {
startState: function() {
return {
tokenizer: tokenBase,
scopes: [{offset: 0, type: 'styl'}]
};
},
token: function(stream, state) {
var style = tokenLexer(stream, state);
state.lastToken = { style: style, content: stream.current() };
return style;
},
/**
* Vendor prefixes
*/
states.vendorPrefixes = function(type, stream, state) {
if (type == "word") {
override = "property";
return pushContext(state, stream, "block", 0);
}
return popContext(state);
};
indent: function(state) {
return state.scopes[0].offset;
},
lineComment: "//",
fold: "indent"
/**
* Pseudo
*/
states.pseudo = function(type, stream, state) {
if (!wordIsProperty(firstWordOfLine(stream.string))) {
stream.match(/^[a-z-]+/);
override = "variable-3";
if (endOfLine(stream)) return pushContext(state, stream, "block");
return popContext(state);
}
return popAndPass(type, stream, state);
};
/**
* atBlock
*/
states.atBlock = function(type, stream, state) {
if (type == "(") return pushContext(state, stream, "atBlock_parens");
if (typeIsBlock(type, stream, state)) {
return pushContext(state, stream, "block");
}
if (typeIsInterpolation(type, stream)) {
return pushContext(state, stream, "interpolation");
}
if (type == "word") {
var word = stream.current().toLowerCase();
if (/^(only|not|and|or)$/.test(word))
override = "keyword";
else if (documentTypes.hasOwnProperty(word))
override = "tag";
else if (mediaTypes.hasOwnProperty(word))
override = "attribute";
else if (mediaFeatures.hasOwnProperty(word))
override = "property";
else if (nonStandardPropertyKeywords.hasOwnProperty(word))
override = "string-2";
else override = wordAsValue(stream.current());
if (override == "tag" && endOfLine(stream)) {
return pushContext(state, stream, "block");
}
}
if (type == "operator" && /^(not|and|or)$/.test(stream.current())) {
override = "keyword";
}
return state.context.type;
};
function urlTokens(stream, state) {
var ch = stream.peek();
states.atBlock_parens = function(type, stream, state) {
if (type == "{" || type == "}") return state.context.type;
if (type == ")") {
if (endOfLine(stream)) return pushContext(state, stream, "block");
else return pushContext(state, stream, "atBlock");
}
if (type == "word") {
var word = stream.current().toLowerCase();
override = wordAsValue(word);
if (/^(max|min)/.test(word)) override = "property";
if (override == "tag") {
tagVariablesRegexp.test(word) ? override = "variable-2" : override = "atom";
}
return state.context.type;
}
return states.atBlock(type, stream, state);
};
if (ch === ")") {
stream.next();
state.tokenizer = tokenBase;
return "operator";
} else if (ch === "(") {
stream.next();
stream.eatSpace();
return "operator";
} else if (ch === "'" || ch === '"') {
state.tokenizer = buildStringTokenizer(stream.next());
return "string";
} else {
state.tokenizer = buildStringTokenizer(")", false);
return "string";
/**
* Keyframes
*/
states.keyframes = function(type, stream, state) {
if (stream.indentation() == "0" && ((type == "}" && startOfLine(stream)) || type == "]" || type == "hash"
|| type == "qualifier" || wordIsTag(stream.current()))) {
return popAndPass(type, stream, state);
}
}
if (type == "{") return pushContext(state, stream, "keyframes");
if (type == "}") {
if (startOfLine(stream)) return popContext(state, true);
else return pushContext(state, stream, "keyframes");
}
if (type == "unit" && /^[0-9]+\%$/.test(stream.current())) {
return pushContext(state, stream, "keyframes");
}
if (type == "word") {
override = wordAsValue(stream.current());
if (override == "block-keyword") {
override = "keyword";
return pushContext(state, stream, "keyframes");
}
}
if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
}
if (type == "mixin") {
return pushContext(state, stream, "block", 0);
}
return state.context.type;
};
function multilineComment(stream, state) {
if (stream.skipTo("*/")) {
stream.next();
stream.next();
state.tokenizer = tokenBase;
} else {
stream.next();
/**
* Interpolation
*/
states.interpolation = function(type, stream, state) {
if (type == "{") popContext(state) && pushContext(state, stream, "block");
if (type == "}") {
if (stream.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i) ||
(stream.string.match(/^\s*[a-z]/i) && wordIsTag(firstWordOfLine(stream)))) {
return pushContext(state, stream, "block");
}
if (!stream.string.match(/^(\{|\s*\&)/) ||
stream.match(/\s*[\w-]/,false)) {
return pushContext(state, stream, "block", 0);
}
return pushContext(state, stream, "block");
}
return "comment";
}
if (type == "variable-name") {
return pushContext(state, stream, "variableName", 0);
}
if (type == "word") {
override = wordAsValue(stream.current());
if (override == "tag") override = "atom";
}
return state.context.type;
};
function buildStringTokenizer(quote, greedy) {
if(greedy == null) {
greedy = true;
/**
* Extend/s
*/
states.extend = function(type, stream, state) {
if (type == "[" || type == "=") return "extend";
if (type == "]") return popContext(state);
if (type == "word") {
override = wordAsValue(stream.current());
return "extend";
}
return popContext(state);
};
function stringTokenizer(stream, state) {
var nextChar = stream.next();
var peekChar = stream.peek();
var previousChar = stream.string.charAt(stream.pos-2);
var endingString = ((nextChar !== "\\" && peekChar === quote) ||
(nextChar === quote && previousChar !== "\\"));
/**
* Variable name
*/
states.variableName = function(type, stream, state) {
if (type == "string" || type == "[" || type == "]" || stream.current().match(/^(\.|\$)/)) {
if (stream.current().match(/^\.[\w-]+/i)) override = "variable-2";
if (endOfLine(stream)) return popContext(state);
return "variableName";
}
return popAndPass(type, stream, state);
};
if (endingString) {
if (nextChar !== quote && greedy) {
stream.next();
}
state.tokenizer = tokenBase;
return "string";
} else if (nextChar === "#" && peekChar === "{") {
state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
stream.next();
return "operator";
} else {
return "string";
return {
startState: function(base) {
return {
tokenize: null,
state: "block",
context: new Context("block", base || 0, null)
};
},
token: function(stream, state) {
if (!state.tokenize && stream.eatSpace()) return null;
style = (state.tokenize || tokenBase)(stream, state);
if (style && typeof style == "object") {
type = style[1];
style = style[0];
}
}
override = style;
state.state = states[state.state](type, stream, state);
return override;
},
indent: function(state, textAfter, line) {
return stringTokenizer;
}
var cx = state.context,
ch = textAfter && textAfter.charAt(0),
indent = cx.indent,
lineFirstWord = firstWordOfLine(textAfter),
lineIndent = line.length - line.replace(/^\s*/, "").length,
prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "",
prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent;
function buildInterpolationTokenizer(currentTokenizer) {
return function(stream, state) {
if (stream.peek() === "}") {
stream.next();
state.tokenizer = currentTokenizer;
return "operator";
} else {
return tokenBase(stream, state);
if (cx.prev &&
(ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") ||
ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
ch == "{" && (cx.type == "at"))) {
indent = cx.indent - indentUnit;
cx = cx.prev;
} else if (!(/(\})/.test(ch))) {
if (/@|\$|\d/.test(ch) ||
/^\{/.test(textAfter) ||
/^\s*\/(\/|\*)/.test(textAfter) ||
/^\s*\/\*/.test(prevLineFirstWord) ||
/^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) ||
/^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) ||
/^return/.test(textAfter) ||
wordIsBlock(lineFirstWord)) {
indent = lineIndent;
} else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) {
if (/\,\s*$/.test(prevLineFirstWord)) {
indent = prevLineIndent;
} else if (/^\s+/.test(line) && (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord))) {
indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
} else {
indent = lineIndent;
}
} else if (!/,\s*$/.test(line) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) {
if (wordIsBlock(prevLineFirstWord)) {
indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
} else if (/^\{/.test(prevLineFirstWord)) {
indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + indentUnit;
} else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) {
indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent;
} else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) ||
/=\s*$/.test(prevLineFirstWord) ||
wordIsTag(prevLineFirstWord) ||
/^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) {
indent = prevLineIndent + indentUnit;
} else {
indent = lineIndent;
}
}
}
};
}
return indent;
},
electricChars: "}",
lineComment: "//",
fold: "indent"
};
});
function indent(state) {
if (state.indentCount == 0) {
state.indentCount++;
var lastScopeOffset = state.scopes[0].offset;
var currentOffset = lastScopeOffset + config.indentUnit;
state.scopes.unshift({ offset:currentOffset });
}
}
// developer.mozilla.org/en-US/docs/Web/HTML/Element
var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"];
function dedent(state) {
if (state.scopes.length == 1) { return true; }
state.scopes.shift();
}
// github.com/codemirror/CodeMirror/blob/master/mode/css/css.js
var documentTypes_ = ["domain", "regexp", "url", "url-prefix"];
var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid"];
var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"];
var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"];
});
var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
blockKeywords_ = ["for","if","else","unless", "from", "to"],
commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"],
commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"];
// https://developer.mozilla.org/en-US/docs/Web/HTML/Element
var cssTypeSelectors_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi","bdo","bgsound","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes","noscript","object","ol","optgroup","option","output","p","param","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];
// https://github.com/csscomb/csscomb.js/blob/master/config/zen.json
var cssProperties_ = ["position","top","right","bottom","left","z-index","display","visibility","flex-direction","flex-order","flex-pack","float","clear","flex-align","overflow","overflow-x","overflow-y","overflow-scrolling","clip","box-sizing","margin","margin-top","margin-right","margin-bottom","margin-left","padding","padding-top","padding-right","padding-bottom","padding-left","min-width","min-height","max-width","max-height","width","height","outline","outline-width","outline-style","outline-color","outline-offset","border","border-spacing","border-collapse","border-width","border-style","border-color","border-top","border-top-width","border-top-style","border-top-color","border-right","border-right-width","border-right-style","border-right-color","border-bottom","border-bottom-width","border-bottom-style","border-bottom-color","border-left","border-left-width","border-left-style","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-image","border-image-source","border-image-slice","border-image-width","border-image-outset","border-image-repeat","border-top-image","border-right-image","border-bottom-image","border-left-image","border-corner-image","border-top-left-image","border-top-right-image","border-bottom-right-image","border-bottom-left-image","background","filter:progid:DXImageTransform\\.Microsoft\\.AlphaImageLoader","background-color","background-image","background-attachment","background-position","background-position-x","background-position-y","background-clip","background-origin","background-size","background-repeat","box-decoration-break","box-shadow","color","table-layout","caption-side","empty-cells","list-style","list-style-position","list-style-type","list-style-image","quotes","content","counter-increment","counter-reset","writing-mode","vertical-align","text-align","text-align-last","text-decoration","text-emphasis","text-emphasis-position","text-emphasis-style","text-emphasis-color","text-indent","-ms-text-justify","text-justify","text-outline","text-transform","text-wrap","text-overflow","text-overflow-ellipsis","text-overflow-mode","text-size-adjust","text-shadow","white-space","word-spacing","word-wrap","word-break","tab-size","hyphens","letter-spacing","font","font-weight","font-style","font-variant","font-size-adjust","font-stretch","font-size","font-family","src","line-height","opacity","filter:\\\\\\\\'progid:DXImageTransform.Microsoft.Alpha","filter:progid:DXImageTransform.Microsoft.Alpha\\(Opacity","interpolation-mode","filter","resize","cursor","nav-index","nav-up","nav-right","nav-down","nav-left","transition","transition-delay","transition-timing-function","transition-duration","transition-property","transform","transform-origin","animation","animation-name","animation-duration","animation-play-state","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","pointer-events","unicode-bidi","direction","columns","column-span","column-width","column-count","column-fill","column-gap","column-rule","column-rule-width","column-rule-style","column-rule-color","break-before","break-inside","break-after","page-break-before","page-break-inside","page-break-after","orphans","widows","zoom","max-zoom","min-zoom","user-zoom","orientation","text-rendering","speak","animation-fill-mode","backface-visibility","user-drag","user-select","appearance"];
// https://github.com/codemirror/CodeMirror/blob/master/mode/css/css.js#L501
var cssValues_ = ["above","absolute","activeborder","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","cambodian","capitalize","caps-lock-indicator","captiontext","caret","cell","center","checkbox","circle","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","contain","content","content-box","context-menu","continuous","copy","cover","crop","cross","crosshair","currentcolor","cursive","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ew-resize","expanded","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-table","inset","inside","intrinsic","invert","italic","justify","kannada","katakana","katakana-iroha","keep-all","khmer","landscape","lao","large","larger","left","level","lighter","line-through","linear","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","media-controls-background","media-current-time-display","media-fullscreen-button","media-mute-button","media-play-button","media-return-to-realtime-button","media-rewind-button","media-seek-back-button","media-seek-forward-button","media-slider","media-sliderthumb","media-time-remaining-display","media-volume-slider","media-volume-slider-container","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menulist-text","menulist-textfield","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scroll","scrollbar","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","single","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","square","square-button","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","telugu","text","text-bottom","text-top","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale"];
var cssColorValues_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
var cssValuesWithBrackets_ = ["gradient","linear-gradient","radial-gradient","repeating-linear-gradient","repeating-radial-gradient","cubic-bezier","translateX","translateY","translate3d","rotate3d","scale","scale3d","perspective","skewX"];
var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_,
propertyKeywords_,nonStandardPropertyKeywords_,
colorKeywords_,valueKeywords_,fontProperties_,
wordOperatorKeywords_,blockKeywords_,
commonAtoms_,commonDef_);
var wordOperators = ["in", "and", "or", "not", "is a", "is", "isnt", "defined", "if unless"],
commonKeywords = ["for", "if", "else", "unless", "return"],
commonAtoms = ["null", "true", "false", "href", "title", "type", "not-allowed", "readonly", "disabled"],
commonDef = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"],
cssTypeSelectors = keySet(cssTypeSelectors_),
cssProperties = keySet(cssProperties_),
cssValues = keySet(cssValues_.concat(cssColorValues_)),
hintWords = wordOperators.concat(commonKeywords,
commonAtoms,
commonDef,
cssTypeSelectors_,
cssProperties_,
cssValues_,
cssValuesWithBrackets_,
cssColorValues_);
function wordRegexp(words) {
words = words.sort(function(a,b){return b > a;});
return new RegExp("^((" + words.join(")|(") + "))\\b");
};
}
function keySet(array) {
var keys = {};
for (var i = 0; i < array.length; ++i) {
keys[array[i]] = true;
}
for (var i = 0; i < array.length; ++i) keys[array[i]] = true;
return keys;
};
}
function escapeRegExp(text) {
return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
}
CodeMirror.registerHelper("hintWords", "stylus", hintWords);
CodeMirror.defineMIME("text/x-styl", "stylus");
});

@@ -32,4 +32,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'in']);
var commonkeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
var operatorKeywords = ['and', 'or', 'not', 'xor', 'in'];
var wordOperators = wordRegexp(operatorKeywords);
var commonKeywords = ['as', 'dim', 'break', 'continue','optional', 'then', 'until',
'goto', 'byval','byref','new','handles','property', 'return',

@@ -39,3 +40,3 @@ 'const','private', 'protected', 'friend', 'public', 'shared', 'static', 'true','false'];

var keywords = wordRegexp(commonkeywords);
var keywords = wordRegexp(commonKeywords);
var types = wordRegexp(commontypes);

@@ -52,5 +53,5 @@ var stringPrefixes = '"';

CodeMirror.registerHelper("hintWords", "vb", openingKeywords.concat(middleKeywords).concat(endKeywords)
.concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
function indent(_stream, state) {

@@ -57,0 +58,0 @@ state.currentIndent++;

@@ -378,5 +378,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others

// SVXVerilog mode
// TLVVerilog mode
var svxchScopePrefixes = {
var tlvchScopePrefixes = {
">": "property", "->": "property", "-": "hr", "|": "link", "?$": "qualifier", "?*": "qualifier",

@@ -386,6 +386,6 @@ "@-": "variable-3", "@": "variable-3", "?": "qualifier"

function svxGenIndent(stream, state) {
var svxindentUnit = 2;
function tlvGenIndent(stream, state) {
var tlvindentUnit = 2;
var rtnIndent = -1, indentUnitRq = 0, curIndent = stream.indentation();
switch (state.svxCurCtlFlowChar) {
switch (state.tlvCurCtlFlowChar) {
case "\\":

@@ -395,31 +395,31 @@ curIndent = 0;

case "|":
if (state.svxPrevPrevCtlFlowChar == "@") {
if (state.tlvPrevPrevCtlFlowChar == "@") {
indentUnitRq = -2; //-2 new pipe rq after cur pipe
break;
}
if (svxchScopePrefixes[state.svxPrevCtlFlowChar])
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
indentUnitRq = 1; // +1 new scope
break;
case "M": // m4
if (state.svxPrevPrevCtlFlowChar == "@") {
if (state.tlvPrevPrevCtlFlowChar == "@") {
indentUnitRq = -2; //-2 new inst rq after pipe
break;
}
if (svxchScopePrefixes[state.svxPrevCtlFlowChar])
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
indentUnitRq = 1; // +1 new scope
break;
case "@":
if (state.svxPrevCtlFlowChar == "S")
if (state.tlvPrevCtlFlowChar == "S")
indentUnitRq = -1; // new pipe stage after stmts
if (state.svxPrevCtlFlowChar == "|")
if (state.tlvPrevCtlFlowChar == "|")
indentUnitRq = 1; // 1st pipe stage
break;
case "S":
if (state.svxPrevCtlFlowChar == "@")
if (state.tlvPrevCtlFlowChar == "@")
indentUnitRq = 1; // flow in pipe stage
if (svxchScopePrefixes[state.svxPrevCtlFlowChar])
if (tlvchScopePrefixes[state.tlvPrevCtlFlowChar])
indentUnitRq = 1; // +1 new scope
break;
}
var statementIndentUnit = svxindentUnit;
var statementIndentUnit = tlvindentUnit;
rtnIndent = curIndent + (indentUnitRq*statementIndentUnit);

@@ -429,3 +429,3 @@ return rtnIndent >= 0 ? rtnIndent : curIndent;

CodeMirror.defineMIME("text/x-svx", {
CodeMirror.defineMIME("text/x-tlv", {
name: "verilog",

@@ -436,15 +436,15 @@ hooks: {

var curPunc = stream.string;
if ((stream.sol()) && (/\\SV/.test(stream.string))) {
curPunc = (/\\SVX_version/.test(stream.string))
? "\\SVX_version" : stream.string;
if ((stream.sol()) && ((/\\SV/.test(stream.string)) || (/\\TLV/.test(stream.string)))) {
curPunc = (/\\TLV_version/.test(stream.string))
? "\\TLV_version" : stream.string;
stream.skipToEnd();
if (curPunc == "\\SV" && state.vxCodeActive) {state.vxCodeActive = false;};
if ((/\\SVX/.test(curPunc) && !state.vxCodeActive)
|| (curPunc=="\\SVX_version" && state.vxCodeActive)) {state.vxCodeActive = true;};
if ((/\\TLV/.test(curPunc) && !state.vxCodeActive)
|| (curPunc=="\\TLV_version" && state.vxCodeActive)) {state.vxCodeActive = true;};
style = "keyword";
state.svxCurCtlFlowChar = state.svxPrevPrevCtlFlowChar
= state.svxPrevCtlFlowChar = "";
state.tlvCurCtlFlowChar = state.tlvPrevPrevCtlFlowChar
= state.tlvPrevCtlFlowChar = "";
if (state.vxCodeActive == true) {
state.svxCurCtlFlowChar = "\\";
vxIndent = svxGenIndent(stream, state);
state.tlvCurCtlFlowChar = "\\";
vxIndent = tlvGenIndent(stream, state);
}

@@ -457,8 +457,8 @@ state.vxIndentRq = vxIndent;

var vxIndent = 0, style = false;
var svxisOperatorChar = /[\[\]=:]/;
var svxkpScopePrefixs = {
var tlvisOperatorChar = /[\[\]=:]/;
var tlvkpScopePrefixs = {
"**":"variable-2", "*":"variable-2", "$$":"variable", "$":"variable",
"^^":"attribute", "^":"attribute"};
var ch = stream.peek();
var vxCurCtlFlowCharValueAtStart = state.svxCurCtlFlowChar;
var vxCurCtlFlowCharValueAtStart = state.tlvCurCtlFlowChar;
if (state.vxCodeActive == true) {

@@ -474,3 +474,3 @@ if (/[\[\]{}\(\);\:]/.test(ch)) {

style = "comment";
state.svxCurCtlFlowChar = "S";
state.tlvCurCtlFlowChar = "S";
} else {

@@ -481,4 +481,4 @@ stream.backUp(1);

// pipeline stage
style = svxchScopePrefixes[ch];
state.svxCurCtlFlowChar = "@";
style = tlvchScopePrefixes[ch];
state.tlvCurCtlFlowChar = "@";
stream.next();

@@ -490,33 +490,33 @@ stream.eatWhile(/[\w\$_]/);

style = "def";
state.svxCurCtlFlowChar = "M";
state.tlvCurCtlFlowChar = "M";
} else if (ch == "!" && stream.sol()) {
// v stmt in svx region
// state.svxCurCtlFlowChar = "S";
// v stmt in tlv region
// state.tlvCurCtlFlowChar = "S";
style = "comment";
stream.next();
} else if (svxisOperatorChar.test(ch)) {
} else if (tlvisOperatorChar.test(ch)) {
// operators
stream.eatWhile(svxisOperatorChar);
stream.eatWhile(tlvisOperatorChar);
style = "operator";
} else if (ch == "#") {
// phy hier
state.svxCurCtlFlowChar = (state.svxCurCtlFlowChar == "")
? ch : state.svxCurCtlFlowChar;
state.tlvCurCtlFlowChar = (state.tlvCurCtlFlowChar == "")
? ch : state.tlvCurCtlFlowChar;
stream.next();
stream.eatWhile(/[+-]\d/);
style = "tag";
} else if (svxkpScopePrefixs.propertyIsEnumerable(ch)) {
// special SVX operators
style = svxkpScopePrefixs[ch];
state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? "S" : state.svxCurCtlFlowChar; // stmt
} else if (tlvkpScopePrefixs.propertyIsEnumerable(ch)) {
// special TLV operators
style = tlvkpScopePrefixs[ch];
state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? "S" : state.tlvCurCtlFlowChar; // stmt
stream.next();
stream.match(/[a-zA-Z_0-9]+/);
} else if (style = svxchScopePrefixes[ch] || false) {
// special SVX operators
state.svxCurCtlFlowChar = state.svxCurCtlFlowChar == "" ? ch : state.svxCurCtlFlowChar;
} else if (style = tlvchScopePrefixes[ch] || false) {
// special TLV operators
state.tlvCurCtlFlowChar = state.tlvCurCtlFlowChar == "" ? ch : state.tlvCurCtlFlowChar;
stream.next();
stream.match(/[a-zA-Z_0-9]+/);
}
if (state.svxCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change
vxIndent = svxGenIndent(stream, state);
if (state.tlvCurCtlFlowChar != vxCurCtlFlowCharValueAtStart) { // flow change
vxIndent = tlvGenIndent(stream, state);
state.vxIndentRq = vxIndent;

@@ -528,6 +528,6 @@ }

token: function(stream, state) {
if (state.vxCodeActive == true && stream.sol() && state.svxCurCtlFlowChar != "") {
state.svxPrevPrevCtlFlowChar = state.svxPrevCtlFlowChar;
state.svxPrevCtlFlowChar = state.svxCurCtlFlowChar;
state.svxCurCtlFlowChar = "";
if (state.vxCodeActive == true && stream.sol() && state.tlvCurCtlFlowChar != "") {
state.tlvPrevPrevCtlFlowChar = state.tlvPrevCtlFlowChar;
state.tlvPrevCtlFlowChar = state.tlvCurCtlFlowChar;
state.tlvCurCtlFlowChar = "";
}

@@ -539,5 +539,5 @@ },

startState: function(state) {
state.svxCurCtlFlowChar = "";
state.svxPrevCtlFlowChar = "";
state.svxPrevPrevCtlFlowChar = "";
state.tlvCurCtlFlowChar = "";
state.tlvPrevCtlFlowChar = "";
state.tlvPrevPrevCtlFlowChar = "";
state.vxCodeActive = true;

@@ -544,0 +544,0 @@ state.vxIndentRq = 0;

{
"name": "codemirror",
"version":"5.0.0",
"version":"5.1.0",
"main": "lib/codemirror.js",

@@ -5,0 +5,0 @@ "description": "In-browser code editing made bearable",

# CodeMirror
[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png)](https://marijnhaverbeke.nl/fund/)
[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?again)](https://marijnhaverbeke.nl/fund/)

@@ -6,0 +6,0 @@ CodeMirror is a JavaScript component that provides a code editor in

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc