Created
October 30, 2012 13:19
-
-
Save sergi/3980137 to your computer and use it in GitHub Desktop.
Test creating
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro val { | |
case $var:ident = $expr => { | |
var $var = $expr | |
} | |
case $var:ident = $x:lit .. $y:lit => { | |
var $var = (function() { | |
var arr = [] | |
for (var i = $x; i < $y; i++) | |
arr.push(i) | |
return arr | |
})(); | |
} | |
} | |
// This snippet below doesn't match | |
val a = 10; | |
console.log(a); | |
// This works nicely | |
val r = 10 .. 25 | |
console.log(r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment