From 1bd1dff6d449ab221e191679fd8ec516b7cc1d4e Mon Sep 17 00:00:00 2001 From: Patrick Spek Date: Mon, 8 Apr 2019 19:30:35 +0200 Subject: Initial commit --- lib/URL/Grammar/Actions.pm6 | 47 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/URL/Grammar/Actions.pm6 (limited to 'lib/URL/Grammar/Actions.pm6') diff --git a/lib/URL/Grammar/Actions.pm6 b/lib/URL/Grammar/Actions.pm6 new file mode 100644 index 0000000..2015073 --- /dev/null +++ b/lib/URL/Grammar/Actions.pm6 @@ -0,0 +1,47 @@ +#! /usr/bin/env false + +use v6.d; + +unit class URL::Grammar::Actions; + +method TOP ($/) +{ + make { + scheme => $/.made // Str, + username => $/.made // Str, + password => $/.made // Str, + hostname => $/.made // Str, + port => $/.made // Int, + path => $/.made // [], + query => $/.made // {}, + fragment => $/.made // Str, + } +} + +method scheme ($/) { make ~$/ } +method username ($/) { make ~$/ } +method password ($/) { make ~$/ } +method hostname ($/) { make ~$/ } +method port ($/) { make +$/ } +method path ($/) { make $/».Str } +method query ($/) { make $/».made } +method query-part ($/) { make $/.Str => $/.Str } +method fragment ($/) { make ~$/ } + +=begin pod + +=NAME URL::Grammar::Actions +=AUTHOR Patrick Spek +=VERSION 0.1.0 + +=head1 Synopsis + +=head1 Description + +=head1 Examples + +=head1 See also + +=end pod + +# vim: ft=perl6 noet -- cgit v1.1