Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added tabspace option, defaults to 8. This allows us to use spaces in…

…stead of tabs for indentation without crashing the lexer
  • Loading branch information...
commit b9dbf6172d142ff2c0fdcbc365d577ba5a13043c 1 parent 63291f8
@rajkissu rajkissu authored pacovell committed
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/kyuri/core.js
View
9 lib/kyuri/core.js
@@ -25,6 +25,13 @@ exports.compile = function (code, options) {
// Default options are to generate steps only
options = options || {};
options.target = options.target || 'steps'
+ options.tabspace = options.tabspace || 8;
+
+ // Convert groups of spaces to tabs
+ code = code.replace(new RegExp(' {' + options.tabspace + '}', 'g'), '\t');

should be conditional on isText, i.e.
if (isText)
code = code.replace(new RegExp(' {' + options.tabspace + '}', 'g'), '\t');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ // we don't need this anymore
+ delete options.tabspace;
try {
ast = isText ? parser.parse(lexer.tokenize(code)) : code;
@@ -64,4 +71,4 @@ exports.setLanguage = function (language) {
lexer = new Lexer(language, i18n);
};
-exports.i18n = i18n;
+exports.i18n = i18n;
Please sign in to comment.
Something went wrong with that request. Please try again.