Conflicts: build/demo/kitchen-sink/mode-coldfusion-uncompressed.js build/demo/kitchen-sink/mode-css-uncompressed.js build/demo/kitchen-sink/mode-groovy-uncompressed.js build/demo/kitchen-sink/mode-html-uncompressed.js build/demo/kitchen-sink/mode-java-uncompressed.js build/demo/kitchen-sink/mode-javascript-uncompressed.js build/demo/kitchen-sink/mode-markdown-uncompressed.js build/demo/kitchen-sink/mode-php-uncompressed.js build/demo/kitchen-sink/mode-scala-uncompressed.js build/demo/kitchen-sink/mode-svg-uncompressed.js build/demo/kitchen-sink/mode-xquery-uncompressed.js build/demo/kitchen-sink/theme-cobalt-uncompressed.js build/demo/kitchen-sink/theme-dawn-uncompressed.js build/demo/kitchen-sink/theme-idle_fingers-uncompressed.js build/demo/kitchen-sink/theme-kr_theme-uncompressed.js build/demo/kitchen-sink/theme-merbivore-uncompressed.js build/demo/kitchen-sink/theme-merbivore_soft-uncompressed.js build/demo/kitchen-sink/theme-mono_industrial-uncompressed.js build/demo/kitchen-sink/theme-pastel_on_dark-uncompressed.js build/demo/kitchen-sink/theme-twilight-uncompressed.js build/demo/kitchen-sink/theme-vibrant_ink-uncompressed.js build/kitchen-sink.html build/src/mode-coldfusion-noconflict.js build/src/mode-coldfusion-uncompressed-noconflict.js build/src/mode-coldfusion-uncompressed.js build/src/mode-coldfusion.js build/src/mode-css-noconflict.js build/src/mode-css-uncompressed-noconflict.js build/src/mode-css-uncompressed.js build/src/mode-css.js build/src/mode-groovy-noconflict.js build/src/mode-groovy-uncompressed-noconflict.js build/src/mode-groovy-uncompressed.js build/src/mode-groovy.js build/src/mode-html-noconflict.js build/src/mode-html-uncompressed-noconflict.js build/src/mode-html-uncompressed.js build/src/mode-html.js build/src/mode-java-noconflict.js build/src/mode-java-uncompressed-noconflict.js build/src/mode-java-uncompressed.js build/src/mode-java.js build/src/mode-javascript-noconflict.js build/src/mode-javascript-uncompressed-noconflict.js build/src/mode-javascript-uncompressed.js build/src/mode-javascript.js build/src/mode-markdown-noconflict.js build/src/mode-markdown-uncompressed-noconflict.js build/src/mode-markdown-uncompressed.js build/src/mode-markdown.js build/src/mode-php-noconflict.js build/src/mode-php-uncompressed-noconflict.js build/src/mode-php-uncompressed.js build/src/mode-php.js build/src/mode-scala-noconflict.js build/src/mode-scala-uncompressed-noconflict.js build/src/mode-scala-uncompressed.js build/src/mode-scala.js build/src/mode-svg-noconflict.js build/src/mode-svg-uncompressed-noconflict.js build/src/mode-svg-uncompressed.js build/src/mode-svg.js build/src/mode-xquery-noconflict.js build/src/mode-xquery.js build/src/theme-clouds-noconflict.js build/src/theme-clouds.js build/src/theme-clouds_midnight-noconflict.js build/src/theme-clouds_midnight.js build/src/theme-cobalt-noconflict.js build/src/theme-cobalt-uncompressed-noconflict.js build/src/theme-cobalt-uncompressed.js build/src/theme-cobalt.js build/src/theme-dawn-noconflict.js build/src/theme-dawn-uncompressed-noconflict.js build/src/theme-dawn-uncompressed.js build/src/theme-dawn.js build/src/theme-idle_fingers-noconflict.js build/src/theme-idle_fingers-uncompressed-noconflict.js build/src/theme-idle_fingers-uncompressed.js build/src/theme-idle_fingers.js build/src/theme-kr_theme-noconflict.js build/src/theme-kr_theme-uncompressed-noconflict.js build/src/theme-kr_theme-uncompressed.js build/src/theme-kr_theme.js build/src/theme-merbivore-noconflict.js build/src/theme-merbivore-uncompressed-noconflict.js build/src/theme-merbivore-uncompressed.js build/src/theme-merbivore.js build/src/theme-merbivore_soft-noconflict.js build/src/theme-merbivore_soft-uncompressed-noconflict.js build/src/theme-merbivore_soft-uncompressed.js build/src/theme-merbivore_soft.js build/src/theme-mono_industrial-noconflict.js build/src/theme-mono_industrial-uncompressed-noconflict.js build/src/theme-mono_industrial-uncompressed.js build/src/theme-mono_industrial.js build/src/theme-monokai-noconflict.js build/src/theme-monokai.js build/src/theme-pastel_on_dark-noconflict.js build/src/theme-pastel_on_dark-uncompressed-noconflict.js build/src/theme-pastel_on_dark-uncompressed.js build/src/theme-pastel_on_dark.js build/src/theme-solarized_dark-noconflict.js build/src/theme-solarized_dark.js build/src/theme-solarized_light-noconflict.js build/src/theme-solarized_light.js build/src/theme-tomorrow-noconflict.js build/src/theme-tomorrow.js build/src/theme-tomorrow_night-noconflict.js build/src/theme-tomorrow_night.js build/src/theme-tomorrow_night_blue-noconflict.js build/src/theme-tomorrow_night_blue.js build/src/theme-tomorrow_night_bright-noconflict.js build/src/theme-tomorrow_night_bright.js build/src/theme-tomorrow_night_eighties-noconflict.js build/src/theme-tomorrow_night_eighties.js build/src/theme-twilight-noconflict.js build/src/theme-twilight-uncompressed-noconflict.js build/src/theme-twilight-uncompressed.js build/src/theme-twilight.js build/src/theme-vibrant_ink-noconflict.js build/src/theme-vibrant_ink-uncompressed-noconflict.js build/src/theme-vibrant_ink-uncompressed.js build/src/theme-vibrant_ink.js
This commit is contained in:
commit
b63d2c178b
362 changed files with 35354 additions and 17306 deletions
|
|
@ -218,9 +218,9 @@ function buildAce(aceProject, options) {
|
||||||
compat: true,
|
compat: true,
|
||||||
modes: [
|
modes: [
|
||||||
"css", "html", "javascript", "php", "coldfusion", "python", "lua", "xml", "ruby", "java", "c_cpp",
|
"css", "html", "javascript", "php", "coldfusion", "python", "lua", "xml", "ruby", "java", "c_cpp",
|
||||||
"coffee", "perl", "csharp", "haxe", "svg", "clojure", "scss", "json", "groovy",
|
"coffee", "perl", "csharp", "haxe", "liquid", "svg", "clojure", "scss", "json", "groovy",
|
||||||
"ocaml", "scala", "textile", "scad", "markdown", "latex", "powershell", "sql",
|
"ocaml", "scala", "textile", "scad", "markdown", "latex", "powershell", "sql",
|
||||||
"text", "pgsql", "sh", "xquery"
|
"text", "pgsql", "sh", "xquery", "less"
|
||||||
],
|
],
|
||||||
themes: [
|
themes: [
|
||||||
"chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn",
|
"chrome", "clouds", "clouds_midnight", "cobalt", "crimson_editor", "dawn",
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ var ClojureHighlightRules = function() {
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -202,6 +205,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -351,7 +357,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -528,12 +534,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +551,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +569,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +594,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +611,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +630,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +659,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +668,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +689,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +699,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -2189,31 +2267,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -2221,27 +2275,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -2259,6 +2293,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -2274,7 +2310,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -2284,6 +2320,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -155,31 +155,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -187,27 +163,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -225,6 +181,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -240,7 +198,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -250,6 +208,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -944,12 +1014,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -961,7 +1031,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -979,7 +1049,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1004,12 +1074,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1021,7 +1091,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1040,14 +1110,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1068,7 +1139,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1077,19 +1148,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1098,7 +1169,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1108,7 +1179,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -1003,12 +1073,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1020,7 +1090,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1038,7 +1108,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1063,12 +1133,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1080,7 +1150,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,14 +1169,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1127,7 +1198,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1136,19 +1207,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1157,7 +1228,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1167,7 +1238,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1535,31 +1607,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -1567,27 +1615,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -1605,6 +1633,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -1620,7 +1650,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -1630,6 +1660,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
@ -1830,6 +1866,9 @@ var HtmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*script\\b)",
|
regex : "<(?=\s*script\\b)",
|
||||||
|
|
@ -1845,6 +1884,9 @@ var HtmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -2014,7 +2056,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -945,12 +1015,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -962,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -980,7 +1050,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1005,12 +1075,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1022,7 +1092,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1041,14 +1111,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1069,7 +1140,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1078,19 +1149,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1170,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1109,7 +1180,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -920,12 +990,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -937,7 +1007,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -955,7 +1025,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -980,12 +1050,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -997,7 +1067,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1016,14 +1086,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1044,7 +1115,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1053,19 +1124,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1074,7 +1145,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1084,7 +1155,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
654
build/demo/kitchen-sink/mode-less-uncompressed.js
Normal file
654
build/demo/kitchen-sink/mode-less-uncompressed.js
Normal file
|
|
@ -0,0 +1,654 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
* John Roepke <john AT justjohn DOT us>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/mode/less', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/less_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules(), "i");
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
// ignore braces in comments
|
||||||
|
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = line.match(/^.*\{\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
* John Roepke <john AT justjohn DOT us>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LessHighlightRules = function() {
|
||||||
|
|
||||||
|
var properties = lang.arrayToMap( (function () {
|
||||||
|
|
||||||
|
var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
|
||||||
|
|
||||||
|
var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
|
||||||
|
"background-size|binding|border-bottom-colors|border-left-colors|" +
|
||||||
|
"border-right-colors|border-top-colors|border-end|border-end-color|" +
|
||||||
|
"border-end-style|border-end-width|border-image|border-start|" +
|
||||||
|
"border-start-color|border-start-style|border-start-width|box-align|" +
|
||||||
|
"box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
|
||||||
|
"box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
|
||||||
|
"column-rule-width|column-rule-style|column-rule-color|float-edge|" +
|
||||||
|
"font-feature-settings|font-language-override|force-broken-image-icon|" +
|
||||||
|
"image-region|margin-end|margin-start|opacity|outline|outline-color|" +
|
||||||
|
"outline-offset|outline-radius|outline-radius-bottomleft|" +
|
||||||
|
"outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
|
||||||
|
"outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
|
||||||
|
"tab-size|text-blink|text-decoration-color|text-decoration-line|" +
|
||||||
|
"text-decoration-style|transform|transform-origin|transition|" +
|
||||||
|
"transition-delay|transition-duration|transition-property|" +
|
||||||
|
"transition-timing-function|user-focus|user-input|user-modify|user-select|" +
|
||||||
|
"window-shadow|border-radius").split("|");
|
||||||
|
|
||||||
|
var properties = ("azimuth|background-attachment|background-color|background-image|" +
|
||||||
|
"background-position|background-repeat|background|border-bottom-color|" +
|
||||||
|
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
||||||
|
"border-color|border-left-color|border-left-style|border-left-width|" +
|
||||||
|
"border-left|border-right-color|border-right-style|border-right-width|" +
|
||||||
|
"border-right|border-spacing|border-style|border-top-color|" +
|
||||||
|
"border-top-style|border-top-width|border-top|border-width|border|" +
|
||||||
|
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
||||||
|
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
||||||
|
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
||||||
|
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
||||||
|
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
||||||
|
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
||||||
|
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
||||||
|
"min-width|opacity|orphans|outline-color|" +
|
||||||
|
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
||||||
|
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
||||||
|
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
||||||
|
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
|
||||||
|
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
||||||
|
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
||||||
|
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
|
||||||
|
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
||||||
|
"z-index").split("|");
|
||||||
|
|
||||||
|
//The return array
|
||||||
|
var ret = [];
|
||||||
|
|
||||||
|
//All prefixProperties will get the browserPrefix in
|
||||||
|
//the begning by join the prefixProperties array with the value of browserPrefix
|
||||||
|
for (var i=0, ln=browserPrefix.length; i<ln; i++) {
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
ret,
|
||||||
|
(( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add also prefixProperties and properties without any browser prefix
|
||||||
|
Array.prototype.push.apply(ret, prefixProperties);
|
||||||
|
Array.prototype.push.apply(ret, properties);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
})() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var functions = lang.arrayToMap(
|
||||||
|
("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
|
||||||
|
"desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
|
||||||
|
"alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
|
||||||
|
"iskeyword|isurl|ispixel|ispercentage|isem").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var constants = lang.arrayToMap(
|
||||||
|
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
||||||
|
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
||||||
|
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
||||||
|
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
||||||
|
"distribute-all-lines|distribute-letter|distribute-space|" +
|
||||||
|
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
||||||
|
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
||||||
|
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
||||||
|
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
||||||
|
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
||||||
|
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
||||||
|
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
||||||
|
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
||||||
|
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
||||||
|
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
||||||
|
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
||||||
|
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
||||||
|
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
||||||
|
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
||||||
|
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
||||||
|
"zero").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var colors = lang.arrayToMap(
|
||||||
|
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
||||||
|
"purple|red|silver|teal|white|yellow").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywords = lang.arrayToMap(
|
||||||
|
("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
|
||||||
|
"@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
|
||||||
|
"def|end|declare|when|not|and").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var tags = lang.arrayToMap(
|
||||||
|
("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
|
||||||
|
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
|
||||||
|
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
|
||||||
|
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
|
||||||
|
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
|
||||||
|
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
|
||||||
|
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
|
||||||
|
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
|
||||||
|
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
merge : true,
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex6 color
|
||||||
|
regex : "#[a-f0-9]{6}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex3 color
|
||||||
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else
|
||||||
|
return "variable";
|
||||||
|
},
|
||||||
|
regex : "@[a-z0-9_\\-@]*\\b"
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (properties.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.type";
|
||||||
|
else if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else if (constants.hasOwnProperty(value))
|
||||||
|
return "constant.language";
|
||||||
|
else if (functions.hasOwnProperty(value))
|
||||||
|
return "support.function";
|
||||||
|
else if (colors.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.constant.color";
|
||||||
|
else if (tags.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "variable.language";
|
||||||
|
else
|
||||||
|
return "text";
|
||||||
|
},
|
||||||
|
regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "#[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "\\.[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: ":[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
merge : true,
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LessHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LessHighlightRules = LessHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
var match = line.match(/^(\s+)/);
|
||||||
|
if (match) {
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length);
|
||||||
|
range.end.column -= 2;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle !== "markbeginend")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[2]) {
|
||||||
|
var range = session.getCommentFoldRange(row, i);
|
||||||
|
range.end.column -= 2;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = {row: row, column: i};
|
||||||
|
var start = session.$findOpeningBracket(match[1], end);
|
||||||
|
|
||||||
|
if (!start)
|
||||||
|
return;
|
||||||
|
|
||||||
|
start.column++;
|
||||||
|
end.column--;
|
||||||
|
|
||||||
|
return Range.fromPoints(start, end);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = null;
|
||||||
|
this.foldingStopMarker = null;
|
||||||
|
|
||||||
|
// must return "" if there's no fold, to enable caching
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
if (this.foldingStartMarker.test(line))
|
||||||
|
return "start";
|
||||||
|
if (foldStyle == "markbeginend"
|
||||||
|
&& this.foldingStopMarker
|
||||||
|
&& this.foldingStopMarker.test(line))
|
||||||
|
return "end";
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.indentationBlock = function(session, row, column) {
|
||||||
|
var re = /^\s*/;
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startColumn = column || line.length;
|
||||||
|
var startLevel = line.match(re)[0].length;
|
||||||
|
var maxRow = session.getLength()
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.match(re)[0].length;
|
||||||
|
|
||||||
|
if (level == line.length)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (level <= startLevel)
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.openingBracketBlock = function(session, bracket, row, column) {
|
||||||
|
var start = {row: row, column: column + 1};
|
||||||
|
var end = session.$findClosingBracket(bracket, start);
|
||||||
|
if (!end)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var fw = session.foldWidgets[end.row];
|
||||||
|
if (fw == null)
|
||||||
|
fw = this.getFoldWidget(session, end.row);
|
||||||
|
|
||||||
|
if (fw == "start") {
|
||||||
|
end.row --;
|
||||||
|
end.column = session.getLine(end.row).length;
|
||||||
|
}
|
||||||
|
return Range.fromPoints(start, end);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
1332
build/demo/kitchen-sink/mode-liquid-uncompressed.js
Normal file
1332
build/demo/kitchen-sink/mode-liquid-uncompressed.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -358,13 +358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -376,51 +376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -443,29 +513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -1000,12 +1070,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1017,7 +1087,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1035,7 +1105,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1060,12 +1130,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1077,7 +1147,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1096,14 +1166,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1124,7 +1195,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1133,19 +1204,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1154,7 +1225,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1164,7 +1235,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1501,6 +1573,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -1508,6 +1583,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -1657,7 +1735,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -2281,31 +2359,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -2313,27 +2367,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -2351,6 +2385,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -2366,7 +2402,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -2376,6 +2412,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
@ -2576,6 +2618,9 @@ var HtmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*script\\b)",
|
regex : "<(?=\s*script\\b)",
|
||||||
|
|
@ -2591,6 +2636,9 @@ var HtmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -2884,7 +2932,7 @@ var MarkdownHighlightRules = function() {
|
||||||
token : "empty_line",
|
token : "empty_line",
|
||||||
regex : '^$'
|
regex : '^$'
|
||||||
}, { // code span `
|
}, { // code span `
|
||||||
token : "support.function",
|
token : ["support.function", "support.function", "support.function"],
|
||||||
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
regex : "(`+)([^\\r]*?[^`])(\\1)"
|
||||||
}, { // code block
|
}, { // code block
|
||||||
token : "support.function",
|
token : "support.function",
|
||||||
|
|
@ -2914,7 +2962,7 @@ var MarkdownHighlightRules = function() {
|
||||||
next : "blockquote"
|
next : "blockquote"
|
||||||
}, { // reference
|
}, { // reference
|
||||||
token : ["text", "constant", "text", "url", "string", "text"],
|
token : ["text", "constant", "text", "url", "string", "text"],
|
||||||
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?\\s*)$"
|
regex : "^([ ]{0,3}\\[)([^\\]]+)(\\]:\\s*)([^ ]+)(\\s*(?:[\"][^\"]+[\"])?(\\s*))$"
|
||||||
}, { // link by reference
|
}, { // link by reference
|
||||||
token : ["text", "string", "text", "constant", "text"],
|
token : ["text", "string", "text", "constant", "text"],
|
||||||
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
regex : "(\\[)((?:[[^\\]]*\\]|[^\\[\\]])*)(\\][ ]?(?:\\n[ ]*)?\\[)(.*?)(\\])"
|
||||||
|
|
@ -2940,10 +2988,10 @@ var MarkdownHighlightRules = function() {
|
||||||
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
regex : "^\\s{0,3}(?:[*+-]|\\d+\\.)\\s+",
|
||||||
next : "listblock"
|
next : "listblock"
|
||||||
}, { // strong ** __
|
}, { // strong ** __
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]{2}|[_]{2}(?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { // emphasis * _
|
}, { // emphasis * _
|
||||||
token : "string",
|
token : ["string", "string", "string"],
|
||||||
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
regex : "([*]|[_](?=\\S))([^\\r]*?\\S[*_]*)(\\1)"
|
||||||
}, { //
|
}, { //
|
||||||
token : ["text", "url", "text"],
|
token : ["text", "url", "text"],
|
||||||
|
|
|
||||||
|
|
@ -1165,7 +1165,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
regex : '[^"]+'
|
regex : '[^"]+'
|
||||||
},
|
}
|
||||||
],
|
],
|
||||||
"qstring" : [
|
"qstring" : [
|
||||||
{
|
{
|
||||||
|
|
@ -1213,7 +1213,7 @@ var PhpHighlightRules = function() {
|
||||||
next : "htmltag"
|
next : "htmltag"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : ">",
|
regex : ">"
|
||||||
}, {
|
}, {
|
||||||
token : 'text',
|
token : 'text',
|
||||||
regex : "(?:media|type|href)"
|
regex : "(?:media|type|href)"
|
||||||
|
|
@ -1223,7 +1223,7 @@ var PhpHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "\{",
|
regex : "\{",
|
||||||
next : "cssdeclaration",
|
next : "cssdeclaration"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "#[A-Za-z0-9\-\_\.]+"
|
regex : "#[A-Za-z0-9\-\_\.]+"
|
||||||
|
|
@ -1265,7 +1265,7 @@ var PhpHighlightRules = function() {
|
||||||
regex : ";",
|
regex : ";",
|
||||||
next : "cssdeclaration"
|
next : "cssdeclaration"
|
||||||
}
|
}
|
||||||
],
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
this.embedRules(DocCommentHighlightRules, "doc-",
|
this.embedRules(DocCommentHighlightRules, "doc-",
|
||||||
|
|
@ -1507,12 +1507,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1524,7 +1524,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -1542,7 +1542,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1567,12 +1567,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1584,7 +1584,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1603,14 +1603,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1631,7 +1632,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1640,19 +1641,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1661,7 +1662,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1671,7 +1672,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -329,12 +329,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -346,7 +346,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -364,7 +364,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -389,12 +389,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -406,7 +406,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -425,14 +425,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -453,7 +454,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -462,19 +463,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,7 +484,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -493,7 +494,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -529,12 +529,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -546,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -564,7 +564,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -589,12 +589,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -606,7 +606,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -625,14 +625,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -653,7 +654,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -662,19 +663,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -683,7 +684,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -693,7 +694,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -945,12 +1015,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -962,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -980,7 +1050,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -1005,12 +1075,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -1022,7 +1092,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1041,14 +1111,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -1069,7 +1140,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -1078,19 +1149,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1099,7 +1170,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1109,7 +1180,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -202,6 +202,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -209,6 +212,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -358,7 +364,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -535,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -552,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -570,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -595,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -612,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -631,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -659,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -668,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -689,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -699,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1357,13 +1365,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1375,51 +1383,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1442,29 +1520,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -131,6 +134,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -280,7 +286,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -457,12 +463,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -474,7 +480,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -492,7 +498,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -517,12 +523,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -534,7 +540,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -553,14 +559,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -581,7 +588,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -590,19 +597,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -611,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -621,7 +628,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -634,12 +634,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -651,7 +651,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -669,7 +669,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -694,12 +694,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -711,7 +711,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -730,14 +730,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -758,7 +759,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -767,19 +768,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -788,7 +789,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -798,7 +799,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,6 @@ exports.cssText = ".ace-chrome .ace_editor {\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-chrome .ace_gutter {\
|
.ace-chrome .ace_gutter {\
|
||||||
width: 50px;\
|
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
color: #333;\
|
color: #333;\
|
||||||
overflow : hidden;\
|
overflow : hidden;\
|
||||||
|
|
@ -58,10 +57,6 @@ exports.cssText = ".ace-chrome .ace_editor {\
|
||||||
text-align: right;\
|
text-align: right;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-chrome .ace_gutter-layer .ace_gutter-cell {\
|
|
||||||
padding-right: 6px;\
|
|
||||||
}\
|
|
||||||
\
|
|
||||||
.ace-chrome .ace_print_margin {\
|
.ace-chrome .ace_print_margin {\
|
||||||
width: 1px;\
|
width: 1px;\
|
||||||
background: #e8e8e8;\
|
background: #e8e8e8;\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-clouds .ace_cursor {\
|
.ace-clouds .ace_cursor {\
|
||||||
border-left: 2px solid #000000;\
|
border-left: 1px solid #000000;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-clouds .ace_cursor.ace_overwrite {\
|
.ace-clouds .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-clouds-midnight .ace_cursor {\
|
.ace-clouds-midnight .ace_cursor {\
|
||||||
border-left: 2px solid #7DA5DC;\
|
border-left: 1px solid #7DA5DC;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-clouds-midnight .ace_cursor.ace_overwrite {\
|
.ace-clouds-midnight .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-cobalt .ace_cursor {\
|
.ace-cobalt .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-cobalt .ace_cursor.ace_overwrite {\
|
.ace-cobalt .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#FF628C;\
|
color:#FF628C;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-cobalt .ace_constant.ace_character, {\
|
||||||
|
color:#FF628C;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-cobalt .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#FF628C;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-cobalt .ace_invalid {\
|
.ace-cobalt .ace_invalid {\
|
||||||
color:#F8F8F8;\
|
color:#F8F8F8;\
|
||||||
background-color:#800F00;\
|
background-color:#800F00;\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-dawn .ace_cursor {\
|
.ace-dawn .ace_cursor {\
|
||||||
border-left: 2px solid #000000;\
|
border-left: 1px solid #000000;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-dawn .ace_cursor.ace_overwrite {\
|
.ace-dawn .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#811F24;\
|
color:#811F24;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-dawn .ace_constant.ace_character, {\
|
||||||
|
color:#811F24;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-dawn .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#811F24;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-dawn .ace_invalid.ace_illegal {\
|
.ace-dawn .ace_invalid.ace_illegal {\
|
||||||
text-decoration:underline;\
|
text-decoration:underline;\
|
||||||
font-style:italic;\
|
font-style:italic;\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-idle-fingers .ace_cursor {\
|
.ace-idle-fingers .ace_cursor {\
|
||||||
border-left: 2px solid #91FF00;\
|
border-left: 1px solid #91FF00;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-idle-fingers .ace_cursor.ace_overwrite {\
|
.ace-idle-fingers .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#6C99BB;\
|
color:#6C99BB;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-idle-fingers .ace_constant.ace_character, {\
|
||||||
|
color:#6C99BB;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-idle-fingers .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#6C99BB;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-idle-fingers .ace_invalid {\
|
.ace-idle-fingers .ace_invalid {\
|
||||||
color:#FFFFFF;\
|
color:#FFFFFF;\
|
||||||
background-color:#FF0000;\
|
background-color:#FF0000;\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-kr-theme .ace_cursor {\
|
.ace-kr-theme .ace_cursor {\
|
||||||
border-left: 2px solid #FF9900;\
|
border-left: 1px solid #FF9900;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-kr-theme .ace_cursor.ace_overwrite {\
|
.ace-kr-theme .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:rgba(210, 117, 24, 0.76);\
|
color:rgba(210, 117, 24, 0.76);\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-kr-theme .ace_constant.ace_character, {\
|
||||||
|
color:rgba(210, 117, 24, 0.76);\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-kr-theme .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:rgba(210, 117, 24, 0.76);\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-kr-theme .ace_invalid {\
|
.ace-kr-theme .ace_invalid {\
|
||||||
color:#F8F8F8;\
|
color:#F8F8F8;\
|
||||||
background-color:#A41300;\
|
background-color:#A41300;\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-merbivore .ace_cursor {\
|
.ace-merbivore .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-merbivore .ace_cursor.ace_overwrite {\
|
.ace-merbivore .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#1EDAFB;\
|
color:#1EDAFB;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-merbivore .ace_constant.ace_character, {\
|
||||||
|
color:#1EDAFB;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-merbivore .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#1EDAFB;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-merbivore .ace_constant.ace_language {\
|
.ace-merbivore .ace_constant.ace_language {\
|
||||||
color:#FDC251;\
|
color:#FDC251;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-merbivore-soft .ace_cursor {\
|
.ace-merbivore-soft .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-merbivore-soft .ace_cursor.ace_overwrite {\
|
.ace-merbivore-soft .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#68C1D8;\
|
color:#68C1D8;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-merbivore-soft .ace_constant.ace_character, {\
|
||||||
|
color:#68C1D8;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-merbivore-soft .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#68C1D8;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-merbivore-soft .ace_constant.ace_language {\
|
.ace-merbivore-soft .ace_constant.ace_language {\
|
||||||
color:#E1C582;\
|
color:#E1C582;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-mono-industrial .ace_cursor {\
|
.ace-mono-industrial .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-mono-industrial .ace_cursor.ace_overwrite {\
|
.ace-mono-industrial .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -113,6 +113,14 @@ exports.cssText = "\
|
||||||
color:#E98800;\
|
color:#E98800;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-mono-industrial .ace_constant.ace_character, {\
|
||||||
|
color:#E98800;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-mono-industrial .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#E98800;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-mono-industrial .ace_constant.ace_numeric {\
|
.ace-mono-industrial .ace_constant.ace_numeric {\
|
||||||
color:#E98800;\
|
color:#E98800;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-monokai .ace_cursor {\
|
.ace-monokai .ace_cursor {\
|
||||||
border-left: 2px solid #F8F8F0;\
|
border-left: 1px solid #F8F8F0;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-monokai .ace_cursor.ace_overwrite {\
|
.ace-monokai .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-pastel-on-dark .ace_cursor {\
|
.ace-pastel-on-dark .ace_cursor {\
|
||||||
border-left: 2px solid #A7A7A7;\
|
border-left: 1px solid #A7A7A7;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-pastel-on-dark .ace_cursor.ace_overwrite {\
|
.ace-pastel-on-dark .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -113,6 +113,14 @@ exports.cssText = "\
|
||||||
color:#4FB7C5;\
|
color:#4FB7C5;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-pastel-on-dark .ace_constant.ace_character, {\
|
||||||
|
color:#4FB7C5;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-pastel-on-dark .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#4FB7C5;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-pastel-on-dark .ace_constant.ace_language {\
|
.ace-pastel-on-dark .ace_constant.ace_language {\
|
||||||
color:#DE8E30;\
|
color:#DE8E30;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-solarized-dark .ace_cursor {\
|
.ace-solarized-dark .ace_cursor {\
|
||||||
border-left: 2px solid #D30102;\
|
border-left: 1px solid #D30102;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-solarized-dark .ace_cursor.ace_overwrite {\
|
.ace-solarized-dark .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-solarized-light .ace_cursor {\
|
.ace-solarized-light .ace_cursor {\
|
||||||
border-left: 2px solid #000000;\
|
border-left: 1px solid #000000;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-solarized-light .ace_cursor.ace_overwrite {\
|
.ace-solarized-light .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow .ace_cursor {\
|
.ace-tomorrow .ace_cursor {\
|
||||||
border-left: 2px solid #AEAFAD;\
|
border-left: 1px solid #AEAFAD;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow .ace_cursor.ace_overwrite {\
|
.ace-tomorrow .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night .ace_cursor {\
|
.ace-tomorrow-night .ace_cursor {\
|
||||||
border-left: 2px solid #AEAFAD;\
|
border-left: 1px solid #AEAFAD;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night .ace_cursor.ace_overwrite {\
|
.ace-tomorrow-night .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-blue .ace_cursor {\
|
.ace-tomorrow-night-blue .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-blue .ace_cursor.ace_overwrite {\
|
.ace-tomorrow-night-blue .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-bright .ace_cursor {\
|
.ace-tomorrow-night-bright .ace_cursor {\
|
||||||
border-left: 2px solid #9F9F9F;\
|
border-left: 1px solid #9F9F9F;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-bright .ace_cursor.ace_overwrite {\
|
.ace-tomorrow-night-bright .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-eighties .ace_cursor {\
|
.ace-tomorrow-night-eighties .ace_cursor {\
|
||||||
border-left: 2px solid #CCCCCC;\
|
border-left: 1px solid #CCCCCC;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-tomorrow-night-eighties .ace_cursor.ace_overwrite {\
|
.ace-tomorrow-night-eighties .ace_cursor.ace_overwrite {\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_cursor {\
|
.ace-twilight .ace_cursor {\
|
||||||
border-left: 2px solid #A7A7A7;\
|
border-left: 1px solid #A7A7A7;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-twilight .ace_cursor.ace_overwrite {\
|
.ace-twilight .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#CF6A4C;\
|
color:#CF6A4C;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-twilight .ace_constant.ace_character, {\
|
||||||
|
color:#CF6A4C;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-twilight .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#CF6A4C;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-twilight .ace_invalid.ace_illegal {\
|
.ace-twilight .ace_invalid.ace_illegal {\
|
||||||
color:#F8F8F8;\
|
color:#F8F8F8;\
|
||||||
background-color:rgba(86, 45, 86, 0.75);\
|
background-color:rgba(86, 45, 86, 0.75);\
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ exports.cssText = "\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-vibrant-ink .ace_cursor {\
|
.ace-vibrant-ink .ace_cursor {\
|
||||||
border-left: 2px solid #FFFFFF;\
|
border-left: 1px solid #FFFFFF;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
.ace-vibrant-ink .ace_cursor.ace_overwrite {\
|
.ace-vibrant-ink .ace_cursor.ace_overwrite {\
|
||||||
|
|
@ -109,6 +109,14 @@ exports.cssText = "\
|
||||||
color:#339999;\
|
color:#339999;\
|
||||||
}\
|
}\
|
||||||
\
|
\
|
||||||
|
.ace-vibrant-ink .ace_constant.ace_character, {\
|
||||||
|
color:#339999;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
|
.ace-vibrant-ink .ace_constant.ace_character.ace_escape, {\
|
||||||
|
color:#339999;\
|
||||||
|
}\
|
||||||
|
\
|
||||||
.ace-vibrant-ink .ace_constant.ace_numeric {\
|
.ace-vibrant-ink .ace_constant.ace_numeric {\
|
||||||
color:#99CC99;\
|
color:#99CC99;\
|
||||||
}\
|
}\
|
||||||
|
|
|
||||||
|
|
@ -1816,6 +1816,7 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
|
// only detect new lines if the document has no line break yet
|
||||||
if (this.getLength() <= 1)
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
|
|
@ -2095,7 +2096,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.isEequal = function(range) {
|
this.isEqual = function(range) {
|
||||||
return this.start.row == range.start.row &&
|
return this.start.row == range.start.row &&
|
||||||
this.end.row == range.end.row &&
|
this.end.row == range.end.row &&
|
||||||
this.start.column == range.start.column &&
|
this.start.column == range.start.column &&
|
||||||
|
|
@ -2161,6 +2162,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.intersectsRange = function(range) {
|
||||||
|
var cmp = this.compareRange(range);
|
||||||
|
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||||
|
}
|
||||||
|
|
||||||
this.isEnd = function(row, column) {
|
this.isEnd = function(row, column) {
|
||||||
return this.end.row == row && this.end.column == column;
|
return this.end.row == row && this.end.column == column;
|
||||||
}
|
}
|
||||||
|
|
@ -2320,6 +2326,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.fixOrientation = function() {
|
||||||
|
if (
|
||||||
|
this.start.row < this.end.row
|
||||||
|
|| (this.start.row == this.end.row && this.start.column < this.end.column)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this.start;
|
||||||
|
this.end = this.start;
|
||||||
|
this.start = temp;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1790,6 +1790,7 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
|
// only detect new lines if the document has no line break yet
|
||||||
if (this.getLength() <= 1)
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
|
|
@ -2069,7 +2070,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.isEequal = function(range) {
|
this.isEqual = function(range) {
|
||||||
return this.start.row == range.start.row &&
|
return this.start.row == range.start.row &&
|
||||||
this.end.row == range.end.row &&
|
this.end.row == range.end.row &&
|
||||||
this.start.column == range.start.column &&
|
this.start.column == range.start.column &&
|
||||||
|
|
@ -2135,6 +2136,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.intersectsRange = function(range) {
|
||||||
|
var cmp = this.compareRange(range);
|
||||||
|
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||||
|
}
|
||||||
|
|
||||||
this.isEnd = function(row, column) {
|
this.isEnd = function(row, column) {
|
||||||
return this.end.row == row && this.end.column == column;
|
return this.end.row == row && this.end.column == column;
|
||||||
}
|
}
|
||||||
|
|
@ -2294,6 +2300,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.fixOrientation = function() {
|
||||||
|
if (
|
||||||
|
this.start.row < this.end.row
|
||||||
|
|| (this.start.row == this.end.row && this.start.column < this.end.column)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this.start;
|
||||||
|
this.end = this.start;
|
||||||
|
this.start = temp;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1827,6 +1827,7 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
|
// only detect new lines if the document has no line break yet
|
||||||
if (this.getLength() <= 1)
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
|
|
@ -2106,7 +2107,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.isEequal = function(range) {
|
this.isEqual = function(range) {
|
||||||
return this.start.row == range.start.row &&
|
return this.start.row == range.start.row &&
|
||||||
this.end.row == range.end.row &&
|
this.end.row == range.end.row &&
|
||||||
this.start.column == range.start.column &&
|
this.start.column == range.start.column &&
|
||||||
|
|
@ -2172,6 +2173,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.intersectsRange = function(range) {
|
||||||
|
var cmp = this.compareRange(range);
|
||||||
|
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||||
|
}
|
||||||
|
|
||||||
this.isEnd = function(row, column) {
|
this.isEnd = function(row, column) {
|
||||||
return this.end.row == row && this.end.column == column;
|
return this.end.row == row && this.end.column == column;
|
||||||
}
|
}
|
||||||
|
|
@ -2331,6 +2337,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.fixOrientation = function() {
|
||||||
|
if (
|
||||||
|
this.start.row < this.end.row
|
||||||
|
|| (this.start.row == this.end.row && this.start.column < this.end.column)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this.start;
|
||||||
|
this.end = this.start;
|
||||||
|
this.start = temp;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -1809,6 +1809,7 @@ var Document = function(text) {
|
||||||
|
|
||||||
position = this.$clipPosition(position);
|
position = this.$clipPosition(position);
|
||||||
|
|
||||||
|
// only detect new lines if the document has no line break yet
|
||||||
if (this.getLength() <= 1)
|
if (this.getLength() <= 1)
|
||||||
this.$detectNewLine(text);
|
this.$detectNewLine(text);
|
||||||
|
|
||||||
|
|
@ -2088,7 +2089,7 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
};
|
};
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.isEequal = function(range) {
|
this.isEqual = function(range) {
|
||||||
return this.start.row == range.start.row &&
|
return this.start.row == range.start.row &&
|
||||||
this.end.row == range.end.row &&
|
this.end.row == range.end.row &&
|
||||||
this.start.column == range.start.column &&
|
this.start.column == range.start.column &&
|
||||||
|
|
@ -2154,6 +2155,11 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.intersectsRange = function(range) {
|
||||||
|
var cmp = this.compareRange(range);
|
||||||
|
return (cmp == -1 || cmp == 0 || cmp == 1);
|
||||||
|
}
|
||||||
|
|
||||||
this.isEnd = function(row, column) {
|
this.isEnd = function(row, column) {
|
||||||
return this.end.row == row && this.end.column == column;
|
return this.end.row == row && this.end.column == column;
|
||||||
}
|
}
|
||||||
|
|
@ -2313,6 +2319,21 @@ var Range = function(startRow, startColumn, endRow, endColumn) {
|
||||||
return Range.fromPoints(start || this.start, end || this.end);
|
return Range.fromPoints(start || this.start, end || this.end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.fixOrientation = function() {
|
||||||
|
if (
|
||||||
|
this.start.row < this.end.row
|
||||||
|
|| (this.start.row == this.end.row && this.start.column < this.end.column)
|
||||||
|
) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this.start;
|
||||||
|
this.end = this.start;
|
||||||
|
this.start = temp;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
this.isEmpty = function() {
|
this.isEmpty = function() {
|
||||||
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
return (this.start.row == this.end.row && this.start.column == this.end.column);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -132,6 +132,13 @@
|
||||||
<input type="checkbox" name="show_hscroll" id="show_hscroll">
|
<input type="checkbox" name="show_hscroll" id="show_hscroll">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td >
|
||||||
|
<label for="animate_scroll">Animate scrolling</label>
|
||||||
|
</td><td>
|
||||||
|
<input type="checkbox" name="animate_scroll" id="animate_scroll">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td >
|
<td >
|
||||||
<label for="keybinding">Key Binding</label>
|
<label for="keybinding">Key Binding</label>
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -541,12 +541,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -558,7 +558,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -576,7 +576,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -601,12 +601,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -618,7 +618,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -637,14 +637,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -665,7 +666,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -674,19 +675,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -695,7 +696,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -705,7 +706,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -260,7 +260,7 @@ var ClojureHighlightRules = function() {
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ var ClojureHighlightRules = function() {
|
||||||
regex : ";.*$"
|
regex : ";.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^\=begin$",
|
regex : "^=begin$",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "keyword", //parens
|
token : "keyword", //parens
|
||||||
|
|
@ -314,17 +314,17 @@ var ClojureHighlightRules = function() {
|
||||||
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
}, {
|
}, {
|
||||||
token : "string", // symbol
|
token : "string", // symbol
|
||||||
regex : "[:](?:[a-zA-Z]|\d)+"
|
regex : "[:](?:[a-zA-Z]|\\d)+"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp", //Regular Expressions
|
token : "string.regexp", //Regular Expressions
|
||||||
regex : '/#"(?:\.|(\\\")|[^\""\n])*"/g'
|
regex : '/#"(?:\\.|(?:\\\")|[^\""\n])*"/g'
|
||||||
}
|
}
|
||||||
|
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^\=end$",
|
regex : "^=end$",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -195,6 +195,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -202,6 +205,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -351,7 +357,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -528,12 +534,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +551,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +569,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +594,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +611,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +630,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +659,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +668,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +689,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +699,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -2023,31 +2101,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -2055,27 +2109,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -2093,6 +2127,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -2108,7 +2144,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -2118,6 +2154,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
|
|
@ -195,6 +195,9 @@ var XmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag", // opening tag
|
token : "meta.tag", // opening tag
|
||||||
regex : "<\\/?",
|
regex : "<\\/?",
|
||||||
|
|
@ -202,6 +205,9 @@ var XmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -351,7 +357,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
@ -528,12 +534,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -545,7 +551,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -563,7 +569,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -588,12 +594,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -605,7 +611,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -624,14 +630,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -652,7 +659,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -661,19 +668,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -682,7 +689,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -692,7 +699,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1350,13 +1358,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -1368,51 +1376,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -1435,29 +1513,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -2023,31 +2101,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -2055,27 +2109,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -2093,6 +2127,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -2108,7 +2144,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -2118,6 +2154,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -155,31 +155,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -187,27 +163,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -225,6 +181,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -240,7 +198,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -250,6 +208,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
|
|
@ -155,31 +155,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -187,27 +163,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -225,6 +181,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -240,7 +198,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -250,6 +208,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -778,12 +848,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -795,7 +865,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -813,7 +883,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -838,12 +908,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -855,7 +925,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -874,14 +944,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -902,7 +973,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -911,19 +982,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -932,7 +1003,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -942,7 +1013,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -302,13 +302,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -320,51 +320,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -387,29 +457,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -778,12 +848,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -795,7 +865,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -813,7 +883,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -838,12 +908,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -855,7 +925,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -874,14 +944,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -902,7 +973,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -911,19 +982,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -932,7 +1003,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -942,7 +1013,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -391,12 +391,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -408,7 +408,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -426,7 +426,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -451,12 +451,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -468,7 +468,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -487,14 +487,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -515,7 +516,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -524,19 +525,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -545,7 +546,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -555,7 +556,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -837,12 +907,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -854,7 +924,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -872,7 +942,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -897,12 +967,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -914,7 +984,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,14 +1003,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -961,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -970,19 +1041,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +1062,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1001,7 +1072,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1369,31 +1441,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -1401,27 +1449,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -1439,6 +1467,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -1454,7 +1484,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -1464,6 +1494,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
@ -1664,6 +1700,9 @@ var HtmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*script\\b)",
|
regex : "<(?=\s*script\\b)",
|
||||||
|
|
@ -1679,6 +1718,9 @@ var HtmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -1848,7 +1890,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
|
||||||
|
|
@ -361,13 +361,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -379,51 +379,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -446,29 +516,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -837,12 +907,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -854,7 +924,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -872,7 +942,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -897,12 +967,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -914,7 +984,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,14 +1003,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -961,7 +1032,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -970,19 +1041,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -991,7 +1062,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -1001,7 +1072,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
@ -1369,31 +1441,7 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
var CssHighlightRules = function() {
|
var CssHighlightRules = function() {
|
||||||
|
|
||||||
var properties = lang.arrayToMap(
|
var properties = lang.arrayToMap(
|
||||||
("-moz-appearance|-moz-box-sizing|-webkit-box-sizing|-moz-outline-radius|-moz-transform|-webkit-transform|" +
|
("animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index").split("|")
|
||||||
"appearance|azimuth|background-attachment|background-color|background-image|" +
|
|
||||||
"background-origin|background-position|background-repeat|background|border-bottom-color|" +
|
|
||||||
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
|
||||||
"border-color|border-left-color|border-left-style|border-left-width|" +
|
|
||||||
"border-left|border-right-color|border-right-style|border-right-width|" +
|
|
||||||
"border-right|border-spacing|border-style|border-top-color|" +
|
|
||||||
"border-top-style|border-top-width|border-top|border-width|border|" +
|
|
||||||
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
|
||||||
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
|
||||||
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
|
||||||
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
|
||||||
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
|
||||||
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
|
||||||
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
|
||||||
"min-width|-moz-border-radius|opacity|orphans|outline-color|outline-offset|outline-radius|" +
|
|
||||||
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
|
||||||
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
|
||||||
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
|
||||||
"pause|pitch-range|pitch|play-during|pointer-events|position|quotes|resize|richness|right|" +
|
|
||||||
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
|
||||||
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
|
||||||
"text-shadow|text-transform|top|transform|unicode-bidi|vertical-align|" +
|
|
||||||
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
|
||||||
"z-index").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var functions = lang.arrayToMap(
|
var functions = lang.arrayToMap(
|
||||||
|
|
@ -1401,27 +1449,7 @@ var CssHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var constants = lang.arrayToMap(
|
var constants = lang.arrayToMap(
|
||||||
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
("absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|font-size|font|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero").split("|")
|
||||||
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
|
||||||
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
|
||||||
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
|
||||||
"distribute-all-lines|distribute-letter|distribute-space|" +
|
|
||||||
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
|
||||||
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
|
||||||
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
|
||||||
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
|
||||||
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
|
||||||
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
|
||||||
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
|
||||||
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
|
||||||
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
|
||||||
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
|
||||||
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
|
||||||
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
|
||||||
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
|
||||||
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
|
||||||
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
|
||||||
"zero").split("|")
|
|
||||||
);
|
);
|
||||||
|
|
||||||
var colors = lang.arrayToMap(
|
var colors = lang.arrayToMap(
|
||||||
|
|
@ -1439,6 +1467,8 @@ var CssHighlightRules = function() {
|
||||||
// regexps are ordered -> the first match is used
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
var pseudoElements = "(\\:+)\\b(after|before|first-letter|first-line|moz-selection|selection)\\b";
|
||||||
|
var pseudoClasses = "(:)\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\b";
|
||||||
|
|
||||||
var base_ruleset = [
|
var base_ruleset = [
|
||||||
{
|
{
|
||||||
|
|
@ -1454,7 +1484,7 @@ var CssHighlightRules = function() {
|
||||||
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric", "keyword"],
|
token : ["constant.numeric", "keyword"],
|
||||||
regex : "(" + numRe + ")(em|ex|px|ch|cm|mm|in|pt|pc|deg|rad|dpi|grad|ms|s|hz|khz|%)"
|
regex : "(" + numRe + ")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)"
|
||||||
}, {
|
}, {
|
||||||
token : ["constant.numeric"],
|
token : ["constant.numeric"],
|
||||||
regex : "([0-9]+)"
|
regex : "([0-9]+)"
|
||||||
|
|
@ -1464,6 +1494,12 @@ var CssHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex3 color
|
token : "constant.numeric", // hex3 color
|
||||||
regex : "#[a-f0-9]{3}"
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-element.css"],
|
||||||
|
regex : pseudoElements
|
||||||
|
}, {
|
||||||
|
token : ["punctuation", "entity.other.attribute-name.pseudo-class.css"],
|
||||||
|
regex : pseudoClasses
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (properties.hasOwnProperty(value.toLowerCase())) {
|
if (properties.hasOwnProperty(value.toLowerCase())) {
|
||||||
|
|
@ -1664,6 +1700,9 @@ var HtmlHighlightRules = function() {
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "<\\!--",
|
regex : "<\\!--",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "xml_pe",
|
||||||
|
regex : "<\\!.*?>"
|
||||||
}, {
|
}, {
|
||||||
token : "meta.tag",
|
token : "meta.tag",
|
||||||
regex : "<(?=\s*script\\b)",
|
regex : "<(?=\s*script\\b)",
|
||||||
|
|
@ -1679,6 +1718,9 @@ var HtmlHighlightRules = function() {
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : "\\s+"
|
||||||
|
}, {
|
||||||
|
token : "constant.character.entity",
|
||||||
|
regex : "(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "[^<]+"
|
regex : "[^<]+"
|
||||||
|
|
@ -1848,7 +1890,7 @@ exports.tag = function(states, name, nextState) {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "[-_a-zA-Z0-9:!]+",
|
regex : "[-_a-zA-Z0-9:]+",
|
||||||
next : name + "_embed_attribute_list"
|
next : name + "_embed_attribute_list"
|
||||||
}, {
|
}, {
|
||||||
token: "empty",
|
token: "empty",
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -779,12 +849,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -796,7 +866,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -814,7 +884,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -839,12 +909,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -856,7 +926,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -875,14 +945,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -903,7 +974,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -912,19 +983,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +1004,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -943,7 +1014,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -303,13 +303,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -321,51 +321,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -388,29 +458,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -779,12 +849,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -796,7 +866,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -814,7 +884,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -839,12 +909,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -856,7 +926,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -875,14 +945,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -903,7 +974,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -912,19 +983,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -933,7 +1004,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -943,7 +1014,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -754,12 +824,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -771,7 +841,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -789,7 +859,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -814,12 +884,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -831,7 +901,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -850,14 +920,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -878,7 +949,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -887,19 +958,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -908,7 +979,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -918,7 +989,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -278,13 +278,13 @@ var JavaScriptHighlightRules = function() {
|
||||||
"start" : [
|
"start" : [
|
||||||
{
|
{
|
||||||
token : "comment",
|
token : "comment",
|
||||||
regex : "\\/\\/.*$"
|
regex : /\/\/.*$/
|
||||||
},
|
},
|
||||||
new DocCommentHighlightRules().getStartRule("doc-start"),
|
new DocCommentHighlightRules().getStartRule("doc-start"),
|
||||||
{
|
{
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
merge : true,
|
merge : true,
|
||||||
regex : "\\/\\*",
|
regex : /\/\*/,
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string",
|
token : "string",
|
||||||
|
|
@ -296,51 +296,121 @@ var JavaScriptHighlightRules = function() {
|
||||||
next : "qqstring"
|
next : "qqstring"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // hex
|
token : "constant.numeric", // hex
|
||||||
regex : "0[xX][0-9a-fA-F]+\\b"
|
regex : /0[xX][0-9a-fA-F]+\b/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.numeric", // float
|
token : "constant.numeric", // float
|
||||||
regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"
|
regex : /[+-]?\d+(?:(?:\.\d*)?(?:[eE][+-]?\d+)?)?\b/
|
||||||
}, { // match stuff like: Sound.prototype.play = function() { }
|
}, { // match stuff like: Sound.prototype.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: Sound.prototype.play = myfunc
|
}, { // match stuff like: Sound.prototype.play = myfunc
|
||||||
token : ["storage.type", "punctuation.operator", "support.function", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"support.function",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text"
|
||||||
|
],
|
||||||
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
regex : "(" + identifierRe + ")(\\.)(prototype)(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)"
|
||||||
}, { // match stuff like: Sound.play = function() { }
|
}, { // match stuff like: Sound.play = function() { }
|
||||||
token : ["storage.type", "punctuation.operator", "entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"storage.type",
|
||||||
|
"punctuation.operator",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\.)(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: play = function() { }
|
}, { // match stuff like: play = function() { }
|
||||||
token : ["entity.name.function", "text", "keyword.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"keyword.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe +")(\\s*)(=)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match regular function like: function myFunc(arg) { }
|
}, { // match regular function like: function myFunc(arg) { }
|
||||||
token : ["storage.type", "text", "entity.name.function", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
regex : "(function)(\\s+)(" + identifierRe + ")(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // match stuff like: foobar: function() { }
|
}, { // match stuff like: foobar: function() { }
|
||||||
token : ["entity.name.function", "text", "punctuation.operator", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)?(\\s*)(\\()(.*?)(\\))"
|
"entity.name.function",
|
||||||
|
"text",
|
||||||
|
"punctuation.operator",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
|
regex : "(" + identifierRe + ")(\\s*)(:)(\\s*)(function)(\\s*)(\\()(.*?)(\\))"
|
||||||
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
}, { // Attempt to match : function() { } (this is for issues with 'foo': function() { })
|
||||||
token : ["text", "text", "storage.type", "text", "paren.lparen", "variable.parameter", "paren.rparen"],
|
token : [
|
||||||
|
"text",
|
||||||
|
"text",
|
||||||
|
"storage.type",
|
||||||
|
"text",
|
||||||
|
"paren.lparen",
|
||||||
|
"variable.parameter",
|
||||||
|
"paren.rparen"
|
||||||
|
],
|
||||||
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
regex : "(:)(\\s*)(function)?(\\s*)(\\()([^)]*)(\\))"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : /(?:true|false)\b/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword",
|
token : "keyword",
|
||||||
regex : "(?:" + kwBeforeRe + ")\\b",
|
regex : "(?:" + kwBeforeRe + ")\\b",
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "support.function",
|
token : ["punctuation.operator", "support.function"],
|
||||||
regex : "\\b(?:s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()"
|
regex : /(\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:opzzzz|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.dom",
|
token : ["punctuation.operator", "support.function.dom"],
|
||||||
regex : "\\b(?:s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()"
|
regex : /(\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/
|
||||||
}, {
|
}, {
|
||||||
token : "support.function.constant",
|
token : ["punctuation.operator", "support.constant"],
|
||||||
regex : "\\b(?:s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b"
|
regex : /(\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/
|
||||||
}, {
|
}, {
|
||||||
token : ["punctuation.operator", "support.function.firebug"],
|
token : ["storage.type", "punctuation.operator", "support.function.firebug"],
|
||||||
regex : "(\\.)(warn|info|log|error|time|timeEnd|assert)\\b"
|
regex : /(console)(\.)(warn|info|log|error|time|timeEnd|assert)\b/
|
||||||
|
|
||||||
}, {
|
}, {
|
||||||
token : function(value) {
|
token : function(value) {
|
||||||
if (globals.hasOwnProperty(value))
|
if (globals.hasOwnProperty(value))
|
||||||
|
|
@ -363,29 +433,29 @@ var JavaScriptHighlightRules = function() {
|
||||||
regex : identifierRe
|
regex : identifierRe
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)",
|
regex : /!|\$|%|&|\*|\-\-|\-|\+\+|\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\|\||\?\:|\*=|%=|\+=|\-=|&=|\^=|\b(?:in|instanceof|new|delete|typeof|void)/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "punctuation.operator",
|
token : "punctuation.operator",
|
||||||
regex : "\\?|\\:|\\,|\\;|\\.",
|
regex : /\?|\:|\,|\;|\./,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.lparen",
|
token : "paren.lparen",
|
||||||
regex : "[[({]",
|
regex : /[\[({]/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token : "paren.rparen",
|
token : "paren.rparen",
|
||||||
regex : "[\\])}]"
|
regex : /[\])}]/
|
||||||
}, {
|
}, {
|
||||||
token : "keyword.operator",
|
token : "keyword.operator",
|
||||||
regex : "\\/=?",
|
regex : /\/=?/,
|
||||||
next : "regex_allowed"
|
next : "regex_allowed"
|
||||||
}, {
|
}, {
|
||||||
token: "comment",
|
token: "comment",
|
||||||
regex: "^#!.*$"
|
regex: /^#!.*$/
|
||||||
}, {
|
}, {
|
||||||
token : "text",
|
token : "text",
|
||||||
regex : "\\s+"
|
regex : /\s+/
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
// regular expressions are only allowed after certain tokens. This
|
// regular expressions are only allowed after certain tokens. This
|
||||||
|
|
@ -754,12 +824,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -771,7 +841,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -789,7 +859,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -814,12 +884,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -831,7 +901,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -850,14 +920,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -878,7 +949,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -887,19 +958,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -908,7 +979,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -918,7 +989,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
|
|
@ -319,12 +319,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '{' + selected + '}',
|
text: '{' + selected + '}',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '{}',
|
text: '{}',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == '}') {
|
} else if (text == '}') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -336,7 +336,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (text == "\n") {
|
} else if (text == "\n") {
|
||||||
|
|
@ -354,7 +354,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '\n' + indent + '\n' + next_indent,
|
text: '\n' + indent + '\n' + next_indent,
|
||||||
selection: [1, indent.length, 1, indent.length]
|
selection: [1, indent.length, 1, indent.length]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -379,12 +379,12 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '(' + selected + ')',
|
text: '(' + selected + ')',
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
text: '()',
|
text: '()',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
} else if (text == ')') {
|
} else if (text == ')') {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
|
|
@ -396,7 +396,7 @@ var CstyleBehaviour = function () {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,14 +415,15 @@ var CstyleBehaviour = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
this.add("string_dquotes", "insertion", function (state, action, editor, session, text) {
|
||||||
if (text == '"') {
|
if (text == '"' || text == "'") {
|
||||||
|
var quote = text;
|
||||||
var selection = editor.getSelectionRange();
|
var selection = editor.getSelectionRange();
|
||||||
var selected = session.doc.getTextRange(selection);
|
var selected = session.doc.getTextRange(selection);
|
||||||
if (selected !== "") {
|
if (selected !== "") {
|
||||||
return {
|
return {
|
||||||
text: '"' + selected + '"',
|
text: quote + selected + quote,
|
||||||
selection: false
|
selection: false
|
||||||
}
|
};
|
||||||
} else {
|
} else {
|
||||||
var cursor = editor.getCursorPosition();
|
var cursor = editor.getCursorPosition();
|
||||||
var line = session.doc.getLine(cursor.row);
|
var line = session.doc.getLine(cursor.row);
|
||||||
|
|
@ -443,7 +444,7 @@ var CstyleBehaviour = function () {
|
||||||
if (token.type == "string") {
|
if (token.type == "string") {
|
||||||
quotepos = -1;
|
quotepos = -1;
|
||||||
} else if (quotepos < 0) {
|
} else if (quotepos < 0) {
|
||||||
quotepos = token.value.indexOf('"');
|
quotepos = token.value.indexOf(quote);
|
||||||
}
|
}
|
||||||
if ((token.value.length + col) > selection.start.column) {
|
if ((token.value.length + col) > selection.start.column) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -452,19 +453,19 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try and be smart about when we auto insert.
|
// Try and be smart about when we auto insert.
|
||||||
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf('"') === token.value.length-1)))) {
|
if (!token || (quotepos < 0 && token.type !== "comment" && (token.type !== "string" || ((selection.start.column !== token.value.length+col-1) && token.value.lastIndexOf(quote) === token.value.length-1)))) {
|
||||||
return {
|
return {
|
||||||
text: '""',
|
text: quote + quote,
|
||||||
selection: [1,1]
|
selection: [1,1]
|
||||||
}
|
};
|
||||||
} else if (token && token.type === "string") {
|
} else if (token && token.type === "string") {
|
||||||
// Ignore input and move right one if we're typing over the closing quote.
|
// Ignore input and move right one if we're typing over the closing quote.
|
||||||
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
var rightChar = line.substring(cursor.column, cursor.column + 1);
|
||||||
if (rightChar == '"') {
|
if (rightChar == quote) {
|
||||||
return {
|
return {
|
||||||
text: '',
|
text: '',
|
||||||
selection: [1, 1]
|
selection: [1, 1]
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -473,7 +474,7 @@ var CstyleBehaviour = function () {
|
||||||
|
|
||||||
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
this.add("string_dquotes", "deletion", function (state, action, editor, session, range) {
|
||||||
var selected = session.doc.getTextRange(range);
|
var selected = session.doc.getTextRange(range);
|
||||||
if (!range.isMultiLine() && selected == '"') {
|
if (!range.isMultiLine() && (selected == '"' || selected == "'")) {
|
||||||
var line = session.doc.getLine(range.start.row);
|
var line = session.doc.getLine(range.start.row);
|
||||||
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
var rightChar = line.substring(range.start.column + 1, range.start.column + 2);
|
||||||
if (rightChar == '"') {
|
if (rightChar == '"') {
|
||||||
|
|
@ -483,7 +484,8 @@ var CstyleBehaviour = function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
oop.inherits(CstyleBehaviour, Behaviour);
|
oop.inherits(CstyleBehaviour, Behaviour);
|
||||||
|
|
||||||
exports.CstyleBehaviour = CstyleBehaviour;
|
exports.CstyleBehaviour = CstyleBehaviour;
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1
build/src/mode-less-noconflict.js
Normal file
1
build/src/mode-less-noconflict.js
Normal file
File diff suppressed because one or more lines are too long
654
build/src/mode-less-uncompressed-noconflict.js
Normal file
654
build/src/mode-less-uncompressed-noconflict.js
Normal file
|
|
@ -0,0 +1,654 @@
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
* John Roepke <john AT justjohn DOT us>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/less', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/mode/text', 'ace/tokenizer', 'ace/mode/less_highlight_rules', 'ace/mode/matching_brace_outdent', 'ace/mode/folding/cstyle'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var TextMode = require("./text").Mode;
|
||||||
|
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||||
|
var LessHighlightRules = require("./less_highlight_rules").LessHighlightRules;
|
||||||
|
var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
||||||
|
var CStyleFoldMode = require("./folding/cstyle").FoldMode;
|
||||||
|
|
||||||
|
var Mode = function() {
|
||||||
|
this.$tokenizer = new Tokenizer(new LessHighlightRules().getRules(), "i");
|
||||||
|
this.$outdent = new MatchingBraceOutdent();
|
||||||
|
this.foldingRules = new CStyleFoldMode();
|
||||||
|
};
|
||||||
|
oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.getNextLineIndent = function(state, line, tab) {
|
||||||
|
var indent = this.$getIndent(line);
|
||||||
|
|
||||||
|
// ignore braces in comments
|
||||||
|
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
||||||
|
if (tokens.length && tokens[tokens.length-1].type == "comment") {
|
||||||
|
return indent;
|
||||||
|
}
|
||||||
|
|
||||||
|
var match = line.match(/^.*\{\s*$/);
|
||||||
|
if (match) {
|
||||||
|
indent += tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
return indent;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.checkOutdent = function(state, line, input) {
|
||||||
|
return this.$outdent.checkOutdent(line, input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(state, doc, row) {
|
||||||
|
this.$outdent.autoOutdent(doc, row);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(Mode.prototype);
|
||||||
|
|
||||||
|
exports.Mode = Mode;
|
||||||
|
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
* John Roepke <john AT justjohn DOT us>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/less_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/mode/text_highlight_rules'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../lib/oop");
|
||||||
|
var lang = require("../lib/lang");
|
||||||
|
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
|
||||||
|
|
||||||
|
var LessHighlightRules = function() {
|
||||||
|
|
||||||
|
var properties = lang.arrayToMap( (function () {
|
||||||
|
|
||||||
|
var browserPrefix = ("-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-").split("|");
|
||||||
|
|
||||||
|
var prefixProperties = ("appearance|background-clip|background-inline-policy|background-origin|" +
|
||||||
|
"background-size|binding|border-bottom-colors|border-left-colors|" +
|
||||||
|
"border-right-colors|border-top-colors|border-end|border-end-color|" +
|
||||||
|
"border-end-style|border-end-width|border-image|border-start|" +
|
||||||
|
"border-start-color|border-start-style|border-start-width|box-align|" +
|
||||||
|
"box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|" +
|
||||||
|
"box-pack|box-sizing|column-count|column-gap|column-width|column-rule|" +
|
||||||
|
"column-rule-width|column-rule-style|column-rule-color|float-edge|" +
|
||||||
|
"font-feature-settings|font-language-override|force-broken-image-icon|" +
|
||||||
|
"image-region|margin-end|margin-start|opacity|outline|outline-color|" +
|
||||||
|
"outline-offset|outline-radius|outline-radius-bottomleft|" +
|
||||||
|
"outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|" +
|
||||||
|
"outline-style|outline-width|padding-end|padding-start|stack-sizing|" +
|
||||||
|
"tab-size|text-blink|text-decoration-color|text-decoration-line|" +
|
||||||
|
"text-decoration-style|transform|transform-origin|transition|" +
|
||||||
|
"transition-delay|transition-duration|transition-property|" +
|
||||||
|
"transition-timing-function|user-focus|user-input|user-modify|user-select|" +
|
||||||
|
"window-shadow|border-radius").split("|");
|
||||||
|
|
||||||
|
var properties = ("azimuth|background-attachment|background-color|background-image|" +
|
||||||
|
"background-position|background-repeat|background|border-bottom-color|" +
|
||||||
|
"border-bottom-style|border-bottom-width|border-bottom|border-collapse|" +
|
||||||
|
"border-color|border-left-color|border-left-style|border-left-width|" +
|
||||||
|
"border-left|border-right-color|border-right-style|border-right-width|" +
|
||||||
|
"border-right|border-spacing|border-style|border-top-color|" +
|
||||||
|
"border-top-style|border-top-width|border-top|border-width|border|" +
|
||||||
|
"bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|" +
|
||||||
|
"counter-reset|cue-after|cue-before|cue|cursor|direction|display|" +
|
||||||
|
"elevation|empty-cells|float|font-family|font-size-adjust|font-size|" +
|
||||||
|
"font-stretch|font-style|font-variant|font-weight|font|height|left|" +
|
||||||
|
"letter-spacing|line-height|list-style-image|list-style-position|" +
|
||||||
|
"list-style-type|list-style|margin-bottom|margin-left|margin-right|" +
|
||||||
|
"margin-top|marker-offset|margin|marks|max-height|max-width|min-height|" +
|
||||||
|
"min-width|opacity|orphans|outline-color|" +
|
||||||
|
"outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|" +
|
||||||
|
"padding-left|padding-right|padding-top|padding|page-break-after|" +
|
||||||
|
"page-break-before|page-break-inside|page|pause-after|pause-before|" +
|
||||||
|
"pause|pitch-range|pitch|play-during|position|quotes|richness|right|" +
|
||||||
|
"size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|" +
|
||||||
|
"stress|table-layout|text-align|text-decoration|text-indent|" +
|
||||||
|
"text-shadow|text-transform|top|unicode-bidi|vertical-align|" +
|
||||||
|
"visibility|voice-family|volume|white-space|widows|width|word-spacing|" +
|
||||||
|
"z-index").split("|");
|
||||||
|
|
||||||
|
//The return array
|
||||||
|
var ret = [];
|
||||||
|
|
||||||
|
//All prefixProperties will get the browserPrefix in
|
||||||
|
//the begning by join the prefixProperties array with the value of browserPrefix
|
||||||
|
for (var i=0, ln=browserPrefix.length; i<ln; i++) {
|
||||||
|
Array.prototype.push.apply(
|
||||||
|
ret,
|
||||||
|
(( browserPrefix[i] + prefixProperties.join("|" + browserPrefix[i]) ).split("|"))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add also prefixProperties and properties without any browser prefix
|
||||||
|
Array.prototype.push.apply(ret, prefixProperties);
|
||||||
|
Array.prototype.push.apply(ret, properties);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
})() );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var functions = lang.arrayToMap(
|
||||||
|
("hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|" +
|
||||||
|
"desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|" +
|
||||||
|
"alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|" +
|
||||||
|
"iskeyword|isurl|ispixel|ispercentage|isem").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var constants = lang.arrayToMap(
|
||||||
|
("absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|" +
|
||||||
|
"block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|" +
|
||||||
|
"char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|" +
|
||||||
|
"decimal-leading-zero|decimal|default|disabled|disc|" +
|
||||||
|
"distribute-all-lines|distribute-letter|distribute-space|" +
|
||||||
|
"distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|" +
|
||||||
|
"hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|" +
|
||||||
|
"ideograph-alpha|ideograph-numeric|ideograph-parenthesis|" +
|
||||||
|
"ideograph-space|inactive|inherit|inline-block|inline|inset|inside|" +
|
||||||
|
"inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|" +
|
||||||
|
"keep-all|left|lighter|line-edge|line-through|line|list-item|loose|" +
|
||||||
|
"lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|" +
|
||||||
|
"medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|" +
|
||||||
|
"nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|" +
|
||||||
|
"overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|" +
|
||||||
|
"ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|" +
|
||||||
|
"solid|square|static|strict|super|sw-resize|table-footer-group|" +
|
||||||
|
"table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|" +
|
||||||
|
"transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|" +
|
||||||
|
"vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|" +
|
||||||
|
"zero").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var colors = lang.arrayToMap(
|
||||||
|
("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
|
||||||
|
"purple|red|silver|teal|white|yellow").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var keywords = lang.arrayToMap(
|
||||||
|
("@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|" +
|
||||||
|
"@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|" +
|
||||||
|
"def|end|declare|when|not|and").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
var tags = lang.arrayToMap(
|
||||||
|
("a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|" +
|
||||||
|
"big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|" +
|
||||||
|
"command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|" +
|
||||||
|
"figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|" +
|
||||||
|
"header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|" +
|
||||||
|
"link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|" +
|
||||||
|
"option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|" +
|
||||||
|
"small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|" +
|
||||||
|
"textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp").split("|")
|
||||||
|
);
|
||||||
|
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
var numRe = "\\-?(?:(?:[0-9]+)|(?:[0-9]*\\.[0-9]+))";
|
||||||
|
|
||||||
|
// regexp must not have capturing parentheses. Use (?:) instead.
|
||||||
|
// regexps are ordered -> the first match is used
|
||||||
|
|
||||||
|
this.$rules = {
|
||||||
|
"start" : [
|
||||||
|
{
|
||||||
|
token : "comment",
|
||||||
|
regex : "\\/\\/.*$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
token : "comment", // multi line comment
|
||||||
|
merge : true,
|
||||||
|
regex : "\\/\\*",
|
||||||
|
next : "comment"
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]'
|
||||||
|
}, {
|
||||||
|
token : "string", // single line
|
||||||
|
regex : "['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe + "(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex6 color
|
||||||
|
regex : "#[a-f0-9]{6}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric", // hex3 color
|
||||||
|
regex : "#[a-f0-9]{3}"
|
||||||
|
}, {
|
||||||
|
token : "constant.numeric",
|
||||||
|
regex : numRe
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else
|
||||||
|
return "variable";
|
||||||
|
},
|
||||||
|
regex : "@[a-z0-9_\\-@]*\\b"
|
||||||
|
}, {
|
||||||
|
token : function(value) {
|
||||||
|
if (properties.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.type";
|
||||||
|
else if (keywords.hasOwnProperty(value))
|
||||||
|
return "keyword";
|
||||||
|
else if (constants.hasOwnProperty(value))
|
||||||
|
return "constant.language";
|
||||||
|
else if (functions.hasOwnProperty(value))
|
||||||
|
return "support.function";
|
||||||
|
else if (colors.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "support.constant.color";
|
||||||
|
else if (tags.hasOwnProperty(value.toLowerCase()))
|
||||||
|
return "variable.language";
|
||||||
|
else
|
||||||
|
return "text";
|
||||||
|
},
|
||||||
|
regex : "\\-?[@a-z_][@a-z0-9_\\-]*"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "#[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: "\\.[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "variable.language",
|
||||||
|
regex: ":[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token: "constant",
|
||||||
|
regex: "[a-z0-9-_]+"
|
||||||
|
}, {
|
||||||
|
token : "keyword.operator",
|
||||||
|
regex : "<|>|<=|>=|==|!=|-|%|#|\\+|\\$|\\+|\\*"
|
||||||
|
}, {
|
||||||
|
token : "paren.lparen",
|
||||||
|
regex : "[[({]"
|
||||||
|
}, {
|
||||||
|
token : "paren.rparen",
|
||||||
|
regex : "[\\])}]"
|
||||||
|
}, {
|
||||||
|
token : "text",
|
||||||
|
regex : "\\s+"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"comment" : [
|
||||||
|
{
|
||||||
|
token : "comment", // closing comment
|
||||||
|
regex : ".*?\\*\\/",
|
||||||
|
next : "start"
|
||||||
|
}, {
|
||||||
|
token : "comment", // comment spanning whole line
|
||||||
|
merge : true,
|
||||||
|
regex : ".+"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
oop.inherits(LessHighlightRules, TextHighlightRules);
|
||||||
|
|
||||||
|
exports.LessHighlightRules = LessHighlightRules;
|
||||||
|
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/matching_brace_outdent', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Range = require("../range").Range;
|
||||||
|
|
||||||
|
var MatchingBraceOutdent = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.checkOutdent = function(line, input) {
|
||||||
|
if (! /^\s+$/.test(line))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return /^\s*\}/.test(input);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.autoOutdent = function(doc, row) {
|
||||||
|
var line = doc.getLine(row);
|
||||||
|
var match = line.match(/^(\s*\})/);
|
||||||
|
|
||||||
|
if (!match) return 0;
|
||||||
|
|
||||||
|
var column = match[1].length;
|
||||||
|
var openBracePos = doc.findMatchingBracket({row: row, column: column});
|
||||||
|
|
||||||
|
if (!openBracePos || openBracePos.row == row) return 0;
|
||||||
|
|
||||||
|
var indent = this.$getIndent(doc.getLine(openBracePos.row));
|
||||||
|
doc.replace(new Range(row, 0, row, column-1), indent);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.$getIndent = function(line) {
|
||||||
|
var match = line.match(/^(\s+)/);
|
||||||
|
if (match) {
|
||||||
|
return match[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(MatchingBraceOutdent.prototype);
|
||||||
|
|
||||||
|
exports.MatchingBraceOutdent = MatchingBraceOutdent;
|
||||||
|
});
|
||||||
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/cstyle', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/range', 'ace/mode/folding/fold_mode'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var oop = require("../../lib/oop");
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
var BaseFoldMode = require("./fold_mode").FoldMode;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
|
||||||
|
this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var match = line.match(this.foldingStartMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index;
|
||||||
|
|
||||||
|
if (match[1])
|
||||||
|
return this.openingBracketBlock(session, match[1], row, i);
|
||||||
|
|
||||||
|
var range = session.getCommentFoldRange(row, i + match[0].length);
|
||||||
|
range.end.column -= 2;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (foldStyle !== "markbeginend")
|
||||||
|
return;
|
||||||
|
|
||||||
|
var match = line.match(this.foldingStopMarker);
|
||||||
|
if (match) {
|
||||||
|
var i = match.index + match[0].length;
|
||||||
|
|
||||||
|
if (match[2]) {
|
||||||
|
var range = session.getCommentFoldRange(row, i);
|
||||||
|
range.end.column -= 2;
|
||||||
|
return range;
|
||||||
|
}
|
||||||
|
|
||||||
|
var end = {row: row, column: i};
|
||||||
|
var start = session.$findOpeningBracket(match[1], end);
|
||||||
|
|
||||||
|
if (!start)
|
||||||
|
return;
|
||||||
|
|
||||||
|
start.column++;
|
||||||
|
end.column--;
|
||||||
|
|
||||||
|
return Range.fromPoints(start, end);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
|
*
|
||||||
|
* The contents of this file are subject to the Mozilla Public License Version
|
||||||
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
* http://www.mozilla.org/MPL/
|
||||||
|
*
|
||||||
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||||
|
* for the specific language governing rights and limitations under the
|
||||||
|
* License.
|
||||||
|
*
|
||||||
|
* The Original Code is Ajax.org Code Editor (ACE).
|
||||||
|
*
|
||||||
|
* The Initial Developer of the Original Code is
|
||||||
|
* Ajax.org B.V.
|
||||||
|
* Portions created by the Initial Developer are Copyright (C) 2010
|
||||||
|
* the Initial Developer. All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Contributor(s):
|
||||||
|
* Fabian Jakobs <fabian AT ajax DOT org>
|
||||||
|
*
|
||||||
|
* Alternatively, the contents of this file may be used under the terms of
|
||||||
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||||
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||||
|
* of those above. If you wish to allow use of your version of this file only
|
||||||
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||||
|
* use your version of this file under the terms of the MPL, indicate your
|
||||||
|
* decision by deleting the provisions above and replace them with the notice
|
||||||
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||||
|
* the provisions above, a recipient may use your version of this file under
|
||||||
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||||
|
*
|
||||||
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
|
ace.define('ace/mode/folding/fold_mode', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var Range = require("../../range").Range;
|
||||||
|
|
||||||
|
var FoldMode = exports.FoldMode = function() {};
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
|
||||||
|
this.foldingStartMarker = null;
|
||||||
|
this.foldingStopMarker = null;
|
||||||
|
|
||||||
|
// must return "" if there's no fold, to enable caching
|
||||||
|
this.getFoldWidget = function(session, foldStyle, row) {
|
||||||
|
var line = session.getLine(row);
|
||||||
|
if (this.foldingStartMarker.test(line))
|
||||||
|
return "start";
|
||||||
|
if (foldStyle == "markbeginend"
|
||||||
|
&& this.foldingStopMarker
|
||||||
|
&& this.foldingStopMarker.test(line))
|
||||||
|
return "end";
|
||||||
|
return "";
|
||||||
|
};
|
||||||
|
|
||||||
|
this.getFoldWidgetRange = function(session, foldStyle, row) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.indentationBlock = function(session, row, column) {
|
||||||
|
var re = /^\s*/;
|
||||||
|
var startRow = row;
|
||||||
|
var endRow = row;
|
||||||
|
var line = session.getLine(row);
|
||||||
|
var startColumn = column || line.length;
|
||||||
|
var startLevel = line.match(re)[0].length;
|
||||||
|
var maxRow = session.getLength()
|
||||||
|
|
||||||
|
while (++row < maxRow) {
|
||||||
|
line = session.getLine(row);
|
||||||
|
var level = line.match(re)[0].length;
|
||||||
|
|
||||||
|
if (level == line.length)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (level <= startLevel)
|
||||||
|
break;
|
||||||
|
|
||||||
|
endRow = row;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (endRow > startRow) {
|
||||||
|
var endColumn = session.getLine(endRow).length;
|
||||||
|
return new Range(startRow, startColumn, endRow, endColumn);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
this.openingBracketBlock = function(session, bracket, row, column) {
|
||||||
|
var start = {row: row, column: column + 1};
|
||||||
|
var end = session.$findClosingBracket(bracket, start);
|
||||||
|
if (!end)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var fw = session.foldWidgets[end.row];
|
||||||
|
if (fw == null)
|
||||||
|
fw = this.getFoldWidget(session, end.row);
|
||||||
|
|
||||||
|
if (fw == "start") {
|
||||||
|
end.row --;
|
||||||
|
end.column = session.getLine(end.row).length;
|
||||||
|
}
|
||||||
|
return Range.fromPoints(start, end);
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(FoldMode.prototype);
|
||||||
|
|
||||||
|
});
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue