ref: 16aa8c14d53c4d2e55651d64de26c68f23f21824
parent: 49f6758a734dc98ed7764d2f2ff8dfb77d4c75b0
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Sep 20 18:28:29 EDT 2015
Add a function to skip whitespace in bio.myr
--- a/lib/bio/bio.myr
+++ b/lib/bio/bio.myr
@@ -50,6 +50,7 @@
const readln : (f : file# -> std.option(byte[:]))
const readto : (f : file#, delim : byte[:] -> std.option(byte[:]))
const skipto : (f : file#, delim : byte[:] -> bool)
+ const skipspace : (f : file# -> void)
/* formatted i/o */
const put : (f : file#, fmt : byte[:], args : ... -> std.size)
@@ -346,6 +347,20 @@
match readdelim(f, delim, true)
| `std.Some ret: -> true
| `std.None: -> false
+ ;;
+}
+
+const skipspace = {f
+ while true
+ match bio.peekc(f)
+ | `std.Some c:
+ if std.isspace(c)
+ break
+ ;;
+ bio.getc(f)
+ | `std.None:
+ break
+ ;;
;;
}