codemirror
Advanced tools
Comparing version 4.6.0 to 4.7.0
@@ -112,3 +112,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var self = this, mode = self.getModeAt(from); | ||
var end = Math.min(to.line, self.lastLine()), start = Math.min(from.line, end); | ||
var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end); | ||
@@ -115,0 +115,0 @@ // Try finding line comments |
@@ -59,3 +59,6 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (inp) { | ||
if (options.value) inp.value = options.value; | ||
if (options.value) { | ||
inp.value = options.value; | ||
inp.select(); | ||
} | ||
@@ -62,0 +65,0 @@ if (options.onInput) |
@@ -81,5 +81,5 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1)); | ||
if (!range.empty()) | ||
if (!range.empty()) { | ||
curType = "surround"; | ||
else if (left == right && next == right) { | ||
} else if (left == right && next == right) { | ||
if (cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == left + left + left) | ||
@@ -91,11 +91,12 @@ curType = "skipThree"; | ||
cm.getRange(Pos(cur.line, cur.ch - 2), cur) == left + left && | ||
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) | ||
(cur.ch <= 2 || cm.getRange(Pos(cur.line, cur.ch - 3), Pos(cur.line, cur.ch - 2)) != left)) { | ||
curType = "addFour"; | ||
else if (left == '"' || left == "'") { | ||
} else if (left == '"' || left == "'") { | ||
if (!CodeMirror.isWordChar(next) && enteringString(cm, cur, left)) curType = "both"; | ||
else return CodeMirror.Pass; | ||
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) | ||
} else if (cm.getLine(cur.line).length == cur.ch || closingBrackets.indexOf(next) >= 0 || SPACE_CHAR_REGEX.test(next)) { | ||
curType = "both"; | ||
else | ||
} else { | ||
return CodeMirror.Pass; | ||
} | ||
if (!type) type = curType; | ||
@@ -102,0 +103,0 @@ else if (type != curType) return CodeMirror.Pass; |
@@ -14,3 +14,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var listRE = /^(\s*)([*+-]|(\d+)\.)(\s+)/, | ||
var listRE = /^(\s*)([> ]+|[*+-]|(\d+)\.)(\s+)/, | ||
emptyListRE = /^(\s*)([> ]+|[*+-]|(\d+)\.)(\s*)$/, | ||
unorderedBullets = "*+-"; | ||
@@ -23,14 +24,26 @@ | ||
var pos = ranges[i].head, match; | ||
var inList = cm.getStateAfter(pos.line).list !== false; | ||
var eolState = cm.getStateAfter(pos.line); | ||
var inList = eolState.list !== false; | ||
var inQuote = eolState.quote !== false; | ||
if (!ranges[i].empty() || !inList || !(match = cm.getLine(pos.line).match(listRE))) { | ||
if (!ranges[i].empty() || (!inList && !inQuote) || !(match = cm.getLine(pos.line).match(listRE))) { | ||
cm.execCommand("newlineAndIndent"); | ||
return; | ||
} | ||
var indent = match[1], after = match[4]; | ||
var bullet = unorderedBullets.indexOf(match[2]) >= 0 | ||
? match[2] | ||
: (parseInt(match[3], 10) + 1) + "."; | ||
if (cm.getLine(pos.line).match(emptyListRE)) { | ||
cm.replaceRange("", { | ||
line: pos.line, ch: 0 | ||
}, { | ||
line: pos.line, ch: pos.ch + 1 | ||
}); | ||
replacements[i] = "\n"; | ||
replacements[i] = "\n" + indent + bullet + after; | ||
} else { | ||
var indent = match[1], after = match[4]; | ||
var bullet = unorderedBullets.indexOf(match[2]) >= 0 || match[2].indexOf(">") >= 0 | ||
? match[2] | ||
: (parseInt(match[3], 10) + 1) + "."; | ||
replacements[i] = "\n" + indent + bullet + after; | ||
} | ||
} | ||
@@ -37,0 +50,0 @@ |
@@ -15,2 +15,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var tables; | ||
var defaultTable; | ||
var keywords; | ||
@@ -47,14 +48,51 @@ var CONS = { | ||
function columnCompletion(result, editor) { | ||
function nameCompletion(result, editor) { | ||
var cur = editor.getCursor(); | ||
var token = editor.getTokenAt(cur); | ||
var useBacktick = (token.string.charAt(0) == "`"); | ||
var string = token.string.substr(1); | ||
var prevCur = Pos(cur.line, token.start); | ||
var table = editor.getTokenAt(prevCur).string; | ||
if (!tables.hasOwnProperty(table)) | ||
table = findTableByAlias(table, editor); | ||
var columns = tables[table]; | ||
if (!columns) return; | ||
var prevToken = editor.getTokenAt(Pos(cur.line, token.start)); | ||
if (token.string.charAt(0) == "." || prevToken.string == "."){ | ||
//Suggest colunm names | ||
if (prevToken.string == ".") { | ||
var prevToken = editor.getTokenAt(Pos(cur.line, token.start - 1)); | ||
} | ||
var table = prevToken.string; | ||
//Check if backtick is used in table name. If yes, use it for columns too. | ||
var useBacktickTable = false; | ||
if (table.match(/`/g)) { | ||
useBacktickTable = true; | ||
table = table.replace(/`/g, ""); | ||
} | ||
//Check if table is available. If not, find table by Alias | ||
if (!tables.hasOwnProperty(table)) | ||
table = findTableByAlias(table, editor); | ||
var columns = tables[table]; | ||
if (!columns) return; | ||
addMatches(result, string, columns, function(w) {return "." + w;}); | ||
if (useBacktick) { | ||
addMatches(result, string, columns, function(w) {return "`" + w + "`";}); | ||
} | ||
else if(useBacktickTable) { | ||
addMatches(result, string, columns, function(w) {return ".`" + w + "`";}); | ||
} | ||
else { | ||
addMatches(result, string, columns, function(w) {return "." + w;}); | ||
} | ||
} | ||
else { | ||
//Suggest table names or colums in defaultTable | ||
while (token.start && string.charAt(0) == ".") { | ||
token = editor.getTokenAt(Pos(cur.line, token.start - 1)); | ||
string = token.string + string; | ||
} | ||
if (useBacktick) { | ||
addMatches(result, string, tables, function(w) {return "`" + w + "`";}); | ||
addMatches(result, string, defaultTable, function(w) {return "`" + w + "`";}); | ||
} | ||
else { | ||
addMatches(result, string, tables, function(w) {return w;}); | ||
addMatches(result, string, defaultTable, function(w) {return w;}); | ||
} | ||
} | ||
} | ||
@@ -133,7 +171,10 @@ | ||
tables = (options && options.tables) || {}; | ||
var defaultTableName = options && options.defaultTable; | ||
defaultTable = (defaultTableName && tables[defaultTableName] || []); | ||
keywords = keywords || getKeywords(editor); | ||
var cur = editor.getCursor(); | ||
var result = []; | ||
var token = editor.getTokenAt(cur), start, end, search; | ||
if (token.string.match(/^[.\w@]\w*$/)) { | ||
if (token.string.match(/^[.`\w@]\w*$/)) { | ||
search = token.string; | ||
@@ -146,14 +187,7 @@ start = token.start; | ||
} | ||
if (search.charAt(0) == ".") { | ||
columnCompletion(result, editor); | ||
if (!result.length) { | ||
while (start && search.charAt(0) == ".") { | ||
token = editor.getTokenAt(Pos(cur.line, token.start - 1)); | ||
start = token.start; | ||
search = token.string + search; | ||
} | ||
addMatches(result, search, tables, function(w) {return w;}); | ||
} | ||
if (search.charAt(0) == "." || search.charAt(0) == "`") { | ||
nameCompletion(result, editor); | ||
} else { | ||
addMatches(result, search, tables, function(w) {return w;}); | ||
addMatches(result, search, defaultTable, function(w) {return w;}); | ||
addMatches(result, search, keywords, function(w) {return w.toUpperCase();}); | ||
@@ -160,0 +194,0 @@ } |
@@ -121,6 +121,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var state = cm.state.lint, options = state.options; | ||
var passOptions = options.options || options; // Support deprecated passing of `options` property in options | ||
if (options.async) | ||
options.getAnnotations(cm, updateLinting, options); | ||
options.getAnnotations(cm.getValue(), updateLinting, passOptions, cm); | ||
else | ||
updateLinting(cm, options.getAnnotations(cm.getValue(), options.options)); | ||
updateLinting(cm, options.getAnnotations(cm.getValue(), passOptions, cm)); | ||
} | ||
@@ -174,16 +175,10 @@ | ||
// When the mouseover fires, the cursor might not actually be over | ||
// the character itself yet. These pairs of x,y offsets are used to | ||
// probe a few nearby points when no suitable marked range is found. | ||
var nearby = [0, 0, 0, 5, 0, -5, 5, 0, -5, 0]; | ||
function onMouseOver(cm, e) { | ||
if (!/\bCodeMirror-lint-mark-/.test((e.target || e.srcElement).className)) return; | ||
for (var i = 0; i < nearby.length; i += 2) { | ||
var spans = cm.findMarksAt(cm.coordsChar({left: e.clientX + nearby[i], | ||
top: e.clientY + nearby[i + 1]}, "client")); | ||
for (var j = 0; j < spans.length; ++j) { | ||
var span = spans[j], ann = span.__annotation; | ||
if (ann) return popupSpanTooltip(ann, e); | ||
} | ||
var target = e.target || e.srcElement; | ||
if (!/\bCodeMirror-lint-mark-/.test(target.className)) return; | ||
var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2; | ||
var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client")); | ||
for (var i = 0; i < spans.length; ++i) { | ||
var ann = spans[i].__annotation; | ||
if (ann) return popupSpanTooltip(ann, e); | ||
} | ||
@@ -190,0 +185,0 @@ } |
@@ -77,3 +77,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {}; | ||
CodeMirror.defineMode = function (name, mode) { modes[name] = mode; }; | ||
CodeMirror.defineMode = function (name, mode) { | ||
if (arguments.length > 2) | ||
mode.dependencies = Array.prototype.slice.call(arguments, 2); | ||
modes[name] = mode; | ||
}; | ||
CodeMirror.defineMIME = function (mime, spec) { mimeModes[mime] = spec; }; | ||
@@ -80,0 +84,0 @@ CodeMirror.resolveMode = function(spec) { |
@@ -77,6 +77,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
exports.defineMode = function(name, mode) { | ||
if (arguments.length > 2) { | ||
mode.dependencies = []; | ||
for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]); | ||
} | ||
if (arguments.length > 2) | ||
mode.dependencies = Array.prototype.slice.call(arguments, 2); | ||
modes[name] = mode; | ||
@@ -83,0 +81,0 @@ }; |
{ | ||
"name": "codemirror", | ||
"version":"4.6.0", | ||
"version":"4.7.0", | ||
"main": ["lib/codemirror.js", "lib/codemirror.css"], | ||
@@ -5,0 +5,0 @@ "ignore": [ |
@@ -15,3 +15,3 @@ # How to contribute | ||
The preferred way to report bugs is to use the | ||
[GitHub issue tracker](http://github.com/marijnh/CodeMirror/issues). Before | ||
[GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before | ||
reporting a bug, read these pointers. | ||
@@ -52,3 +52,3 @@ | ||
- Make sure you have a [GitHub Account](https://github.com/signup/free) | ||
- Fork [CodeMirror](https://github.com/marijnh/CodeMirror/) | ||
- Fork [CodeMirror](https://github.com/codemirror/CodeMirror/) | ||
([how to fork a repo](https://help.github.com/articles/fork-a-repo)) | ||
@@ -55,0 +55,0 @@ - Make your changes |
@@ -23,3 +23,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
hooks = parserConfig.hooks || {}, | ||
multiLineStrings = parserConfig.multiLineStrings; | ||
multiLineStrings = parserConfig.multiLineStrings, | ||
indentStatements = parserConfig.indentStatements !== false; | ||
var isOperatorChar = /[+\-*&%=<>!?|\/]/; | ||
@@ -61,3 +62,3 @@ | ||
} | ||
stream.eatWhile(/[\w\$_]/); | ||
stream.eatWhile(/[\w\$_\xa1-\uffff]/); | ||
var cur = stream.current(); | ||
@@ -156,3 +157,5 @@ if (keywords.propertyIsEnumerable(cur)) { | ||
else if (curPunc == ctx.type) popContext(state); | ||
else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement")) | ||
else if (indentStatements && | ||
(((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || | ||
(ctx.type == "statement" && curPunc == "newstatement"))) | ||
pushContext(state, stream.column(), "statement"); | ||
@@ -304,2 +307,3 @@ state.startOfLine = false; | ||
}); | ||
def("text/x-java", { | ||
@@ -322,2 +326,3 @@ name: "clike", | ||
}); | ||
def("text/x-csharp", { | ||
@@ -349,2 +354,15 @@ name: "clike", | ||
}); | ||
function tokenTripleString(stream, state) { | ||
var escaped = false; | ||
while (!stream.eol()) { | ||
if (!escaped && stream.match('"""')) { | ||
state.tokenize = null; | ||
break; | ||
} | ||
escaped = stream.next() != "\\" && !escaped; | ||
} | ||
return "string"; | ||
} | ||
def("text/x-scala", { | ||
@@ -375,4 +393,2 @@ name: "clike", | ||
"StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void" | ||
), | ||
@@ -382,2 +398,3 @@ multiLineStrings: true, | ||
atoms: words("true false null"), | ||
indentStatements: false, | ||
hooks: { | ||
@@ -387,5 +404,11 @@ "@": function(stream) { | ||
return "meta"; | ||
}, | ||
'"': function(stream, state) { | ||
if (!stream.match('""')) return false; | ||
state.tokenize = tokenTripleString; | ||
return state.tokenize(stream, state); | ||
} | ||
} | ||
}); | ||
def(["x-shader/x-vertex", "x-shader/x-fragment"], { | ||
@@ -392,0 +415,0 @@ name: "clike", |
@@ -21,3 +21,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var BUILTIN = "builtin", COMMENT = "comment", STRING = "string", CHARACTER = "string-2", | ||
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword"; | ||
ATOM = "atom", NUMBER = "number", BRACKET = "bracket", KEYWORD = "keyword", VAR = "variable"; | ||
var INDENT_WORD_SKIP = options.indentUnit || 2; | ||
@@ -63,3 +63,3 @@ var NORMAL_INDENT_UNIT = options.indentUnit || 2; | ||
keyword_char: /[^\s\(\[\;\)\]]/, | ||
symbol: /[\w*+!\-\._?:<>\/]/ | ||
symbol: /[\w*+!\-\._?:<>\/\xa1-\uffff]/ | ||
}; | ||
@@ -225,3 +225,5 @@ | ||
returnType = ATOM; | ||
} else returnType = null; | ||
} else { | ||
returnType = VAR; | ||
} | ||
} | ||
@@ -228,0 +230,0 @@ } |
@@ -25,3 +25,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?)/; | ||
var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/; | ||
var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/; | ||
@@ -38,3 +38,3 @@ var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/; | ||
"do", "in", "of", "new", "return", "then", | ||
"this", "throw", "when", "until"]; | ||
"this", "@", "throw", "when", "until", "extends"]; | ||
@@ -222,3 +222,3 @@ var keywords = wordRegexp(indentKeywords.concat(commonKeywords)); | ||
for (var scope = state.scope; scope; scope = scope.prev) { | ||
if (scope.type === "coffee") { | ||
if (scope.type === "coffee" || scope.type == "}") { | ||
offset = scope.offset + conf.indentUnit; | ||
@@ -284,3 +284,3 @@ break; | ||
if (current === "return") { | ||
state.dedent += 1; | ||
state.dedent = true; | ||
} | ||
@@ -317,5 +317,6 @@ if (((current === "->" || current === "=>") && | ||
} | ||
if (state.dedent > 0 && stream.eol() && state.scope.type == "coffee") { | ||
if (state.scope.prev) state.scope = state.scope.prev; | ||
state.dedent -= 1; | ||
if (state.dedent && stream.eol()) { | ||
if (state.scope.type == "coffee" && state.scope.prev) | ||
state.scope = state.scope.prev; | ||
state.dedent = false; | ||
} | ||
@@ -322,0 +323,0 @@ |
@@ -63,3 +63,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
stream.eatWhile(/[\w\$_]/); | ||
stream.eatWhile(/[\w\$_\xa1-\uffff]/); | ||
var cur = stream.current(); | ||
@@ -66,0 +66,0 @@ if (keywords.propertyIsEnumerable(cur)) { |
@@ -7,3 +7,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
Ported to CodeMirror by Peter Kroon <plakroon@gmail.com> | ||
Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues | ||
Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues | ||
GitHub: @peterkroon | ||
@@ -10,0 +10,0 @@ */ |
@@ -153,2 +153,13 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
"[link http://www.example.com/]"); | ||
MT("headerCodeBlockGithub", | ||
"[header&header-1 # heading]", | ||
"", | ||
"[comment ```]", | ||
"[comment code]", | ||
"[comment ```]", | ||
"", | ||
"Commit: [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2]", | ||
"Issue: [link #1]", | ||
"Link: [link http://www.example.com/]"); | ||
})(); |
@@ -6,3 +6,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
Gherkin mode - http://www.cukes.info/ | ||
Report bugs/issues here: https://github.com/marijnh/CodeMirror/issues | ||
Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues | ||
*/ | ||
@@ -9,0 +9,0 @@ |
@@ -74,3 +74,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
stream.eatWhile(/[\w\$_]/); | ||
stream.eatWhile(/[\w\$_\xa1-\uffff]/); | ||
var cur = stream.current(); | ||
@@ -77,0 +77,0 @@ if (keywords.propertyIsEnumerable(cur)) { |
@@ -27,3 +27,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var octitRE = /[0-7]/; | ||
var idRE = /[a-z_A-Z0-9']/; | ||
var idRE = /[a-z_A-Z0-9'\xa1-\uffff]/; | ||
var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/; | ||
@@ -30,0 +30,0 @@ var specialRE = /[(),;[\]`{}]/; |
@@ -22,3 +22,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var isTS = parserConfig.typescript; | ||
var wordRE = parserConfig.wordCharacters || /[\w$]/; | ||
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/; | ||
@@ -594,3 +594,3 @@ // Tokenizer | ||
if (type == "for") return pass(comprehension, expect("]")); | ||
if (type == ",") return cont(commasep(expressionNoComma, "]")); | ||
if (type == ",") return cont(commasep(maybeexpressionNoComma, "]")); | ||
return pass(commasep(expressionNoComma, "]")); | ||
@@ -661,3 +661,3 @@ } | ||
electricChars: ":{}", | ||
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/, | ||
blockCommentStart: jsonMode ? null : "/*", | ||
@@ -664,0 +664,0 @@ blockCommentEnd: jsonMode ? null : "*/", |
@@ -150,2 +150,9 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
MT("indent_strange_array", | ||
"[keyword var] [variable x] [operator =] [[", | ||
" [number 1],,", | ||
" [number 2],", | ||
"]];", | ||
"[number 10];"); | ||
var jsonld_mode = CodeMirror.getMode( | ||
@@ -152,0 +159,0 @@ {indentUnit: 2}, |
@@ -23,3 +23,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var delimiters = parserConf.delimiters || /^[;,()[\]{}]/; | ||
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*!*/; | ||
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*!*/; | ||
var blockOpeners = ["begin", "function", "type", "immutable", "let", "macro", "for", "while", "quote", "if", "else", "elseif", "try", "finally", "catch", "do"]; | ||
@@ -26,0 +26,0 @@ var blockClosers = ["end", "else", "elseif", "catch", "finally"]; |
@@ -703,3 +703,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
if (stream.sol()) { | ||
var forceBlankLine = stream.match(/^\s*$/, true) || state.header; | ||
var forceBlankLine = !!state.header; | ||
@@ -709,5 +709,6 @@ // Reset state.header | ||
if (forceBlankLine) { | ||
if (stream.match(/^\s*$/, true) || forceBlankLine) { | ||
state.prevLineHasContent = false; | ||
return blankLine(state); | ||
blankLine(state); | ||
return forceBlankLine ? this.token(stream, state) : null; | ||
} else { | ||
@@ -714,0 +715,0 @@ state.prevLineHasContent = state.thisLineHasContent; |
230
mode/meta.js
@@ -14,104 +14,132 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
CodeMirror.modeInfo = [ | ||
{name: "APL", mime: "text/apl", mode: "apl"}, | ||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk"}, | ||
{name: "C", mime: "text/x-csrc", mode: "clike"}, | ||
{name: "C++", mime: "text/x-c++src", mode: "clike"}, | ||
{name: "Cobol", mime: "text/x-cobol", mode: "cobol"}, | ||
{name: "Java", mime: "text/x-java", mode: "clike"}, | ||
{name: "C#", mime: "text/x-csharp", mode: "clike"}, | ||
{name: "Scala", mime: "text/x-scala", mode: "clike"}, | ||
{name: "Clojure", mime: "text/x-clojure", mode: "clojure"}, | ||
{name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript"}, | ||
{name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp"}, | ||
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher"}, | ||
{name: "CSS", mime: "text/css", mode: "css"}, | ||
{name: "D", mime: "text/x-d", mode: "d"}, | ||
{name: "diff", mime: "text/x-diff", mode: "diff"}, | ||
{name: "DTD", mime: "application/xml-dtd", mode: "dtd"}, | ||
{name: "Dylan", mime: "text/x-dylan", mode: "dylan"}, | ||
{name: "ECL", mime: "text/x-ecl", mode: "ecl"}, | ||
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel"}, | ||
{name: "Erlang", mime: "text/x-erlang", mode: "erlang"}, | ||
{name: "Fortran", mime: "text/x-fortran", mode: "fortran"}, | ||
{name: "F#", mime: "text/x-fsharp", mode: "mllike"}, | ||
{name: "Gas", mime: "text/x-gas", mode: "gas"}, | ||
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin"}, | ||
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm"}, | ||
{name: "Go", mime: "text/x-go", mode: "go"}, | ||
{name: "Groovy", mime: "text/x-groovy", mode: "groovy"}, | ||
{name: "HAML", mime: "text/x-haml", mode: "haml"}, | ||
{name: "Haskell", mime: "text/x-haskell", mode: "haskell"}, | ||
{name: "Haxe", mime: "text/x-haxe", mode: "haxe"}, | ||
{name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded"}, | ||
{name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded"}, | ||
{name: "JavaServer Pages", mime: "application/x-jsp", mode: "htmlembedded"}, | ||
{name: "HTML", mime: "text/html", mode: "htmlmixed"}, | ||
{name: "HTTP", mime: "message/http", mode: "http"}, | ||
{name: "Jade", mime: "text/x-jade", mode: "jade"}, | ||
{name: "JavaScript", mime: "text/javascript", mode: "javascript"}, | ||
{name: "JavaScript", mime: "application/javascript", mode: "javascript"}, | ||
{name: "JSON", mime: "application/x-json", mode: "javascript"}, | ||
{name: "JSON", mime: "application/json", mode: "javascript"}, | ||
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript"}, | ||
{name: "TypeScript", mime: "application/typescript", mode: "javascript"}, | ||
{name: "Jinja2", mime: null, mode: "jinja2"}, | ||
{name: "Julia", mime: "text/x-julia", mode: "julia"}, | ||
{name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin"}, | ||
{name: "LESS", mime: "text/x-less", mode: "css"}, | ||
{name: "LiveScript", mime: "text/x-livescript", mode: "livescript"}, | ||
{name: "Lua", mime: "text/x-lua", mode: "lua"}, | ||
{name: "Markdown (GitHub-flavour)", mime: "text/x-markdown", mode: "markdown"}, | ||
{name: "mIRC", mime: "text/mirc", mode: "mirc"}, | ||
{name: "Modelica", mime: "text/x-modelica", mode: "modelica"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"}, | ||
{name: "NTriples", mime: "text/n-triples", mode: "ntriples"}, | ||
{name: "OCaml", mime: "text/x-ocaml", mode: "mllike"}, | ||
{name: "Octave", mime: "text/x-octave", mode: "octave"}, | ||
{name: "Pascal", mime: "text/x-pascal", mode: "pascal"}, | ||
{name: "PEG.js", mime: null, mode: "pegjs"}, | ||
{name: "Perl", mime: "text/x-perl", mode: "perl"}, | ||
{name: "PHP", mime: "text/x-php", mode: "php"}, | ||
{name: "PHP(HTML)", mime: "application/x-httpd-php", mode: "php"}, | ||
{name: "Pig", mime: "text/x-pig", mode: "pig"}, | ||
{name: "Plain Text", mime: "text/plain", mode: "null"}, | ||
{name: "Properties files", mime: "text/x-properties", mode: "properties"}, | ||
{name: "Python", mime: "text/x-python", mode: "python"}, | ||
{name: "Puppet", mime: "text/x-puppet", mode: "puppet"}, | ||
{name: "Cython", mime: "text/x-cython", mode: "python"}, | ||
{name: "R", mime: "text/x-rsrc", mode: "r"}, | ||
{name: "reStructuredText", mime: "text/x-rst", mode: "rst"}, | ||
{name: "Ruby", mime: "text/x-ruby", mode: "ruby"}, | ||
{name: "Rust", mime: "text/x-rustsrc", mode: "rust"}, | ||
{name: "Sass", mime: "text/x-sass", mode: "sass"}, | ||
{name: "Scheme", mime: "text/x-scheme", mode: "scheme"}, | ||
{name: "SCSS", mime: "text/x-scss", mode: "css"}, | ||
{name: "Shell", mime: "text/x-sh", mode: "shell"}, | ||
{name: "Sieve", mime: "application/sieve", mode: "sieve"}, | ||
{name: "Slim", mime: "text/x-slim", mode: "slim"}, | ||
{name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk"}, | ||
{name: "Smarty", mime: "text/x-smarty", mode: "smarty"}, | ||
{name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, | ||
{name: "Solr", mime: "text/x-solr", mode: "solr"}, | ||
{name: "SPARQL", mime: "application/x-sparql-query", mode: "sparql"}, | ||
{name: "SQL", mime: "text/x-sql", mode: "sql"}, | ||
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, | ||
{name: "sTeX", mime: "text/x-stex", mode: "stex"}, | ||
{name: "LaTeX", mime: "text/x-latex", mode: "stex"}, | ||
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog"}, | ||
{name: "Tcl", mime: "text/x-tcl", mode: "tcl"}, | ||
{name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, | ||
{name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, | ||
{name: "TOML", mime: "text/x-toml", mode: "toml"}, | ||
{name: "Turtle", mime: "text/turtle", mode: "turtle"}, | ||
{name: "VB.NET", mime: "text/x-vb", mode: "vb"}, | ||
{name: "VBScript", mime: "text/vbscript", mode: "vbscript"}, | ||
{name: "Velocity", mime: "text/velocity", mode: "velocity"}, | ||
{name: "Verilog", mime: "text/x-verilog", mode: "verilog"}, | ||
{name: "XML", mime: "application/xml", mode: "xml"}, | ||
{name: "XQuery", mime: "application/xquery", mode: "xquery"}, | ||
{name: "YAML", mime: "text/x-yaml", mode: "yaml"}, | ||
{name: "Z80", mime: "text/x-z80", mode: "z80"} | ||
]; | ||
CodeMirror.modeInfo = [ | ||
{name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]}, | ||
{name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk"}, | ||
{name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]}, | ||
{name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "hpp", "h++"]}, | ||
{name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]}, | ||
{name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"]}, | ||
{name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]}, | ||
{name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"]}, | ||
{name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"]}, | ||
{name: "Cypher", mime: "application/x-cypher-query", mode: "cypher"}, | ||
{name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]}, | ||
{name: "CSS", mime: "text/css", mode: "css", ext: ["css"]}, | ||
{name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]}, | ||
{name: "D", mime: "text/x-d", mode: "d", ext: ["d"]}, | ||
{name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]}, | ||
{name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]}, | ||
{name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]}, | ||
{name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]}, | ||
{name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]}, | ||
{name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]}, | ||
{name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]}, | ||
{name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]}, | ||
{name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"]}, | ||
{name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]}, | ||
{name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]}, | ||
{name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm"}, | ||
{name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]}, | ||
{name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]}, | ||
{name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]}, | ||
{name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]}, | ||
{name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]}, | ||
{name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]}, | ||
{name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"]}, | ||
{name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"]}, | ||
{name: "HTTP", mime: "message/http", mode: "http"}, | ||
{name: "Jade", mime: "text/x-jade", mode: "jade", ext: ["jade"]}, | ||
{name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]}, | ||
{name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"]}, | ||
{name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"], | ||
mode: "javascript", ext: ["js"]}, | ||
{name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"]}, | ||
{name: "JSON-LD", mime: "application/ld+json", mode: "javascript"}, | ||
{name: "Jinja2", mime: "null", mode: "jinja2"}, | ||
{name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]}, | ||
{name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin", ext: ["kt"]}, | ||
{name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]}, | ||
{name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"]}, | ||
{name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]}, | ||
{name: "Markdown (GitHub-flavour)", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]}, | ||
{name: "mIRC", mime: "text/mirc", mode: "mirc"}, | ||
{name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"}, | ||
{name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]}, | ||
{name: "MS SQL", mime: "text/x-mssql", mode: "sql"}, | ||
{name: "MySQL", mime: "text/x-mysql", mode: "sql"}, | ||
{name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"}, | ||
{name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]}, | ||
{name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]}, | ||
{name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]}, | ||
{name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]}, | ||
{name: "PEG.js", mime: "null", mode: "pegjs"}, | ||
{name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]}, | ||
{name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]}, | ||
{name: "Pig", mime: "text/x-pig", mode: "pig"}, | ||
{name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]}, | ||
{name: "PLSQL", mime: "text/x-plsql", mode: "sql"}, | ||
{name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"]}, | ||
{name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]}, | ||
{name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]}, | ||
{name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]}, | ||
{name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"]}, | ||
{name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"]}, | ||
{name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"]}, | ||
{name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]}, | ||
{name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]}, | ||
{name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]}, | ||
{name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]}, | ||
{name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]}, | ||
{name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"]}, | ||
{name: "Sieve", mime: "application/sieve", mode: "sieve"}, | ||
{name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim"}, | ||
{name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]}, | ||
{name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]}, | ||
{name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"}, | ||
{name: "Solr", mime: "text/x-solr", mode: "solr"}, | ||
{name: "SPARQL", mime: "application/x-sparql-query", mode: "sparql", ext: ["sparql"]}, | ||
{name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]}, | ||
{name: "MariaDB", mime: "text/x-mariadb", mode: "sql"}, | ||
{name: "sTeX", mime: "text/x-stex", mode: "stex"}, | ||
{name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"]}, | ||
{name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]}, | ||
{name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]}, | ||
{name: "Textile", mime: "text/x-textile", mode: "textile"}, | ||
{name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"}, | ||
{name: "Tiki wiki", mime: "text/tiki", mode: "tiki"}, | ||
{name: "TOML", mime: "text/x-toml", mode: "toml"}, | ||
{name: "Tornado", mime: "text/x-tornado", mode: "tornado"}, | ||
{name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]}, | ||
{name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"]}, | ||
{name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]}, | ||
{name: "VBScript", mime: "text/vbscript", mode: "vbscript"}, | ||
{name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]}, | ||
{name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]}, | ||
{name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"]}, | ||
{name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]}, | ||
{name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"]}, | ||
{name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]} | ||
]; | ||
// Ensure all modes have a mime property for backwards compatibility | ||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { | ||
var info = CodeMirror.modeInfo[i]; | ||
if (info.mimes) info.mime = info.mimes[0]; | ||
} | ||
CodeMirror.findModeByMIME = function(mime) { | ||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { | ||
var info = CodeMirror.modeInfo[i]; | ||
if (info.mime == mime) return info; | ||
if (info.mimes) for (var j = 0; j < info.mimes.length; j++) | ||
if (info.mimes[j] == mime) return info; | ||
} | ||
}; | ||
CodeMirror.findModeByExtension = function(ext) { | ||
for (var i = 0; i < CodeMirror.modeInfo.length; i++) { | ||
var info = CodeMirror.modeInfo[i]; | ||
if (info.ext) for (var j = 0; j < info.ext.length; j++) | ||
if (info.ext[j] == ext) return info; | ||
} | ||
}; | ||
}); |
@@ -25,3 +25,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var expressionEnd = new RegExp("^[\\]\\)]"); | ||
var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); | ||
var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*"); | ||
@@ -28,0 +28,0 @@ var builtins = wordRegexp([ |
@@ -791,4 +791,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
token:function(stream,state){ | ||
return (state.tokenize||tokenPerl)(stream,state);}, | ||
electricChars:"{}"};}); | ||
return (state.tokenize||tokenPerl)(stream,state);} | ||
};}); | ||
@@ -795,0 +795,0 @@ CodeMirror.registerHelper("wordChars", "perl", /[\w$]/); |
@@ -19,28 +19,20 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
function heredoc(delim) { | ||
return function(stream, state) { | ||
if (stream.match(delim)) state.tokenize = null; | ||
else stream.skipToEnd(); | ||
return "string"; | ||
}; | ||
} | ||
// Helper for stringWithEscapes | ||
function matchSequence(list) { | ||
if (list.length == 0) return stringWithEscapes; | ||
function matchSequence(list, end) { | ||
if (list.length == 0) return stringWithEscapes(end); | ||
return function (stream, state) { | ||
var patterns = list[0]; | ||
for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) { | ||
state.tokenize = matchSequence(list.slice(1)); | ||
state.tokenize = matchSequence(list.slice(1), end); | ||
return patterns[i][1]; | ||
} | ||
state.tokenize = stringWithEscapes; | ||
state.tokenize = stringWithEscapes(end); | ||
return "string"; | ||
}; | ||
} | ||
function stringWithEscapes(stream, state) { | ||
var escaped = false, next, end = false; | ||
if (stream.current() == '"') return "string"; | ||
function stringWithEscapes(closing) { | ||
return function(stream, state) { return stringWithEscapes_(stream, state, closing); }; | ||
} | ||
function stringWithEscapes_(stream, state, closing) { | ||
// "Complex" syntax | ||
@@ -53,3 +45,3 @@ if (stream.match("${", false) || stream.match("{$", false)) { | ||
// Simple syntax | ||
if (stream.match(/\$[a-zA-Z_][a-zA-Z0-9_]*/)) { | ||
if (stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) { | ||
// After the variable name there may appear array or object operator. | ||
@@ -64,3 +56,3 @@ if (stream.match("[", false)) { | ||
[["]", null]] | ||
]); | ||
], closing); | ||
} | ||
@@ -72,3 +64,3 @@ if (stream.match(/\-\>\w/, false)) { | ||
[[/[\w]+/, "variable"]] | ||
]); | ||
], closing); | ||
} | ||
@@ -78,16 +70,14 @@ return "variable-2"; | ||
var escaped = false; | ||
// Normal string | ||
while ( | ||
!stream.eol() && | ||
(!stream.match("{$", false)) && | ||
(!stream.match(/(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false) || escaped) | ||
) { | ||
next = stream.next(); | ||
if (!escaped && next == '"') { end = true; break; } | ||
escaped = !escaped && next == "\\"; | ||
while (!stream.eol() && | ||
(escaped || (!stream.match("{$", false) && | ||
!stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) { | ||
if (!escaped && stream.match(closing)) { | ||
state.tokenize = null; | ||
state.tokStack.pop(); state.tokStack.pop(); | ||
break; | ||
} | ||
escaped = stream.next() == "\\" && !escaped; | ||
} | ||
if (end) { | ||
state.tokenize = null; | ||
state.phpEncapsStack.pop(); | ||
} | ||
return "string"; | ||
@@ -123,4 +113,8 @@ } | ||
stream.eatWhile(/[\w\.]/); | ||
state.tokenize = heredoc(stream.current().slice(3)); | ||
return state.tokenize(stream, state); | ||
var delim = stream.current().slice(3); | ||
if (delim) { | ||
(state.tokStack || (state.tokStack = [])).push(delim, 0); | ||
state.tokenize = stringWithEscapes(delim); | ||
return "string"; | ||
} | ||
} | ||
@@ -140,18 +134,17 @@ return false; | ||
}, | ||
'"': function(stream, state) { | ||
if (!state.phpEncapsStack) | ||
state.phpEncapsStack = []; | ||
state.phpEncapsStack.push(0); | ||
state.tokenize = stringWithEscapes; | ||
return state.tokenize(stream, state); | ||
'"': function(_stream, state) { | ||
(state.tokStack || (state.tokStack = [])).push('"', 0); | ||
state.tokenize = stringWithEscapes('"'); | ||
return "string"; | ||
}, | ||
"{": function(_stream, state) { | ||
if (state.phpEncapsStack && state.phpEncapsStack.length > 0) | ||
state.phpEncapsStack[state.phpEncapsStack.length - 1]++; | ||
if (state.tokStack && state.tokStack.length) | ||
state.tokStack[state.tokStack.length - 1]++; | ||
return false; | ||
}, | ||
"}": function(_stream, state) { | ||
if (state.phpEncapsStack && state.phpEncapsStack.length > 0) | ||
if (--state.phpEncapsStack[state.phpEncapsStack.length - 1] == 0) | ||
state.tokenize = stringWithEscapes; | ||
if (state.tokStack && state.tokStack.length > 0 && | ||
!--state.tokStack[state.tokStack.length - 1]) { | ||
state.tokenize = stringWithEscapes(state.tokStack[state.tokStack.length - 2]); | ||
} | ||
return false; | ||
@@ -158,0 +151,0 @@ } |
@@ -148,2 +148,8 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
'[meta ?>]'); | ||
MT("variable_interpolation_heredoc", | ||
"[meta <?php]", | ||
"[string <<<here]", | ||
"[string doc ][variable-2 $]{[variable yay]}[string more]", | ||
"[string here]; [comment // normal]"); | ||
})(); |
@@ -51,3 +51,2 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); | ||
var singleDelimiters = parserConf.singleDelimiters || new RegExp("^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]"); | ||
@@ -57,3 +56,12 @@ var doubleOperators = parserConf.doubleOperators || new RegExp("^((==)|(!=)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))"); | ||
var tripleDelimiters = parserConf.tripleDelimiters || new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))"); | ||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); | ||
if (parserConf.version && parseInt(parserConf.version, 10) == 3){ | ||
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator | ||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!@]"); | ||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); | ||
} else { | ||
var singleOperators = parserConf.singleOperators || new RegExp("^[\\+\\-\\*/%&|\\^~<>!]"); | ||
var identifiers = parserConf.identifiers|| new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); | ||
} | ||
var hangingIndent = parserConf.hangingIndent || conf.indentUnit; | ||
@@ -257,4 +265,9 @@ | ||
// Handle decorators | ||
if (current == "@") | ||
return stream.match(identifiers, false) ? "meta" : ERRORCLASS; | ||
if (current == "@"){ | ||
if(parserConf.version && parseInt(parserConf.version, 10) == 3){ | ||
return stream.match(identifiers, false) ? "meta" : "operator"; | ||
} else { | ||
return stream.match(identifiers, false) ? "meta" : ERRORCLASS; | ||
} | ||
} | ||
@@ -261,0 +274,0 @@ if ((style == "variable" || style == "builtin") |
@@ -110,4 +110,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
// Symbols can't start by a digit | ||
if (stream.eat(/[a-zA-Z$@_]/)) { | ||
stream.eatWhile(/[\w]/); | ||
if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) { | ||
stream.eatWhile(/[\w$\xa1-\uffff]/); | ||
// Only one ? ! = is allowed and only as the last character | ||
@@ -118,5 +118,5 @@ stream.eat(/[\?\!\=]/); | ||
return "operator"; | ||
} else if (ch == "@" && stream.match(/^@?[a-zA-Z_]/)) { | ||
} else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) { | ||
stream.eat("@"); | ||
stream.eatWhile(/[\w]/); | ||
stream.eatWhile(/[\w\xa1-\uffff]/); | ||
return "variable-2"; | ||
@@ -132,4 +132,4 @@ } else if (ch == "$") { | ||
return "variable-3"; | ||
} else if (/[a-zA-Z_]/.test(ch)) { | ||
stream.eatWhile(/[\w]/); | ||
} else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) { | ||
stream.eatWhile(/[\w\xa1-\uffff]/); | ||
stream.eat(/[\?\!]/); | ||
@@ -155,13 +155,14 @@ if (stream.eat(":")) return "atom"; | ||
function tokenBaseUntilBrace() { | ||
var depth = 1; | ||
function tokenBaseUntilBrace(depth) { | ||
if (!depth) depth = 1; | ||
return function(stream, state) { | ||
if (stream.peek() == "}") { | ||
depth--; | ||
if (depth == 0) { | ||
if (depth == 1) { | ||
state.tokenize.pop(); | ||
return state.tokenize[state.tokenize.length-1](stream, state); | ||
} else { | ||
state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1); | ||
} | ||
} else if (stream.peek() == "{") { | ||
depth++; | ||
state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1); | ||
} | ||
@@ -168,0 +169,0 @@ return tokenBase(stream, state); |
@@ -17,3 +17,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var valKeywords = { | ||
"if": "if-style", "while": "if-style", "else": "else-style", | ||
"if": "if-style", "while": "if-style", "loop": "else-style", "else": "else-style", | ||
"do": "else-style", "ret": "else-style", "fail": "else-style", | ||
@@ -26,3 +26,3 @@ "break": "atom", "cont": "atom", "const": "let", "resource": "fn", | ||
"export": "else-style", "copy": "op", "log": "op", "log_err": "op", | ||
"use": "op", "bind": "op", "self": "atom" | ||
"use": "op", "bind": "op", "self": "atom", "struct": "enum" | ||
}; | ||
@@ -29,0 +29,0 @@ var typeKeywords = function() { |
@@ -80,3 +80,7 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
html: function(stream, state) { | ||
if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && state.htmlMixedState.htmlState.tagName === null) { | ||
var htmlTagName = state.htmlMixedState.htmlState.context && state.htmlMixedState.htmlState.context.tagName | ||
? state.htmlMixedState.htmlState.context.tagName | ||
: null; | ||
if (!state.inLiteral && stream.match(regs.htmlHasLeftDelimeter, false) && htmlTagName === null) { | ||
state.tokenize = parsers.smarty; | ||
@@ -83,0 +87,0 @@ state.localMode = smartyMode; |
@@ -216,3 +216,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
} | ||
return null; | ||
stream.backUp(stream.current().length - 1); | ||
return stream.eatWhile(/\w/) ? "variable-2" : null; | ||
} | ||
@@ -219,0 +220,0 @@ |
@@ -254,3 +254,4 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
return state.f(stream, state); | ||
} | ||
}, | ||
lineComment: "%" | ||
}; | ||
@@ -257,0 +258,0 @@ }); |
@@ -81,3 +81,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
else { | ||
stream.eatWhile(/[\w\$_{}]/); | ||
stream.eatWhile(/[\w\$_{}\xa1-\uffff]/); | ||
var word = stream.current().toLowerCase(); | ||
@@ -84,0 +84,0 @@ if (keywords && keywords.propertyIsEnumerable(word)) |
@@ -228,3 +228,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
MT("export_function_does_not_indent", | ||
MT("export_function_one_line_does_not_indent", | ||
"[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];", | ||
@@ -234,3 +234,3 @@ "" | ||
MT("export_task_does_not_indent", | ||
MT("export_task_one_line_does_not_indent", | ||
"[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];", | ||
@@ -240,3 +240,37 @@ "" | ||
MT("export_function_two_lines_indents_properly", | ||
"[keyword export]", | ||
" [string \"DPI-C\"] [keyword function] [variable helloFromSV];", | ||
"" | ||
); | ||
MT("export_task_two_lines_indents_properly", | ||
"[keyword export]", | ||
" [string \"DPI-C\"] [keyword task] [variable helloFromSV];", | ||
"" | ||
); | ||
MT("import_function_one_line_does_not_indent", | ||
"[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];", | ||
"" | ||
); | ||
MT("import_task_one_line_does_not_indent", | ||
"[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];", | ||
"" | ||
); | ||
MT("import_package_single_line_does_not_indent", | ||
"[keyword import] [variable p]::[variable x];", | ||
"[keyword import] [variable p]::[variable y];", | ||
"" | ||
); | ||
MT("covergoup_with_function_indents_properly", | ||
"[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];", | ||
" [variable c] : [keyword coverpoint] [variable c];", | ||
"[keyword endgroup]: [variable cg]", | ||
"" | ||
); | ||
})(); |
@@ -83,3 +83,3 @@ // CodeMirror, copyright (c) by Marijn Haverbeke and others | ||
var blockKeywords = words( | ||
"case checker class clocking config function generate group interface module package" + | ||
"case checker class clocking config function generate interface module package" + | ||
"primitive program property specify sequence table task" | ||
@@ -98,8 +98,4 @@ ); | ||
openClose["fork" ] = "join;join_any;join_none"; | ||
openClose["covergroup"] = "endgroup"; | ||
// This is a bit of a hack but will work to not indent after import/epxort statements | ||
// as long as the function/task name is on the same line | ||
openClose["import"] = "function;task"; | ||
openClose["export"] = "function;task"; | ||
for (var i in noIndentKeywords) { | ||
@@ -112,3 +108,4 @@ var keyword = noIndentKeywords[i]; | ||
var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else for foreach forever if initial repeat while"); | ||
// Keywords which open statements that are ended with a semi-colon | ||
var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while"); | ||
@@ -326,4 +323,12 @@ function tokenBase(stream, state) { | ||
} else if (curPunc == "newblock") { | ||
var close = openClose[curKeyword]; | ||
pushContext(state, stream.column(), close); | ||
if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) { | ||
// The 'function' keyword can appear in some other contexts where it actually does not | ||
// indicate a function (import/export DPI and covergroup definitions). | ||
// Do nothing in this case | ||
} else if (curKeyword == "task" && ctx && ctx.type == "statement") { | ||
// Same thing for task | ||
} else { | ||
var close = openClose[curKeyword]; | ||
pushContext(state, stream.column(), close); | ||
} | ||
} | ||
@@ -330,0 +335,0 @@ |
{ | ||
"name": "codemirror", | ||
"version":"4.6.0", | ||
"version":"4.7.0", | ||
"main": "lib/codemirror.js", | ||
@@ -12,3 +12,3 @@ "description": "In-browser code editing made bearable", | ||
"phantomjs": "1.9.2-5"}, | ||
"bugs": "http://github.com/marijnh/CodeMirror/issues", | ||
"bugs": "http://github.com/codemirror/CodeMirror/issues", | ||
"keywords": ["JavaScript", "CodeMirror", "Editor"], | ||
@@ -20,3 +20,3 @@ "homepage": "http://codemirror.net", | ||
"repository": {"type": "git", | ||
"url": "https://github.com/marijnh/CodeMirror.git"} | ||
"url": "https://github.com/codemirror/CodeMirror.git"} | ||
} |
# CodeMirror | ||
[![Build Status](https://travis-ci.org/marijnh/CodeMirror.svg)](https://travis-ci.org/marijnh/CodeMirror) | ||
[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror) | ||
[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror) | ||
@@ -11,2 +11,2 @@ | ||
The manual is at http://codemirror.net/doc/manual.html | ||
The contributing guidelines are in [CONTRIBUTING.md](https://github.com/marijnh/CodeMirror/blob/master/CONTRIBUTING.md) | ||
The contributing guidelines are in [CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
2971730
375
52054