From ebdec9bd1cdf236d7826d0641da46dc9ddf9fc5b Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Fri, 14 Jul 2006 15:12:19 +0000 Subject: Fixed the handling of `:' by the Skribe reader. * src/guile/skribilo/reader/skribe.scm (make-colon-free-token-reader): New. (%make-skribe-reader): Make sure `:' is handled only by the keyword reader. git-archimport-id: lcourtes@laas.fr--2005-libre/skribilo--devo--1.2--patch-10 --- ChangeLog | 16 ++++++++++++++++ src/guile/skribilo/reader/skribe.scm | 23 ++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2119c85..c743e12 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,22 @@ # arch-tag: automatic-ChangeLog--lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2 # +2006-07-14 14:42:40 GMT Ludovic Courtes patch-59 + + Summary: + Fixed the handling of `:' by the Skribe reader. + Revision: + skribilo--devel--1.2--patch-59 + + * src/guile/skribilo/reader/skribe.scm (make-colon-free-token-reader): + New. + (%make-skribe-reader): Make sure `:' is handled only by the keyword + reader. + + modified files: + ChangeLog src/guile/skribilo/reader/skribe.scm + + 2006-07-12 16:28:29 GMT Ludovic Courtes patch-58 Summary: diff --git a/src/guile/skribilo/reader/skribe.scm b/src/guile/skribilo/reader/skribe.scm index f92f13b..6b1fa4f 100644 --- a/src/guile/skribilo/reader/skribe.scm +++ b/src/guile/skribilo/reader/skribe.scm @@ -1,6 +1,6 @@ ;;; skribe.scm -- A reader for the Skribe syntax. ;;; -;;; Copyright 2005 Ludovic Courtès +;;; Copyright 2005, 2006 Ludovic Courtès ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -21,6 +21,7 @@ (define-module (skribilo reader skribe) :use-module (skribilo reader) :use-module (ice-9 optargs) + :use-module (srfi srfi-1) ;; the Scheme reader composition framework :use-module ((system reader) #:renamer (symbol-prefix-proc 'r:)) @@ -46,6 +47,17 @@ the Skribe syntax." (error "make-skribe-reader: unsupported version" version) %skribe-reader)) +(define (make-colon-free-token-reader tr) + ;; Stolen from `guile-reader' 0.3. + "If token reader @var{tr} handles the @code{:} (colon) character, remove it +from its specification and return the new token reader." + (let* ((spec (r:token-reader-specification tr)) + (proc (r:token-reader-procedure tr))) + (r:make-token-reader (filter (lambda (chr) + (not (char=? chr #\:))) + spec) + proc))) + (define &sharp-reader ;; The reader for what comes after a `#' character. (let* ((dsssl-keyword-reader ;; keywords à la `#!key' @@ -65,18 +77,23 @@ the Skribe syntax." (let ((colon-keywords ;; keywords à la `:key' fashion (r:make-token-reader #\: (r:token-reader-procedure - (r:standard-token-reader 'keyword))))) + (r:standard-token-reader 'keyword)))) + (symbol-misc-chars-tr + ;; Make sure `:' is handled only by the keyword token reader. + (make-colon-free-token-reader + (r:standard-token-reader 'r6rs-symbol-misc-chars)))) + ;; Note: we use the `r6rs-symbol-*' and `r6rs-number' token readers since ;; they consider square brackets as delimiters. (r:make-reader (cons* (r:make-token-reader #\# &sharp-reader) colon-keywords + symbol-misc-chars-tr (map r:standard-token-reader `(whitespace sexp string r6rs-number r6rs-symbol-lower-case r6rs-symbol-upper-case - r6rs-symbol-misc-chars quote-quasiquote-unquote semicolon-comment skribe-exp))) -- cgit v1.2.3