diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-10 20:50:15 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-10 20:50:15 -0400 |
| commit | 6d3d104363426d9d26a3fa65979899c032a093a7 (patch) | |
| tree | 1d0353fc224d0d97c5f987c5087e8ac018c98d81 /parse.c | |
| parent | f0e56acc5b7930111ddf429f7186f0e72146517e (diff) | |
Overhaul of operator metamethods
Diffstat (limited to 'parse.c')
| -rw-r--r-- | parse.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2096,7 +2096,10 @@ PARSER(parse_doctest) { *output_end = pos + strcspn(pos, "\r\n"); if (output_end <= output_start) parser_err(ctx, output_start, output_end, "You're missing expected output here"); - output = GC_strndup(output_start, (size_t)(output_end - output_start)); + int64_t trailing_spaces = 0; + while (output_end - trailing_spaces - 1 > output_start && (output_end[-trailing_spaces-1] == ' ' || output_end[-trailing_spaces-1] == '\t')) + ++trailing_spaces; + output = GC_strndup(output_start, (size_t)(output_end - output_start) - trailing_spaces); pos = output_end; } else { pos = expr->end; |
