Merge pull request #357 from defunkt/greedy-symbols
Make Ruby symbols less greedy - don't match Namespaced::Constants
This commit is contained in:
commit
9d634eee7b
2 changed files with 13 additions and 0 deletions
|
|
@ -118,6 +118,9 @@ var RubyHighlightRules = function() {
|
|||
token : "string", // backtick string
|
||||
regex : "[`](?:(?:\\\\.)|(?:[^'\\\\]))*?[`]"
|
||||
}, {
|
||||
token : "text", // namespaces aren't symbols
|
||||
regex : "::"
|
||||
}, {
|
||||
token : "variable.instancce", // instance variable
|
||||
regex : "@{1,2}(?:[a-zA-Z_]|\d)+"
|
||||
}, {
|
||||
|
|
|
|||
|
|
@ -60,6 +60,16 @@ module.exports = {
|
|||
":th!ing", ":thing#"]);
|
||||
},
|
||||
|
||||
"test: namespaces aren't symbols" : function() {
|
||||
var line = "Namespaced::Class";
|
||||
var tokens = this.tokenizer.getLineTokens(line, "start").tokens;
|
||||
|
||||
assert.equal(3, tokens.length);
|
||||
assert.equal("variable.class", tokens[0].type);
|
||||
assert.equal("text", tokens[1].type);
|
||||
assert.equal("variable.class", tokens[2].type);
|
||||
},
|
||||
|
||||
"test: hex tokenizer" : function() {
|
||||
assertValidTokens(this.tokenizer, "constant.numeric",
|
||||
["0x9a", "0XA1", "0x9_a"]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue