Created
October 31, 2016 17:01
-
-
Save zoffixznet/aec4dcd55478859c90ebbd54f09801c4 to your computer and use it in GitHub Desktop.
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
my $PHP6_CODE = Q:to/END_CODE/; | |
<!DOCTYPE html> | |
<html lang="en"> | |
<meta charset="utf-8"> | |
<title>Today's Time and Date</title> | |
<?💩 | |
use LWP::Simple; | |
my $*foo = get 'http://perl.org'; | |
💩> | |
<h1>It's <?💩 $foo; 💩> right now!</h1> | |
END_CODE | |
grammar Acme::PHP6::Grammar { | |
token TOP { [ <html> | <code-block> ]+ } | |
token html { [<!before <bs>> .]+ } | |
token bs { '<?💩' } | |
token be { '💩>' } | |
token code-block { <bs> <code> <be> } | |
token code { .+? } | |
} | |
# class Acme::PHP6::Actions { | |
# method TOP ($/) { $/.Str.EVAL } | |
# method html ($/) { make "say Q|$/|;"; } | |
# method code ($/) { make $/ ~ ';'; } | |
# } | |
say Acme::PHP6::Grammar.subparse($PHP6_CODE) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment