Skip to content

Instantly share code, notes, and snippets.

@moonshiner
Last active July 22, 2022 02:47
Show Gist options
  • Save moonshiner/d188af80392b6458225c7b7e54a7b37b to your computer and use it in GitHub Desktop.
Save moonshiner/d188af80392b6458225c7b7e54a7b37b to your computer and use it in GitHub Desktop.
martin's ABNF
; Current ABNF
; non-special is VCHAR minus DQUOTE, ";", "(", ")", and "\".
non-special = %x21 / %x23-27 / %x2A-3A / %x3C-5B / %x5D-7E
; non-digit is VCHAR minus DIGIT
non-digit = %x21-2F / %x3A-7E
; dec-octet is a number 0-255 as a three-digit decimal number.
dec-octet = ( "0" / "1" ) 2DIGIT /
"2" ( ( %x30-34 DIGIT ) / ( "5" %x30-35 ) )
escaped = "\" ( non-digit / dec-octet )
contiguous = 1*( non-special / escaped )
quoted = DQUOTE *( contiguous / ( ["\"] WSP ) ) DQUOTE
char-string = contiguous / quoted
; Martin's ABNF
; non-special is VCHAR minus DQUOTE, ";", "(", ")", and "\".
non-special = %x21 / %x23-27 / %x2A-3A / %x3C-5B / %x5D-7E
; non-digit is VCHAR minus DIGIT
non-digit = %x21-2F / %x3A-7E
; dec-octet is a number 0-255 as a three-digit decimal number.
dec-octet = ( "0" / "1" ) 2DIGIT /
"2" ( ( %x30-34 DIGIT ) / ( "5" %x30-35 ) )
escaped = "\" ( non-digit / dec-octet )
contiguous = 1*( non-special / escaped )
; VCHAR minus DQUOTE and "\"
quoted-char = WSP / "!" / %x23-5B / %x5D-7E
; OLD quoted = DQUOTE *( contiguous / ( ["\"] WSP ) ) DQUOTE
quoted = DQUOTE *( quoted-char / escaped ) DQUOTE
char-string = contiguous / quoted
; diff
< quoted = DQUOTE *( contiguous / ( ["\"] WSP ) ) DQUOTE
---
> ; VCHAR minus DQUOTE and "\"
> quoted-char = WSP / "!" / %x23-5B / %x5D-7E
> quoted = DQUOTE *( quoted-char / escaped ) DQUOTE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment