Skip to content

Instantly share code, notes, and snippets.

@jyotty
Created July 31, 2009 20:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyotty/159435 to your computer and use it in GitHub Desktop.
Save jyotty/159435 to your computer and use it in GitHub Desktop.
# this causes a 'null PMC access' in rakudo
# which is an obvious improvement.
use v6;
grammar Apache {
regex TOP {
<directive>+
}
regex directive {
\h* [
| <directive_name> [\h+ <argument>]+\n+
| '<'<directive_name> [\h+ <argument>]?'>'\n <directive>+ '</'$0'>'\n
]
}
token directive_name {
(\w+)
}
regex argument {
| '"' (<-["]>*) '"'
| (\S+)
}
}
my $conf = $*IN.slurp;
Apache.parse($conf);
$/.perl.say;
TestDirective ArgOne "Arg Two"
ServerRoot "/test"
Include other/*.conf
<Asdf jkl>
DirectoryIndex index.html "test index.html"
</Asdf>
# it seems to be any angle bracket rule causes the error
#<Directory "/Documents and Settings/user/etc">
DirectoryIndex index.html "test index.html"
Allow from All
</Directory>
#<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>
<IfModule log_config_module>
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
</IfModule>
ExampleDirective ArgOne "Arg Two" \
ArgThree
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment