;;
;; CSV parser combinators specialized for strings.
;;
;; Copyright 2009-2011 Ivan Raikov and the Okinawa Institute of Science
;; and Technology.
;;
;;
;; This program is free software: you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation, either version 3 of
;; the License, or (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; A full copy of the GPL license can be found at
;; .
(module csv-string
(
csv-parser make-format
list->csv-record csv-record->list csv-record?
)
(import scheme chicken )
(require-extension utils data-structures srfi-1 srfi-13 typeclass input-classes)
(require-library abnf csv)
(import (only abnf
CharLex->CoreABNF Input->Token
Token->CharLex
)
(only csv make-parser make-format csv-record?
list->csv-record csv-record->list
CoreABNF->CSV )
)
(define (string-car x) (string-ref x 0))
(define (string-cdr x) (string-drop x 1))
(define string-
(make- string-null? string-car string-cdr))
(define string-
(Input->Token string-))
(define string-
(Token->CharLex string-))
(define string-
(CharLex->CoreABNF string-))
(define string-
(CoreABNF->CSV string- ))
(define csv-parser (make-parser string-))
)