From fc1da5f0373f32ae6fc141afd1c6218bd85bd6d7 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Sun, 4 Mar 2018 11:22:18 -0700 Subject: [PATCH] reader: fix quoting in some error messages --- racket/src/expander/read/extension.rkt | 2 +- racket/src/expander/read/main.rkt | 10 +++---- racket/src/expander/read/number.rkt | 2 +- racket/src/expander/read/struct.rkt | 8 +++--- racket/src/expander/read/whitespace.rkt | 2 +- racket/src/racket/src/startup.inc | 36 ++++++++++++++++--------- 6 files changed, 36 insertions(+), 24 deletions(-) diff --git a/racket/src/expander/read/extension.rkt b/racket/src/expander/read/extension.rkt index bf78f904c2..dc99f4f69b 100644 --- a/racket/src/expander/read/extension.rkt +++ b/racket/src/expander/read/extension.rkt @@ -87,7 +87,7 @@ [(not (char? c)) (consume-char/special in config c) (reader-error in config #:due-to c - "found non-character while reading `#~a'" + "found non-character while reading `#~a`" extend-str)] [(char-whitespace? c) (void)] [(or (char-lang-nonsep? c) diff --git a/racket/src/expander/read/main.rkt b/racket/src/expander/read/main.rkt index bc7f43fbd1..f949953789 100644 --- a/racket/src/expander/read/main.rkt +++ b/racket/src/expander/read/main.rkt @@ -198,11 +198,11 @@ [(#\#) (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 (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 (check-parameter read-accept-quasiquote config) @@ -210,8 +210,8 @@ (if (eqv? c2 #\@) (begin (consume-char in c2) - (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-splicing "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)] [(#\)) @@ -350,7 +350,7 @@ [(#\i #\I) (read-one #f in (override-parameter read-case-sensitive config #f))] [else (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)])] [(#\h #\H) (read-hash read-one dispatch-c c in config)] [(#\r) diff --git a/racket/src/expander/read/number.rkt b/racket/src/expander/read/number.rkt index b0812da13b..9595dc33dd 100644 --- a/racket/src/expander/read/number.rkt +++ b/racket/src/expander/read/number.rkt @@ -325,7 +325,7 @@ [(or @-pos (eq? in-complex '@)) (fail convert-mode "cannot mix `@` and `i` in `~.a`" (substring s start end))] [(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 (loop (add1 i) any-digits? any-hashes? i @-pos sign-pos #f #f #f diff --git a/racket/src/expander/read/struct.rkt b/racket/src/expander/read/struct.rkt index cba9ec1228..1d999eb178 100644 --- a/racket/src/expander/read/struct.rkt +++ b/racket/src/expander/read/struct.rkt @@ -40,12 +40,12 @@ (when (null? seq) (reader-error in config - "missing structure description in `~as' form" + "missing structure description in `~as` form" dispatch-c)) (unless (prefab-key? (car seq)) (reader-error in config - "invalid structure description in `~as' form" + "invalid structure description in `~as` form" dispatch-c)) (define st (with-handlers ([exn:fail? (lambda (exn) #f)]) @@ -53,13 +53,13 @@ (unless st (reader-error in config (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)) (when (read-config-for-syntax? config) (unless (all-fields-immutable? (car seq)) (reader-error in config - "cannot read mutable `~as' form as syntax" + "cannot read mutable `~as` form as syntax" dispatch-c))) (wrap (apply make-prefab-struct seq) diff --git a/racket/src/expander/read/whitespace.rkt b/racket/src/expander/read/whitespace.rkt index 109f34f0a4..47e1871205 100644 --- a/racket/src/expander/read/whitespace.rkt +++ b/racket/src/expander/read/whitespace.rkt @@ -64,7 +64,7 @@ (when (eof-object? v) (reader-error in config #: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)) (if (read-config-keep-comment? config) (result-special-comment) diff --git a/racket/src/racket/src/startup.inc b/racket/src/racket/src/startup.inc index 926c6c1bbf..c7a1763754 100644 --- a/racket/src/racket/src/startup.inc +++ b/racket/src/racket/src/startup.inc @@ -47998,7 +47998,7 @@ static const char *startup_source = "((config2_0) config_15)" "((v3_0) v_182)" "((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))" "(reader-error10.1" " #f" @@ -49843,7 +49843,7 @@ static const char *startup_source = "(if(eq? convert-mode_3 'must-read)" "(let-values()" "(format" -" \"`i' must be at the end in `~.a`\"" +" \"`i` must be at the end in `~.a`\"" "(substring s_202 start_44 end_34)))" "(let-values() #f)))" "(let-values()" @@ -51600,7 +51600,7 @@ static const char *startup_source = "(let-values()" "(let-values(((in12_2) in_5)" "((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))" "(reader-error10.1" " #f" @@ -51622,7 +51622,7 @@ static const char *startup_source = "(let-values()" "(let-values(((in16_0) in_5)" "((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))" "(reader-error10.1" " #f" @@ -51658,7 +51658,7 @@ static const char *startup_source = "((temp24_8)" "(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-c25_0) dispatch-c_1))" "(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)" @@ -51668,7 +51668,7 @@ static const char *startup_source = "(let-values()" "(let-values(((in26_0) in_5)" "((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))" "(reader-error10.1 #f #f #f #f #f #f in26_0 config27_0 temp28_4(list dispatch-c29_0))))))" "(void))" @@ -54143,7 +54143,7 @@ static const char *startup_source = "((config93_1) config_35)" "((c94_1) c_9)" "((temp95_3)" -" \"found non-character while reading `#~a'\")" +" \"found non-character while reading `#~a`\")" "((extend-str96_0)" " extend-str_2))" "(reader-error10.1" @@ -54934,12 +54934,18 @@ static const char *startup_source = "(retry-special-comment v_245 in_62 config_54)))" "(let-values()(read-dispatch c_109 in_62 r-config_0 config_54)))" "(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)" "(let-values()" "(if(check-parameter 1/read-accept-quasiquote config_54)" "(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(((in83_0) in_62)" "((r-config84_0) r-config_0)" @@ -54979,11 +54985,17 @@ static const char *startup_source = "(read-quote" " read-one" " 'unquote-splicing" -" \"unquoting ,@\"" +" \"unquoting `,@`\"" " c_109" " in_62" " 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(((in87_0) in_62)" "((r-config88_0) r-config_0)" @@ -55739,7 +55751,7 @@ static const char *startup_source = "(let-values(((in250_0) in_67)" "((config251_0) config_5)" "((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)" "((c255_0) c_111))" "(reader-error10.1"