Update Eiffel programming language definition.
- Disable comments into strings - Enable concise form for real numbers - Enable juxtaposed digit separators - Check char and string content.
This commit is contained in:
parent
0d4566b42b
commit
29597325d9
1 changed files with 30 additions and 37 deletions
|
|
@ -39,7 +39,7 @@ var EiffelHighlightRules = function() {
|
|||
"class|convert|create|debug|deferred|detachable|do|else|elseif|end|" +
|
||||
"ensure|expanded|export|external|feature|from|frozen|if|inherit|" +
|
||||
"inspect|invariant|like|local|loop|not|note|obsolete|old|once|" +
|
||||
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
|
||||
"Precursor|redefine|rename|require|rescue|retry|select|separate|" +
|
||||
"some|then|undefine|until|variant|when";
|
||||
|
||||
var operatorKeywords = "and|implies|or|xor";
|
||||
|
|
@ -58,45 +58,44 @@ var EiffelHighlightRules = function() {
|
|||
"keyword": keywords
|
||||
}, "identifier", true);
|
||||
|
||||
var simpleString = /(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)+?/;
|
||||
|
||||
this.$rules = {
|
||||
"start": [{
|
||||
token : "comment.line.double-dash",
|
||||
regex : /--.*$/
|
||||
}, {
|
||||
token : "string.quoted.double",
|
||||
regex : /"(?:%"|[^%])*?"/
|
||||
}, {
|
||||
token : "string.quoted.other", // "[ ]" aligned verbatim string
|
||||
token : "string.quoted.other", // Aligned-verbatim-strings (verbatim option not supported)
|
||||
regex : /"\[/,
|
||||
next: "aligned_verbatim_string"
|
||||
}, {
|
||||
token : "string.quoted.other", // "{ }" non-aligned verbatim string
|
||||
token : "string.quoted.other", // Non-aligned-verbatim-strings (verbatim option not supported)
|
||||
regex : /"\{/,
|
||||
next: "non-aligned_verbatim_string"
|
||||
}, {
|
||||
token : "string.quoted.double",
|
||||
regex : /"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)*?"/
|
||||
}, {
|
||||
token : "comment.line.double-dash",
|
||||
regex : /--.*/
|
||||
}, {
|
||||
token : "constant.character",
|
||||
regex : /'(?:%%|%T|%R|%N|%F|%'|[^%])'/
|
||||
regex : /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_*[\da-fA-F])*|0[cC][0-7](?:_*[0-7])*|0[bB][01](?:_*[01])*|\d(?:_*\d)*)\/)'/
|
||||
}, {
|
||||
token : "constant.numeric", // real
|
||||
regex : /(?:\d(?:_?\d)*\.|\.\d)(?:\d*[eE][+-]?\d+)?\b/
|
||||
token : "constant.numeric", // hexa | octal | bin
|
||||
regex : /\b0(?:[xX][\da-fA-F](?:_*[\da-fA-F])*|[cC][0-7](?:_*[0-7])*|[bB][01](?:_*[01])*)\b/
|
||||
}, {
|
||||
token : "constant.numeric", // integer
|
||||
regex : /\d(?:_?\d)*\b/
|
||||
token : "constant.numeric",
|
||||
regex : /(?:(?:\d(?:_*\d)*)?\.(?:(?:\d(?:_*\d)*)?[eE][+-]?)?\d(?:_*\d)*)|\d(?:_*\d)*\.?/
|
||||
}, {
|
||||
token : "constant.numeric", // hex
|
||||
regex : /0[xX][a-fA-F\d](?:_?[a-fA-F\d])*\b/
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]|<<|\|\(/
|
||||
}, {
|
||||
token : "constant.numeric", // octal
|
||||
regex : /0[cC][0-7](?:_?[0-7])*\b/
|
||||
},{
|
||||
token : "constant.numeric", // bin
|
||||
regex : /0[bB][01](?:_?[01])*\b/
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /\+|\-|\*|\/|\\\\|\/\/|\^|~|\/~|<|>|<=|>=|\/=|=|:=|\|\.\.\||\.\./
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]|>>|\|\)/
|
||||
}, {
|
||||
token : "keyword.operator", // punctuation
|
||||
regex : /\.|:|,|;\b/
|
||||
regex : /:=|->|\.(?=\w)|[;,:?]/
|
||||
}, {
|
||||
token : "keyword.operator",
|
||||
regex : /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/
|
||||
}, {
|
||||
token : function (v) {
|
||||
var result = keywordMapper (v);
|
||||
|
|
@ -106,33 +105,27 @@ var EiffelHighlightRules = function() {
|
|||
return result;
|
||||
},
|
||||
regex : /[a-zA-Z][a-zA-Z\d_]*\b/
|
||||
}, {
|
||||
token : "paren.lparen",
|
||||
regex : /[\[({]/
|
||||
}, {
|
||||
token : "paren.rparen",
|
||||
regex : /[\])}]/
|
||||
}, {
|
||||
token : "text",
|
||||
regex : /\s+/
|
||||
}
|
||||
],
|
||||
"aligned_verbatim_string" : [{
|
||||
token : "string", // closing multi-line comment
|
||||
token : "string",
|
||||
regex : /]"/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string", // comment spanning whole line
|
||||
regex : /[^(?:\]")]+/
|
||||
token : "string",
|
||||
regex : simpleString
|
||||
}
|
||||
],
|
||||
"non-aligned_verbatim_string" : [{
|
||||
token : "string.quoted.other", // closing multi-line comment
|
||||
token : "string.quoted.other",
|
||||
regex : /}"/,
|
||||
next : "start"
|
||||
}, {
|
||||
token : "string.quoted.other", // comment spanning whole line
|
||||
regex : /[^(?:\}")]+/
|
||||
token : "string.quoted.other",
|
||||
regex : simpleString
|
||||
}
|
||||
]};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue