reader: fix quoting in some error messages

This commit is contained in:
Matthew Flatt 2018-03-04 11:22:18 -07:00
parent c6579bbdcf
commit fc1da5f037
6 changed files with 36 additions and 24 deletions

View File

@ -87,7 +87,7 @@
[(not (char? c)) [(not (char? c))
(consume-char/special in config c) (consume-char/special in config c)
(reader-error in config #:due-to c (reader-error in config #:due-to c
"found non-character while reading `#~a'" "found non-character while reading `#~a`"
extend-str)] extend-str)]
[(char-whitespace? c) (void)] [(char-whitespace? c) (void)]
[(or (char-lang-nonsep? c) [(or (char-lang-nonsep? c)

View File

@ -198,11 +198,11 @@
[(#\#) [(#\#)
(read-dispatch c in r-config config)] (read-dispatch c in r-config config)]
[(#\') [(#\')
(read-quote read-one 'quote "quoting '" c in r-config)] (read-quote read-one 'quote "quoting \"'\"" c in r-config)]
[(#\`) [(#\`)
(guard-legal (guard-legal
(check-parameter read-accept-quasiquote config) (check-parameter read-accept-quasiquote config)
(read-quote read-one 'quasiquote "quasiquoting `" c in r-config))] (read-quote read-one 'quasiquote "quasiquoting \"`\"" c in r-config))]
[(#\,) [(#\,)
(guard-legal (guard-legal
(check-parameter read-accept-quasiquote config) (check-parameter read-accept-quasiquote config)
@ -210,8 +210,8 @@
(if (eqv? c2 #\@) (if (eqv? c2 #\@)
(begin (begin
(consume-char in c2) (consume-char in c2)
(read-quote read-one 'unquote-splicing "unquoting ,@" c in r-config)) (read-quote read-one 'unquote-splicing "unquoting `,@`" c in r-config))
(read-quote read-one 'unquote "unquoting ," c in r-config)))] (read-quote read-one 'unquote "unquoting `,`" c in r-config)))]
[(#\() [(#\()
(wrap (read-unwrapped-sequence read-one ec #\( #\) in r-config #:shape-tag? #t) in r-config ec)] (wrap (read-unwrapped-sequence read-one ec #\( #\) in r-config #:shape-tag? #t) in r-config ec)]
[(#\)) [(#\))
@ -350,7 +350,7 @@
[(#\i #\I) (read-one #f in (override-parameter read-case-sensitive config #f))] [(#\i #\I) (read-one #f in (override-parameter read-case-sensitive config #f))]
[else [else
(reader-error in config #:due-to c2 (reader-error in config #:due-to c2
"expected `s', `S`, `i', or `I` after `~a~a`" "expected `s', `S`, `i`, or `I` after `~a~a`"
dispatch-c c)])] dispatch-c c)])]
[(#\h #\H) (read-hash read-one dispatch-c c in config)] [(#\h #\H) (read-hash read-one dispatch-c c in config)]
[(#\r) [(#\r)

View File

@ -325,7 +325,7 @@
[(or @-pos (eq? in-complex '@)) [(or @-pos (eq? in-complex '@))
(fail convert-mode "cannot mix `@` and `i` in `~.a`" (substring s start end))] (fail convert-mode "cannot mix `@` and `i` in `~.a`" (substring s start end))]
[(or ((add1 i) . < . end) (eq? in-complex 'i)) [(or ((add1 i) . < . end) (eq? in-complex 'i))
(fail convert-mode "`i' must be at the end in `~.a`" (substring s start end))] (fail convert-mode "`i` must be at the end in `~.a`" (substring s start end))]
[else [else
(loop (add1 i) any-digits? any-hashes? i @-pos (loop (add1 i) any-digits? any-hashes? i @-pos
sign-pos #f #f #f sign-pos #f #f #f

View File

@ -40,12 +40,12 @@
(when (null? seq) (when (null? seq)
(reader-error in config (reader-error in config
"missing structure description in `~as' form" "missing structure description in `~as` form"
dispatch-c)) dispatch-c))
(unless (prefab-key? (car seq)) (unless (prefab-key? (car seq))
(reader-error in config (reader-error in config
"invalid structure description in `~as' form" "invalid structure description in `~as` form"
dispatch-c)) dispatch-c))
(define st (with-handlers ([exn:fail? (lambda (exn) #f)]) (define st (with-handlers ([exn:fail? (lambda (exn) #f)])
@ -53,13 +53,13 @@
(unless st (unless st
(reader-error in config (reader-error in config
(string-append "mismatch between structure description" (string-append "mismatch between structure description"
" and number of provided field values in `~as' form") " and number of provided field values in `~as` form")
dispatch-c)) dispatch-c))
(when (read-config-for-syntax? config) (when (read-config-for-syntax? config)
(unless (all-fields-immutable? (car seq)) (unless (all-fields-immutable? (car seq))
(reader-error in config (reader-error in config
"cannot read mutable `~as' form as syntax" "cannot read mutable `~as` form as syntax"
dispatch-c))) dispatch-c)))
(wrap (apply make-prefab-struct seq) (wrap (apply make-prefab-struct seq)

View File

@ -64,7 +64,7 @@
(when (eof-object? v) (when (eof-object? v)
(reader-error in config (reader-error in config
#:due-to v #:due-to v
"expected a commented-out element for `~a;', but found end-of-file" "expected a commented-out element for `~a;`, but found end-of-file"
ec)) ec))
(if (read-config-keep-comment? config) (if (read-config-keep-comment? config)
(result-special-comment) (result-special-comment)

View File

@ -47998,7 +47998,7 @@ static const char *startup_source =
"((config2_0) config_15)" "((config2_0) config_15)"
"((v3_0) v_182)" "((v3_0) v_182)"
"((temp4_3)" "((temp4_3)"
" \"expected a commented-out element for `~a;', but found end-of-file\")" " \"expected a commented-out element for `~a;`, but found end-of-file\")"
"((ec5_0) ec_0))" "((ec5_0) ec_0))"
"(reader-error10.1" "(reader-error10.1"
" #f" " #f"
@ -49843,7 +49843,7 @@ static const char *startup_source =
"(if(eq? convert-mode_3 'must-read)" "(if(eq? convert-mode_3 'must-read)"
"(let-values()" "(let-values()"
"(format" "(format"
" \"`i' must be at the end in `~.a`\"" " \"`i` must be at the end in `~.a`\""
"(substring s_202 start_44 end_34)))" "(substring s_202 start_44 end_34)))"
"(let-values() #f)))" "(let-values() #f)))"
"(let-values()" "(let-values()"
@ -51600,7 +51600,7 @@ static const char *startup_source =
"(let-values()" "(let-values()"
"(let-values(((in12_2) in_5)" "(let-values(((in12_2) in_5)"
"((config13_0) config_15)" "((config13_0) config_15)"
" ((temp14_7) \"missing structure description in `~as' form\")" " ((temp14_7) \"missing structure description in `~as` form\")"
"((dispatch-c15_0) dispatch-c_1))" "((dispatch-c15_0) dispatch-c_1))"
"(reader-error10.1" "(reader-error10.1"
" #f" " #f"
@ -51622,7 +51622,7 @@ static const char *startup_source =
"(let-values()" "(let-values()"
"(let-values(((in16_0) in_5)" "(let-values(((in16_0) in_5)"
"((config17_0) config_15)" "((config17_0) config_15)"
" ((temp18_5) \"invalid structure description in `~as' form\")" " ((temp18_5) \"invalid structure description in `~as` form\")"
"((dispatch-c19_0) dispatch-c_1))" "((dispatch-c19_0) dispatch-c_1))"
"(reader-error10.1" "(reader-error10.1"
" #f" " #f"
@ -51658,7 +51658,7 @@ static const char *startup_source =
"((temp24_8)" "((temp24_8)"
"(string-append" "(string-append"
" \"mismatch between structure description\"" " \"mismatch between structure description\""
" \" and number of provided field values in `~as' form\"))" " \" and number of provided field values in `~as` form\"))"
"((dispatch-c25_0) dispatch-c_1))" "((dispatch-c25_0) dispatch-c_1))"
"(reader-error10.1 #f #f #f #f #f #f in22_3 config23_2 temp24_8(list dispatch-c25_0)))))" "(reader-error10.1 #f #f #f #f #f #f in22_3 config23_2 temp24_8(list dispatch-c25_0)))))"
"(if(read-config-for-syntax? config_15)" "(if(read-config-for-syntax? config_15)"
@ -51668,7 +51668,7 @@ static const char *startup_source =
"(let-values()" "(let-values()"
"(let-values(((in26_0) in_5)" "(let-values(((in26_0) in_5)"
"((config27_0) config_15)" "((config27_0) config_15)"
" ((temp28_4) \"cannot read mutable `~as' form as syntax\")" " ((temp28_4) \"cannot read mutable `~as` form as syntax\")"
"((dispatch-c29_0) dispatch-c_1))" "((dispatch-c29_0) dispatch-c_1))"
"(reader-error10.1 #f #f #f #f #f #f in26_0 config27_0 temp28_4(list dispatch-c29_0))))))" "(reader-error10.1 #f #f #f #f #f #f in26_0 config27_0 temp28_4(list dispatch-c29_0))))))"
"(void))" "(void))"
@ -54143,7 +54143,7 @@ static const char *startup_source =
"((config93_1) config_35)" "((config93_1) config_35)"
"((c94_1) c_9)" "((c94_1) c_9)"
"((temp95_3)" "((temp95_3)"
" \"found non-character while reading `#~a'\")" " \"found non-character while reading `#~a`\")"
"((extend-str96_0)" "((extend-str96_0)"
" extend-str_2))" " extend-str_2))"
"(reader-error10.1" "(reader-error10.1"
@ -54934,12 +54934,18 @@ static const char *startup_source =
"(retry-special-comment v_245 in_62 config_54)))" "(retry-special-comment v_245 in_62 config_54)))"
"(let-values()(read-dispatch c_109 in_62 r-config_0 config_54)))" "(let-values()(read-dispatch c_109 in_62 r-config_0 config_54)))"
"(if(unsafe-fx< index_4 3)" "(if(unsafe-fx< index_4 3)"
" (let-values () (read-quote read-one 'quote \"quoting '\" c_109 in_62 r-config_0))" " (let-values () (read-quote read-one 'quote \"quoting \\\"'\\\"\" c_109 in_62 r-config_0))"
"(if(unsafe-fx< index_4 4)" "(if(unsafe-fx< index_4 4)"
"(let-values()" "(let-values()"
"(if(check-parameter 1/read-accept-quasiquote config_54)" "(if(check-parameter 1/read-accept-quasiquote config_54)"
"(let-values()" "(let-values()"
" (read-quote read-one 'quasiquote \"quasiquoting `\" c_109 in_62 r-config_0))" "(read-quote"
" read-one"
" 'quasiquote"
" \"quasiquoting \\\"`\\\"\""
" c_109"
" in_62"
" r-config_0))"
"(let-values()" "(let-values()"
"(let-values(((in83_0) in_62)" "(let-values(((in83_0) in_62)"
"((r-config84_0) r-config_0)" "((r-config84_0) r-config_0)"
@ -54979,11 +54985,17 @@ static const char *startup_source =
"(read-quote" "(read-quote"
" read-one" " read-one"
" 'unquote-splicing" " 'unquote-splicing"
" \"unquoting ,@\"" " \"unquoting `,@`\""
" c_109" " c_109"
" in_62" " in_62"
" r-config_0))" " r-config_0))"
" (read-quote read-one 'unquote \"unquoting ,\" c_109 in_62 r-config_0))))" "(read-quote"
" read-one"
" 'unquote"
" \"unquoting `,`\""
" c_109"
" in_62"
" r-config_0))))"
"(let-values()" "(let-values()"
"(let-values(((in87_0) in_62)" "(let-values(((in87_0) in_62)"
"((r-config88_0) r-config_0)" "((r-config88_0) r-config_0)"
@ -55739,7 +55751,7 @@ static const char *startup_source =
"(let-values(((in250_0) in_67)" "(let-values(((in250_0) in_67)"
"((config251_0) config_5)" "((config251_0) config_5)"
"((c2252_0) c2_14)" "((c2252_0) c2_14)"
" ((temp253_0) \"expected `s', `S`, `i', or `I` after `~a~a`\")" " ((temp253_0) \"expected `s', `S`, `i`, or `I` after `~a~a`\")"
"((dispatch-c254_0) dispatch-c_5)" "((dispatch-c254_0) dispatch-c_5)"
"((c255_0) c_111))" "((c255_0) c_111))"
"(reader-error10.1" "(reader-error10.1"