Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Daniel Ziltener | d449ee8469 | |
Daniel Ziltener | b637ac6cab | |
Daniel Ziltener | 9611de7aa9 |
|
@ -0,0 +1,2 @@
|
|||
((scheme-mode . ((flymake-chicken-command-args . ("-X" "r7rs" "-R" "r7rs" "-X" "chalk"))
|
||||
(geiser-scheme . 'chicken))))
|
|
@ -22,19 +22,21 @@ Data type conversions
|
|||
|
||||
Missing reader functionality
|
||||
----------------------------
|
||||
Should you notice missing functionality of the reader, plesase use [the issues page](https://gitea.lyrion.ch/zilti/edn/issues) to report
|
||||
it and, if possible, provide a minimal test case.
|
||||
Should you notice missing functionality of the reader, plesase use [the issues
|
||||
page](https://gitea.lyrion.ch/Chicken/edn/issues) to report it and, if possible, provide a minimal
|
||||
test case.
|
||||
|
||||
API
|
||||
---
|
||||
|
||||
* Transforming EDN into Scheme: `(read-edn <port>)`
|
||||
* Transforming Scheme into EDN: `(write-edn <port> <datastructure>)`
|
||||
* 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.
|
||||
|
|
|
@ -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)
|
||||
|
|
2
edn.egg
2
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
|
||||
|
|
|
@ -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")
|
||||
(repo git "https:///gitea.lyrion.ch/Chicken/edn.git")
|
||||
(uri targz "https://gitea.lyrion.ch/Chicken/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
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue