-
-
Save muraiki/e856a437ab8d60f055ff to your computer and use it in GitHub Desktop.
grammar for a link header
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 link-header { | |
token TOP { | |
<url> ';' \h <rel> | |
} | |
token url { | |
\< .+ \> | |
} | |
token rel { | |
rel '=' \h \w+ | |
} | |
} | |
my $lhstring = "<https://foo.bar.com/baz?page=2>; rel= next"; | |
my $lh = link-header.parse($lhstring); | |
say $lh.perl; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to fix this, change "token url" to "regex url" as tokens don't support backtracking. or else use a non-greedy quantifier in token url