Skip to content

Commit

Permalink
Merge pull request gkz#958 from rhendric/object-syntax-work
Browse files Browse the repository at this point in the history
Object syntax work
  • Loading branch information
rhendric committed May 15, 2017
2 parents 03c6e6a + abf216a commit 6116559
Show file tree
Hide file tree
Showing 12 changed files with 777 additions and 594 deletions.
445 changes: 250 additions & 195 deletions lib/ast.js

Large diffs are not rendered by default.

68 changes: 29 additions & 39 deletions lib/grammar.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion lib/node.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

352 changes: 170 additions & 182 deletions lib/parser.js

Large diffs are not rendered by default.

34 changes: 24 additions & 10 deletions scripts/test
@@ -1,6 +1,7 @@
#!/usr/bin/env node

(function() {
require('source-map-support').install({ hookRequire: true });
var fs = require("fs");
var path = require("path");
var assert = require("assert");
Expand Down Expand Up @@ -46,9 +47,14 @@
};

global.compileThrows = function(msg, lno, code){
throws(msg + " on line " + lno, function(){
LiveScript.compile(code);
});
try {
throws(msg + " on line " + lno, function(){
LiveScript.compile(code);
});
} catch (e) {
e.code = code;
throw e;
}
};

var activeCommandTests = 0;
Expand Down Expand Up @@ -118,7 +124,7 @@
}
};

process.on("exit", function(){
process.on("beforeExit", function(){
var printResults = function() {
var time = ((Date.now() - startTime) / 1e3).toFixed(2);
var message = "passed " + passedTests + " tests in " + time + " seconds";
Expand All @@ -131,10 +137,12 @@
process.exit(1);
}
};
var waitCountdown = 200; // wait at most one second
var check = function() {
if (activeCommandTests > 0) {
setTimeout(wait, 5);
if (activeCommandTests > 0 && waitCountdown-- > 0) {
setTimeout(check, 5);
} else {
failedTests += activeCommandTests;
printResults();
}
};
Expand All @@ -161,7 +169,7 @@

try {
console.log(filename);
LiveScript.run(code, { filename: filename });
LiveScript.run(code, { filename: filename, map: 'embedded' });
} catch (e) {
++failedTests;

Expand All @@ -182,17 +190,23 @@
if ((ref = RegExp(filename + ":(\\d+):(\\d+)\\)?$", "m").exec(stk)) != null) {
row = ref[1];
col = ref[2];
} else if ((ref = RegExp(filename + "(js):(\\d+):(\\d+)\\)?$", "m").exec(stk)) != null) {
row = ref[1];
col = ref[2];
code = LiveScript.compile(code, {
bare: true
});
}

if (row && col) {
console.error(tint(msg + "\n" + red + "at " + filename + ":" + row-- + ":" + col--, red));
code = LiveScript.compile(code, {
bare: true
});
} else if (that = /\bon line (\d+)\b/.exec(msg)) {
console.error(tint(msg, red));
row = that[1] - 1;
col = 0;
if (e.code) {
code = e.code;
}
} else {
console.error(stk);
return;
Expand Down

0 comments on commit 6116559

Please sign in to comment.