Permalink
Browse files

more flexible regexp for detecting language

  • Loading branch information...
1 parent b107286 commit 0beabd409eb35c257d1eef24b5c49bfb7d071dde @ldegen ldegen committed Sep 10, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/cucumber/parser.js
View
2 lib/cucumber/parser.js
@@ -21,7 +21,7 @@ var Parser = function(featureSources, astFilter) {
var currentSourceUri = featureSources[i][Parser.FEATURE_NAME_SOURCE_PAIR_URI_INDEX];
var featureSource = featureSources[i][Parser.FEATURE_NAME_SOURCE_PAIR_SOURCE_INDEX];
self.setCurrentSourceUri(currentSourceUri);
- var languageMatch = /^# language: ([a-z_]*)/.exec(featureSource.toString());
+ var languageMatch = /^\s*#\s*language:\s*([a-z_]*)/.exec(featureSource.toString());
var language = languageMatch == null ? 'en' : languageMatch[1];
lexer(language).scan(featureSource);
}

0 comments on commit 0beabd4

Please sign in to comment.