(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.
See the project page.
Quick assessment (2023-04-01)
- dso-lex-0.3.3.tar.gz responded with 403 Forbidden at this time. Testing with dso-lex-0.3.tar.gz.
- Doesn't work with CL implementations that represent string and base-string differently.