add Gherkin highlighting

This commit is contained in:
Patrick Nevels 2014-01-25 19:32:40 -06:00
commit 2428de10ed
2 changed files with 7 additions and 14 deletions

View file

@ -16,14 +16,14 @@ oop.inherits(Mode, TextMode);
this.getNextLineIndent = function(state, line, tab) {
var indent = this.$getIndent(line);
var space2 = " ";
var tokenizedLine = this.getTokenizer().getLineTokens(line, state);
var tokens = tokenizedLine.tokens;
console.log(state)
if(line.match("[ ]*\\|")) {
console.log(line.match("\|"));
if(line.match("[ ]*\\|")) {
indent += "| ";
}
@ -33,10 +33,10 @@ oop.inherits(Mode, TextMode);
if (state == "start") {
if (line.match("Scenario:|Feature:")) {
indent = tab;
} else if(line.match("Given.+(:)$|Examples:")) {
indent += tab;
if (line.match("Scenario:|Feature:|Scenario\ Outline:")) {
indent += space2;
} else if(line.match("(Given|Then).+(:)$|Examples:")) {
indent += space2;
} else if(line.match("\\*.+")) {
indent += "* ";
}
@ -45,13 +45,6 @@ oop.inherits(Mode, TextMode);
return indent;
};
this.checkOutdent = function(state, line, input) {
if(line.match("Feature:")) {
}
}
// Extra logic goes here. (see below)
}).call(Mode.prototype);
exports.Mode = Mode;

View file

@ -16,7 +16,7 @@ var GherkinHighlightRules = function() {
regex : "#.*$"
}, {
token : "keyword",
regex : "Feature:|Background:|Scenario:|Scenario Outline:|Examples:|Given|When|Then|And|But|\\*|Scenario\ Outline",
regex : "Feature:|Background:|Scenario:|Scenario\ Outline:|Examples:|Given|When|Then|And|But|\\*",
}, {
token : "string", // multi line """ string start
regex : '"{3}',