highlight Ruby floats with underscores
This commit is contained in:
parent
bd75d46e5a
commit
d632427880
2 changed files with 8 additions and 1 deletions
|
|
@ -131,7 +131,7 @@ var RubyHighlightRules = function() {
|
||||||
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|_(?=\\d))*(?:(?:\\.\\d(?:\\d|_(?=\\d))*)?(?:[eE][+-]?\\d+)?)?\\b"
|
||||||
}, {
|
}, {
|
||||||
token : "constant.language.boolean",
|
token : "constant.language.boolean",
|
||||||
regex : "(?:true|false)\\b"
|
regex : "(?:true|false)\\b"
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,13 @@ module.exports = {
|
||||||
assertInvalidTokens(this.tokenizer, "string",
|
assertInvalidTokens(this.tokenizer, "string",
|
||||||
[":", ":@", ":$", ":1", ":1thing", ":th?ing", ":thi=ng", ":1thing",
|
[":", ":@", ":$", ":1", ":1thing", ":th?ing", ":thi=ng", ":1thing",
|
||||||
":th!ing", ":thing#"]);
|
":th!ing", ":thing#"]);
|
||||||
|
},
|
||||||
|
|
||||||
|
"test: float tokenizer" : function() {
|
||||||
|
assertValidTokens(this.tokenizer, "constant.numeric",
|
||||||
|
["1", "+1", "-1", "12_345", "0.000_1"]);
|
||||||
|
assertInvalidTokens(this.tokenizer, "constant.numeric",
|
||||||
|
["_", "_1", "1_", "1_.0", "0._1"]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue