Generic CSV lens collection
Author: Raphael Pinson raphael@camptoc amp.com .pinson
CSV | Generic CSV lens collection |
Reference | https://tools.ietf.org/html/rfc4180 |
License | This file is licenced under the LGPL v2+, like the rest of Augeas. |
Lens Usage | To be documented |
Configuration files | |
Examples | The <Test_CSV> file contains various examples and tests. |
Augeas Lenses | |
eol | |
comment | |
entry | An entry of fields, quoted or not |
lns | The generic lens, taking the separator as a parameter |
lns | The comma-separated value lens |
lns_semicol | A semicolon-separated value lens |
let eol = Util.del_str "\n"
let comment = Util.comment | [ del /#[ \t]*\r?\n/ "#\n" ]
An entry of fields, quoted or not
let entry (sep_str:string) = let field = [ seq "field" . store (/[^"#\r\n]/ - sep_str)* ] | [ seq "field" . store /("[^"#]*")+/ ] in let sep = Util.del_str sep_str in [ seq "entry" . counter "field" . Build.opt_list field sep . eol ]
The generic lens, taking the separator as a parameter
let lns_generic (sep:string) = (comment | entry sep)*
A semicolon-separated value lens
let lns_semicol = lns_generic ";"