diff --git a/.dir-locals.el b/.dir-locals.el new file mode 100644 index 0000000..d526aa3 --- /dev/null +++ b/.dir-locals.el @@ -0,0 +1,2 @@ +((scheme-mode . ((flymake-chicken-command-args . ("-X" "r7rs" "-R" "r7rs" "-X" "chalk")) + (geiser-scheme . 'chicken)))) diff --git a/README.md b/README.md index 48a84b4..253b381 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,12 @@ API * Transforming EDN into Scheme: `(read-edn )` * Transforming Scheme into EDN: `(write-edn )` -* Using reader tags: the library contains a public a-list `tag-handlers`. To register a handler, add an a-list entry where the key is the tag without `\#` and as a keyword, and the value a one-argument procedure. +* Using reader tags: the library contains a parameter `tag-handlers` containing an a-list. To register a handler, add an a-list entry where the key is the tag without `\#` and as a keyword, and the value a one-argument procedure. Releases -------- + * **1.0**: Made the custom parsers a parameter. * **0.5.2**: Update for Chicken 5 * **0.5.1**: Small compatibility improvements: "/" now starts a symbol as well, and "," is treated as whitespace. * **0.5**: Reader tag support. diff --git a/edn-impl.scm b/edn-impl.scm index 3d46d0e..c541f47 100644 --- a/edn-impl.scm +++ b/edn-impl.scm @@ -159,7 +159,7 @@ @("An a-list containing the handlers for reader tags. You can register your own reader tags by simply adding a new a-list entry. Example for a tag \"#keywordify\": add the entry `(cons keywordify: keywordify-procedure)`.") - (list (cons _: (lambda (input) edn/omit:)))) + (make-parameter (list (cons _: (lambda (input) edn/omit:))))) (define reader-handlers (list (cons (is-char? #\() edn->list) @@ -182,10 +182,10 @@ Example for a tag \"#keywordify\": add the entry `(cons keywordify: keywordify-p (contains-tag-handler? (car in)))) (define (contains-tag-handler? tag) - (assoc (cdr tag) tag-handlers)) + (assoc (cdr tag) (tag-handlers))) (define (call-tag tag data) - ((cdr (assoc (cdr tag) tag-handlers)) data)) + ((cdr (assoc (cdr tag) (tag-handlers))) data)) (define (parse-edn state) (lambda (in-port) diff --git a/edn.egg b/edn.egg index a5571a2..7751334 100644 --- a/edn.egg +++ b/edn.egg @@ -4,7 +4,7 @@ (synopsis "EDN data reader/writer.") (category parsing) (license "BSD") - (version "0.5.2") + (version "1.0") (dependencies r7rs srfi-69 srfi-1 chalk) (test-dependencies r7rs srfi-64 chalk) (components (extension edn diff --git a/edn.release-info b/edn.release-info index 7452c3e..1277f52 100644 --- a/edn.release-info +++ b/edn.release-info @@ -1,4 +1,5 @@ (repo git "https:///gitea.lyrion.ch/zilti/edn.git") (uri targz "https://gitea.lyrion.ch/zilti/edn/archive/{egg-release}.tar.gz") +(release "1.0") ;; Made the custom parsers a parameter (release "0.5.3") ;; Replaced Hahn with Chalk (release "0.5.2") ;; Update for Chicken 5 diff --git a/tests/run.scm b/tests/run.scm index 4c2342c..063f342 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -1,4 +1,4 @@ -(import r7rs) +(import r7rs chalk) (require-extension srfi-69 srfi-64 srfi-88 srfi-1) ;;(import (chicken port)) (include "../edn-impl.scm") @@ -50,9 +50,9 @@ (test-begin "Tag handling") (test-equal (wifs "(1 2 #_ 3 4)" read-edn) '(1 2 4)) -(set! tag-handlers (cons (cons keywordify: +(tag-handlers (cons (cons keywordify: (lambda (input) (string->keyword (symbol->string input)))) - tag-handlers)) + (tag-handlers))) (test-equal (wifs "(asdf #keywordify qwertz)" read-edn) '(asdf qwertz:)) (test-end "Tag handling")