fix highlighting of tables in Gherkin mode

This commit is contained in:
nightwing 2015-05-27 19:56:28 +04:00
commit 9f57989043
2 changed files with 53 additions and 49 deletions

View file

@ -56,33 +56,33 @@
],[ ],[
"start", "start",
["text"," "], ["text"," "],
["comment","| "], ["comment","|"],
["string","start "], ["string"," start "],
["comment","| "], ["comment","|"],
["string","eat "], ["string"," eat "],
["comment","| "], ["comment","|"],
["string","left "], ["string"," left "],
["comment","|"] ["comment","|"]
],[ ],[
"start", "start",
["text"," "], ["text"," "],
["comment","| "], ["comment","|"],
["string"," 12 "], ["string"," 12 "],
["comment","| "], ["comment","|"],
["string"," 5 "], ["string"," 5 "],
["comment","| "], ["comment","|"],
["string"," 7 "], ["string"," 7 "],
["comment","|"] ["comment","|"]
],[ ],[
"start", "start",
["text"," "], ["text"," "],
["comment","| "], ["comment","|"],
["string"," 20 "], ["string"," 20 "],
["comment","| "], ["comment","|"],
["string"," 5 "], ["string"," 5 "],
["comment","| "], ["comment","|"],
["string"," 15 "], ["string"," 15 "],
["comment","| "], ["comment","|"],
["string"," "] ["string"," "]
],[ ],[
"start" "start"

View file

@ -64,7 +64,7 @@ var GherkinHighlightRules = function() {
regex : "<.+>" regex : "<.+>"
}, { }, {
token : "comment", token : "comment",
regex : "\\| ", regex : "\\|(?=.)",
next : "table-item" next : "table-item"
}, { }, {
token : "comment", token : "comment",
@ -96,15 +96,19 @@ var GherkinHighlightRules = function() {
defaultToken: "string" defaultToken: "string"
}], }],
"table-item" : [{ "table-item" : [{
token : "string", token : "comment",
regex : "[A-Za-z0-9 ]*", regex : /$/,
next : "start" next : "start"
}], }, {
token : "comment",
regex : /\|/
}, {
token : "string",
regex : /\\./
}, {
defaultToken : "string"
}]
}; };
//new TextHighlightRules().getRules();
} }
oop.inherits(GherkinHighlightRules, TextHighlightRules); oop.inherits(GherkinHighlightRules, TextHighlightRules);