Skip to content

Instantly share code, notes, and snippets.

@ronaldxs
Created January 20, 2017 01:17
Show Gist options
  • Save ronaldxs/034612d248e8d5856093b72a278aa817 to your computer and use it in GitHub Desktop.
Save ronaldxs/034612d248e8d5856093b72a278aa817 to your computer and use it in GitHub Desktop.
use Test;
use IETF::RFC_Grammar::URI;
grammar IETF::RFC_Grammar::URI::slightly-better is IETF::RFC_Grammar::URI {
# just change <digit> to [0..9]
token uri-alphanum { <+uri-alpha +[0..9]> }
}
# By luck the existing code finds an IP address for host
is IETF::RFC_Grammar::URI.parse(
'1.2.3.4', :rule<host>
).keys[0], 'IPv4address', 'Existing grammar happens by luck to work';
# LTM seems too fragile. A small change for the better results
# in parse as registered domain name.
is IETF::RFC_Grammar::URI::slightly-better.parse(
'1.2.3.4', :rule<host>
).keys[0], 'IPv4address',
'Match with small and valid change fails apparently caused by LTM';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment