1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Read Scheme via read-syntax

* module/language/scheme/spec.scm: Use read-syntax.
* test-suite/tests/dwarf.test: Adapt expected source locations.
* am/bootstrap.am (SOURCES): Add ice-9/read.
This commit is contained in:
Andy Wingo 2021-02-24 20:47:28 +01:00
parent a758ba075a
commit 03448b289d
3 changed files with 16 additions and 8 deletions

View file

@ -102,6 +102,7 @@ SOURCES = \
ice-9/match.scm \ ice-9/match.scm \
ice-9/networking.scm \ ice-9/networking.scm \
ice-9/posix.scm \ ice-9/posix.scm \
ice-9/read.scm \
ice-9/rdelim.scm \ ice-9/rdelim.scm \
ice-9/receive.scm \ ice-9/receive.scm \
ice-9/regex.scm \ ice-9/regex.scm \

View file

@ -21,6 +21,7 @@
(define-module (language scheme spec) (define-module (language scheme spec)
#:use-module (system base compile) #:use-module (system base compile)
#:use-module (system base language) #:use-module (system base language)
#:use-module (ice-9 read)
#:use-module (language scheme compile-tree-il) #:use-module (language scheme compile-tree-il)
#:use-module (language scheme decompile-tree-il) #:use-module (language scheme decompile-tree-il)
#:export (scheme)) #:export (scheme))
@ -37,7 +38,7 @@
((or (and=> (and=> (module-variable env 'current-reader) ((or (and=> (and=> (module-variable env 'current-reader)
variable-ref) variable-ref)
fluid-ref) fluid-ref)
read) read-syntax)
port)) port))
#:compilers `((tree-il . ,compile-tree-il)) #:compilers `((tree-il . ,compile-tree-il))

View file

@ -1,6 +1,6 @@
;;;; dwarf.test -*- scheme -*- ;;;; dwarf.test -*- scheme -*-
;;;; ;;;;
;;;; Copyright 2013 Free Software Foundation, Inc. ;;;; Copyright 2013, 2021 Free Software Foundation, Inc.
;;;; ;;;;
;;;; This library is free software; you can redistribute it and/or ;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public ;;;; modify it under the terms of the GNU Lesser General Public
@ -26,7 +26,7 @@
(define prog (define prog
(string-concatenate (string-concatenate
;; Every open parenthesis is a possible source location. ;; The start of every datum is a possible source location.
'("(define (qux f)\n" '("(define (qux f)\n"
;^ 0:0 ;^ 0:0
" (+ 32 (f)))\n" " (+ 32 (f)))\n"
@ -37,6 +37,7 @@
" (lambda (a)\n" " (lambda (a)\n"
; ^ 4:2 ; ^ 4:2
" 13))\n" " 13))\n"
; ^ 5:4
"'success\n") "'success\n")
)) ))
@ -81,10 +82,15 @@
(error "unexpected sources" sources))) (error "unexpected sources" sources)))
(match (find-program-sources (program-code bar)) (match (find-program-sources (program-code bar))
((source) ((s1 s2)
(pass-if-equal "foo.scm" (source-file source)) (pass-if-equal "foo.scm" (source-file s1))
(pass-if-equal 4 (source-line source)) (pass-if-equal 4 (source-line s1))
(pass-if-equal 5 (source-line-for-user source)) (pass-if-equal 5 (source-line-for-user s1))
(pass-if-equal 2 (source-column source))) (pass-if-equal 2 (source-column s1))
(pass-if-equal "foo.scm" (source-file s2))
(pass-if-equal 5 (source-line s2))
(pass-if-equal 6 (source-line-for-user s2))
(pass-if-equal 4 (source-column s2)))
(sources (sources
(error "unexpected sources" sources)))) (error "unexpected sources" sources))))