Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
assertchris committed Jan 27, 2017
0 parents commit 65e0b2e
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
vendor
composer.lock
14 changes: 14 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "pre/short-closures",
"require": {
"php": "^7.0",
"pre/plugin": "dev-master"
},
"autoload": {
"files": [
"functions.php"
]
},
"minimum-stability": "dev",
"prefer-stable": true
}
5 changes: 5 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace Pre;

addMacroPath(__DIR__ . "/macros.pre");
21 changes: 21 additions & 0 deletions macros.pre
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

macro {
→(···expression)
} >> {
··stringify(···expression)
}

macro {
(···parameters) => { ···body }
} >> {
eval('
$context = get_defined_vars();

return function('.→(···parameters).') use ($context) {
extract($context);

'.→(···body).'
};
')
}

0 comments on commit 65e0b2e

Please sign in to comment.