Warning, /office/calligra/filters/sheets/csv/DESIGN is written in an unsupported language. File is not indexed.

0001 The CSV import filter uses a hand-made state machine to parse the CSV file.
0002 This allows to handle quoted fields (such as those containing the CSV delimiter),
0003 as well as the double-quote character itself (which then appears twice, and
0004 always in a quoted field).
0005 Just to make sure about the vocabulary, I call a quoted field a field
0006 starting with " and finishing with ".
0007 
0008 Let's try to draw the graph of the state machine using ascii-art.
0009 
0010 
0011          DEL or EOL
0012             /--\            
0013             |  |           
0014             |  v    "     
0015        /--[START]-------->[QUOTED_FIELD] (**)
0016   other|   ^   ^            |        ^
0017    (*) |   |   | DEL or     | "      | " (*)
0018        |   |   | EOL        v        |
0019        |   |   \----[MAYBE_END_OF_QUOTED_FIELD]
0020        |   |                  |
0021        |   | DEL or           |
0022        |   | EOL              | other
0023        |   |                  |
0024        v   |   /------<-------|
0025    [NORMAL_FIELD] (**)
0026 
0027 DEL : CSV delimiter (depends on locale !). Often comma, sometimes semicolon.
0028 EOL : End Of Line.
0029 (*) : added to the current field
0030 (**) : implicit loop on itself, labeled "other (*)"
0031 
0032 
0033 Ugly isn't it ? :) One can't be good in drawings AND in hacking :)
0034 
0035 That's all. For the rest, see csvfilter.cc
0036 
0037 David Faure <faure@kde.org>, 1999