# SIP basic rules

Section 25.1 of RFC 3261

alphanum =

LHEX =
DIGIT /  %x61‑66
; lowercase a‑f

LWS =
[ *WSPCRLF ]  1*WSP
; linear whitespace

SWS =
LWS ]
; sep whitespace

HCOLON =
*( SP /  HTAB )   ":"   SWS

separators =
"(" /  ")" /  "<" /  ">" /  "@" /  "," /  ";" /  ":" /  "\" /  DQUOTE /  "/" /  "[" /  "]" /  "?" /  "=" /  "{" /  "}" /  SP /  HTAB

STAR =
SWS  "*"  SWS
; asterisk

SLASH =
SWS  "/"  SWS
; slash

EQUAL =
SWS  "="  SWS
; equal

LPAREN =
SWS  "("  SWS
; left parenthesis

RPAREN =
SWS  ")"  SWS
; right parenthesis

LAQUOT =
SWS  "<"
; left angle quote

RAQUOT =
">"  SWS
; right angle quote

COMMA =
SWS  ","  SWS
; comma

SEMI =
SWS  ";"  SWS
; semicolon

COLON =
SWS  ":"  SWS
; colon

LDQUOT =
SWSDQUOTE
; open double quotation mark

RDQUOT =
DQUOTESWS
; close double quotation mark

token =
1*( alphanum /  "-" /  "." /  "!" /  "%" /  "*" /  "_" /  "+" /  "`" /  "'" /  "~" )

quoted-string =

qdtext =
LWS /  %x21 /  %x23‑5B /  %x5D‑7E /  UTF8‑NONASCII

quoted-pair =
"\"  ( %x00‑09 /  %x0B‑0C /  %x0E‑7F )

comment =

ctext =
%x21‑27 /  %x2A‑5B /  %x5D‑7E /  UTF8‑NONASCII /  LWS

word =
1*( alphanum /  "-" /  "." /  "!" /  "%" /  "*" /  "_" /  "+" /  "`" /  "'" /  "~" /  "(" /  ")" /  "<" /  ">" /  ":" /  "\" /  DQUOTE /  "/" /  "[" /  "]" /  "?" /  "{" /  "}" )

TEXT-UTF8-TRIM =

TEXT-UTF8char =
%x21‑7E /  UTF8‑NONASCII

UTF8-NONASCII =
%xC0-DF   1UTF8‑CONT /
%xE0-EF   2UTF8‑CONT /
%xF0-F7   3UTF8‑CONT /
%xF8-FB   4UTF8‑CONT /
%xFC-FD   5UTF8‑CONT

UTF8-CONT =
%x80-BF

escaped =
"%"   HEXDIG   HEXDIG

mark =
"-" /  "_" /  "." /  "!" /  "~" /  "*" /  "'" /  "(" /  ")"

reserved =
";" /  "/" /  "?" /  ":" /  "@" /  "&" /  "=" /  "+" /  "\$" /  ","

unreserved =