summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtes2006-07-14 15:12:19 +0000
committerLudovic Courtes2006-07-14 15:12:19 +0000
commitebdec9bd1cdf236d7826d0641da46dc9ddf9fc5b (patch)
tree154876c952db13dba9025108caf416766dbce371
parent9a02dfaefa324ac1e5df3adc11003e1b578cfe64 (diff)
downloadskribilo-ebdec9bd1cdf236d7826d0641da46dc9ddf9fc5b.tar.gz
skribilo-ebdec9bd1cdf236d7826d0641da46dc9ddf9fc5b.tar.lz
skribilo-ebdec9bd1cdf236d7826d0641da46dc9ddf9fc5b.zip
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
-rw-r--r--ChangeLog16
-rw-r--r--src/guile/skribilo/reader/skribe.scm23
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 <ludovic.courtes@laas.fr> 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 <ludovic.courtes@laas.fr> 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 <ludovic.courtes@laas.fr>
+;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr>
;;;
;;;
;;; 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)))