Skip to content

Commit

Permalink
handle readtable changes in gambit head
Browse files Browse the repository at this point in the history
  • Loading branch information
vyzo committed Oct 19, 2021
1 parent fa9537b commit 67c092c
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions src/gerbil/runtime/gx-gambc1.scm
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,38 @@
(make-&context 'root #f #f _gx#*core*)
(make-hash-table-eq)))

(define _gx#*readtable*
(let ((rt (readtable-write-extended-read-macros?-set
(##make-standard-readtable) #t)))
(macro-readtable-bracket-keyword-set! rt '@list)
(macro-readtable-brace-keyword-set! rt '@method)
;; the gerbil readtable
(define (_gx#make-readtable)
(let ((rt (##make-standard-readtable)))
(macro-readtable-write-extended-read-macros?-set! rt #t)
(_gx#readtable-bracket-keyword-set! rt '@list)
(_gx#readtable-brace-keyword-set! rt '@method)
(##readtable-char-sharp-handler-set! rt #\! _gx#read-sharp-bang)
rt))

(eval-if (>= (##vector-length (current-readtable)) 42)
(begin
(define (_gx#readtable-bracket-keyword-set! rt kw)
(macro-readtable-bracket-handler-set! rt kw))
(define (_gx#readtable-brace-keyword-set! rt kw)
(macro-readtable-brace-handler-set! rt kw)))
(begin
(define (_gx#readtable-bracket-keyword-set! rt kw)
(macro-readtable-bracket-keyword-set! rt kw))
(define (_gx#readtable-brace-keyword-set! rt kw)
(macro-readtable-brace-keyword-set! rt kw))))

(define (_gx#read-sharp-bang re next start-pos)
(if (eq? start-pos 0)
(begin
(##read-line (macro-readenv-port re) #\newline #f ##max-fixnum)
(##script-marker))
(##read-sharp-bang re next start-pos)))

(define _gx#*readtable*
(_gx#make-readtable))

;; interpretation parameters
(define &current-expander
(make-parameter #f))
(define &current-compiler
Expand Down

0 comments on commit 67c092c

Please sign in to comment.