blob: 185a76c6b9d4081f0e89e0c980200def58c6cde3 (
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
|
%%{
machine uri;
action scheme {}
action loc {}
action item {}
action query {}
action last {}
action nothing {}
main :=
# Scheme machine. This is ambiguous with the item machine. We commit
# to the scheme machine on colon.
( [^:/?#]+ ':' @(colon,1) @scheme )?
# Location machine. This is ambiguous with the item machine. We remain
# ambiguous until a second slash, at that point and all points after
# we place a higher priority on staying in the location machine over
# moving into the item machine.
( ( '/' ( '/' [^/?#]* ) $(loc,1) ) %loc %/loc )?
# Item machine. Ambiguous with both scheme and location, which both
# get a higher priority on the characters causing ambiguity.
( ( [^?#]+ ) $(loc,0) $(colon,0) %item %/item )?
# Last two components, the characters that initiate these machines are
# not supported in any previous components, therefore there are no
# ambiguities introduced by these parts.
( '?' [^#]* %query %/query)?
( '#' any* %/last )?;
}%%
|