(defun snip (s) (subseq s 1 (1- (length s))))(defun un-squote (s) (regex-replace-all "''" (snip s) "'")) (defun un-dquote (s) (regex-replace-all "\"\"" (snip s) "\""))
(deflexer scan-csv (:priority-only t) ("[^\"',]+" value) ("'(?:[^']|'')*'" value un-squote) ("\"(?:[^\"]|\"\")*\"" value un-dquote) ("," comma))
See the distribution for a more complete example.
Download ASDF package from http://download.fugue88.ws/lex/dso-lex-0.3.2.tar.gz, or see the project page.
This page is linked from: David Owen
CLiki pages can be edited by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively