Skip to content

Instantly share code, notes, and snippets.

@jaredhowland
Created December 3, 2025 01:22
Show Gist options
  • Select an option

  • Save jaredhowland/047757747d9864838d18809a9a8680a1 to your computer and use it in GitHub Desktop.

Select an option

Save jaredhowland/047757747d9864838d18809a9a8680a1 to your computer and use it in GitHub Desktop.
abnf-to-regexp error message

Error message:

>> uvx abnf-to-regexp -i rfc6350-modified.abnf
Traceback (most recent call last):
  File "/Users/***/.cache/uv/archive-v0/***/bin/abnf-to-regexp", line 12, in <module>
    sys.exit(main())
             ~~~~^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/main.py", line 153, in main
    return run(
        params=params,
        stdout=sys.stdout,
        stderr=sys.stderr,
    )
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/main.py", line 104, in run
    regexp = abnf_to_regexp.single_regexp.translate(rule_cls=OurRule)
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/icontract/_checkers.py", line 834, in wrapper
    result = func(*args, **kwargs)
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/single_regexp.py", line 67, in translate
    regexp = abnf_to_regexp.compression.compress(regexp)
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/compression.py", line 105, in compress
    element = _MergeAlternationsOfCharacterClasses().transform(element)
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 109, in transform
    return self.transform_repetition(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 135, in transform_repetition
    element=self.transform(element.element),
            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 105, in transform
    return self.transform_concatenation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 125, in transform_concatenation
    elements=[self.transform(subelement) for subelement in element.elements]
              ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 109, in transform
    return self.transform_repetition(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 135, in transform_repetition
    element=self.transform(element.element),
            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 105, in transform
    return self.transform_concatenation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 125, in transform_concatenation
    elements=[self.transform(subelement) for subelement in element.elements]
              ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 109, in transform
    return self.transform_repetition(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 135, in transform_repetition
    element=self.transform(element.element),
            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 105, in transform
    return self.transform_concatenation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 125, in transform_concatenation
    elements=[self.transform(subelement) for subelement in element.elements]
              ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 107, in transform
    return self.transform_alternation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/compression.py", line 41, in transform_alternation
    self.transform(subelement) for subelement in element.elements
    ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 105, in transform
    return self.transform_concatenation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 125, in transform_concatenation
    elements=[self.transform(subelement) for subelement in element.elements]
              ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 105, in transform
    return self.transform_concatenation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 125, in transform_concatenation
    elements=[self.transform(subelement) for subelement in element.elements]
              ~~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/base.py", line 107, in transform
    return self.transform_alternation(element)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
  File "/Users/***/.cache/uv/archive-v0/***/lib/python3.14/site-packages/abnf_to_regexp/compression.py", line 63, in transform_alternation
    assert len(subelement.value) == 1
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError

ABNF Rules List for RFC6350

vcard-entity = 1*vcard

vcard = "BEGIN:VCARD" CRLF
           "VERSION:4.0" CRLF
           1*contentline
           "END:VCARD" CRLF
contentline = [group "."] name *(";" param) ":" value CRLF

group = 1*(ALPHA / DIGIT / "-")
name  = "SOURCE" / "KIND" / "FN" / "N" / "NICKNAME"
         / "PHOTO" / "BDAY" / "ANNIVERSARY" / "GENDER" / "ADR" / "TEL"
         / "EMAIL" / "IMPP" / "LANG" / "TZ" / "GEO" / "TITLE" / "ROLE"
         / "LOGO" / "ORG" / "MEMBER" / "RELATED" / "CATEGORIES"
         / "NOTE" / "PRODID" / "REV" / "SOUND" / "UID" / "CLIENTPIDMAP"
         / "URL" / "KEY" / "FBURL" / "CALADRURI" / "CALURI" / "XML"
         / iana-token / x-name

iana-token = 1*(ALPHA / DIGIT / "-")

x-name = "x-" 1*(ALPHA / DIGIT / "-")

param = language-param / value-param / pref-param / pid-param
         / type-param / geo-parameter / tz-parameter / sort-as-param
         / calscale-param / any-param

param-value = *SAFE-CHAR / DQUOTE *QSAFE-CHAR DQUOTE

any-param  = (iana-token / x-name) "=" param-value *("," param-value)

UTF8-tail   = %x80-BF
UTF8-1      = %x00-7F
UTF8-2      = %xC2-DF UTF8-tail
UTF8-3      = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) /
                 %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail )
UTF8-4      = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) /
                 %xF4 %x80-8F 2( UTF8-tail )
UTF8-char   = UTF8-1 / UTF8-2 / UTF8-3 / UTF8-4
UTF8-octets = *( UTF8-char )

NON-ASCII = UTF8-2 / UTF8-3 / UTF8-4

CRLF        =  %d13.10

ALPHA          =  %x41-5A / %x61-7A ; A-Z / a-z

DIGIT          =  %x30-39 ; 0-9

DQUOTE         =  %x22 ; " (Double Quote)

HTAB           =  %x09 ; horizontal tab

SP             =  %x20

WSP            =  SP / HTAB
VCHAR          =  %x21-7E

QSAFE-CHAR = WSP / "!" / %x23-7E / NON-ASCII

SAFE-CHAR = WSP / "!" / %x23-39 / %x3C-7E / NON-ASCII

VALUE-CHAR = WSP / VCHAR / NON-ASCII
value = text
           / text-list
           / date-list
           / time-list
           / date-time-list
           / date-and-or-time-list
           / timestamp-list
           / boolean
           / integer-list
           / float-list
           / URI               ; from Section 3 of [RFC3986]
           / utc-offset
           / Language-Tag
text = *TEXT-CHAR

TEXT-CHAR = "\\" / "\," / "\n" / WSP / NON-ASCII
               / %x21-2B / %x2D-5B / %x5D-7E

component = "\\" / "\," / "\;" / "\n" / WSP / NON-ASCII
               / %x21-2B / %x2D-3A / %x3C-5B / %x5D-7E
list-component = component *("," component)

text-list             = text             *("," text)
date-list             = date             *("," date)
time-list             = time             *("," time)
date-time-list        = date-time        *("," date-time)
date-and-or-time-list = date-and-or-time *("," date-and-or-time)
timestamp-list        = timestamp        *("," timestamp)
integer-list          = integer          *("," integer)
float-list            = float            *("," float)

boolean = "TRUE" / "FALSE"
integer = [sign] 1*DIGIT
float   = [sign] 1*DIGIT ["." 1*DIGIT]

sign = "+" / "-"

year   = 4DIGIT  ; 0000-9999
month  = 2DIGIT  ; 01-12
day    = 2DIGIT  ; 01-28/29/30/31 depending on month and leap year
hour   = 2DIGIT  ; 00-23
minute = 2DIGIT  ; 00-59
second = 2DIGIT  ; 00-58/59/60 depending on leap second
zone   = utc-designator / utc-offset
utc-designator = %x5A  ; uppercase "Z"

date          = year    [month  day]
                   / year "-" month
                   / "--"     month [day]
                   / "--"      "-"   day
date-noreduc  = year     month  day
                   / "--"     month  day
                   / "--"      "-"   day
date-complete = year     month  day

time          = hour [minute [second]] [zone]
                   /  "-"  minute [second]  [zone]
                   /  "-"   "-"    second   [zone]
time-notrunc  = hour [minute [second]] [zone]
time-complete = hour  minute  second   [zone]
time-designator = %x54  ; uppercase "T"
date-time = date-noreduc  time-designator time-notrunc
timestamp = date-complete time-designator time-complete

date-and-or-time = date-time / date / time-designator time

utc-offset = sign hour [minute]

Language-Tag  = langtag             ; normal language tags
               / privateuse          ; private use tag
               / grandfathered       ; grandfathered tags
langtag       = language
                 ["-" script]
                 ["-" region]
                 *("-" variant)
                 *("-" extension)
                 ["-" privateuse]

language      = 2*3ALPHA            ; shortest ISO 639 code
                 ["-" extlang]       ; sometimes followed by
               / 4ALPHA              ; or reserved for future use
               / 5*8ALPHA            ; or registered language subtag

extlang       = 3ALPHA              ; selected ISO 639 codes
                 *2("-" 3ALPHA)      ; permanently reserved

script        = 4ALPHA              ; ISO 15924 code

region        = 2ALPHA              ; ISO 3166-1 code
               / 3DIGIT              ; UN M.49 code

variant       = 5*8alphanum         ; registered variants
               / (DIGIT 3alphanum)

extension     = singleton 1*("-" (2*8alphanum))
singleton     = DIGIT               ; 0 - 9
               / %x41-57             ; A - W
               / %x59-5A             ; Y - Z
               / %x61-77             ; a - w
               / %x79-7A             ; y - z

privateuse    = "x" 1*("-" (1*8alphanum))

grandfathered = irregular           ; non-redundant tags registered
               / regular             ; during the RFC 3066 era

irregular     = "en-GB-oed"         ; irregular tags do not match
               / "i-ami"             ; the 'langtag' production and
               / "i-bnn"             ; would not otherwise be
               / "i-default"         ; considered 'well-formed'
               / "i-enochian"        ; These tags are all valid,
               / "i-hak"             ; but most are deprecated
               / "i-klingon"         ; in favor of more modern
               / "i-lux"             ; subtags or subtag
               / "i-mingo"           ; combination
               / "i-navajo"
               / "i-pwn"
               / "i-tao"
               / "i-tay"
               / "i-tsu"
               / "sgn-BE-FR"
               / "sgn-BE-NL"
               / "sgn-CH-DE"

regular       = "art-lojban"        ; these tags match the 'langtag'
               / "cel-gaulish"       ; production, but their subtags
               / "no-bok"            ; are not extended language
               / "no-nyn"            ; or variant subtags: their meaning
               / "zh-guoyu"          ; is defined by their registration
               / "zh-hakka"          ; and all of these are deprecated
               / "zh-min"            ; in favor of a more modern
               / "zh-min-nan"        ; subtag or sequence of subtags
               / "zh-xiang"

obs-language-tag = primary-subtag *( "-" subtag )
primary-subtag   = 1*8ALPHA
subtag           = 1*8(ALPHA / DIGIT)

language-param = "LANGUAGE=" Language-Tag

alphanum      = (ALPHA / DIGIT)     ; letters and numbers

value-param = "VALUE=" value-type

value-type = "text"
                / "uri"
                / "date"
                / "time"
                / "date-time"
                / "date-and-or-time"
                / "timestamp"
                / "boolean"
                / "integer"
                / "float"
                / "utc-offset"
                / "language-tag"
                / iana-token  ; registered as described in section 12
                / x-name

pref-param = "PREF=" (1*2DIGIT / "100")
altid-param = "ALTID=" param-value

pid-param = "PID=" pid-value *("," pid-value)
pid-value = 1*DIGIT ["." 1*DIGIT]

type-param = "TYPE=" type-value *("," type-value)

type-value = "work" / "home" / type-param-tel
                      / type-param-related / iana-token / x-name

mediatype-param = "MEDIATYPE=" mediatype
mediatype = type-name "/" subtype-name *( ";" attribute "=" value )
attribute = 1*ALPHA / DIGIT / "-"
token = attribute

calscale-param = "CALSCALE=" calscale-value

calscale-value = "gregorian" / iana-token / x-name

sort-as-param = "SORT-AS=" sort-as-value

sort-as-value = param-value *("," param-value)

geo-parameter = "GEO=" DQUOTE URI DQUOTE

tz-parameter = "TZ=" (param-value / DQUOTE URI DQUOTE)
BEGIN-param = ""  ; no parameter allowed
BEGIN-value = "VCARD"

END-param = ""  ; no parameter allowed
END-value = "VCARD"

SOURCE-param = "VALUE=uri" / pid-param / pref-param / altid-param
                  / mediatype-param / any-param
SOURCE-value = URI

KIND-param = "VALUE=text" / any-param
KIND-value = "individual" / "group" / "org" / "location"
                / iana-token / x-name

XML-param = "VALUE=text" / altid-param
XML-value = text

FN-param = "VALUE=text" / type-param / language-param / altid-param
              / pid-param / pref-param / any-param
FN-value = text

N-param = "VALUE=text" / sort-as-param / language-param
             / altid-param / any-param
N-value = list-component 4(";" list-component)

NICKNAME-param = "VALUE=text" / type-param / language-param
                    / altid-param / pid-param / pref-param / any-param
NICKNAME-value = text-list

PHOTO-param = "VALUE=uri" / altid-param / type-param
                 / mediatype-param / pref-param / pid-param / any-param
PHOTO-value = URI

BDAY-param = BDAY-param-date / BDAY-param-text
BDAY-value = date-and-or-time / text

BDAY-param-date = "VALUE=date-and-or-time"
BDAY-param-text = "VALUE=text" / language-param

BDAY-param =/ altid-param / calscale-param / any-param

ANNIVERSARY-param = "VALUE=" ("date-and-or-time" / "text")
ANNIVERSARY-value = date-and-or-time / text

ANNIVERSARY-param =/ altid-param / calscale-param / any-param

GENDER-param = "VALUE=text" / any-param
GENDER-value = sex [";" text]

sex = "" / "M" / "F" / "O" / "N" / "U"

label-param = "LABEL=" param-value

ADR-param = "VALUE=text" / label-param / language-param
               / geo-parameter / tz-parameter / altid-param / pid-param
               / pref-param / type-param / any-param
ADR-value = ADR-component-pobox ";" ADR-component-ext ";"
                 ADR-component-street ";" ADR-component-locality ";"
                 ADR-component-region ";" ADR-component-code ";"
                 ADR-component-country
ADR-component-pobox    = list-component
ADR-component-ext      = list-component
ADR-component-street   = list-component
ADR-component-locality = list-component
ADR-component-region   = list-component
ADR-component-code     = list-component
ADR-component-country  = list-component

TEL-TYPE="voice,fax"

TEL-param = TEL-text-param / TEL-uri-param
TEL-value = TEL-text-value / TEL-uri-value

TEL-text-param = "VALUE=text"
TEL-text-value = text

TEL-uri-param = "VALUE=uri" / mediatype-param
TEL-uri-value = URI

TEL-param =/ type-param / pid-param / pref-param / altid-param
                / any-param

type-param-tel = "text" / "voice" / "fax" / "cell" / "video"
                    / "pager" / "textphone" / iana-token / x-name
EMAIL-param = "VALUE=text" / pid-param / pref-param / type-param
                 / altid-param / any-param
EMAIL-value = text

IMPP-param = "VALUE=uri" / pid-param / pref-param / type-param
                / mediatype-param / altid-param / any-param
IMPP-value = URI

LANG-param = "VALUE=language-tag" / pid-param / pref-param
                / altid-param / type-param / any-param
LANG-value = Language-Tag

TZ-param = "VALUE=" ("text" / "uri" / "utc-offset")
TZ-value = text / URI / utc-offset

TZ-param =/ altid-param / pid-param / pref-param / type-param
               / mediatype-param / any-param

GEO-param = "VALUE=uri" / pid-param / pref-param / type-param
               / mediatype-param / altid-param / any-param
GEO-value = URI

TITLE-param = "VALUE=text" / language-param / pid-param
                 / pref-param / altid-param / type-param / any-param
TITLE-value = text

ROLE-param = "VALUE=text" / language-param / pid-param / pref-param
                / type-param / altid-param / any-param
ROLE-value = text

LOGO-param = "VALUE=uri" / language-param / pid-param / pref-param
                / type-param / mediatype-param / altid-param / any-param
LOGO-value = URI

ORG-param = "VALUE=text" / sort-as-param / language-param
               / pid-param / pref-param / altid-param / type-param
               / any-param
ORG-value = component *(";" component)

MEMBER-param = "VALUE=uri" / pid-param / pref-param / altid-param
                  / mediatype-param / any-param
MEMBER-value = URI
RELATED-param = RELATED-param-uri / RELATED-param-text
RELATED-value = URI / text

RELATED-param-uri = "VALUE=uri" / mediatype-param
RELATED-param-text = "VALUE=text" / language-param

RELATED-param =/ pid-param / pref-param / altid-param / type-param
                    / any-param

type-param-related = related-type-value *("," related-type-value)

related-type-value = "contact" / "acquaintance" / "friend" / "met"
                        / "co-worker" / "colleague" / "co-resident"
                        / "neighbor" / "child" / "parent"
                        / "sibling" / "spouse" / "kin" / "muse"
                        / "crush" / "date" / "sweetheart" / "me"
                        / "agent" / "emergency"

CATEGORIES-param = "VALUE=text" / pid-param / pref-param
                      / type-param / altid-param / any-param
CATEGORIES-value = text-list

NOTE-param = "VALUE=text" / language-param / pid-param / pref-param
                / type-param / altid-param / any-param
NOTE-value = text

PRODID-param = "VALUE=text" / any-param
PRODID-value = text

REV-param = "VALUE=timestamp" / any-param
REV-value = timestamp

SOUND-param = "VALUE=uri" / language-param / pid-param / pref-param
                 / type-param / mediatype-param / altid-param
                 / any-param
SOUND-value = URI
UID-param = UID-uri-param / UID-text-param
UID-value = UID-uri-value / UID-text-value

UID-uri-param = "VALUE=uri"
UID-uri-value = URI

UID-text-param = "VALUE=text"
UID-text-value = text

UID-param =/ any-param

CLIENTPIDMAP-param = any-param
CLIENTPIDMAP-value = 1*DIGIT ";" URI

URL-param = "VALUE=uri" / pid-param / pref-param / type-param
               / mediatype-param / altid-param / any-param
URL-value = URI

VERSION-param = "VALUE=text" / any-param
VERSION-value = "4.0"

KEY-param = KEY-uri-param / KEY-text-param
KEY-value = KEY-uri-value / KEY-text-value

KEY-uri-param = "VALUE=uri" / mediatype-param
KEY-uri-value = URI

KEY-text-param = "VALUE=text"
KEY-text-value = text

KEY-param =/ altid-param / pid-param / pref-param / type-param
                / any-param

FBURL-param = "VALUE=uri" / pid-param / pref-param / type-param
                 / mediatype-param / altid-param / any-param
FBURL-value = URI

CALADRURI-param = "VALUE=uri" / pid-param / pref-param / type-param
                     / mediatype-param / altid-param / any-param
CALADRURI-value = URI

CALURI-param = "VALUE=uri" / pid-param / pref-param / type-param
                  / mediatype-param / altid-param / any-param
CALURI-value = URI

HEXDIG         =  DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
reserved    = gen-delims / sub-delims

gen-delims  = ":" / "/" / "?" / "#" / "[" / "]" / "@"

sub-delims  = "!" / "$" / "&" / "'" / "(" / ")"
                  / "*" / "+" / "," / ";" / "="

unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
URI         = scheme ":" hier-part [ "?" query ] [ "#" fragment ]

hier-part   = "//" authority path-abempty
                  / path-absolute
                  / path-rootless
                  / path-empty

scheme      = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

authority   = [ userinfo "@" ] host [ ":" port ]

userinfo    = *( unreserved / pct-encoded / sub-delims / ":" )

host        = IP-literal / IPv4address / reg-name

IP-literal = "[" ( IPv6address / IPvFuture  ) "]"

IPvFuture  = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" )

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 ] "::"

ls32        = ( h16 ":" h16 ) / IPv4address

h16         = 1*4HEXDIG

IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet

dec-octet   = DIGIT                 ; 0-9
                  / %x31-39 DIGIT         ; 10-99
                  / "1" 2DIGIT            ; 100-199
                  / "2" %x30-34 DIGIT     ; 200-249
                  / "25" %x30-35          ; 250-255

reg-name    = *( unreserved / pct-encoded / sub-delims )

port        = *DIGIT

path          = path-abempty    ; begins with "/" or is empty
                    / path-absolute   ; begins with "/" but not "//"
                    / path-noscheme   ; begins with a non-colon segment
                    / path-rootless   ; begins with a segment
                    / path-empty      ; zero characters

path-abempty  = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty    = ""
segment       = *pchar
segment-nz    = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )

pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"

query       = *( pchar / "/" / "?" )

fragment    = *( pchar / "/" / "?" )

URI-reference = URI / relative-ref
relative-ref  = relative-part [ "?" query ] [ "#" fragment ]

relative-part = "//" authority path-abempty
                    / path-absolute
                    / path-noscheme
                    / path-empty

absolute-URI  = scheme ":" hier-part [ "?" query ]

result = ""

type-name = reg-name
subtype-name = reg-name

parameter-name = reg-name

pct-encoded   = "%" HEXDIG HEXDIG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment