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