Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

0.6.11

  • Loading branch information...
commit 845829c3c50a3a1cbe433e215b2aa7e7b1070739 1 parent 7989b46
Jeff Su authored
9 CHANGELOG
View
@@ -1,6 +1,13 @@
### 0.6.11
- *
+ * allowing trailing foreach statements
+ * adding tests for inline heredocs
+
+ ```
+ var str = foo.map(#{ => <<END; }).join("\n");
+ hello
+ END
+ ```
### 0.6.9
3  platforms/gem/lib/mochiscript/core.rb
View
@@ -1020,6 +1020,7 @@ class Parser
var exec = nhashes == 2;
tokens.consume(nhashes);
+
var argsMatch = tokens.match(ARGS_REGEX);
var args = null;
@@ -1033,7 +1034,7 @@ class Parser
var body = new $c.CurlyParser();
body.parse(tokens);
var semi = tokens.match(/^\s*[,;\)\}\]]/) ? '' : ';';
- var out = [ 'function', args, body ];
+ var out = [ 'function', args, body, semi ];
if (exec) {
out.unshift('(');
2  platforms/gem/lib/mochiscript/version.rb
View
@@ -1,3 +1,3 @@
module Mochiscript
- VERSION = "0.6.9"
+ VERSION = "0.6.11"
end
3  platforms/npm/lib/mochiscript/mochiscript.js
View
@@ -1007,6 +1007,7 @@ RootParser.extend("ShorthandFunctionParser", function(KLASS, OO){
var exec = nhashes == 2;
tokens.consume(nhashes);
+
var argsMatch = tokens.match(ARGS_REGEX);
var args = null;
@@ -1020,7 +1021,7 @@ RootParser.extend("ShorthandFunctionParser", function(KLASS, OO){
var body = new $c.CurlyParser();
body.parse(tokens);
var semi = tokens.match(/^\s*[,;\)\}\]]/) ? '' : ';';
- var out = [ 'function', args, body ];
+ var out = [ 'function', args, body, semi ];
if (exec) {
out.unshift('(');
2  platforms/npm/package.json
View
@@ -3,7 +3,7 @@
"description": "Javascript Dessert",
"keywords": [ "javascript", "language", "mochiscript", "compiler" ],
"author": "Jeff Su",
- "version": "0.6.9",
+ "version": "0.6.11",
"licenses": [ { "type": "MIT" }],
"engines": { "node": ">=0.4.0" },
"directories": { "lib": "./lib/mochiscript" },
3  src/parsers.ms
View
@@ -460,6 +460,7 @@ class ShorthandFunctionParser extends RootParser {
var exec = nhashes == 2;
tokens.consume(nhashes);
+
var argsMatch = tokens.match(ARGS_REGEX);
var args = null;
@@ -473,7 +474,7 @@ class ShorthandFunctionParser extends RootParser {
var body = new $c.CurlyParser();
body.parse(tokens);
var semi = tokens.match(/^\s*[,;\)\}\]]/) ? '' : ';';
- var out = [ 'function', args, body ];
+ var out = [ 'function', args, body, semi ];
if (exec) {
out.unshift('(');
15 tests/heredocs.ms
View
@@ -18,8 +18,23 @@ var test4 = <<END + " world";
hello
END
+var foo = {
+ test: #{ => $1 + " world" }
+};
+
+var test5 = foo.test(<<END);
+ hello
+END
+
+var test6 = [ 'hello' ].map(#{ => $1 + " " + <<END; })[0];
+ world
+END
+
$m.test(#{
$1.eq("hello\nworld", test1);
$1.eq("hello\nworld", test2);
$1.eq("hello world", test4);
+ $1.eq("hello world", test5);
+ $1.eq("hello world", test5);
+ $1.eq("hello world", test6);
});
Please sign in to comment.
Something went wrong with that request. Please try again.