File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -460,16 +460,21 @@ static const char* get_escape_shorthand(uint8_t c) {
460
460
static void invalid_char_error (Tokenize *t, uint8_t c) {
461
461
if (c == ' \r ' ) {
462
462
tokenize_error (t, " invalid carriage return, only '\\ n' line endings are supported" );
463
- } else if (isprint (c)) {
463
+ return ;
464
+ }
465
+
466
+ const char *sh = get_escape_shorthand (c);
467
+ if (sh) {
468
+ tokenize_error (t, " invalid character: '%s'" , sh);
469
+ return ;
470
+ }
471
+
472
+ if (isprint (c)) {
464
473
tokenize_error (t, " invalid character: '%c'" , c);
465
- } else {
466
- const char *sh = get_escape_shorthand (c);
467
- if (sh) {
468
- tokenize_error (t, " invalid character: '%s'" , sh);
469
- } else {
470
- tokenize_error (t, " invalid character: '\\ x%x'" , c);
471
- }
474
+ return ;
472
475
}
476
+
477
+ tokenize_error (t, " invalid character: '\\ x%02x'" , c);
473
478
}
474
479
475
480
void tokenize (Buf *buf, Tokenization *out) {
You can’t perform that action at this time.
0 commit comments