Browse files

Merge pull request #30 from marco4net/patch-1

Update lib/kyuri/core.js
  • Loading branch information...
2 parents 9c3525d + 1962ab5 commit dbf291d9a7a73329e2c2f72b0d6d947bf8dda773 @indexzero indexzero committed Dec 19, 2012
Showing with 11 additions and 7 deletions.
  1. +11 −7 lib/kyuri/core.js
View
18 lib/kyuri/core.js
@@ -27,14 +27,18 @@ exports.compile = function (code, 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');
-
- // we don't need this anymore
- delete options.tabspace;
-
try {
- ast = isText ? parser.parse(lexer.tokenize(code)) : code;
+ if (isText) {
+ // Convert groups of spaces to tabs
+ code = code.replace(new RegExp(' {' + options.tabspace + '}', 'g'), '\t');
+ // we don't need this anymore
+ delete options.tabspace;
+
+ ast = parser.parse(lexer.tokenize(code));
+ } else {
+ ast = code;
+ }
+
var steps = new StepGenerator(ast).compile(options);
if (options.target === 'all') {

0 comments on commit dbf291d

Please sign in to comment.