summaryrefslogtreecommitdiff
path: root/lib/date
diff options
context:
space:
mode:
authorS. Gilles <sgilles@math.umd.edu>2017-11-05 04:11:27 -0500
committerOri Bernstein <ori@eigenstate.org>2017-11-05 20:52:12 -0800
commitf8f5b71ca85fed63d295f50e3f45ba3230edaead (patch)
tree2dc6c605daf0bb9735a3b197596a8ccae519029d /lib/date
parenta2a63e13a470401d10625a0d5be163767adb7e46 (diff)
downloadmc-f8f5b71ca85fed63d295f50e3f45ba3230edaead.tar.gz
Implement graphemestep
And change 'strstep' to 'charstep' for consistency, now that it has a sibling function.
Diffstat (limited to 'lib/date')
-rw-r--r--lib/date/fmt.myr4
-rw-r--r--lib/date/parse.myr10
2 files changed, 7 insertions, 7 deletions
diff --git a/lib/date/fmt.myr b/lib/date/fmt.myr
index 82f865b..39df830 100644
--- a/lib/date/fmt.myr
+++ b/lib/date/fmt.myr
@@ -40,9 +40,9 @@ const sbfmt = {sb, ap, opts
const datefmt = {sb, fmt, d
var c
while fmt.len != 0
- (c, fmt) = std.strstep(fmt)
+ (c, fmt) = std.charstep(fmt)
if c == '%'
- (c, fmt) = std.strstep(fmt)
+ (c, fmt) = std.charstep(fmt)
match c
| 'a': std.sbfmt(sb, "{}", _names.abbrevday[d.wday])
| 'A': std.sbfmt(sb, "{}", _names.fullday[d.wday])
diff --git a/lib/date/parse.myr b/lib/date/parse.myr
index 19798dd..7f2eaff 100644
--- a/lib/date/parse.myr
+++ b/lib/date/parse.myr
@@ -70,9 +70,9 @@ const filldate = {d, f, s, seen, err
z = ""
am = `std.None
while f.len != 0
- (fc, f) = std.strstep(f)
+ (fc, f) = std.charstep(f)
if fc == '%'
- (fc, f) = std.strstep(f)
+ (fc, f) = std.charstep(f)
if std.bshas(seen, fc)
err# = `std.Some `Doublefmt fc
-> s
@@ -120,7 +120,7 @@ const filldate = {d, f, s, seen, err
| _: std.fatal("unknown format character %c\n", fc)
;;
else
- (sc, s) = std.strstep(s)
+ (sc, s) = std.charstep(s)
if std.isspace(fc) && std.isspace(sc)
s = eatspace(s)
elif sc != fc
@@ -157,7 +157,7 @@ const eatspace = {s
var c
while std.isspace(std.decode(s))
- (c, s) = std.strstep(s)
+ (c, s) = std.charstep(s)
;;
-> s
}
@@ -246,7 +246,7 @@ generic intval = {dst : @a::(numeric,integral)#, s : byte[:], \
num = s
for i = 0; i < min; i++
- (c, s) = std.strstep(s)
+ (c, s) = std.charstep(s)
if !std.isdigit(c)
err# = `std.Some `Shortint
-> s