add alternative (R7RS) spelling of booleans (#563)
This commit is contained in:
parent
da2a9969ef
commit
68d8c8acc2
|
@ -2193,3 +2193,5 @@
|
|||
- fixed the documentation of load-shared-object to mention an up-to-date
|
||||
dll for Windows
|
||||
foreign.stex
|
||||
- New spellings #true and #false for #t and #f are recognized
|
||||
read.ss 6.ms
|
||||
|
|
|
@ -1731,6 +1731,30 @@
|
|||
(lambda () (close-input-port ip))))])
|
||||
vals)
|
||||
'(atomic eat 1 4))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#t" read-token)) list)
|
||||
'(atomic #t 0 2))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#true" read-token)) list)
|
||||
'(atomic #t 0 5))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#True" read-token)) list)
|
||||
'(atomic #t 0 5))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#TRUE" read-token)) list)
|
||||
'(atomic #t 0 5))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#f" read-token)) list)
|
||||
'(atomic #f 0 2))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#false" read-token)) list)
|
||||
'(atomic #f 0 6))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#False" read-token)) list)
|
||||
'(atomic #f 0 6))
|
||||
(equal?
|
||||
(call-with-values (lambda () (with-input-from-string "#FALSE" read-token)) list)
|
||||
'(atomic #f 0 6))
|
||||
)
|
||||
|
||||
(define read-test
|
||||
|
@ -1863,6 +1887,11 @@
|
|||
"; Test error \"unexpected end-of-file reading character\"\n#\\"
|
||||
"; Test error \"unexpected end-of-file reading character\"\n#\\new"
|
||||
"; Test error \"unexpected end-of-file reading character\"\n#\\02"
|
||||
"; Test error \"unexpected end-of-file reading boolean\"\n\n#tr"
|
||||
"; Test error \"unexpected end-of-file reading boolean\"\n\n#tru"
|
||||
"; Test error \"unexpected end-of-file reading boolean\"\n\n#fa"
|
||||
"; Test error \"unexpected end-of-file reading boolean\"\n\n#fal"
|
||||
"; Test error \"unexpected end-of-file reading boolean\"\n\n#fals"
|
||||
"; Test error \"unexpected end-of-file reading expression comment\"\n\n(define oops '#; ; that's all I've got!\n"
|
||||
"; Test error \"unexpected end-of-file reading gensym\"\n(pretty-print '#{"
|
||||
"; Test error \"unexpected end-of-file reading gensym\"\n(pretty-print '#{foo"
|
||||
|
@ -1931,6 +1960,13 @@
|
|||
"; Test error \"octal character syntax not allowed in #!r6rs mode\"\n\n#!r6rs #\\010\n"
|
||||
"; Test error \"invalid delimiter 1 for character\"\n\n#\\0001\n"
|
||||
"; Test error \"delimiter { is not allowed in #!r6rs mode\"\n\n#!r6rs #\\0{\n"
|
||||
"; Test error \"invalid delimiter 2 for boolean\"\n\n#t2\n"
|
||||
"; Test error \"invalid delimiter 2 for boolean\"\n\n#true2\n"
|
||||
"; Test error \"invalid delimiter 3 for boolean\"\n\n#f3\n"
|
||||
"; Test error \"invalid delimiter 3 for boolean\"\n\n#false3\n"
|
||||
"; Test error \"invalid boolean\"\n\n#travis"
|
||||
"; Test error \"invalid boolean\"\n\n#FALSIFY"
|
||||
;; NOTE: there's no "delimiter not allowed in #!r6rs mode" test for r7rs-style booleans because they are not r6rs!
|
||||
"; Test error \"#!eof syntax not allowed in #!r6rs mode\"\n\n#!r6rs #!eof\n"
|
||||
"; Test error \"#!bwp syntax not allowed in #!r6rs mode\"\n\n#!r6rs #!bwp\n"
|
||||
"; Test error \"#vfx(...) fxvector syntax not allowed in #!r6rs mode\"\n\n#!r6rs '#vfx(1 2 3)\n"
|
||||
|
@ -1944,7 +1980,12 @@
|
|||
"; Test error \"123# number syntax not allowed in #!r6rs mode\"\n\n#!r6rs 123#\n"
|
||||
"; Test error \"#x1/2e2 number syntax not allowed in #!r6rs mode\"\n\n#!r6rs 1/2e2\n"
|
||||
"; Test error \"#x.3 number syntax not allowed in #!r6rs mode\"\n\n#!r6rs #x.3\n"
|
||||
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #true\n"
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #True\n"
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #TRUE\n"
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #false\n"
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #False\n"
|
||||
"; Test error \"alternative boolean syntax not allowed in #!r6rs mode\"\n\n#!r6rs #FALSE\n"
|
||||
; following tests adapted from the read0 benchmark distributed by Will
|
||||
; Clinger, which as of 08/08/2009 appears to be in the public domain,
|
||||
; with no license, copyright notice, author name, or date.
|
||||
|
|
|
@ -4621,6 +4621,11 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading s-expression comment at line 3, char 15 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
|
@ -4689,6 +4694,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat read-test: "read: octal character syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid delimiter 1 for character at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: delimiter { is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid boolean #tra at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: invalid boolean #falsi at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: #!eof syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: #!bwp syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: #vfx(...) fxvector syntax is not allowed in #!r6rs mode at line 3, char 9 of testfile.ss".
|
||||
|
@ -4702,6 +4713,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat read-test: "read: 123# number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: 1/2e2 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: #x.3 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: U+488 symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: @ symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat read-test: "read: @b symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
|
@ -5404,6 +5421,11 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading s-expression comment at line 3, char 15 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
|
@ -5472,6 +5494,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat load-test: "read: octal character syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid delimiter 1 for character at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: delimiter { is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid boolean #tra at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: invalid boolean #falsi at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: #!eof syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: #!bwp syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: #vfx(...) fxvector syntax is not allowed in #!r6rs mode at line 3, char 9 of testfile.ss".
|
||||
|
@ -5485,6 +5513,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat load-test: "read: 123# number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: 1/2e2 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: #x.3 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: U+488 symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: @ symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat load-test: "read: @b symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
|
@ -6187,6 +6221,11 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading character at line 2, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading s-expression comment at line 3, char 15 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: unexpected end-of-file reading gensym at line 2, char 16 of testfile.ss".
|
||||
|
@ -6255,6 +6294,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat compile-test: "read: octal character syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid delimiter 1 for character at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: delimiter { is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid delimiter 2 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid delimiter 3 for boolean at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid boolean #tra at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: invalid boolean #falsi at line 3, char 1 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: #!eof syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: #!bwp syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: #vfx(...) fxvector syntax is not allowed in #!r6rs mode at line 3, char 9 of testfile.ss".
|
||||
|
@ -6268,6 +6313,12 @@ cp0.mo:Expected error in mat expand/optimize-output: "expand/optimize-output: #<
|
|||
6.mo:Expected error in mat compile-test: "read: 123# number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: 1/2e2 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: #x.3 number syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: alternative boolean syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: U+488 symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: @ symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
6.mo:Expected error in mat compile-test: "read: @b symbol syntax is not allowed in #!r6rs mode at line 3, char 8 of testfile.ss".
|
||||
|
|
|
@ -58,6 +58,12 @@ Online versions of both books can be found at
|
|||
%-----------------------------------------------------------------------------
|
||||
\section{Functionality Changes}\label{section:functionality}
|
||||
|
||||
\subsection{Additional reader syntax for booleans (9.5.5)}
|
||||
|
||||
The reader now case-insensitively accepts \scheme{#true} and
|
||||
\scheme{#false} as alternative spellings of the booleans \scheme{#t}
|
||||
and \scheme{#f}, respectively.
|
||||
|
||||
\subsection{Phantom bytevectors (9.5.1)}
|
||||
|
||||
Phantom bytevectors reflect externally allocated memory use in an
|
||||
|
|
|
@ -439,8 +439,8 @@
|
|||
(with-read-char c
|
||||
(state-case c
|
||||
[eof (with-unread-char c (xcall rd-eof-error "# prefix"))]
|
||||
[(#\f #\F) (xcall rd-token-delimiter #f "boolean")]
|
||||
[(#\t #\T) (xcall rd-token-delimiter #t "boolean")]
|
||||
[(#\f #\F) (*state rd-token-boolean #f)]
|
||||
[(#\t #\T) (*state rd-token-boolean #t)]
|
||||
[#\\ (*state rd-token-char)]
|
||||
[#\( (state-return vparen #f)] ;) for paren bouncer
|
||||
[#\' (state-return quote 'syntax)]
|
||||
|
@ -476,6 +476,31 @@
|
|||
[#\| (*state rd-token-block-comment 0)]
|
||||
[else (xcall rd-error #f #t "invalid sharp-sign prefix #~c" c)])))
|
||||
|
||||
(define-state (rd-token-boolean x)
|
||||
(with-peek-char c
|
||||
(state-case c
|
||||
[eof (state-return atomic x)]
|
||||
[char-alphabetic?
|
||||
;; Trying to specify a R7RS boolean.
|
||||
(let* ([s (if x "true" "false")]
|
||||
[last-index (fx- (string-length s) 1)])
|
||||
(*state rd-token-boolean-rest x s 1 last-index))]
|
||||
[else (*state rd-token-delimiter x "boolean")])))
|
||||
|
||||
(define-state (rd-token-boolean-rest x s i last-index)
|
||||
(with-read-char c
|
||||
(cond
|
||||
[(eof-object? c)
|
||||
;; we ruled out a possible initial eof before, so it is always an error, here
|
||||
(with-unread-char c (xcall rd-eof-error "boolean"))]
|
||||
[(not (char-ci=? c (string-ref s i)))
|
||||
(with-unread-char c
|
||||
(xcall rd-error #f #t "invalid boolean #~a~c" (substring s 0 i) (char-downcase c)))]
|
||||
[(fx= i last-index)
|
||||
(nonstandard "alternative boolean")
|
||||
(*state rd-token-delimiter x "boolean")]
|
||||
[else (*state rd-token-boolean-rest x s (fx+ i 1) last-index)])))
|
||||
|
||||
(define-state (rd-token-delimiter x what)
|
||||
(with-peek-char c
|
||||
(state-case c
|
||||
|
|
Loading…
Reference in New Issue
Block a user