jstanks: handle lack of whitespace around braces

This commit is contained in:
Alyssa Milburn 2014-07-29 16:56:44 +02:00
parent 53e0829b8a
commit 0cad982dbd
1 changed files with 2 additions and 1 deletions

View File

@ -161,7 +161,8 @@ Forf.prototype.init = function(code) {
Forf.prototype.parse = function() {
// 'parse' the input
this.code = this.code.replace(/\([^)]*\)/g, "");
var tokens = this.code.split(/\s+/).filter(Boolean); // filter to deal with newlines etc
var splitCode = this.code.split(/([{}])/).join(" ");
var tokens = splitCode.split(/\s+/).filter(Boolean); // filter to deal with newlines etc
// FIXME: this is a hack right now because ugh stacks
var parseTokensAt = function(i, stack) {
var val = tokens[i];