add more tests for ruby highlighting
This commit is contained in:
parent
b4e9790763
commit
328f0cb347
3 changed files with 119 additions and 3 deletions
|
|
@ -12,4 +12,23 @@
|
||||||
#test: float tokenizer
|
#test: float tokenizer
|
||||||
[1, +1, -1, 12_345, 0.000_1,
|
[1, +1, -1, 12_345, 0.000_1,
|
||||||
_, 3_1, 1_2, 1_.0, 0._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
|
||||||
|
|
@ -132,4 +132,101 @@
|
||||||
],[
|
],[
|
||||||
"start",
|
"start",
|
||||||
["text"," "]
|
["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"]
|
||||||
]]
|
]]
|
||||||
|
|
@ -134,7 +134,7 @@ var RubyHighlightRules = function() {
|
||||||
regex : "#.*$"
|
regex : "#.*$"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // multi line comment
|
token : "comment", // multi line comment
|
||||||
regex : "^=begin\\s",
|
regex : "^=begin(?:$|\\s.*$)",
|
||||||
next : "comment"
|
next : "comment"
|
||||||
}, {
|
}, {
|
||||||
token : "string.regexp",
|
token : "string.regexp",
|
||||||
|
|
@ -231,7 +231,7 @@ var RubyHighlightRules = function() {
|
||||||
"comment" : [
|
"comment" : [
|
||||||
{
|
{
|
||||||
token : "comment", // closing comment
|
token : "comment", // closing comment
|
||||||
regex : "^=end\\s.*$",
|
regex : "^=end(?:$|\\s.*$)",
|
||||||
next : "start"
|
next : "start"
|
||||||
}, {
|
}, {
|
||||||
token : "comment", // comment spanning whole line
|
token : "comment", // comment spanning whole line
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue