diff --git a/.travis.yml b/.travis.yml index 4e046b8f..c33b24d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,8 @@ before_install: "npm install -g npm" node_js: - "iojs" - "0.12" - - "0.11" - "0.10" + - "0.8" matrix: fast_finish: true sudo: false diff --git a/lib/output.js b/lib/output.js index 80235ca9..0324d896 100644 --- a/lib/output.js +++ b/lib/output.js @@ -161,6 +161,8 @@ function OutputStream(options) { str = String(str); var ch = str.charAt(0); if (might_need_semicolon) { + might_need_semicolon = false; + if ((!ch || ";}".indexOf(ch) < 0) && !/[;]$/.test(last)) { if (options.semicolons || requireSemicolonChars(ch)) { OUTPUT += ";"; @@ -171,11 +173,17 @@ function OutputStream(options) { current_pos++; current_line++; current_col = 0; + + if (/^\s+$/.test(str)) { + // reset the semicolon flag, since we didn't print one + // now and might still have to later + might_need_semicolon = true; + } } + if (!options.beautify) might_need_space = false; } - might_need_semicolon = false; } if (!options.beautify && options.preserve_line && stack[stack.length - 1]) { diff --git a/lib/parse.js b/lib/parse.js index 913da4bc..48bc70bb 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -480,7 +480,11 @@ function tokenizer($TEXT, filename, html5_comments) { regexp += ch; } var mods = read_name(); - return token("regexp", new RegExp(regexp, mods)); + try { + return token("regexp", new RegExp(regexp, mods)); + } catch(e) { + parse_error(e.message); + } }); function read_operator(prefix) { diff --git a/package.json b/package.json index 88bcc646..0bf1de09 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "license": "BSD", "version": "2.4.24", "engines": { - "node": ">=0.4.0" + "node": ">=0.8.0" }, "maintainers": [ "Mihai Bazon (http://lisperator.net/)" diff --git a/test/run-tests.js b/test/run-tests.js index 92872f92..92b153ee 100755 --- a/test/run-tests.js +++ b/test/run-tests.js @@ -35,7 +35,7 @@ function tmpl() { function log() { var txt = tmpl.apply(this, arguments); - sys.puts(txt); + console.log("%s", txt); } function log_directory(dir) {