diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-11-09 16:27:54 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-11-09 16:27:54 -0500 |
| commit | 898bee15817573b5ab865a1dae7e52da310affa8 (patch) | |
| tree | b8531a828190997a63a1e1ef32f4aa568304e61c /stdlib/ranges.c | |
| parent | 7a4f2e73addf6dfcde2a6b17b62b961608e556a0 (diff) | |
Introduce a `Match` struct to represent pattern matching results, which
improves the usability of a lot of the APIs. Also bugfix some issues
with ranges.
Diffstat (limited to 'stdlib/ranges.c')
| -rw-r--r-- | stdlib/ranges.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/stdlib/ranges.c b/stdlib/ranges.c index ae469bc4..3f673b52 100644 --- a/stdlib/ranges.c +++ b/stdlib/ranges.c @@ -38,10 +38,11 @@ static Text_t Range$as_text(const Range_t *r, bool use_color, const TypeInfo_t * (void)type; if (!r) return Text("Range"); - return Text$format(use_color ? "\x1b[0;1mRange\x1b[m(first=%r, last=%r, step=%r)" - : "Range(first=%r, last=%r, step=%r)", - Int$as_text(&r->first, use_color, &Int$info), Int$as_text(&r->last, use_color, &Int$info), - Int$as_text(&r->step, use_color, &Int$info)); + Text_t first = Int$as_text(&r->first, use_color, &Int$info); + Text_t last = Int$as_text(&r->last, use_color, &Int$info); + Text_t step = Int$as_text(&r->step, use_color, &Int$info); + return Text$format(use_color ? "\x1b[0;1mRange\x1b[m(first=%k, last=%k, step=%k)" + : "Range(first=%k, last=%k, step=%k)", &first, &last, &step); } PUREFUNC public Range_t Range$reversed(Range_t r) |
