aboutsummaryrefslogtreecommitdiff
path: root/lib/URL/Grammar/Actions.pm6
blob: 2ef70bb15bc03dee2572ff004cef33043208ec01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env false

use v6.d;

unit class URL::Grammar::Actions;

method TOP ($/)
{
	make {
		scheme => $/<scheme>.made // Str,
		username => $/<userinfo><username>.made // Str,
		password => $/<userinfo><password>.made // Str,
		hostname => $/<host><hostname>.made // Str,
		port => $/<host><port>.made // Int,
		path => $/<path>.made // [],
		query => $/<query>.made // {},
		fragment => $/<fragment>.made // Str,
	}
}

method scheme ($/) { make ~$/ }
method username ($/) { make ~$/ }
method password ($/) { make ~$/ }
method hostname ($/) { make ~$/ }
method port ($/) { make +$/ }
method path ($/) { make $/<part>».Str }
method query ($/) { make $/<part>».made }
method query-part ($/) { make $/<key>.Str => $/<value>.Str }
method fragment ($/) { make ~$/ }

=begin pod

=NAME    URL::Grammar::Actions
=AUTHOR  Patrick Spek <p.spek@tyil.work>
=VERSION 0.2.0

=head1 Synopsis

=head1 Description

=head1 Examples

=head1 See also

=end pod

# vim: ft=perl6 noet