- From: Mark Nottingham <mnot@mnot.net>
- Date: Thu, 25 Dec 2014 04:39:01 -0500
- To: Sam Ruby <rubys@intertwingly.net>
- Cc: Bjoern Hoehrmann <derhoermi@gmx.net>, "public-ietf-w3c@w3.org" <public-ietf-w3c@w3.org>
> On 23 Dec 2014, at 1:48 pm, Sam Ruby <rubys@intertwingly.net> wrote: > > I believe I found a second problem with the following: > >> # IPv6address = 6( h16 ":" ) ls32 >> # / "::" 5( h16 ":" ) ls32 >> # / [ h16 ] "::" 4( h16 ":" ) ls32 >> # / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 >> # / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 >> # / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 >> # / [ *4( h16 ":" ) h16 ] "::" ls32 >> # / [ *5( h16 ":" ) h16 ] "::" h16 >> # / [ *6( h16 ":" ) h16 ] "::" >> IPv6address = r"""(?: (?: %(h16)s : ){6} %(ls32)s | >> :: (?: %(h16)s : ){5} %(ls32)s | >> %(h16)s :: (?: %(h16)s : ){4} %(ls32)s | >> (?: %(h16)s : ) %(h16)s :: (?: %(h16)s : ){3} %(ls32)s | >> (?: %(h16)s : ){2} %(h16)s :: (?: %(h16)s : ){2} %(ls32)s | >> (?: %(h16)s : ){3} %(h16)s :: %(h16)s : %(ls32)s | >> (?: %(h16)s : ){4} %(h16)s :: %(ls32)s | >> (?: %(h16)s : ){5} %(h16)s :: %(h16)s | >> (?: %(h16)s : ){6} %(h16)s :: >> ) >> """ % locals() > > I believe the *n notation in ABNF corresponds to {0,n} in regular expressions. A corrected version: > >> IPv6address = r"""(?: (?: %(h16)s : ){6} %(ls32)s | >> :: (?: %(h16)s : ){5} %(ls32)s | >> %(h16)s :: (?: %(h16)s : ){4} %(ls32)s | >> (?: %(h16)s : ){0,1} %(h16)s :: (?: %(h16)s : ){3} %(ls32)s | >> (?: %(h16)s : ){0,2} %(h16)s :: (?: %(h16)s : ){2} %(ls32)s | >> (?: %(h16)s : ){0,3} %(h16)s :: %(h16)s : %(ls32)s | >> (?: %(h16)s : ){0,4} %(h16)s :: %(ls32)s | >> (?: %(h16)s : ){0,5} %(h16)s :: %(h16)s | >> (?: %(h16)s : ){0,6} %(h16)s :: >> ) >> """ % locals() Yes, but it needs to go further to align with the ABNF: IPv6address = r"""(?: (?: %(h16)s : ){6} %(ls32)s | :: (?: %(h16)s : ){5} %(ls32)s | (?: %(h16)s )? :: (?: %(h16)s : ){4} %(ls32)s | (?: (?: %(h16)s : ){0,1} %(h16)s )? :: (?: %(h16)s : ){3} %(ls32)s | (?: (?: %(h16)s : ){0,2} %(h16)s )? :: (?: %(h16)s : ){2} %(ls32)s | (?: (?: %(h16)s : ){0,3} %(h16)s )? :: %(h16)s : %(ls32)s | (?: (?: %(h16)s : ){0,4} %(h16)s )? :: %(ls32)s | (?: (?: %(h16)s : ){0,5} %(h16)s )? :: %(h16)s | (?: (?: %(h16)s : ){0,6} %(h16)s )? :: ) """ % locals() I’ve updated the gist at <https://gist.github.com/mnot/138549> with this and the previous correction. Thanks, -- Mark Nottingham http://www.mnot.net/
Received on Thursday, 25 December 2014 09:39:26 UTC