;======================================================================== ; Highest-level parsers: XML to SXML (module ssax (ssax:read-char-data xml-token-kind xml-token-head (ssax:make-parser fold) (ssax:make-pi-parser fold) (ssax:make-elem-parser fold) ssax:xml->sxml ssax:warn html-entity-unicode-chars) (import (except scheme string make-string) (except chicken assert)) (import (prefix (only chicken assert) core:)) (require-extension ports) (require-library extras srfi-1 srfi-13) (import (except extras read-string) (except srfi-1 fold fold-right cons*)) (import (except srfi-13 string-null?)) (require-extension input-parse) (define ucscode->char integer->char) (define ascii->char integer->char) (define char-return (ascii->char 13)) (define char-tab (ascii->char 9)) (define char-newline (ascii->char 10)) ;; SSAX.scm expects STRING to work on characters > #\u00ff; ;; this allows entities > 255 to be parsed correctly. (define (string x) (##sys#char->utf8-string x)) ;; For UTF8 (make-string 1 ch) in html-entity-codes.scm; no one else uses this, ;; so don't bother to support k > 1. (define (make-string k x) (core:assert (= k 1) "attempt to call ssax:make-string with k != 1") (string x)) (define parser-error error) (define (ssax:warn port msg . other-msg) (apply cerr (cons* nl "Warning: " msg other-msg))) (include "myenv-chicken.scm") (include "look-for-str.scm") (include "SSAX.scm") (include "html-entity-codes.scm") )