git @ Cat's Eye Technologies Tamsin / master eg / csv_parse.tamsin
master

Tree @master (Download .tar.gz)

csv_parse.tamsin @masterraw · history · blame

1
2
3
4
5
6
7
8
9
# This example Tamsin program was written by Chris Pressey, and is
# hereby placed in the public domain.  It comes with NO WARRANTY.

main = line & {"\n" & line} & 'ok'.
line = field → F & {"," & field → G & F ← fields(G, F)} & F.
field = strings | bare.
strings = string → T & {string → S & T ← T + '"' + S} & T.
string = "\"" & T ← '' & {!"\"" & any → S & T ← T + S} & "\"" & T.
bare = T ← '' & {!(","|"\n") & any → S & T ← T + S} & T.