mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-28 02:44:53 +00:00
codemirror: remove some files
git-svn-id: https://svn.fhem.de/fhem/trunk@5140 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
471a7de813
commit
046aec2344
fhem/www/codemirror
@ -2459,14 +2459,14 @@ sub FW_codemirrorLink($)
|
|||||||
$lang = "perl" if( !$lang );
|
$lang = "perl" if( !$lang );
|
||||||
|
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/pgm2/jquery.min.js\"></script>";
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/pgm2/jquery.min.js\"></script>";
|
||||||
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/lib/codemirror.css\">";
|
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/codemirror.css\">";
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/lib/codemirror.js\"></script>";
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/codemirror.js\"></script>";
|
||||||
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/theme/$theme.css\">";
|
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/$theme.css\">";
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/addon/edit/closebrackets.js\"></script>";
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/closebrackets.js\"></script>";
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/addon/edit/matchbrackets.js\"></script>";
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/matchbrackets.js\"></script>";
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/addon/hint/show-hint.js\"></script>";
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/show-hint.js\"></script>";
|
||||||
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/addon/hint/show-hint.css\">";
|
FW_pO "<link rel=\"stylesheet\" href=\"$FW_ME/codemirror/show-hint.css\">";
|
||||||
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/mode/$lang/$lang.js\"></script>" if( $lang );
|
FW_pO "<script type=\"text/javascript\" src=\"$FW_ME/codemirror/$lang.js\"></script>" if( $lang );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
84
fhem/www/codemirror/addon/edit/closebrackets.js
vendored
84
fhem/www/codemirror/addon/edit/closebrackets.js
vendored
@ -1,84 +0,0 @@
|
|||||||
(function() {
|
|
||||||
var DEFAULT_BRACKETS = "()[]{}''\"\"";
|
|
||||||
var DEFAULT_EXPLODE_ON_ENTER = "[]{}";
|
|
||||||
var SPACE_CHAR_REGEX = /\s/;
|
|
||||||
|
|
||||||
CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
|
|
||||||
if (old != CodeMirror.Init && old)
|
|
||||||
cm.removeKeyMap("autoCloseBrackets");
|
|
||||||
if (!val) return;
|
|
||||||
var pairs = DEFAULT_BRACKETS, 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.explode != null) explode = val.explode;
|
|
||||||
}
|
|
||||||
var map = buildKeymap(pairs);
|
|
||||||
if (explode) map.Enter = buildExplodeHandler(explode);
|
|
||||||
cm.addKeyMap(map);
|
|
||||||
});
|
|
||||||
|
|
||||||
function charsAround(cm, pos) {
|
|
||||||
var str = cm.getRange(CodeMirror.Pos(pos.line, pos.ch - 1),
|
|
||||||
CodeMirror.Pos(pos.line, pos.ch + 1));
|
|
||||||
return str.length == 2 ? str : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildKeymap(pairs) {
|
|
||||||
var map = {
|
|
||||||
name : "autoCloseBrackets",
|
|
||||||
Backspace: function(cm) {
|
|
||||||
if (cm.somethingSelected() || cm.getOption("disableInput")) return CodeMirror.Pass;
|
|
||||||
var cur = cm.getCursor(), around = charsAround(cm, cur);
|
|
||||||
if (around && pairs.indexOf(around) % 2 == 0)
|
|
||||||
cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1));
|
|
||||||
else
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var closingBrackets = "";
|
|
||||||
for (var i = 0; i < pairs.length; i += 2) (function(left, right) {
|
|
||||||
if (left != right) closingBrackets += right;
|
|
||||||
function surround(cm) {
|
|
||||||
var selection = cm.getSelection();
|
|
||||||
cm.replaceSelection(left + selection + right);
|
|
||||||
}
|
|
||||||
function maybeOverwrite(cm) {
|
|
||||||
var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1));
|
|
||||||
if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass;
|
|
||||||
else cm.execCommand("goCharRight");
|
|
||||||
}
|
|
||||||
map["'" + left + "'"] = function(cm) {
|
|
||||||
if (left == "'" && cm.getTokenAt(cm.getCursor()).type == "comment" ||
|
|
||||||
cm.getOption("disableInput"))
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
if (cm.somethingSelected()) return surround(cm);
|
|
||||||
if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return;
|
|
||||||
var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1);
|
|
||||||
var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch), curChar = cur.ch > 0 ? line.charAt(cur.ch - 1) : "";
|
|
||||||
if (left == right && CodeMirror.isWordChar(curChar))
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar))
|
|
||||||
cm.replaceSelection(left + right, {head: ahead, anchor: ahead});
|
|
||||||
else
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
};
|
|
||||||
if (left != right) map["'" + right + "'"] = maybeOverwrite;
|
|
||||||
})(pairs.charAt(i), pairs.charAt(i + 1));
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildExplodeHandler(pairs) {
|
|
||||||
return function(cm) {
|
|
||||||
var cur = cm.getCursor(), around = charsAround(cm, cur);
|
|
||||||
if (!around || pairs.indexOf(around) % 2 != 0 || cm.getOption("disableInput"))
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
cm.operation(function() {
|
|
||||||
var newPos = CodeMirror.Pos(cur.line + 1, 0);
|
|
||||||
cm.replaceSelection("\n\n", {anchor: newPos, head: newPos}, "+input");
|
|
||||||
cm.indentLine(cur.line + 1, null, true);
|
|
||||||
cm.indentLine(cur.line + 2, null, true);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})();
|
|
93
fhem/www/codemirror/addon/edit/closetag.js
vendored
93
fhem/www/codemirror/addon/edit/closetag.js
vendored
@ -1,93 +0,0 @@
|
|||||||
/**
|
|
||||||
* Tag-closer extension for CodeMirror.
|
|
||||||
*
|
|
||||||
* This extension adds an "autoCloseTags" option that can be set to
|
|
||||||
* either true to get the default behavior, or an object to further
|
|
||||||
* configure its behavior.
|
|
||||||
*
|
|
||||||
* These are supported options:
|
|
||||||
*
|
|
||||||
* `whenClosing` (default true)
|
|
||||||
* Whether to autoclose when the '/' of a closing tag is typed.
|
|
||||||
* `whenOpening` (default true)
|
|
||||||
* Whether to autoclose the tag when the final '>' of an opening
|
|
||||||
* tag is typed.
|
|
||||||
* `dontCloseTags` (default is empty tags for HTML, none for XML)
|
|
||||||
* An array of tag names that should not be autoclosed.
|
|
||||||
* `indentTags` (default is block tags for HTML, none for XML)
|
|
||||||
* An array of tag names that should, when opened, cause a
|
|
||||||
* blank line to be added inside the tag, and the blank line and
|
|
||||||
* closing line to be indented.
|
|
||||||
*
|
|
||||||
* See demos/closetag.html for a usage example.
|
|
||||||
*/
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
|
|
||||||
if (old != CodeMirror.Init && old)
|
|
||||||
cm.removeKeyMap("autoCloseTags");
|
|
||||||
if (!val) return;
|
|
||||||
var map = {name: "autoCloseTags"};
|
|
||||||
if (typeof val != "object" || val.whenClosing)
|
|
||||||
map["'/'"] = function(cm) { return autoCloseSlash(cm); };
|
|
||||||
if (typeof val != "object" || val.whenOpening)
|
|
||||||
map["'>'"] = function(cm) { return autoCloseGT(cm); };
|
|
||||||
cm.addKeyMap(map);
|
|
||||||
});
|
|
||||||
|
|
||||||
var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
|
|
||||||
"source", "track", "wbr"];
|
|
||||||
var htmlIndent = ["applet", "blockquote", "body", "button", "div", "dl", "fieldset", "form", "frameset", "h1", "h2", "h3", "h4",
|
|
||||||
"h5", "h6", "head", "html", "iframe", "layer", "legend", "object", "ol", "p", "select", "table", "ul"];
|
|
||||||
|
|
||||||
function autoCloseGT(cm) {
|
|
||||||
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
|
|
||||||
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
|
||||||
if (inner.mode.name != "xml" || !state.tagName || cm.getOption("disableInput")) return CodeMirror.Pass;
|
|
||||||
|
|
||||||
var opt = cm.getOption("autoCloseTags"), html = inner.mode.configuration == "html";
|
|
||||||
var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
|
|
||||||
var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
|
|
||||||
|
|
||||||
var tagName = state.tagName;
|
|
||||||
if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
|
|
||||||
var lowerTagName = tagName.toLowerCase();
|
|
||||||
// Don't process the '>' at the end of an end-tag or self-closing tag
|
|
||||||
if (!tagName ||
|
|
||||||
tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
|
|
||||||
tok.type == "tag" && state.type == "closeTag" ||
|
|
||||||
tok.string.indexOf("/") == (tok.string.length - 1) || // match something like <someTagName />
|
|
||||||
dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
|
|
||||||
CodeMirror.scanForClosingTag && CodeMirror.scanForClosingTag(cm, pos, tagName,
|
|
||||||
Math.min(cm.lastLine() + 1, pos.line + 50)))
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
|
|
||||||
var doIndent = indentTags && indexOf(indentTags, lowerTagName) > -1;
|
|
||||||
var curPos = doIndent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1);
|
|
||||||
cm.replaceSelection(">" + (doIndent ? "\n\n" : "") + "</" + tagName + ">",
|
|
||||||
{head: curPos, anchor: curPos});
|
|
||||||
if (doIndent) {
|
|
||||||
cm.indentLine(pos.line + 1, null, true);
|
|
||||||
cm.indentLine(pos.line + 2, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function autoCloseSlash(cm) {
|
|
||||||
var pos = cm.getCursor(), tok = cm.getTokenAt(pos);
|
|
||||||
var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
|
|
||||||
if (tok.type == "string" || tok.string.charAt(0) != "<" ||
|
|
||||||
tok.start != pos.ch - 1 || inner.mode.name != "xml" ||
|
|
||||||
cm.getOption("disableInput"))
|
|
||||||
return CodeMirror.Pass;
|
|
||||||
|
|
||||||
var tagName = state.context && state.context.tagName;
|
|
||||||
if (tagName) cm.replaceSelection("/" + tagName + ">", "end");
|
|
||||||
}
|
|
||||||
|
|
||||||
function indexOf(collection, elt) {
|
|
||||||
if (collection.indexOf) return collection.indexOf(elt);
|
|
||||||
for (var i = 0, e = collection.length; i < e; ++i)
|
|
||||||
if (collection[i] == elt) return i;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
})();
|
|
87
fhem/www/codemirror/addon/edit/matchbrackets.js
vendored
87
fhem/www/codemirror/addon/edit/matchbrackets.js
vendored
@ -1,87 +0,0 @@
|
|||||||
(function() {
|
|
||||||
var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
|
|
||||||
(document.documentMode == null || document.documentMode < 8);
|
|
||||||
|
|
||||||
var Pos = CodeMirror.Pos;
|
|
||||||
|
|
||||||
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
|
||||||
function findMatchingBracket(cm, where, strict) {
|
|
||||||
var state = cm.state.matchBrackets;
|
|
||||||
var maxScanLen = (state && state.maxScanLineLength) || 10000;
|
|
||||||
var maxScanLines = (state && state.maxScanLines) || 100;
|
|
||||||
|
|
||||||
var cur = where || cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
|
|
||||||
var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
|
|
||||||
if (!match) return null;
|
|
||||||
var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
|
|
||||||
if (strict && forward != (pos == cur.ch)) return null;
|
|
||||||
var style = cm.getTokenTypeAt(Pos(cur.line, pos + 1));
|
|
||||||
|
|
||||||
var stack = [line.text.charAt(pos)], re = /[(){}[\]]/;
|
|
||||||
function scan(line, lineNo, start) {
|
|
||||||
if (!line.text) return;
|
|
||||||
var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1;
|
|
||||||
if (line.text.length > maxScanLen) return null;
|
|
||||||
if (start != null) pos = start + d;
|
|
||||||
for (; pos != end; pos += d) {
|
|
||||||
var ch = line.text.charAt(pos);
|
|
||||||
if (re.test(ch) && cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style) {
|
|
||||||
var match = matching[ch];
|
|
||||||
if (match.charAt(1) == ">" == forward) stack.push(ch);
|
|
||||||
else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false};
|
|
||||||
else if (!stack.length) return {pos: pos, match: true};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var i = cur.line, found, e = forward ? Math.min(i + maxScanLines, cm.lineCount()) : Math.max(-1, i - maxScanLines); i != e; i+=d) {
|
|
||||||
if (i == cur.line) found = scan(line, i, pos);
|
|
||||||
else found = scan(cm.getLineHandle(i), i);
|
|
||||||
if (found) break;
|
|
||||||
}
|
|
||||||
return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos),
|
|
||||||
match: found && found.match, forward: forward};
|
|
||||||
}
|
|
||||||
|
|
||||||
function matchBrackets(cm, autoclear) {
|
|
||||||
// Disable brace matching in long lines, since it'll cause hugely slow updates
|
|
||||||
var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
|
|
||||||
var found = findMatchingBracket(cm);
|
|
||||||
if (!found || cm.getLine(found.from.line).length > maxHighlightLen ||
|
|
||||||
found.to && cm.getLine(found.to.line).length > maxHighlightLen)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
|
|
||||||
var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style});
|
|
||||||
var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style});
|
|
||||||
// Kludge to work around the IE bug from issue #1193, where text
|
|
||||||
// input stops going to the textarea whenever this fires.
|
|
||||||
if (ie_lt8 && cm.state.focused) cm.display.input.focus();
|
|
||||||
var clear = function() {
|
|
||||||
cm.operation(function() { one.clear(); two && two.clear(); });
|
|
||||||
};
|
|
||||||
if (autoclear) setTimeout(clear, 800);
|
|
||||||
else return clear;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentlyHighlighted = null;
|
|
||||||
function doMatchBrackets(cm) {
|
|
||||||
cm.operation(function() {
|
|
||||||
if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;}
|
|
||||||
if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
|
|
||||||
if (old && old != CodeMirror.Init)
|
|
||||||
cm.off("cursorActivity", doMatchBrackets);
|
|
||||||
if (val) {
|
|
||||||
cm.state.matchBrackets = typeof val == "object" ? val : {};
|
|
||||||
cm.on("cursorActivity", doMatchBrackets);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
|
|
||||||
CodeMirror.defineExtension("findMatchingBracket", function(pos, strict){
|
|
||||||
return findMatchingBracket(this, pos, strict);
|
|
||||||
});
|
|
||||||
})();
|
|
56
fhem/www/codemirror/addon/edit/matchtags.js
vendored
56
fhem/www/codemirror/addon/edit/matchtags.js
vendored
@ -1,56 +0,0 @@
|
|||||||
(function() {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
|
|
||||||
if (old && old != CodeMirror.Init) {
|
|
||||||
cm.off("cursorActivity", doMatchTags);
|
|
||||||
cm.off("viewportChange", maybeUpdateMatch);
|
|
||||||
clear(cm);
|
|
||||||
}
|
|
||||||
if (val) {
|
|
||||||
cm.state.matchBothTags = typeof val == "object" && val.bothTags;
|
|
||||||
cm.on("cursorActivity", doMatchTags);
|
|
||||||
cm.on("viewportChange", maybeUpdateMatch);
|
|
||||||
doMatchTags(cm);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function clear(cm) {
|
|
||||||
if (cm.state.tagHit) cm.state.tagHit.clear();
|
|
||||||
if (cm.state.tagOther) cm.state.tagOther.clear();
|
|
||||||
cm.state.tagHit = cm.state.tagOther = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function doMatchTags(cm) {
|
|
||||||
cm.state.failedTagMatch = false;
|
|
||||||
cm.operation(function() {
|
|
||||||
clear(cm);
|
|
||||||
if (cm.somethingSelected()) return;
|
|
||||||
var cur = cm.getCursor(), range = cm.getViewport();
|
|
||||||
range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
|
|
||||||
var match = CodeMirror.findMatchingTag(cm, cur, range);
|
|
||||||
if (!match) return;
|
|
||||||
if (cm.state.matchBothTags) {
|
|
||||||
var hit = match.at == "open" ? match.open : match.close;
|
|
||||||
if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
|
|
||||||
}
|
|
||||||
var other = match.at == "close" ? match.open : match.close;
|
|
||||||
if (other)
|
|
||||||
cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
|
|
||||||
else
|
|
||||||
cm.state.failedTagMatch = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function maybeUpdateMatch(cm) {
|
|
||||||
if (cm.state.failedTagMatch) doMatchTags(cm);
|
|
||||||
}
|
|
||||||
|
|
||||||
CodeMirror.commands.toMatchingTag = function(cm) {
|
|
||||||
var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
|
|
||||||
if (found) {
|
|
||||||
var other = found.at == "close" ? found.open : found.close;
|
|
||||||
if (other) cm.setSelection(other.to, other.from);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})();
|
|
38
fhem/www/codemirror/addon/hint/show-hint.css
vendored
38
fhem/www/codemirror/addon/hint/show-hint.css
vendored
@ -1,38 +0,0 @@
|
|||||||
.CodeMirror-hints {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 10;
|
|
||||||
overflow: hidden;
|
|
||||||
list-style: none;
|
|
||||||
|
|
||||||
margin: 0;
|
|
||||||
padding: 2px;
|
|
||||||
|
|
||||||
-webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
-moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
box-shadow: 2px 3px 5px rgba(0,0,0,.2);
|
|
||||||
border-radius: 3px;
|
|
||||||
border: 1px solid silver;
|
|
||||||
|
|
||||||
background: white;
|
|
||||||
font-size: 90%;
|
|
||||||
font-family: monospace;
|
|
||||||
|
|
||||||
max-height: 20em;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-hint {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 4px;
|
|
||||||
border-radius: 2px;
|
|
||||||
max-width: 19em;
|
|
||||||
overflow: hidden;
|
|
||||||
white-space: pre;
|
|
||||||
color: black;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-hint-active {
|
|
||||||
background: #08f;
|
|
||||||
color: white;
|
|
||||||
}
|
|
335
fhem/www/codemirror/addon/hint/show-hint.js
vendored
335
fhem/www/codemirror/addon/hint/show-hint.js
vendored
@ -1,335 +0,0 @@
|
|||||||
(function() {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var HINT_ELEMENT_CLASS = "CodeMirror-hint";
|
|
||||||
var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
|
|
||||||
|
|
||||||
CodeMirror.showHint = function(cm, getHints, options) {
|
|
||||||
// We want a single cursor position.
|
|
||||||
if (cm.somethingSelected()) return;
|
|
||||||
if (getHints == null) {
|
|
||||||
if (options && options.async) return;
|
|
||||||
else getHints = CodeMirror.hint.auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (cm.state.completionActive) cm.state.completionActive.close();
|
|
||||||
|
|
||||||
var completion = cm.state.completionActive = new Completion(cm, getHints, options || {});
|
|
||||||
CodeMirror.signal(cm, "startCompletion", cm);
|
|
||||||
if (completion.options.async)
|
|
||||||
getHints(cm, function(hints) { completion.showHints(hints); }, completion.options);
|
|
||||||
else
|
|
||||||
return completion.showHints(getHints(cm, completion.options));
|
|
||||||
};
|
|
||||||
|
|
||||||
function Completion(cm, getHints, options) {
|
|
||||||
this.cm = cm;
|
|
||||||
this.getHints = getHints;
|
|
||||||
this.options = options;
|
|
||||||
this.widget = this.onClose = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
Completion.prototype = {
|
|
||||||
close: function() {
|
|
||||||
if (!this.active()) return;
|
|
||||||
this.cm.state.completionActive = null;
|
|
||||||
|
|
||||||
if (this.widget) this.widget.close();
|
|
||||||
if (this.onClose) this.onClose();
|
|
||||||
CodeMirror.signal(this.cm, "endCompletion", this.cm);
|
|
||||||
},
|
|
||||||
|
|
||||||
active: function() {
|
|
||||||
return this.cm.state.completionActive == this;
|
|
||||||
},
|
|
||||||
|
|
||||||
pick: function(data, i) {
|
|
||||||
var completion = data.list[i];
|
|
||||||
if (completion.hint) completion.hint(this.cm, data, completion);
|
|
||||||
else this.cm.replaceRange(getText(completion), data.from, data.to);
|
|
||||||
CodeMirror.signal(data, "pick", completion);
|
|
||||||
this.close();
|
|
||||||
},
|
|
||||||
|
|
||||||
showHints: function(data) {
|
|
||||||
if (!data || !data.list.length || !this.active()) return this.close();
|
|
||||||
|
|
||||||
if (this.options.completeSingle != false && data.list.length == 1)
|
|
||||||
this.pick(data, 0);
|
|
||||||
else
|
|
||||||
this.showWidget(data);
|
|
||||||
},
|
|
||||||
|
|
||||||
showWidget: function(data) {
|
|
||||||
this.widget = new Widget(this, data);
|
|
||||||
CodeMirror.signal(data, "shown");
|
|
||||||
|
|
||||||
var debounce = 0, completion = this, finished;
|
|
||||||
var closeOn = this.options.closeCharacters || /[\s()\[\]{};:>,]/;
|
|
||||||
var startPos = this.cm.getCursor(), startLen = this.cm.getLine(startPos.line).length;
|
|
||||||
|
|
||||||
var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
|
|
||||||
return setTimeout(fn, 1000/60);
|
|
||||||
};
|
|
||||||
var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
|
|
||||||
|
|
||||||
function done() {
|
|
||||||
if (finished) return;
|
|
||||||
finished = true;
|
|
||||||
completion.close();
|
|
||||||
completion.cm.off("cursorActivity", activity);
|
|
||||||
if (data) CodeMirror.signal(data, "close");
|
|
||||||
}
|
|
||||||
|
|
||||||
function update() {
|
|
||||||
if (finished) return;
|
|
||||||
CodeMirror.signal(data, "update");
|
|
||||||
if (completion.options.async)
|
|
||||||
completion.getHints(completion.cm, finishUpdate, completion.options);
|
|
||||||
else
|
|
||||||
finishUpdate(completion.getHints(completion.cm, completion.options));
|
|
||||||
}
|
|
||||||
function finishUpdate(data_) {
|
|
||||||
data = data_;
|
|
||||||
if (finished) return;
|
|
||||||
if (!data || !data.list.length) return done();
|
|
||||||
completion.widget = new Widget(completion, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
function clearDebounce() {
|
|
||||||
if (debounce) {
|
|
||||||
cancelAnimationFrame(debounce);
|
|
||||||
debounce = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function activity() {
|
|
||||||
clearDebounce();
|
|
||||||
var pos = completion.cm.getCursor(), line = completion.cm.getLine(pos.line);
|
|
||||||
if (pos.line != startPos.line || line.length - pos.ch != startLen - startPos.ch ||
|
|
||||||
pos.ch < startPos.ch || completion.cm.somethingSelected() ||
|
|
||||||
(pos.ch && closeOn.test(line.charAt(pos.ch - 1)))) {
|
|
||||||
completion.close();
|
|
||||||
} else {
|
|
||||||
debounce = requestAnimationFrame(update);
|
|
||||||
if (completion.widget) completion.widget.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.cm.on("cursorActivity", activity);
|
|
||||||
this.onClose = done;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function getText(completion) {
|
|
||||||
if (typeof completion == "string") return completion;
|
|
||||||
else return completion.text;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildKeyMap(options, handle) {
|
|
||||||
var baseMap = {
|
|
||||||
Up: function() {handle.moveFocus(-1);},
|
|
||||||
Down: function() {handle.moveFocus(1);},
|
|
||||||
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
|
|
||||||
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
|
|
||||||
Home: function() {handle.setFocus(0);},
|
|
||||||
End: function() {handle.setFocus(handle.length - 1);},
|
|
||||||
Enter: handle.pick,
|
|
||||||
Tab: handle.pick,
|
|
||||||
Esc: handle.close
|
|
||||||
};
|
|
||||||
var ourMap = options.customKeys ? {} : baseMap;
|
|
||||||
function addBinding(key, val) {
|
|
||||||
var bound;
|
|
||||||
if (typeof val != "string")
|
|
||||||
bound = function(cm) { return val(cm, handle); };
|
|
||||||
// This mechanism is deprecated
|
|
||||||
else if (baseMap.hasOwnProperty(val))
|
|
||||||
bound = baseMap[val];
|
|
||||||
else
|
|
||||||
bound = val;
|
|
||||||
ourMap[key] = bound;
|
|
||||||
}
|
|
||||||
if (options.customKeys)
|
|
||||||
for (var key in options.customKeys) if (options.customKeys.hasOwnProperty(key))
|
|
||||||
addBinding(key, options.customKeys[key]);
|
|
||||||
if (options.extraKeys)
|
|
||||||
for (var key in options.extraKeys) if (options.extraKeys.hasOwnProperty(key))
|
|
||||||
addBinding(key, options.extraKeys[key]);
|
|
||||||
return ourMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getHintElement(hintsElement, el) {
|
|
||||||
while (el && el != hintsElement) {
|
|
||||||
if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
|
|
||||||
el = el.parentNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function Widget(completion, data) {
|
|
||||||
this.completion = completion;
|
|
||||||
this.data = data;
|
|
||||||
var widget = this, cm = completion.cm, options = completion.options;
|
|
||||||
|
|
||||||
var hints = this.hints = document.createElement("ul");
|
|
||||||
hints.className = "CodeMirror-hints";
|
|
||||||
this.selectedHint = options.getDefaultSelection ? options.getDefaultSelection(cm,options,data) : 0;
|
|
||||||
|
|
||||||
var completions = data.list;
|
|
||||||
for (var i = 0; i < completions.length; ++i) {
|
|
||||||
var elt = hints.appendChild(document.createElement("li")), cur = completions[i];
|
|
||||||
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
|
||||||
if (cur.className != null) className = cur.className + " " + className;
|
|
||||||
elt.className = className;
|
|
||||||
if (cur.render) cur.render(elt, data, cur);
|
|
||||||
else elt.appendChild(document.createTextNode(cur.displayText || getText(cur)));
|
|
||||||
elt.hintId = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
var pos = cm.cursorCoords(options.alignWithWord !== false ? data.from : null);
|
|
||||||
var left = pos.left, top = pos.bottom, below = true;
|
|
||||||
hints.style.left = left + "px";
|
|
||||||
hints.style.top = top + "px";
|
|
||||||
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
|
||||||
var winW = window.innerWidth || Math.max(document.body.offsetWidth, document.documentElement.offsetWidth);
|
|
||||||
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
|
|
||||||
(options.container || document.body).appendChild(hints);
|
|
||||||
var box = hints.getBoundingClientRect();
|
|
||||||
var overlapX = box.right - winW, overlapY = box.bottom - winH;
|
|
||||||
if (overlapX > 0) {
|
|
||||||
if (box.right - box.left > winW) {
|
|
||||||
hints.style.width = (winW - 5) + "px";
|
|
||||||
overlapX -= (box.right - box.left) - winW;
|
|
||||||
}
|
|
||||||
hints.style.left = (left = pos.left - overlapX) + "px";
|
|
||||||
}
|
|
||||||
if (overlapY > 0) {
|
|
||||||
var height = box.bottom - box.top;
|
|
||||||
if (box.top - (pos.bottom - pos.top) - height > 0) {
|
|
||||||
overlapY = height + (pos.bottom - pos.top);
|
|
||||||
below = false;
|
|
||||||
} else if (height > winH) {
|
|
||||||
hints.style.height = (winH - 5) + "px";
|
|
||||||
overlapY -= height - winH;
|
|
||||||
}
|
|
||||||
hints.style.top = (top = pos.bottom - overlapY) + "px";
|
|
||||||
}
|
|
||||||
|
|
||||||
cm.addKeyMap(this.keyMap = buildKeyMap(options, {
|
|
||||||
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
|
|
||||||
setFocus: function(n) { widget.changeActive(n); },
|
|
||||||
menuSize: function() { return widget.screenAmount(); },
|
|
||||||
length: completions.length,
|
|
||||||
close: function() { completion.close(); },
|
|
||||||
pick: function() { widget.pick(); }
|
|
||||||
}));
|
|
||||||
|
|
||||||
if (options.closeOnUnfocus !== false) {
|
|
||||||
var closingOnBlur;
|
|
||||||
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
|
|
||||||
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
|
|
||||||
}
|
|
||||||
|
|
||||||
var startScroll = cm.getScrollInfo();
|
|
||||||
cm.on("scroll", this.onScroll = function() {
|
|
||||||
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
|
||||||
var newTop = top + startScroll.top - curScroll.top;
|
|
||||||
var point = newTop - (window.pageYOffset || (document.documentElement || document.body).scrollTop);
|
|
||||||
if (!below) point += hints.offsetHeight;
|
|
||||||
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
|
||||||
hints.style.top = newTop + "px";
|
|
||||||
hints.style.left = (left + startScroll.left - curScroll.left) + "px";
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.on(hints, "dblclick", function(e) {
|
|
||||||
var t = getHintElement(hints, e.target || e.srcElement);
|
|
||||||
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.on(hints, "click", function(e) {
|
|
||||||
var t = getHintElement(hints, e.target || e.srcElement);
|
|
||||||
if (t && t.hintId != null) {
|
|
||||||
widget.changeActive(t.hintId);
|
|
||||||
if (options.completeOnSingleClick) widget.pick();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.on(hints, "mousedown", function() {
|
|
||||||
setTimeout(function(){cm.focus();}, 20);
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.signal(data, "select", completions[0], hints.firstChild);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget.prototype = {
|
|
||||||
close: function() {
|
|
||||||
if (this.completion.widget != this) return;
|
|
||||||
this.completion.widget = null;
|
|
||||||
this.hints.parentNode.removeChild(this.hints);
|
|
||||||
this.completion.cm.removeKeyMap(this.keyMap);
|
|
||||||
|
|
||||||
var cm = this.completion.cm;
|
|
||||||
if (this.completion.options.closeOnUnfocus !== false) {
|
|
||||||
cm.off("blur", this.onBlur);
|
|
||||||
cm.off("focus", this.onFocus);
|
|
||||||
}
|
|
||||||
cm.off("scroll", this.onScroll);
|
|
||||||
},
|
|
||||||
|
|
||||||
pick: function() {
|
|
||||||
this.completion.pick(this.data, this.selectedHint);
|
|
||||||
},
|
|
||||||
|
|
||||||
changeActive: function(i, avoidWrap) {
|
|
||||||
if (i >= this.data.list.length)
|
|
||||||
i = avoidWrap ? this.data.list.length - 1 : 0;
|
|
||||||
else if (i < 0)
|
|
||||||
i = avoidWrap ? 0 : this.data.list.length - 1;
|
|
||||||
if (this.selectedHint == i) return;
|
|
||||||
var node = this.hints.childNodes[this.selectedHint];
|
|
||||||
node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
|
|
||||||
node = this.hints.childNodes[this.selectedHint = i];
|
|
||||||
node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
|
|
||||||
if (node.offsetTop < this.hints.scrollTop)
|
|
||||||
this.hints.scrollTop = node.offsetTop - 3;
|
|
||||||
else if (node.offsetTop + node.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
|
|
||||||
this.hints.scrollTop = node.offsetTop + node.offsetHeight - this.hints.clientHeight + 3;
|
|
||||||
CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
|
|
||||||
},
|
|
||||||
|
|
||||||
screenAmount: function() {
|
|
||||||
return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeMirror.registerHelper("hint", "auto", function(cm, options) {
|
|
||||||
var helpers = cm.getHelpers(cm.getCursor(), "hint");
|
|
||||||
if (helpers.length) {
|
|
||||||
for (var i = 0; i < helpers.length; i++) {
|
|
||||||
var cur = helpers[i](cm, options);
|
|
||||||
if (cur && cur.list.length) return cur;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
var words = cm.getHelper(cm.getCursor(), "hintWords");
|
|
||||||
if (words) return CodeMirror.hint.fromList(cm, {words: words});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
|
|
||||||
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
|
||||||
var found = [];
|
|
||||||
for (var i = 0; i < options.words.length; i++) {
|
|
||||||
var word = options.words[i];
|
|
||||||
if (word.slice(0, token.string.length) == token.string)
|
|
||||||
found.push(word);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (found.length) return {
|
|
||||||
list: found,
|
|
||||||
from: CodeMirror.Pos(cur.line, token.start),
|
|
||||||
to: CodeMirror.Pos(cur.line, token.end)
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.commands.autocomplete = CodeMirror.showHint;
|
|
||||||
})();
|
|
263
fhem/www/codemirror/lib/codemirror.css
vendored
263
fhem/www/codemirror/lib/codemirror.css
vendored
@ -1,263 +0,0 @@
|
|||||||
/* BASICS */
|
|
||||||
|
|
||||||
.CodeMirror {
|
|
||||||
/* Set height, width, borders, and global font properties here */
|
|
||||||
font-family: monospace;
|
|
||||||
height: 300px;
|
|
||||||
}
|
|
||||||
.CodeMirror-scroll {
|
|
||||||
/* Set scrolling behaviour here */
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PADDING */
|
|
||||||
|
|
||||||
.CodeMirror-lines {
|
|
||||||
padding: 4px 0; /* Vertical padding around content */
|
|
||||||
}
|
|
||||||
.CodeMirror pre {
|
|
||||||
padding: 0 4px; /* Horizontal padding of content */
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
|
||||||
background-color: white; /* The little square between H and V scrollbars */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* GUTTER */
|
|
||||||
|
|
||||||
.CodeMirror-gutters {
|
|
||||||
border-right: 1px solid #ddd;
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
.CodeMirror-linenumbers {}
|
|
||||||
.CodeMirror-linenumber {
|
|
||||||
padding: 0 3px 0 5px;
|
|
||||||
min-width: 20px;
|
|
||||||
text-align: right;
|
|
||||||
color: #999;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CURSOR */
|
|
||||||
|
|
||||||
.CodeMirror div.CodeMirror-cursor {
|
|
||||||
border-left: 1px solid black;
|
|
||||||
z-index: 3;
|
|
||||||
}
|
|
||||||
/* Shown when moving in bi-directional text */
|
|
||||||
.CodeMirror div.CodeMirror-secondarycursor {
|
|
||||||
border-left: 1px solid silver;
|
|
||||||
}
|
|
||||||
.CodeMirror.cm-keymap-fat-cursor div.CodeMirror-cursor {
|
|
||||||
width: auto;
|
|
||||||
border: 0;
|
|
||||||
background: #7e7;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
/* Can style cursor different in overwrite (non-insert) mode */
|
|
||||||
.CodeMirror div.CodeMirror-cursor.CodeMirror-overwrite {}
|
|
||||||
|
|
||||||
.cm-tab { display: inline-block; }
|
|
||||||
|
|
||||||
/* DEFAULT THEME */
|
|
||||||
|
|
||||||
.cm-s-default .cm-keyword {color: #708;}
|
|
||||||
.cm-s-default .cm-atom {color: #219;}
|
|
||||||
.cm-s-default .cm-number {color: #164;}
|
|
||||||
.cm-s-default .cm-def {color: #00f;}
|
|
||||||
.cm-s-default .cm-variable {color: black;}
|
|
||||||
.cm-s-default .cm-variable-2 {color: #05a;}
|
|
||||||
.cm-s-default .cm-variable-3 {color: #085;}
|
|
||||||
.cm-s-default .cm-property {color: black;}
|
|
||||||
.cm-s-default .cm-operator {color: black;}
|
|
||||||
.cm-s-default .cm-comment {color: #a50;}
|
|
||||||
.cm-s-default .cm-string {color: #a11;}
|
|
||||||
.cm-s-default .cm-string-2 {color: #f50;}
|
|
||||||
.cm-s-default .cm-meta {color: #555;}
|
|
||||||
.cm-s-default .cm-qualifier {color: #555;}
|
|
||||||
.cm-s-default .cm-builtin {color: #30a;}
|
|
||||||
.cm-s-default .cm-bracket {color: #997;}
|
|
||||||
.cm-s-default .cm-tag {color: #170;}
|
|
||||||
.cm-s-default .cm-attribute {color: #00c;}
|
|
||||||
.cm-s-default .cm-header {color: blue;}
|
|
||||||
.cm-s-default .cm-quote {color: #090;}
|
|
||||||
.cm-s-default .cm-hr {color: #999;}
|
|
||||||
.cm-s-default .cm-link {color: #00c;}
|
|
||||||
|
|
||||||
.cm-negative {color: #d44;}
|
|
||||||
.cm-positive {color: #292;}
|
|
||||||
.cm-header, .cm-strong {font-weight: bold;}
|
|
||||||
.cm-em {font-style: italic;}
|
|
||||||
.cm-link {text-decoration: underline;}
|
|
||||||
|
|
||||||
.cm-s-default .cm-error {color: #f00;}
|
|
||||||
.cm-invalidchar {color: #f00;}
|
|
||||||
|
|
||||||
div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
|
|
||||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
|
|
||||||
.CodeMirror-activeline-background {background: #e8f2ff;}
|
|
||||||
|
|
||||||
/* STOP */
|
|
||||||
|
|
||||||
/* The rest of this file contains styles related to the mechanics of
|
|
||||||
the editor. You probably shouldn't touch them. */
|
|
||||||
|
|
||||||
.CodeMirror {
|
|
||||||
line-height: 1;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
background: white;
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-scroll {
|
|
||||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
|
||||||
/* See overflow: hidden in .CodeMirror */
|
|
||||||
margin-bottom: -30px; margin-right: -30px;
|
|
||||||
padding-bottom: 30px; padding-right: 30px;
|
|
||||||
height: 100%;
|
|
||||||
outline: none; /* Prevent dragging from highlighting the element */
|
|
||||||
position: relative;
|
|
||||||
-moz-box-sizing: content-box;
|
|
||||||
box-sizing: content-box;
|
|
||||||
}
|
|
||||||
.CodeMirror-sizer {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
|
||||||
before actuall scrolling happens, thus preventing shaking and
|
|
||||||
flickering artifacts. */
|
|
||||||
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
|
|
||||||
position: absolute;
|
|
||||||
z-index: 6;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.CodeMirror-vscrollbar {
|
|
||||||
right: 0; top: 0;
|
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: scroll;
|
|
||||||
}
|
|
||||||
.CodeMirror-hscrollbar {
|
|
||||||
bottom: 0; left: 0;
|
|
||||||
overflow-y: hidden;
|
|
||||||
overflow-x: scroll;
|
|
||||||
}
|
|
||||||
.CodeMirror-scrollbar-filler {
|
|
||||||
right: 0; bottom: 0;
|
|
||||||
}
|
|
||||||
.CodeMirror-gutter-filler {
|
|
||||||
left: 0; bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-gutters {
|
|
||||||
position: absolute; left: 0; top: 0;
|
|
||||||
padding-bottom: 30px;
|
|
||||||
z-index: 3;
|
|
||||||
}
|
|
||||||
.CodeMirror-gutter {
|
|
||||||
white-space: normal;
|
|
||||||
height: 100%;
|
|
||||||
-moz-box-sizing: content-box;
|
|
||||||
box-sizing: content-box;
|
|
||||||
padding-bottom: 30px;
|
|
||||||
margin-bottom: -32px;
|
|
||||||
display: inline-block;
|
|
||||||
/* Hack to make IE7 behave */
|
|
||||||
*zoom:1;
|
|
||||||
*display:inline;
|
|
||||||
}
|
|
||||||
.CodeMirror-gutter-elt {
|
|
||||||
position: absolute;
|
|
||||||
cursor: default;
|
|
||||||
z-index: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-lines {
|
|
||||||
cursor: text;
|
|
||||||
}
|
|
||||||
.CodeMirror pre {
|
|
||||||
/* Reset some styles that the rest of the page might have set */
|
|
||||||
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
|
|
||||||
border-width: 0;
|
|
||||||
background: transparent;
|
|
||||||
font-family: inherit;
|
|
||||||
font-size: inherit;
|
|
||||||
margin: 0;
|
|
||||||
white-space: pre;
|
|
||||||
word-wrap: normal;
|
|
||||||
line-height: inherit;
|
|
||||||
color: inherit;
|
|
||||||
z-index: 2;
|
|
||||||
position: relative;
|
|
||||||
overflow: visible;
|
|
||||||
}
|
|
||||||
.CodeMirror-wrap pre {
|
|
||||||
word-wrap: break-word;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: normal;
|
|
||||||
}
|
|
||||||
.CodeMirror-code pre {
|
|
||||||
border-right: 30px solid transparent;
|
|
||||||
width: -webkit-fit-content;
|
|
||||||
width: -moz-fit-content;
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
.CodeMirror-wrap .CodeMirror-code pre {
|
|
||||||
border-right: none;
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
.CodeMirror-linebackground {
|
|
||||||
position: absolute;
|
|
||||||
left: 0; right: 0; top: 0; bottom: 0;
|
|
||||||
z-index: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-linewidget {
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-widget {}
|
|
||||||
|
|
||||||
.CodeMirror-wrap .CodeMirror-scroll {
|
|
||||||
overflow-x: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-measure {
|
|
||||||
position: absolute;
|
|
||||||
width: 100%;
|
|
||||||
height: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
.CodeMirror-measure pre { position: static; }
|
|
||||||
|
|
||||||
.CodeMirror div.CodeMirror-cursor {
|
|
||||||
position: absolute;
|
|
||||||
visibility: hidden;
|
|
||||||
border-right: none;
|
|
||||||
width: 0;
|
|
||||||
}
|
|
||||||
.CodeMirror-focused div.CodeMirror-cursor {
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
.CodeMirror-selected { background: #d9d9d9; }
|
|
||||||
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
|
|
||||||
|
|
||||||
.cm-searching {
|
|
||||||
background: #ffa;
|
|
||||||
background: rgba(255, 255, 0, .4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* IE7 hack to prevent it from returning funny offsetTops on the spans */
|
|
||||||
.CodeMirror span { *vertical-align: text-bottom; }
|
|
||||||
|
|
||||||
@media print {
|
|
||||||
/* Hide the cursor when printing */
|
|
||||||
.CodeMirror div.CodeMirror-cursor {
|
|
||||||
visibility: hidden;
|
|
||||||
}
|
|
||||||
}
|
|
6049
fhem/www/codemirror/lib/codemirror.js
vendored
6049
fhem/www/codemirror/lib/codemirror.js
vendored
File diff suppressed because it is too large
Load Diff
1020
fhem/www/codemirror/mode/fhem/fhem.js
vendored
1020
fhem/www/codemirror/mode/fhem/fhem.js
vendored
File diff suppressed because it is too large
Load Diff
816
fhem/www/codemirror/mode/perl/perl.js
vendored
816
fhem/www/codemirror/mode/perl/perl.js
vendored
@ -1,816 +0,0 @@
|
|||||||
// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
|
|
||||||
// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
|
|
||||||
CodeMirror.defineMode("perl",function(){
|
|
||||||
// http://perldoc.perl.org
|
|
||||||
var PERL={ // null - magic touch
|
|
||||||
// 1 - keyword
|
|
||||||
// 2 - def
|
|
||||||
// 3 - atom
|
|
||||||
// 4 - operator
|
|
||||||
// 5 - variable-2 (predefined)
|
|
||||||
// [x,y] - x=1,2,3; y=must be defined if x{...}
|
|
||||||
// PERL operators
|
|
||||||
'->' : 4,
|
|
||||||
'++' : 4,
|
|
||||||
'--' : 4,
|
|
||||||
'**' : 4,
|
|
||||||
// ! ~ \ and unary + and -
|
|
||||||
'=~' : 4,
|
|
||||||
'!~' : 4,
|
|
||||||
'*' : 4,
|
|
||||||
'/' : 4,
|
|
||||||
'%' : 4,
|
|
||||||
'x' : 4,
|
|
||||||
'+' : 4,
|
|
||||||
'-' : 4,
|
|
||||||
'.' : 4,
|
|
||||||
'<<' : 4,
|
|
||||||
'>>' : 4,
|
|
||||||
// named unary operators
|
|
||||||
'<' : 4,
|
|
||||||
'>' : 4,
|
|
||||||
'<=' : 4,
|
|
||||||
'>=' : 4,
|
|
||||||
'lt' : 4,
|
|
||||||
'gt' : 4,
|
|
||||||
'le' : 4,
|
|
||||||
'ge' : 4,
|
|
||||||
'==' : 4,
|
|
||||||
'!=' : 4,
|
|
||||||
'<=>' : 4,
|
|
||||||
'eq' : 4,
|
|
||||||
'ne' : 4,
|
|
||||||
'cmp' : 4,
|
|
||||||
'~~' : 4,
|
|
||||||
'&' : 4,
|
|
||||||
'|' : 4,
|
|
||||||
'^' : 4,
|
|
||||||
'&&' : 4,
|
|
||||||
'||' : 4,
|
|
||||||
'//' : 4,
|
|
||||||
'..' : 4,
|
|
||||||
'...' : 4,
|
|
||||||
'?' : 4,
|
|
||||||
':' : 4,
|
|
||||||
'=' : 4,
|
|
||||||
'+=' : 4,
|
|
||||||
'-=' : 4,
|
|
||||||
'*=' : 4, // etc. ???
|
|
||||||
',' : 4,
|
|
||||||
'=>' : 4,
|
|
||||||
'::' : 4,
|
|
||||||
// list operators (rightward)
|
|
||||||
'not' : 4,
|
|
||||||
'and' : 4,
|
|
||||||
'or' : 4,
|
|
||||||
'xor' : 4,
|
|
||||||
// PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;)
|
|
||||||
'BEGIN' : [5,1],
|
|
||||||
'END' : [5,1],
|
|
||||||
'PRINT' : [5,1],
|
|
||||||
'PRINTF' : [5,1],
|
|
||||||
'GETC' : [5,1],
|
|
||||||
'READ' : [5,1],
|
|
||||||
'READLINE' : [5,1],
|
|
||||||
'DESTROY' : [5,1],
|
|
||||||
'TIE' : [5,1],
|
|
||||||
'TIEHANDLE' : [5,1],
|
|
||||||
'UNTIE' : [5,1],
|
|
||||||
'STDIN' : 5,
|
|
||||||
'STDIN_TOP' : 5,
|
|
||||||
'STDOUT' : 5,
|
|
||||||
'STDOUT_TOP' : 5,
|
|
||||||
'STDERR' : 5,
|
|
||||||
'STDERR_TOP' : 5,
|
|
||||||
'$ARG' : 5,
|
|
||||||
'$_' : 5,
|
|
||||||
'@ARG' : 5,
|
|
||||||
'@_' : 5,
|
|
||||||
'$LIST_SEPARATOR' : 5,
|
|
||||||
'$"' : 5,
|
|
||||||
'$PROCESS_ID' : 5,
|
|
||||||
'$PID' : 5,
|
|
||||||
'$$' : 5,
|
|
||||||
'$REAL_GROUP_ID' : 5,
|
|
||||||
'$GID' : 5,
|
|
||||||
'$(' : 5,
|
|
||||||
'$EFFECTIVE_GROUP_ID' : 5,
|
|
||||||
'$EGID' : 5,
|
|
||||||
'$)' : 5,
|
|
||||||
'$PROGRAM_NAME' : 5,
|
|
||||||
'$0' : 5,
|
|
||||||
'$SUBSCRIPT_SEPARATOR' : 5,
|
|
||||||
'$SUBSEP' : 5,
|
|
||||||
'$;' : 5,
|
|
||||||
'$REAL_USER_ID' : 5,
|
|
||||||
'$UID' : 5,
|
|
||||||
'$<' : 5,
|
|
||||||
'$EFFECTIVE_USER_ID' : 5,
|
|
||||||
'$EUID' : 5,
|
|
||||||
'$>' : 5,
|
|
||||||
'$a' : 5,
|
|
||||||
'$b' : 5,
|
|
||||||
'$COMPILING' : 5,
|
|
||||||
'$^C' : 5,
|
|
||||||
'$DEBUGGING' : 5,
|
|
||||||
'$^D' : 5,
|
|
||||||
'${^ENCODING}' : 5,
|
|
||||||
'$ENV' : 5,
|
|
||||||
'%ENV' : 5,
|
|
||||||
'$SYSTEM_FD_MAX' : 5,
|
|
||||||
'$^F' : 5,
|
|
||||||
'@F' : 5,
|
|
||||||
'${^GLOBAL_PHASE}' : 5,
|
|
||||||
'$^H' : 5,
|
|
||||||
'%^H' : 5,
|
|
||||||
'@INC' : 5,
|
|
||||||
'%INC' : 5,
|
|
||||||
'$INPLACE_EDIT' : 5,
|
|
||||||
'$^I' : 5,
|
|
||||||
'$^M' : 5,
|
|
||||||
'$OSNAME' : 5,
|
|
||||||
'$^O' : 5,
|
|
||||||
'${^OPEN}' : 5,
|
|
||||||
'$PERLDB' : 5,
|
|
||||||
'$^P' : 5,
|
|
||||||
'$SIG' : 5,
|
|
||||||
'%SIG' : 5,
|
|
||||||
'$BASETIME' : 5,
|
|
||||||
'$^T' : 5,
|
|
||||||
'${^TAINT}' : 5,
|
|
||||||
'${^UNICODE}' : 5,
|
|
||||||
'${^UTF8CACHE}' : 5,
|
|
||||||
'${^UTF8LOCALE}' : 5,
|
|
||||||
'$PERL_VERSION' : 5,
|
|
||||||
'$^V' : 5,
|
|
||||||
'${^WIN32_SLOPPY_STAT}' : 5,
|
|
||||||
'$EXECUTABLE_NAME' : 5,
|
|
||||||
'$^X' : 5,
|
|
||||||
'$1' : 5, // - regexp $1, $2...
|
|
||||||
'$MATCH' : 5,
|
|
||||||
'$&' : 5,
|
|
||||||
'${^MATCH}' : 5,
|
|
||||||
'$PREMATCH' : 5,
|
|
||||||
'$`' : 5,
|
|
||||||
'${^PREMATCH}' : 5,
|
|
||||||
'$POSTMATCH' : 5,
|
|
||||||
"$'" : 5,
|
|
||||||
'${^POSTMATCH}' : 5,
|
|
||||||
'$LAST_PAREN_MATCH' : 5,
|
|
||||||
'$+' : 5,
|
|
||||||
'$LAST_SUBMATCH_RESULT' : 5,
|
|
||||||
'$^N' : 5,
|
|
||||||
'@LAST_MATCH_END' : 5,
|
|
||||||
'@+' : 5,
|
|
||||||
'%LAST_PAREN_MATCH' : 5,
|
|
||||||
'%+' : 5,
|
|
||||||
'@LAST_MATCH_START' : 5,
|
|
||||||
'@-' : 5,
|
|
||||||
'%LAST_MATCH_START' : 5,
|
|
||||||
'%-' : 5,
|
|
||||||
'$LAST_REGEXP_CODE_RESULT' : 5,
|
|
||||||
'$^R' : 5,
|
|
||||||
'${^RE_DEBUG_FLAGS}' : 5,
|
|
||||||
'${^RE_TRIE_MAXBUF}' : 5,
|
|
||||||
'$ARGV' : 5,
|
|
||||||
'@ARGV' : 5,
|
|
||||||
'ARGV' : 5,
|
|
||||||
'ARGVOUT' : 5,
|
|
||||||
'$OUTPUT_FIELD_SEPARATOR' : 5,
|
|
||||||
'$OFS' : 5,
|
|
||||||
'$,' : 5,
|
|
||||||
'$INPUT_LINE_NUMBER' : 5,
|
|
||||||
'$NR' : 5,
|
|
||||||
'$.' : 5,
|
|
||||||
'$INPUT_RECORD_SEPARATOR' : 5,
|
|
||||||
'$RS' : 5,
|
|
||||||
'$/' : 5,
|
|
||||||
'$OUTPUT_RECORD_SEPARATOR' : 5,
|
|
||||||
'$ORS' : 5,
|
|
||||||
'$\\' : 5,
|
|
||||||
'$OUTPUT_AUTOFLUSH' : 5,
|
|
||||||
'$|' : 5,
|
|
||||||
'$ACCUMULATOR' : 5,
|
|
||||||
'$^A' : 5,
|
|
||||||
'$FORMAT_FORMFEED' : 5,
|
|
||||||
'$^L' : 5,
|
|
||||||
'$FORMAT_PAGE_NUMBER' : 5,
|
|
||||||
'$%' : 5,
|
|
||||||
'$FORMAT_LINES_LEFT' : 5,
|
|
||||||
'$-' : 5,
|
|
||||||
'$FORMAT_LINE_BREAK_CHARACTERS' : 5,
|
|
||||||
'$:' : 5,
|
|
||||||
'$FORMAT_LINES_PER_PAGE' : 5,
|
|
||||||
'$=' : 5,
|
|
||||||
'$FORMAT_TOP_NAME' : 5,
|
|
||||||
'$^' : 5,
|
|
||||||
'$FORMAT_NAME' : 5,
|
|
||||||
'$~' : 5,
|
|
||||||
'${^CHILD_ERROR_NATIVE}' : 5,
|
|
||||||
'$EXTENDED_OS_ERROR' : 5,
|
|
||||||
'$^E' : 5,
|
|
||||||
'$EXCEPTIONS_BEING_CAUGHT' : 5,
|
|
||||||
'$^S' : 5,
|
|
||||||
'$WARNING' : 5,
|
|
||||||
'$^W' : 5,
|
|
||||||
'${^WARNING_BITS}' : 5,
|
|
||||||
'$OS_ERROR' : 5,
|
|
||||||
'$ERRNO' : 5,
|
|
||||||
'$!' : 5,
|
|
||||||
'%OS_ERROR' : 5,
|
|
||||||
'%ERRNO' : 5,
|
|
||||||
'%!' : 5,
|
|
||||||
'$CHILD_ERROR' : 5,
|
|
||||||
'$?' : 5,
|
|
||||||
'$EVAL_ERROR' : 5,
|
|
||||||
'$@' : 5,
|
|
||||||
'$OFMT' : 5,
|
|
||||||
'$#' : 5,
|
|
||||||
'$*' : 5,
|
|
||||||
'$ARRAY_BASE' : 5,
|
|
||||||
'$[' : 5,
|
|
||||||
'$OLD_PERL_VERSION' : 5,
|
|
||||||
'$]' : 5,
|
|
||||||
// PERL blocks
|
|
||||||
'if' :[1,1],
|
|
||||||
elsif :[1,1],
|
|
||||||
'else' :[1,1],
|
|
||||||
'while' :[1,1],
|
|
||||||
unless :[1,1],
|
|
||||||
'for' :[1,1],
|
|
||||||
foreach :[1,1],
|
|
||||||
// PERL functions
|
|
||||||
'abs' :1, // - absolute value function
|
|
||||||
accept :1, // - accept an incoming socket connect
|
|
||||||
alarm :1, // - schedule a SIGALRM
|
|
||||||
'atan2' :1, // - arctangent of Y/X in the range -PI to PI
|
|
||||||
bind :1, // - binds an address to a socket
|
|
||||||
binmode :1, // - prepare binary files for I/O
|
|
||||||
bless :1, // - create an object
|
|
||||||
bootstrap :1, //
|
|
||||||
'break' :1, // - break out of a "given" block
|
|
||||||
caller :1, // - get context of the current subroutine call
|
|
||||||
chdir :1, // - change your current working directory
|
|
||||||
chmod :1, // - changes the permissions on a list of files
|
|
||||||
chomp :1, // - remove a trailing record separator from a string
|
|
||||||
chop :1, // - remove the last character from a string
|
|
||||||
chown :1, // - change the owership on a list of files
|
|
||||||
chr :1, // - get character this number represents
|
|
||||||
chroot :1, // - make directory new root for path lookups
|
|
||||||
close :1, // - close file (or pipe or socket) handle
|
|
||||||
closedir :1, // - close directory handle
|
|
||||||
connect :1, // - connect to a remote socket
|
|
||||||
'continue' :[1,1], // - optional trailing block in a while or foreach
|
|
||||||
'cos' :1, // - cosine function
|
|
||||||
crypt :1, // - one-way passwd-style encryption
|
|
||||||
dbmclose :1, // - breaks binding on a tied dbm file
|
|
||||||
dbmopen :1, // - create binding on a tied dbm file
|
|
||||||
'default' :1, //
|
|
||||||
defined :1, // - test whether a value, variable, or function is defined
|
|
||||||
'delete' :1, // - deletes a value from a hash
|
|
||||||
die :1, // - raise an exception or bail out
|
|
||||||
'do' :1, // - turn a BLOCK into a TERM
|
|
||||||
dump :1, // - create an immediate core dump
|
|
||||||
each :1, // - retrieve the next key/value pair from a hash
|
|
||||||
endgrent :1, // - be done using group file
|
|
||||||
endhostent :1, // - be done using hosts file
|
|
||||||
endnetent :1, // - be done using networks file
|
|
||||||
endprotoent :1, // - be done using protocols file
|
|
||||||
endpwent :1, // - be done using passwd file
|
|
||||||
endservent :1, // - be done using services file
|
|
||||||
eof :1, // - test a filehandle for its end
|
|
||||||
'eval' :1, // - catch exceptions or compile and run code
|
|
||||||
'exec' :1, // - abandon this program to run another
|
|
||||||
exists :1, // - test whether a hash key is present
|
|
||||||
exit :1, // - terminate this program
|
|
||||||
'exp' :1, // - raise I to a power
|
|
||||||
fcntl :1, // - file control system call
|
|
||||||
fileno :1, // - return file descriptor from filehandle
|
|
||||||
flock :1, // - lock an entire file with an advisory lock
|
|
||||||
fork :1, // - create a new process just like this one
|
|
||||||
format :1, // - declare a picture format with use by the write() function
|
|
||||||
formline :1, // - internal function used for formats
|
|
||||||
getc :1, // - get the next character from the filehandle
|
|
||||||
getgrent :1, // - get next group record
|
|
||||||
getgrgid :1, // - get group record given group user ID
|
|
||||||
getgrnam :1, // - get group record given group name
|
|
||||||
gethostbyaddr :1, // - get host record given its address
|
|
||||||
gethostbyname :1, // - get host record given name
|
|
||||||
gethostent :1, // - get next hosts record
|
|
||||||
getlogin :1, // - return who logged in at this tty
|
|
||||||
getnetbyaddr :1, // - get network record given its address
|
|
||||||
getnetbyname :1, // - get networks record given name
|
|
||||||
getnetent :1, // - get next networks record
|
|
||||||
getpeername :1, // - find the other end of a socket connection
|
|
||||||
getpgrp :1, // - get process group
|
|
||||||
getppid :1, // - get parent process ID
|
|
||||||
getpriority :1, // - get current nice value
|
|
||||||
getprotobyname :1, // - get protocol record given name
|
|
||||||
getprotobynumber :1, // - get protocol record numeric protocol
|
|
||||||
getprotoent :1, // - get next protocols record
|
|
||||||
getpwent :1, // - get next passwd record
|
|
||||||
getpwnam :1, // - get passwd record given user login name
|
|
||||||
getpwuid :1, // - get passwd record given user ID
|
|
||||||
getservbyname :1, // - get services record given its name
|
|
||||||
getservbyport :1, // - get services record given numeric port
|
|
||||||
getservent :1, // - get next services record
|
|
||||||
getsockname :1, // - retrieve the sockaddr for a given socket
|
|
||||||
getsockopt :1, // - get socket options on a given socket
|
|
||||||
given :1, //
|
|
||||||
glob :1, // - expand filenames using wildcards
|
|
||||||
gmtime :1, // - convert UNIX time into record or string using Greenwich time
|
|
||||||
'goto' :1, // - create spaghetti code
|
|
||||||
grep :1, // - locate elements in a list test true against a given criterion
|
|
||||||
hex :1, // - convert a string to a hexadecimal number
|
|
||||||
'import' :1, // - patch a module's namespace into your own
|
|
||||||
index :1, // - find a substring within a string
|
|
||||||
'int' :1, // - get the integer portion of a number
|
|
||||||
ioctl :1, // - system-dependent device control system call
|
|
||||||
'join' :1, // - join a list into a string using a separator
|
|
||||||
keys :1, // - retrieve list of indices from a hash
|
|
||||||
kill :1, // - send a signal to a process or process group
|
|
||||||
last :1, // - exit a block prematurely
|
|
||||||
lc :1, // - return lower-case version of a string
|
|
||||||
lcfirst :1, // - return a string with just the next letter in lower case
|
|
||||||
length :1, // - return the number of bytes in a string
|
|
||||||
'link' :1, // - create a hard link in the filesytem
|
|
||||||
listen :1, // - register your socket as a server
|
|
||||||
local : 2, // - create a temporary value for a global variable (dynamic scoping)
|
|
||||||
localtime :1, // - convert UNIX time into record or string using local time
|
|
||||||
lock :1, // - get a thread lock on a variable, subroutine, or method
|
|
||||||
'log' :1, // - retrieve the natural logarithm for a number
|
|
||||||
lstat :1, // - stat a symbolic link
|
|
||||||
m :null, // - match a string with a regular expression pattern
|
|
||||||
map :1, // - apply a change to a list to get back a new list with the changes
|
|
||||||
mkdir :1, // - create a directory
|
|
||||||
msgctl :1, // - SysV IPC message control operations
|
|
||||||
msgget :1, // - get SysV IPC message queue
|
|
||||||
msgrcv :1, // - receive a SysV IPC message from a message queue
|
|
||||||
msgsnd :1, // - send a SysV IPC message to a message queue
|
|
||||||
my : 2, // - declare and assign a local variable (lexical scoping)
|
|
||||||
'new' :1, //
|
|
||||||
next :1, // - iterate a block prematurely
|
|
||||||
no :1, // - unimport some module symbols or semantics at compile time
|
|
||||||
oct :1, // - convert a string to an octal number
|
|
||||||
open :1, // - open a file, pipe, or descriptor
|
|
||||||
opendir :1, // - open a directory
|
|
||||||
ord :1, // - find a character's numeric representation
|
|
||||||
our : 2, // - declare and assign a package variable (lexical scoping)
|
|
||||||
pack :1, // - convert a list into a binary representation
|
|
||||||
'package' :1, // - declare a separate global namespace
|
|
||||||
pipe :1, // - open a pair of connected filehandles
|
|
||||||
pop :1, // - remove the last element from an array and return it
|
|
||||||
pos :1, // - find or set the offset for the last/next m//g search
|
|
||||||
print :1, // - output a list to a filehandle
|
|
||||||
printf :1, // - output a formatted list to a filehandle
|
|
||||||
prototype :1, // - get the prototype (if any) of a subroutine
|
|
||||||
push :1, // - append one or more elements to an array
|
|
||||||
q :null, // - singly quote a string
|
|
||||||
qq :null, // - doubly quote a string
|
|
||||||
qr :null, // - Compile pattern
|
|
||||||
quotemeta :null, // - quote regular expression magic characters
|
|
||||||
qw :null, // - quote a list of words
|
|
||||||
qx :null, // - backquote quote a string
|
|
||||||
rand :1, // - retrieve the next pseudorandom number
|
|
||||||
read :1, // - fixed-length buffered input from a filehandle
|
|
||||||
readdir :1, // - get a directory from a directory handle
|
|
||||||
readline :1, // - fetch a record from a file
|
|
||||||
readlink :1, // - determine where a symbolic link is pointing
|
|
||||||
readpipe :1, // - execute a system command and collect standard output
|
|
||||||
recv :1, // - receive a message over a Socket
|
|
||||||
redo :1, // - start this loop iteration over again
|
|
||||||
ref :1, // - find out the type of thing being referenced
|
|
||||||
rename :1, // - change a filename
|
|
||||||
require :1, // - load in external functions from a library at runtime
|
|
||||||
reset :1, // - clear all variables of a given name
|
|
||||||
'return' :1, // - get out of a function early
|
|
||||||
reverse :1, // - flip a string or a list
|
|
||||||
rewinddir :1, // - reset directory handle
|
|
||||||
rindex :1, // - right-to-left substring search
|
|
||||||
rmdir :1, // - remove a directory
|
|
||||||
s :null, // - replace a pattern with a string
|
|
||||||
say :1, // - print with newline
|
|
||||||
scalar :1, // - force a scalar context
|
|
||||||
seek :1, // - reposition file pointer for random-access I/O
|
|
||||||
seekdir :1, // - reposition directory pointer
|
|
||||||
select :1, // - reset default output or do I/O multiplexing
|
|
||||||
semctl :1, // - SysV semaphore control operations
|
|
||||||
semget :1, // - get set of SysV semaphores
|
|
||||||
semop :1, // - SysV semaphore operations
|
|
||||||
send :1, // - send a message over a socket
|
|
||||||
setgrent :1, // - prepare group file for use
|
|
||||||
sethostent :1, // - prepare hosts file for use
|
|
||||||
setnetent :1, // - prepare networks file for use
|
|
||||||
setpgrp :1, // - set the process group of a process
|
|
||||||
setpriority :1, // - set a process's nice value
|
|
||||||
setprotoent :1, // - prepare protocols file for use
|
|
||||||
setpwent :1, // - prepare passwd file for use
|
|
||||||
setservent :1, // - prepare services file for use
|
|
||||||
setsockopt :1, // - set some socket options
|
|
||||||
shift :1, // - remove the first element of an array, and return it
|
|
||||||
shmctl :1, // - SysV shared memory operations
|
|
||||||
shmget :1, // - get SysV shared memory segment identifier
|
|
||||||
shmread :1, // - read SysV shared memory
|
|
||||||
shmwrite :1, // - write SysV shared memory
|
|
||||||
shutdown :1, // - close down just half of a socket connection
|
|
||||||
'sin' :1, // - return the sine of a number
|
|
||||||
sleep :1, // - block for some number of seconds
|
|
||||||
socket :1, // - create a socket
|
|
||||||
socketpair :1, // - create a pair of sockets
|
|
||||||
'sort' :1, // - sort a list of values
|
|
||||||
splice :1, // - add or remove elements anywhere in an array
|
|
||||||
'split' :1, // - split up a string using a regexp delimiter
|
|
||||||
sprintf :1, // - formatted print into a string
|
|
||||||
'sqrt' :1, // - square root function
|
|
||||||
srand :1, // - seed the random number generator
|
|
||||||
stat :1, // - get a file's status information
|
|
||||||
state :1, // - declare and assign a state variable (persistent lexical scoping)
|
|
||||||
study :1, // - optimize input data for repeated searches
|
|
||||||
'sub' :1, // - declare a subroutine, possibly anonymously
|
|
||||||
'substr' :1, // - get or alter a portion of a stirng
|
|
||||||
symlink :1, // - create a symbolic link to a file
|
|
||||||
syscall :1, // - execute an arbitrary system call
|
|
||||||
sysopen :1, // - open a file, pipe, or descriptor
|
|
||||||
sysread :1, // - fixed-length unbuffered input from a filehandle
|
|
||||||
sysseek :1, // - position I/O pointer on handle used with sysread and syswrite
|
|
||||||
system :1, // - run a separate program
|
|
||||||
syswrite :1, // - fixed-length unbuffered output to a filehandle
|
|
||||||
tell :1, // - get current seekpointer on a filehandle
|
|
||||||
telldir :1, // - get current seekpointer on a directory handle
|
|
||||||
tie :1, // - bind a variable to an object class
|
|
||||||
tied :1, // - get a reference to the object underlying a tied variable
|
|
||||||
time :1, // - return number of seconds since 1970
|
|
||||||
times :1, // - return elapsed time for self and child processes
|
|
||||||
tr :null, // - transliterate a string
|
|
||||||
truncate :1, // - shorten a file
|
|
||||||
uc :1, // - return upper-case version of a string
|
|
||||||
ucfirst :1, // - return a string with just the next letter in upper case
|
|
||||||
umask :1, // - set file creation mode mask
|
|
||||||
undef :1, // - remove a variable or function definition
|
|
||||||
unlink :1, // - remove one link to a file
|
|
||||||
unpack :1, // - convert binary structure into normal perl variables
|
|
||||||
unshift :1, // - prepend more elements to the beginning of a list
|
|
||||||
untie :1, // - break a tie binding to a variable
|
|
||||||
use :1, // - load in a module at compile time
|
|
||||||
utime :1, // - set a file's last access and modify times
|
|
||||||
values :1, // - return a list of the values in a hash
|
|
||||||
vec :1, // - test or set particular bits in a string
|
|
||||||
wait :1, // - wait for any child process to die
|
|
||||||
waitpid :1, // - wait for a particular child process to die
|
|
||||||
wantarray :1, // - get void vs scalar vs list context of current subroutine call
|
|
||||||
warn :1, // - print debugging info
|
|
||||||
when :1, //
|
|
||||||
write :1, // - print a picture record
|
|
||||||
y :null}; // - transliterate a string
|
|
||||||
|
|
||||||
var RXstyle="string-2";
|
|
||||||
var RXmodifiers=/[goseximacplud]/; // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type
|
|
||||||
|
|
||||||
function tokenChain(stream,state,chain,style,tail){ // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
|
|
||||||
state.chain=null; // 12 3tail
|
|
||||||
state.style=null;
|
|
||||||
state.tail=null;
|
|
||||||
state.tokenize=function(stream,state){
|
|
||||||
var e=false,c,i=0;
|
|
||||||
while(c=stream.next()){
|
|
||||||
if(c===chain[i]&&!e){
|
|
||||||
if(chain[++i]!==undefined){
|
|
||||||
state.chain=chain[i];
|
|
||||||
state.style=style;
|
|
||||||
state.tail=tail;}
|
|
||||||
else if(tail)
|
|
||||||
stream.eatWhile(tail);
|
|
||||||
state.tokenize=tokenPerl;
|
|
||||||
return style;}
|
|
||||||
e=!e&&c=="\\";}
|
|
||||||
return style;};
|
|
||||||
return state.tokenize(stream,state);}
|
|
||||||
|
|
||||||
function tokenSOMETHING(stream,state,string){
|
|
||||||
state.tokenize=function(stream,state){
|
|
||||||
if(stream.string==string)
|
|
||||||
state.tokenize=tokenPerl;
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "string";};
|
|
||||||
return state.tokenize(stream,state);}
|
|
||||||
|
|
||||||
function tokenPerl(stream,state){
|
|
||||||
if(stream.eatSpace())
|
|
||||||
return null;
|
|
||||||
if(state.chain)
|
|
||||||
return tokenChain(stream,state,state.chain,state.style,state.tail);
|
|
||||||
if(stream.match(/^\-?[\d\.]/,false))
|
|
||||||
if(stream.match(/^(\-?(\d*\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F]+|0b[01]+|\d+(e[+-]?\d+)?)/))
|
|
||||||
return 'number';
|
|
||||||
if(stream.match(/^<<(?=\w)/)){ // NOTE: <<SOMETHING\n...\nSOMETHING\n
|
|
||||||
stream.eatWhile(/\w/);
|
|
||||||
return tokenSOMETHING(stream,state,stream.current().substr(2));}
|
|
||||||
if(stream.sol()&&stream.match(/^\=item(?!\w)/)){// NOTE: \n=item...\n=cut\n
|
|
||||||
return tokenSOMETHING(stream,state,'=cut');}
|
|
||||||
var ch=stream.next();
|
|
||||||
if(ch=='"'||ch=="'"){ // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
|
|
||||||
if(stream.prefix(3)=="<<"+ch){
|
|
||||||
var p=stream.pos;
|
|
||||||
stream.eatWhile(/\w/);
|
|
||||||
var n=stream.current().substr(1);
|
|
||||||
if(n&&stream.eat(ch))
|
|
||||||
return tokenSOMETHING(stream,state,n);
|
|
||||||
stream.pos=p;}
|
|
||||||
return tokenChain(stream,state,[ch],"string");}
|
|
||||||
if(ch=="q"){
|
|
||||||
var c=stream.look(-2);
|
|
||||||
if(!(c&&/\w/.test(c))){
|
|
||||||
c=stream.look(0);
|
|
||||||
if(c=="x"){
|
|
||||||
c=stream.look(1);
|
|
||||||
if(c=="("){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="["){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="{"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="<"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
|
|
||||||
else if(c=="q"){
|
|
||||||
c=stream.look(1);
|
|
||||||
if(c=="("){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[")"],"string");}
|
|
||||||
if(c=="["){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["]"],"string");}
|
|
||||||
if(c=="{"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["}"],"string");}
|
|
||||||
if(c=="<"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[">"],"string");}
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[stream.eat(c)],"string");}}
|
|
||||||
else if(c=="w"){
|
|
||||||
c=stream.look(1);
|
|
||||||
if(c=="("){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[")"],"bracket");}
|
|
||||||
if(c=="["){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["]"],"bracket");}
|
|
||||||
if(c=="{"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["}"],"bracket");}
|
|
||||||
if(c=="<"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[">"],"bracket");}
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[stream.eat(c)],"bracket");}}
|
|
||||||
else if(c=="r"){
|
|
||||||
c=stream.look(1);
|
|
||||||
if(c=="("){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="["){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="{"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="<"){
|
|
||||||
stream.eatSuffix(2);
|
|
||||||
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
|
|
||||||
else if(/[\^'"!~\/(\[{<]/.test(c)){
|
|
||||||
if(c=="("){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[")"],"string");}
|
|
||||||
if(c=="["){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,["]"],"string");}
|
|
||||||
if(c=="{"){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,["}"],"string");}
|
|
||||||
if(c=="<"){
|
|
||||||
stream.eatSuffix(1);
|
|
||||||
return tokenChain(stream,state,[">"],"string");}
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
return tokenChain(stream,state,[stream.eat(c)],"string");}}}}
|
|
||||||
if(ch=="m"){
|
|
||||||
var c=stream.look(-2);
|
|
||||||
if(!(c&&/\w/.test(c))){
|
|
||||||
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
|
||||||
if(c){
|
|
||||||
if(/[\^'"!~\/]/.test(c)){
|
|
||||||
return tokenChain(stream,state,[c],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="("){
|
|
||||||
return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="["){
|
|
||||||
return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="{"){
|
|
||||||
return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
|
|
||||||
if(c=="<"){
|
|
||||||
return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}}
|
|
||||||
if(ch=="s"){
|
|
||||||
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
|
||||||
if(!c){
|
|
||||||
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
|
||||||
if(c){
|
|
||||||
if(c=="[")
|
|
||||||
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="{")
|
|
||||||
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="<")
|
|
||||||
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="(")
|
|
||||||
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
|
||||||
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
|
|
||||||
if(ch=="y"){
|
|
||||||
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
|
||||||
if(!c){
|
|
||||||
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
|
||||||
if(c){
|
|
||||||
if(c=="[")
|
|
||||||
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="{")
|
|
||||||
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="<")
|
|
||||||
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="(")
|
|
||||||
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
|
||||||
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
|
|
||||||
if(ch=="t"){
|
|
||||||
var c=/[\/>\]})\w]/.test(stream.look(-2));
|
|
||||||
if(!c){
|
|
||||||
c=stream.eat("r");if(c){
|
|
||||||
c=stream.eat(/[(\[{<\^'"!~\/]/);
|
|
||||||
if(c){
|
|
||||||
if(c=="[")
|
|
||||||
return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="{")
|
|
||||||
return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="<")
|
|
||||||
return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
|
|
||||||
if(c=="(")
|
|
||||||
return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
|
|
||||||
return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}}
|
|
||||||
if(ch=="`"){
|
|
||||||
return tokenChain(stream,state,[ch],"variable-2");}
|
|
||||||
if(ch=="/"){
|
|
||||||
if(!/~\s*$/.test(stream.prefix()))
|
|
||||||
return "operator";
|
|
||||||
else
|
|
||||||
return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);}
|
|
||||||
if(ch=="$"){
|
|
||||||
var p=stream.pos;
|
|
||||||
if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
|
|
||||||
return "variable-2";
|
|
||||||
else
|
|
||||||
stream.pos=p;}
|
|
||||||
if(/[$@%]/.test(ch)){
|
|
||||||
var p=stream.pos;
|
|
||||||
if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(stream.look(-2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
|
|
||||||
var c=stream.current();
|
|
||||||
if(PERL[c])
|
|
||||||
return "variable-2";}
|
|
||||||
stream.pos=p;}
|
|
||||||
if(/[$@%&]/.test(ch)){
|
|
||||||
if(stream.eatWhile(/[\w$\[\]]/)||stream.eat("{")&&stream.eatWhile(/[\w$\[\]]/)&&stream.eat("}")){
|
|
||||||
var c=stream.current();
|
|
||||||
if(PERL[c])
|
|
||||||
return "variable-2";
|
|
||||||
else
|
|
||||||
return "variable";}}
|
|
||||||
if(ch=="#"){
|
|
||||||
if(stream.look(-2)!="$"){
|
|
||||||
stream.skipToEnd();
|
|
||||||
return "comment";}}
|
|
||||||
if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
|
|
||||||
var p=stream.pos;
|
|
||||||
stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);
|
|
||||||
if(PERL[stream.current()])
|
|
||||||
return "operator";
|
|
||||||
else
|
|
||||||
stream.pos=p;}
|
|
||||||
if(ch=="_"){
|
|
||||||
if(stream.pos==1){
|
|
||||||
if(stream.suffix(6)=="_END__"){
|
|
||||||
return tokenChain(stream,state,['\0'],"comment");}
|
|
||||||
else if(stream.suffix(7)=="_DATA__"){
|
|
||||||
return tokenChain(stream,state,['\0'],"variable-2");}
|
|
||||||
else if(stream.suffix(7)=="_C__"){
|
|
||||||
return tokenChain(stream,state,['\0'],"string");}}}
|
|
||||||
if(/\w/.test(ch)){
|
|
||||||
var p=stream.pos;
|
|
||||||
if(stream.look(-2)=="{"&&(stream.look(0)=="}"||stream.eatWhile(/\w/)&&stream.look(0)=="}"))
|
|
||||||
return "string";
|
|
||||||
else
|
|
||||||
stream.pos=p;}
|
|
||||||
if(/[A-Z]/.test(ch)){
|
|
||||||
var l=stream.look(-2);
|
|
||||||
var p=stream.pos;
|
|
||||||
stream.eatWhile(/[A-Z_]/);
|
|
||||||
if(/[\da-z]/.test(stream.look(0))){
|
|
||||||
stream.pos=p;}
|
|
||||||
else{
|
|
||||||
var c=PERL[stream.current()];
|
|
||||||
if(!c)
|
|
||||||
return "meta";
|
|
||||||
if(c[1])
|
|
||||||
c=c[0];
|
|
||||||
if(l!=":"){
|
|
||||||
if(c==1)
|
|
||||||
return "keyword";
|
|
||||||
else if(c==2)
|
|
||||||
return "def";
|
|
||||||
else if(c==3)
|
|
||||||
return "atom";
|
|
||||||
else if(c==4)
|
|
||||||
return "operator";
|
|
||||||
else if(c==5)
|
|
||||||
return "variable-2";
|
|
||||||
else
|
|
||||||
return "meta";}
|
|
||||||
else
|
|
||||||
return "meta";}}
|
|
||||||
if(/[a-zA-Z_]/.test(ch)){
|
|
||||||
var l=stream.look(-2);
|
|
||||||
stream.eatWhile(/\w/);
|
|
||||||
var c=PERL[stream.current()];
|
|
||||||
if(!c)
|
|
||||||
return "meta";
|
|
||||||
if(c[1])
|
|
||||||
c=c[0];
|
|
||||||
if(l!=":"){
|
|
||||||
if(c==1)
|
|
||||||
return "keyword";
|
|
||||||
else if(c==2)
|
|
||||||
return "def";
|
|
||||||
else if(c==3)
|
|
||||||
return "atom";
|
|
||||||
else if(c==4)
|
|
||||||
return "operator";
|
|
||||||
else if(c==5)
|
|
||||||
return "variable-2";
|
|
||||||
else
|
|
||||||
return "meta";}
|
|
||||||
else
|
|
||||||
return "meta";}
|
|
||||||
return null;}
|
|
||||||
|
|
||||||
return{
|
|
||||||
startState:function(){
|
|
||||||
return{
|
|
||||||
tokenize:tokenPerl,
|
|
||||||
chain:null,
|
|
||||||
style:null,
|
|
||||||
tail:null};},
|
|
||||||
token:function(stream,state){
|
|
||||||
return (state.tokenize||tokenPerl)(stream,state);},
|
|
||||||
electricChars:"{}"};});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/x-perl", "perl");
|
|
||||||
|
|
||||||
// it's like "peek", but need for look-ahead or look-behind if index < 0
|
|
||||||
CodeMirror.StringStream.prototype.look=function(c){
|
|
||||||
return this.string.charAt(this.pos+(c||0));};
|
|
||||||
|
|
||||||
// return a part of prefix of current stream from current position
|
|
||||||
CodeMirror.StringStream.prototype.prefix=function(c){
|
|
||||||
if(c){
|
|
||||||
var x=this.pos-c;
|
|
||||||
return this.string.substr((x>=0?x:0),c);}
|
|
||||||
else{
|
|
||||||
return this.string.substr(0,this.pos-1);}};
|
|
||||||
|
|
||||||
// return a part of suffix of current stream from current position
|
|
||||||
CodeMirror.StringStream.prototype.suffix=function(c){
|
|
||||||
var y=this.string.length;
|
|
||||||
var x=y-this.pos+1;
|
|
||||||
return this.string.substr(this.pos,(c&&c<y?c:x));};
|
|
||||||
|
|
||||||
// return a part of suffix of current stream from current position and change current position
|
|
||||||
CodeMirror.StringStream.prototype.nsuffix=function(c){
|
|
||||||
var p=this.pos;
|
|
||||||
var l=c||(this.string.length-this.pos+1);
|
|
||||||
this.pos+=l;
|
|
||||||
return this.string.substr(p,l);};
|
|
||||||
|
|
||||||
// eating and vomiting a part of stream from current position
|
|
||||||
CodeMirror.StringStream.prototype.eatSuffix=function(c){
|
|
||||||
var x=this.pos+c;
|
|
||||||
var y;
|
|
||||||
if(x<=0)
|
|
||||||
this.pos=0;
|
|
||||||
else if(x>=(y=this.string.length-1))
|
|
||||||
this.pos=y;
|
|
||||||
else
|
|
||||||
this.pos=x;};
|
|
332
fhem/www/codemirror/mode/xml/xml.js
vendored
332
fhem/www/codemirror/mode/xml/xml.js
vendored
@ -1,332 +0,0 @@
|
|||||||
CodeMirror.defineMode("xml", function(config, parserConfig) {
|
|
||||||
var indentUnit = config.indentUnit;
|
|
||||||
var multilineTagIndentFactor = parserConfig.multilineTagIndentFactor || 1;
|
|
||||||
var multilineTagIndentPastTag = parserConfig.multilineTagIndentPastTag || true;
|
|
||||||
|
|
||||||
var Kludges = parserConfig.htmlMode ? {
|
|
||||||
autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
|
|
||||||
'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
|
|
||||||
'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
|
|
||||||
'track': true, 'wbr': true},
|
|
||||||
implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
|
|
||||||
'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
|
|
||||||
'th': true, 'tr': true},
|
|
||||||
contextGrabbers: {
|
|
||||||
'dd': {'dd': true, 'dt': true},
|
|
||||||
'dt': {'dd': true, 'dt': true},
|
|
||||||
'li': {'li': true},
|
|
||||||
'option': {'option': true, 'optgroup': true},
|
|
||||||
'optgroup': {'optgroup': true},
|
|
||||||
'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
|
|
||||||
'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
|
|
||||||
'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
|
|
||||||
'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
|
|
||||||
'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
|
|
||||||
'rp': {'rp': true, 'rt': true},
|
|
||||||
'rt': {'rp': true, 'rt': true},
|
|
||||||
'tbody': {'tbody': true, 'tfoot': true},
|
|
||||||
'td': {'td': true, 'th': true},
|
|
||||||
'tfoot': {'tbody': true},
|
|
||||||
'th': {'td': true, 'th': true},
|
|
||||||
'thead': {'tbody': true, 'tfoot': true},
|
|
||||||
'tr': {'tr': true}
|
|
||||||
},
|
|
||||||
doNotIndent: {"pre": true},
|
|
||||||
allowUnquoted: true,
|
|
||||||
allowMissing: true
|
|
||||||
} : {
|
|
||||||
autoSelfClosers: {},
|
|
||||||
implicitlyClosed: {},
|
|
||||||
contextGrabbers: {},
|
|
||||||
doNotIndent: {},
|
|
||||||
allowUnquoted: false,
|
|
||||||
allowMissing: false
|
|
||||||
};
|
|
||||||
var alignCDATA = parserConfig.alignCDATA;
|
|
||||||
|
|
||||||
// Return variables for tokenizers
|
|
||||||
var tagName, type, setStyle;
|
|
||||||
|
|
||||||
function inText(stream, state) {
|
|
||||||
function chain(parser) {
|
|
||||||
state.tokenize = parser;
|
|
||||||
return parser(stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == "<") {
|
|
||||||
if (stream.eat("!")) {
|
|
||||||
if (stream.eat("[")) {
|
|
||||||
if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
|
|
||||||
else return null;
|
|
||||||
} else if (stream.match("--")) {
|
|
||||||
return chain(inBlock("comment", "-->"));
|
|
||||||
} else if (stream.match("DOCTYPE", true, true)) {
|
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
|
||||||
return chain(doctype(1));
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else if (stream.eat("?")) {
|
|
||||||
stream.eatWhile(/[\w\._\-]/);
|
|
||||||
state.tokenize = inBlock("meta", "?>");
|
|
||||||
return "meta";
|
|
||||||
} else {
|
|
||||||
var isClose = stream.eat("/");
|
|
||||||
tagName = "";
|
|
||||||
var c;
|
|
||||||
while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
|
|
||||||
if (!tagName) return "tag error";
|
|
||||||
type = isClose ? "closeTag" : "openTag";
|
|
||||||
state.tokenize = inTag;
|
|
||||||
return "tag";
|
|
||||||
}
|
|
||||||
} else if (ch == "&") {
|
|
||||||
var ok;
|
|
||||||
if (stream.eat("#")) {
|
|
||||||
if (stream.eat("x")) {
|
|
||||||
ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
|
|
||||||
} else {
|
|
||||||
ok = stream.eatWhile(/[\d]/) && stream.eat(";");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
|
|
||||||
}
|
|
||||||
return ok ? "atom" : "error";
|
|
||||||
} else {
|
|
||||||
stream.eatWhile(/[^&<]/);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inTag(stream, state) {
|
|
||||||
var ch = stream.next();
|
|
||||||
if (ch == ">" || (ch == "/" && stream.eat(">"))) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
type = ch == ">" ? "endTag" : "selfcloseTag";
|
|
||||||
return "tag";
|
|
||||||
} else if (ch == "=") {
|
|
||||||
type = "equals";
|
|
||||||
return null;
|
|
||||||
} else if (ch == "<") {
|
|
||||||
state.tokenize = inText;
|
|
||||||
state.state = baseState;
|
|
||||||
state.tagName = state.tagStart = null;
|
|
||||||
var next = state.tokenize(stream, state);
|
|
||||||
return next ? next + " error" : "error";
|
|
||||||
} else if (/[\'\"]/.test(ch)) {
|
|
||||||
state.tokenize = inAttribute(ch);
|
|
||||||
state.stringStartCol = stream.column();
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
} else {
|
|
||||||
stream.eatWhile(/[^\s\u00a0=<>\"\']/);
|
|
||||||
return "word";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function inAttribute(quote) {
|
|
||||||
var closure = function(stream, state) {
|
|
||||||
while (!stream.eol()) {
|
|
||||||
if (stream.next() == quote) {
|
|
||||||
state.tokenize = inTag;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "string";
|
|
||||||
};
|
|
||||||
closure.isInAttribute = true;
|
|
||||||
return closure;
|
|
||||||
}
|
|
||||||
|
|
||||||
function inBlock(style, terminator) {
|
|
||||||
return function(stream, state) {
|
|
||||||
while (!stream.eol()) {
|
|
||||||
if (stream.match(terminator)) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
stream.next();
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
function doctype(depth) {
|
|
||||||
return function(stream, state) {
|
|
||||||
var ch;
|
|
||||||
while ((ch = stream.next()) != null) {
|
|
||||||
if (ch == "<") {
|
|
||||||
state.tokenize = doctype(depth + 1);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
} else if (ch == ">") {
|
|
||||||
if (depth == 1) {
|
|
||||||
state.tokenize = inText;
|
|
||||||
break;
|
|
||||||
} else {
|
|
||||||
state.tokenize = doctype(depth - 1);
|
|
||||||
return state.tokenize(stream, state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "meta";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function Context(state, tagName, startOfLine) {
|
|
||||||
this.prev = state.context;
|
|
||||||
this.tagName = tagName;
|
|
||||||
this.indent = state.indented;
|
|
||||||
this.startOfLine = startOfLine;
|
|
||||||
if (Kludges.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
|
|
||||||
this.noIndent = true;
|
|
||||||
}
|
|
||||||
function popContext(state) {
|
|
||||||
if (state.context) state.context = state.context.prev;
|
|
||||||
}
|
|
||||||
function maybePopContext(state, nextTagName) {
|
|
||||||
var parentTagName;
|
|
||||||
while (true) {
|
|
||||||
if (!state.context) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
parentTagName = state.context.tagName.toLowerCase();
|
|
||||||
if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
|
|
||||||
!Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
popContext(state);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function baseState(type, stream, state) {
|
|
||||||
if (type == "openTag") {
|
|
||||||
state.tagName = tagName;
|
|
||||||
state.tagStart = stream.column();
|
|
||||||
return attrState;
|
|
||||||
} else if (type == "closeTag") {
|
|
||||||
var err = false;
|
|
||||||
if (state.context) {
|
|
||||||
if (state.context.tagName != tagName) {
|
|
||||||
if (Kludges.implicitlyClosed.hasOwnProperty(state.context.tagName.toLowerCase()))
|
|
||||||
popContext(state);
|
|
||||||
err = !state.context || state.context.tagName != tagName;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
err = true;
|
|
||||||
}
|
|
||||||
if (err) setStyle = "error";
|
|
||||||
return err ? closeStateErr : closeState;
|
|
||||||
} else {
|
|
||||||
return baseState;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function closeState(type, _stream, state) {
|
|
||||||
if (type != "endTag") {
|
|
||||||
setStyle = "error";
|
|
||||||
return closeState;
|
|
||||||
}
|
|
||||||
popContext(state);
|
|
||||||
return baseState;
|
|
||||||
}
|
|
||||||
function closeStateErr(type, stream, state) {
|
|
||||||
setStyle = "error";
|
|
||||||
return closeState(type, stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
function attrState(type, _stream, state) {
|
|
||||||
if (type == "word") {
|
|
||||||
setStyle = "attribute";
|
|
||||||
return attrEqState;
|
|
||||||
} else if (type == "endTag" || type == "selfcloseTag") {
|
|
||||||
var tagName = state.tagName, tagStart = state.tagStart;
|
|
||||||
state.tagName = state.tagStart = null;
|
|
||||||
if (type == "selfcloseTag" ||
|
|
||||||
Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase())) {
|
|
||||||
maybePopContext(state, tagName.toLowerCase());
|
|
||||||
} else {
|
|
||||||
maybePopContext(state, tagName.toLowerCase());
|
|
||||||
state.context = new Context(state, tagName, tagStart == state.indented);
|
|
||||||
}
|
|
||||||
return baseState;
|
|
||||||
}
|
|
||||||
setStyle = "error";
|
|
||||||
return attrState;
|
|
||||||
}
|
|
||||||
function attrEqState(type, stream, state) {
|
|
||||||
if (type == "equals") return attrValueState;
|
|
||||||
if (!Kludges.allowMissing) setStyle = "error";
|
|
||||||
return attrState(type, stream, state);
|
|
||||||
}
|
|
||||||
function attrValueState(type, stream, state) {
|
|
||||||
if (type == "string") return attrContinuedState;
|
|
||||||
if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return attrState;}
|
|
||||||
setStyle = "error";
|
|
||||||
return attrState(type, stream, state);
|
|
||||||
}
|
|
||||||
function attrContinuedState(type, stream, state) {
|
|
||||||
if (type == "string") return attrContinuedState;
|
|
||||||
return attrState(type, stream, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
startState: function() {
|
|
||||||
return {tokenize: inText,
|
|
||||||
state: baseState,
|
|
||||||
indented: 0,
|
|
||||||
tagName: null, tagStart: null,
|
|
||||||
context: null};
|
|
||||||
},
|
|
||||||
|
|
||||||
token: function(stream, state) {
|
|
||||||
if (!state.tagName && stream.sol())
|
|
||||||
state.indented = stream.indentation();
|
|
||||||
|
|
||||||
if (stream.eatSpace()) return null;
|
|
||||||
tagName = type = null;
|
|
||||||
var style = state.tokenize(stream, state);
|
|
||||||
if ((style || type) && style != "comment") {
|
|
||||||
setStyle = null;
|
|
||||||
state.state = state.state(type || style, stream, state);
|
|
||||||
if (setStyle)
|
|
||||||
style = setStyle == "error" ? style + " error" : setStyle;
|
|
||||||
}
|
|
||||||
return style;
|
|
||||||
},
|
|
||||||
|
|
||||||
indent: function(state, textAfter, fullLine) {
|
|
||||||
var context = state.context;
|
|
||||||
// Indent multi-line strings (e.g. css).
|
|
||||||
if (state.tokenize.isInAttribute) {
|
|
||||||
return state.stringStartCol + 1;
|
|
||||||
}
|
|
||||||
if (context && context.noIndent) return CodeMirror.Pass;
|
|
||||||
if (state.tokenize != inTag && state.tokenize != inText)
|
|
||||||
return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
|
|
||||||
// Indent the starts of attribute names.
|
|
||||||
if (state.tagName) {
|
|
||||||
if (multilineTagIndentPastTag)
|
|
||||||
return state.tagStart + state.tagName.length + 2;
|
|
||||||
else
|
|
||||||
return state.tagStart + indentUnit * multilineTagIndentFactor;
|
|
||||||
}
|
|
||||||
if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
|
|
||||||
if (context && /^<\//.test(textAfter))
|
|
||||||
context = context.prev;
|
|
||||||
while (context && !context.startOfLine)
|
|
||||||
context = context.prev;
|
|
||||||
if (context) return context.indent + indentUnit;
|
|
||||||
else return 0;
|
|
||||||
},
|
|
||||||
|
|
||||||
electricChars: "/",
|
|
||||||
blockCommentStart: "<!--",
|
|
||||||
blockCommentEnd: "-->",
|
|
||||||
|
|
||||||
configuration: parserConfig.htmlMode ? "html" : "xml",
|
|
||||||
helperType: parserConfig.htmlMode ? "html" : "xml"
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
CodeMirror.defineMIME("text/xml", "xml");
|
|
||||||
CodeMirror.defineMIME("application/xml", "xml");
|
|
||||||
if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
|
|
||||||
CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
|
|
28
fhem/www/codemirror/theme/blackboard.css
vendored
28
fhem/www/codemirror/theme/blackboard.css
vendored
@ -1,28 +0,0 @@
|
|||||||
/* Port of TextMate's Blackboard theme */
|
|
||||||
|
|
||||||
.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
|
|
||||||
.cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; }
|
|
||||||
.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
|
|
||||||
.cm-s-blackboard .CodeMirror-linenumber { color: #888; }
|
|
||||||
.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; }
|
|
||||||
|
|
||||||
.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
|
|
||||||
.cm-s-blackboard .cm-atom { color: #D8FA3C; }
|
|
||||||
.cm-s-blackboard .cm-number { color: #D8FA3C; }
|
|
||||||
.cm-s-blackboard .cm-def { color: #8DA6CE; }
|
|
||||||
.cm-s-blackboard .cm-variable { color: #FF6400; }
|
|
||||||
.cm-s-blackboard .cm-operator { color: #FBDE2D;}
|
|
||||||
.cm-s-blackboard .cm-comment { color: #AEAEAE; }
|
|
||||||
.cm-s-blackboard .cm-string { color: #61CE3C; }
|
|
||||||
.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
|
|
||||||
.cm-s-blackboard .cm-meta { color: #D8FA3C; }
|
|
||||||
.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
|
|
||||||
.cm-s-blackboard .cm-tag { color: #8DA6CE; }
|
|
||||||
.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
|
|
||||||
.cm-s-blackboard .cm-header { color: #FF6400; }
|
|
||||||
.cm-s-blackboard .cm-hr { color: #AEAEAE; }
|
|
||||||
.cm-s-blackboard .cm-link { color: #8DA6CE; }
|
|
||||||
.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
|
|
||||||
|
|
||||||
.cm-s-blackboard .CodeMirror-activeline-background {background: #3C3636 !important;}
|
|
||||||
.cm-s-blackboard .CodeMirror-matchingbracket {outline:1px solid grey;color:white !important}
|
|
Loading…
x
Reference in New Issue
Block a user