add more tests for ruby highlighting

This commit is contained in:
nightwing 2013-02-28 12:24:19 +04:00
commit 328f0cb347
3 changed files with 119 additions and 3 deletions

View file

@ -12,4 +12,23 @@
#test: float tokenizer
[1, +1, -1, 12_345, 0.000_1,
_, 3_1, 1_2, 1_.0, 0._1];
{:id => 34, :key => "value"}
=begin
=end
=begin x
=end-
=end x
herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment
FOO #{literal}
FOO
BAR #{fact(10)}
BAR
BAZ indented
BAZ
echo hi
EXEC
puts herDocs

View file

@ -132,4 +132,101 @@
],[
"start",
["text"," "]
],[
"start",
["paren.lparen","{"],
["constant.other.symbol.ruby",":id"],
["text"," "],
["punctuation.separator.key-value","=>"],
["text"," "],
["constant.numeric","34"],
["text",", "],
["constant.other.symbol.ruby",":key"],
["text"," "],
["punctuation.separator.key-value","=>"],
["text"," "],
["string","\"value\""],
["paren.rparen","}"]
],[
"start"
],[
"comment",
["comment","=begin"]
],[
"start",
["comment","=end"]
],[
"start"
],[
"comment",
["comment","=begin x"]
],[
"comment",
["comment","=end-"]
],[
"start",
["comment","=end x"]
],[
"start"
],[
["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["text"," "],
["identifier","herDocs"],
["text"," "],
["keyword.operator","="],
["text"," "],
["paren.lparen","["],
["constant","<<"],
["string","'"],
["support.class","FOO"],
["string","'"],
["text",", "],
["constant","<<"],
["string",""],
["support.class","BAR"],
["string",""],
["text",", "],
["constant","<<-"],
["string",""],
["support.class","BAZ"],
["string",""],
["text",", "],
["constant","<<-"],
["string","`"],
["support.class","EXEC"],
["string","`"],
["paren.rparen","]"],
["text"," "],
["comment","#comment"]
],[
["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["string"," FOO #{literal}"]
],[
["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["support.class","FOO"]
],[
["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["string"," BAR #{fact(10)}"]
],[
["indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["support.class","BAR"]
],[
["indentedHeredoc","BAZ","indentedHeredoc","EXEC"],
["string"," BAZ indented"]
],[
["indentedHeredoc","EXEC"],
["string"," "],
["support.class","BAZ"]
],[
["indentedHeredoc","EXEC"],
["string"," echo hi"]
],[
"start",
["string"," "],
["support.class","EXEC"]
],[
"start",
["support.function","puts"],
["text"," "],
["identifier","herDocs"]
]]

View file

@ -134,7 +134,7 @@ var RubyHighlightRules = function() {
regex : "#.*$"
}, {
token : "comment", // multi line comment
regex : "^=begin\\s",
regex : "^=begin(?:$|\\s.*$)",
next : "comment"
}, {
token : "string.regexp",
@ -231,7 +231,7 @@ var RubyHighlightRules = function() {
"comment" : [
{
token : "comment", // closing comment
regex : "^=end\\s.*$",
regex : "^=end(?:$|\\s.*$)",
next : "start"
}, {
token : "comment", // comment spanning whole line