#---------------------------------------------------------------------------
# CSV - RFC 4180
#---------------------------------------------------------------------------

CSV         = file;

file        = [header CRLF] record *(CRLF record) [CRLF];

header      = name *(COMMA name);

record      = field *(COMMA field);

name        = field;

field       = (escaped / non-escaped);

escaped     = DQUOTE *(TEXTDATA / COMMA / CR / LF / 2DQUOTE) DQUOTE;

non-escaped = *TEXTDATA;

COMMA       = %x2C;

CR          = %x0D;

DQUOTE      = %x22;

LF          = %x0A;

CRLF        = CR LF;

TEXTDATA    = %x20-21 / %x23-2B / %x2D-7E;

#---------------------------------------------------------------------------
# end
#---------------------------------------------------------------------------