diff options
| author | Alexander <39702500+threadless-screw@users.noreply.github.com> | 2019-07-21 11:52:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-21 11:52:32 +0200 |
| commit | 7386f0133e54d93b83a999b8d9888f38095a9ded (patch) | |
| tree | e183904b2421a1df2ffdb29b966b252d7eadfb1b | |
| parent | d3555cbcb94591c037667d64c72ad06cc9dd127a (diff) | |
| download | perlweeklychallenge-club-7386f0133e54d93b83a999b8d9888f38095a9ded.tar.gz perlweeklychallenge-club-7386f0133e54d93b83a999b8d9888f38095a9ded.tar.bz2 perlweeklychallenge-club-7386f0133e54d93b83a999b8d9888f38095a9ded.zip | |
Create ch-2.p6
| -rw-r--r-- | challenge-017/ozzy/perl6/ch-2.p6 | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/challenge-017/ozzy/perl6/ch-2.p6 b/challenge-017/ozzy/perl6/ch-2.p6 new file mode 100644 index 0000000000..47ea2a415b --- /dev/null +++ b/challenge-017/ozzy/perl6/ch-2.p6 @@ -0,0 +1,25 @@ +#!/usr/bin/env perl6 +# +# Destructuring a URI +# URI = scheme:[//authority]path[?query][#fragment] +# authority = [userinfo@]host[:port] + +grammar G { + + regex TOP { ^ <scheme> ':' ['//' <authority>]? <path> ['?' <query>]? ['#' <fragment>]? $ } + + token scheme { <+alpha-[_]> <[\w \+ \. \-]>+ } + + token authority { [<userinfo> '@']? <host> [':' <port>]? } + token userinfo { <user> [':' <password>]? } + token user { \w+ } + token password { \w* } + token host { <[\w\.\[\]]>+ } + token port { \d+ } + + token path { [ '/' \w+ ]+ } + token query { <[=\w]>+ } + token fragment { \w+ } +} + +say G.parse: 'jdbc://user:password@localhost:3306/pwc?profile=true#h1'; |
