mozilla/sweet.js — pull request #405 by VimalKumarS (2014-10-16 23:33:39+00:00)
Title: Implementation of Syntax-param in sweet.js

Hello,

File updated - Parser.js / Pattern.js
File added - Test1/Test2/test3.js and Debug-syntax.js
Syntax param example
-----------
macro aif {
case {
$aif_name
($cond ...) {$tru ...} else { $els ... }

} => {
SyntaxParameter(it, $cond ... , aif ,
return #
{
(function () {
if ($cond ...) {
$tru ...
} else {
$els ...
}
})

})
}
}

macro unless {
case {
$unless_name
($cond ...) { $body ...} } => {
return #{
while (true) {
aif ($cond ...) {
// `it` is correctly bound by `aif`
console.log("loop finished at: " + it);
} else {
$body ...
}
}}
}
}

x=2
unless (x) {
console.log(it)
}

--------------------

Please review once, let me know if this break the current working, or if have any example that fails.

thanks
Vimal