Created
March 28, 2017 22:06
Star
You must be signed in to star a gist
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
| grammar Pkg { | |
| token TOP { <ws> <name> ['-' <ver>]? ['-' <arch>]? ['-' <build>]? [. <ext>]? } | |
| token name { <alnum>+ } | |
| token ver { <digit>+ ['.'<digit>+]* } | |
| token arch { <alnum>+ } | |
| token build { <digit>+ } | |
| token ext { <alnum>+ } | |
| } | |
| # grammar should match successfully when passed: | |
| # name (rakudo) | |
| # name and ver (rakudo-5.3.2) | |
| # name, ver and arch (rakudo-5.3.2-x86_64) | |
| # name, ver, arch and build (rakudo-5.3.2-x86_64-7) | |
| # name, ver, arch, build and ext (rakudo-5.3.2-x86_64-7.pkg) | |
| my $m = Pkg.parse('rakudo-5.3.2-x86_64-7.pkg'); | |
| #my $m = Pkg.parse('rakudo-star-5.3.2-x86_64-7.xyz'); # What to do to allow "-" in package name! | |
| say "name: $m<name>"; | |
| say "ver: $m<ver>"; | |
| say "arch: $m<arch>"; | |
| say "build: $m<build>"; | |
| say "ext: $m<ext>"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment