Merge pull request #2075 from ajaxorg/highlighter-fixes
Highlighter fixes
This commit is contained in:
commit
2859373983
10 changed files with 32 additions and 28 deletions
|
|
@ -147,7 +147,7 @@ var supportedModes = {
|
||||||
Twig: ["twig"],
|
Twig: ["twig"],
|
||||||
Typescript: ["ts|typescript|str"],
|
Typescript: ["ts|typescript|str"],
|
||||||
Vala: ["vala"],
|
Vala: ["vala"],
|
||||||
VBScript: ["vbs"],
|
VBScript: ["vbs|vb"],
|
||||||
Velocity: ["vm"],
|
Velocity: ["vm"],
|
||||||
Verilog: ["v|vh|sv|svh"],
|
Verilog: ["v|vh|sv|svh"],
|
||||||
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],
|
||||||
|
|
@ -159,7 +159,7 @@ var nameOverrides = {
|
||||||
ObjectiveC: "Objective-C",
|
ObjectiveC: "Objective-C",
|
||||||
CSharp: "C#",
|
CSharp: "C#",
|
||||||
golang: "Go",
|
golang: "Go",
|
||||||
C_Cpp: "C/C++",
|
C_Cpp: "C and C++",
|
||||||
coffee: "CoffeeScript",
|
coffee: "CoffeeScript",
|
||||||
HTML_Ruby: "HTML (Ruby)",
|
HTML_Ruby: "HTML (Ruby)",
|
||||||
FTL: "FreeMarker"
|
FTL: "FreeMarker"
|
||||||
|
|
|
||||||
|
|
@ -288,9 +288,9 @@
|
||||||
["string.regexp.charachterclass","r"],
|
["string.regexp.charachterclass","r"],
|
||||||
["constant.language.escape","-"],
|
["constant.language.escape","-"],
|
||||||
["string.regexp.charachterclass","o"],
|
["string.regexp.charachterclass","o"],
|
||||||
["regexp.keyword.operator","\\f\\f"],
|
["regexp.charclass.keyword.operator","\\f\\f"],
|
||||||
["string.regexp.charachterclass","["],
|
["string.regexp.charachterclass","["],
|
||||||
["regexp.keyword.operator","\\f"],
|
["regexp.charclass.keyword.operator","\\f"],
|
||||||
["constant.language.escape","]?"],
|
["constant.language.escape","]?"],
|
||||||
["string.regexp","r"],
|
["string.regexp","r"],
|
||||||
["invalid","{7}+"],
|
["invalid","{7}+"],
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,9 @@ var c_cppHighlightRules = function() {
|
||||||
);
|
);
|
||||||
|
|
||||||
var storageModifiers = (
|
var storageModifiers = (
|
||||||
"const|extern|register|restrict|static|volatile|inline|private:|" +
|
"const|extern|register|restrict|static|volatile|inline|private|" +
|
||||||
"protected:|public:|friend|explicit|virtual|export|mutable|typename"
|
"protected|public|friend|explicit|virtual|export|mutable|typename|" +
|
||||||
|
"constexpr|new|delete"
|
||||||
);
|
);
|
||||||
|
|
||||||
var keywordOperators = (
|
var keywordOperators = (
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,9 @@ module.exports = {
|
||||||
session.setFoldStyle("markbeginend");
|
session.setFoldStyle("markbeginend");
|
||||||
|
|
||||||
assert.equal(session.getFoldWidget(0), "start");
|
assert.equal(session.getFoldWidget(0), "start");
|
||||||
assert.equal(session.getFoldWidget(1), "");
|
assert.equal(session.getFoldWidget(1), "start");
|
||||||
assert.equal(session.getFoldWidget(2), "");
|
assert.equal(session.getFoldWidget(2), "");
|
||||||
assert.equal(session.getFoldWidget(3), "");
|
assert.equal(session.getFoldWidget(3), "start");
|
||||||
assert.equal(session.getFoldWidget(4), "");
|
assert.equal(session.getFoldWidget(4), "");
|
||||||
assert.equal(session.getFoldWidget(5), "end");
|
assert.equal(session.getFoldWidget(5), "end");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,11 @@ var TokenIterator = require("../../token_iterator").TokenIterator;
|
||||||
|
|
||||||
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
|
var FoldMode = exports.FoldMode = function(voidElements, optionalEndTags) {
|
||||||
BaseFoldMode.call(this);
|
BaseFoldMode.call(this);
|
||||||
// TODO folding support for optional end tags
|
this.voidElements = voidElements || {};
|
||||||
this.voidElements = oop.mixin(voidElements || {}, optionalEndTags || {});
|
this.optionalEndTags = oop.mixin({}, this.voidElements);
|
||||||
|
if (optionalEndTags)
|
||||||
|
oop.mixin(this.optionalEndTags, optionalEndTags);
|
||||||
|
|
||||||
};
|
};
|
||||||
oop.inherits(FoldMode, BaseFoldMode);
|
oop.inherits(FoldMode, BaseFoldMode);
|
||||||
|
|
||||||
|
|
@ -189,10 +192,10 @@ function is(token, type) {
|
||||||
if (!tag || top.tagName == tag.tagName) {
|
if (!tag || top.tagName == tag.tagName) {
|
||||||
return stack.pop();
|
return stack.pop();
|
||||||
}
|
}
|
||||||
else if (this.voidElements.hasOwnProperty(tag.tagName)) {
|
else if (this.optionalEndTags.hasOwnProperty(tag.tagName)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (this.voidElements.hasOwnProperty(top.tagName)) {
|
else if (this.optionalEndTags.hasOwnProperty(top.tagName)) {
|
||||||
stack.pop();
|
stack.pop();
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -1979,7 +1979,7 @@ var JSHINT = (function () {
|
||||||
|
|
||||||
function doOption() {
|
function doOption() {
|
||||||
var nt = state.tokens.next;
|
var nt = state.tokens.next;
|
||||||
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g);
|
var body = nt.body.match(/(-\s+)?[^\s,:]+(?:\s*:\s*(-\s+)?[^\s,]+)?/g) || [];
|
||||||
var predef = {};
|
var predef = {};
|
||||||
|
|
||||||
if (nt.type === "globals") {
|
if (nt.type === "globals") {
|
||||||
|
|
|
||||||
|
|
@ -272,7 +272,7 @@ var JavaScriptHighlightRules = function() {
|
||||||
],
|
],
|
||||||
"regex_character_class": [
|
"regex_character_class": [
|
||||||
{
|
{
|
||||||
token: "regexp.keyword.operator",
|
token: "regexp.charclass.keyword.operator",
|
||||||
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
regex: "\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"
|
||||||
}, {
|
}, {
|
||||||
token: "constant.language.escape",
|
token: "constant.language.escape",
|
||||||
|
|
|
||||||
|
|
@ -1005,7 +1005,7 @@ var PhpLangHighlightRules = function() {
|
||||||
return "string";
|
return "string";
|
||||||
stack.shift();
|
stack.shift();
|
||||||
stack.shift();
|
stack.shift();
|
||||||
return "markup.list"
|
return "markup.list";
|
||||||
},
|
},
|
||||||
regex : "^\\w+(?=;?$)",
|
regex : "^\\w+(?=;?$)",
|
||||||
next: "start"
|
next: "start"
|
||||||
|
|
@ -1016,12 +1016,11 @@ var PhpLangHighlightRules = function() {
|
||||||
],
|
],
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment",
|
||||||
regex : ".*?\\*\\/",
|
regex : "\\*\\/",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
defaultToken : "comment"
|
||||||
regex : ".+"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"qqstring" : [
|
"qqstring" : [
|
||||||
|
|
@ -1029,10 +1028,10 @@ var PhpLangHighlightRules = function() {
|
||||||
token : "constant.language.escape",
|
token : "constant.language.escape",
|
||||||
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
|
regex : '\\\\(?:[nrtvef\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.escape",
|
token : "variable",
|
||||||
regex : /\$[\w]+(?:\[[\w\]+]|=>\w+)?/
|
regex : /\$[\w]+(?:\[[\w\]+]|[=\-]>\w+)?/
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.escape",
|
token : "variable",
|
||||||
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
|
regex : /\$\{[^"\}]+\}?/ // this is wrong but ok for now
|
||||||
},
|
},
|
||||||
{token : "string", regex : '"', next : "start"},
|
{token : "string", regex : '"', next : "start"},
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,7 @@ oop.inherits(Mode, TextMode);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
this.$indentWithTabs = true;
|
this.$indentWithTabs = true;
|
||||||
|
this.lineCommentStart = "#";
|
||||||
this.$id = "ace/mode/snippets";
|
this.$id = "ace/mode/snippets";
|
||||||
}).call(Mode.prototype);
|
}).call(Mode.prototype);
|
||||||
exports.Mode = Mode;
|
exports.Mode = Mode;
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ var ValaHighlightRules = function() {
|
||||||
[ { token: 'meta.class.vala',
|
[ { token: 'meta.class.vala',
|
||||||
regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)',
|
regex: '(?=\\w?[\\w\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\s+\\w+)',
|
||||||
push:
|
push:
|
||||||
[ { token: 'punctuation.section.class.end.vala',
|
[ { token: 'paren.vala',
|
||||||
regex: '}',
|
regex: '}',
|
||||||
next: 'pop' },
|
next: 'pop' },
|
||||||
{ include: '#storage-modifiers' },
|
{ include: '#storage-modifiers' },
|
||||||
|
|
@ -166,10 +166,10 @@ var ValaHighlightRules = function() {
|
||||||
{ include: '#object-types-inherited' },
|
{ include: '#object-types-inherited' },
|
||||||
{ include: '#comments' },
|
{ include: '#comments' },
|
||||||
{ defaultToken: 'meta.definition.class.implemented.interfaces.vala' } ] },
|
{ defaultToken: 'meta.definition.class.implemented.interfaces.vala' } ] },
|
||||||
{ token: 'meta.class.body.vala',
|
{ token: 'paren.vala',
|
||||||
regex: '{',
|
regex: '{',
|
||||||
push:
|
push:
|
||||||
[ { token: 'meta.class.body.vala', regex: '(?=})', next: 'pop' },
|
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
|
||||||
{ include: '#class-body' },
|
{ include: '#class-body' },
|
||||||
{ defaultToken: 'meta.class.body.vala' } ] },
|
{ defaultToken: 'meta.class.body.vala' } ] },
|
||||||
{ defaultToken: 'meta.class.vala' } ],
|
{ defaultToken: 'meta.class.vala' } ],
|
||||||
|
|
@ -266,7 +266,7 @@ var ValaHighlightRules = function() {
|
||||||
[ { token: 'meta.method.vala',
|
[ { token: 'meta.method.vala',
|
||||||
regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()',
|
regex: '(?!new)(?=\\w.*\\s+)(?=[^=]+\\()',
|
||||||
push:
|
push:
|
||||||
[ { token: 'meta.method.vala', regex: '}|(?=;)', next: 'pop' },
|
[ { token: 'paren.vala', regex: '}|(?=;)', next: 'pop' },
|
||||||
{ include: '#storage-modifiers' },
|
{ include: '#storage-modifiers' },
|
||||||
{ token: [ 'entity.name.function.vala', 'meta.method.identifier.vala' ],
|
{ token: [ 'entity.name.function.vala', 'meta.method.identifier.vala' ],
|
||||||
regex: '([\\~\\w\\.]+)(\\s*\\()',
|
regex: '([\\~\\w\\.]+)(\\s*\\()',
|
||||||
|
|
@ -285,10 +285,10 @@ var ValaHighlightRules = function() {
|
||||||
{ include: '#all-types' },
|
{ include: '#all-types' },
|
||||||
{ defaultToken: 'meta.method.return-type.vala' } ] },
|
{ defaultToken: 'meta.method.return-type.vala' } ] },
|
||||||
{ include: '#throws' },
|
{ include: '#throws' },
|
||||||
{ token: 'meta.method.body.vala',
|
{ token: 'paren.vala',
|
||||||
regex: '{',
|
regex: '{',
|
||||||
push:
|
push:
|
||||||
[ { token: 'meta.method.body.vala', regex: '(?=})', next: 'pop' },
|
[ { token: 'paren.vala', regex: '(?=})', next: 'pop' },
|
||||||
{ include: '#code' },
|
{ include: '#code' },
|
||||||
{ defaultToken: 'meta.method.body.vala' } ] },
|
{ defaultToken: 'meta.method.body.vala' } ] },
|
||||||
{ defaultToken: 'meta.method.vala' } ] } ],
|
{ defaultToken: 'meta.method.vala' } ] } ],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue