Skip to content

Commit e5b92dd

Browse files
authored
Some fixes for 'read_'
Before this change, if the line break was `\r`, comments didn't work correctly. Fixed a bug in `read_`, now you can add a '\' character before 'n', 'r', 't'.
1 parent ed4cda9 commit e5b92dd

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/fe.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ static fe_Object* read_(fe_Context *ctx, fe_ReadFn fn, void *udata) {
474474
return NULL;
475475

476476
case ';':
477-
while (chr && chr != '\n') { chr = fn(ctx, udata); }
477+
while (chr && chr != '\n' && chr != '\r') { chr = fn(ctx, udata); }
478478
return read_(ctx, fn, udata);
479479

480480
case ')':
@@ -513,7 +513,7 @@ static fe_Object* read_(fe_Context *ctx, fe_ReadFn fn, void *udata) {
513513
if (chr == '\0') { fe_error(ctx, "unclosed string"); }
514514
if (chr == '\\') {
515515
chr = fn(ctx, udata);
516-
if (strchr("nrt", chr)) { chr = strchr("n\nr\rt\t", chr)[1]; }
516+
if (strchr("\\nrt", chr)) { chr = strchr("\\\\n\nr\rt\t", chr)[1]; }
517517
}
518518
v = buildstring(ctx, v, chr);
519519
chr = fn(ctx, udata);

0 commit comments

Comments
 (0)