ref: d515158d85a5361cd9127f13424e4242226ab9b0
parent: 3ecd5cbac39da3cc30cc1c7abd514968fca069a9
author: Ori Bernstein <ori@eigenstate.org>
date: Fri Feb 5 06:42:48 EST 2016
Split out 'striter' code.
--- a/lib/std/bigint.myr
+++ b/lib/std/bigint.myr
@@ -2,17 +2,18 @@
use "chartype"
use "cmp"
use "die"
+use "errno"
use "extremum"
use "hasprefix"
+use "memops"
use "option"
use "slcp"
use "sldup"
use "slfill"
use "slpush"
+use "striter"
use "types"
use "utf"
-use "errno"
-use "memops"
pkg std =
type bigint = struct
--- a/lib/std/bld.sub
+++ b/lib/std/bld.sub
@@ -60,6 +60,7 @@
strjoin.myr
strsplit.myr
strstrip.myr
+ striter.myr
swap.myr
try.myr
types.myr
--- a/lib/std/dial+posixy.myr
+++ b/lib/std/dial+posixy.myr
@@ -10,9 +10,10 @@
use "option"
use "resolve"
use "result"
-use "sleq"
use "slcp"
+use "sleq"
use "strfind"
+use "striter"
use "syswrap"
use "utf"
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -6,8 +6,8 @@
use "hashfuncs"
use "hasprefix"
use "htab"
-use "introspect"
use "intparse"
+use "introspect"
use "option"
use "result"
use "sleq"
@@ -14,9 +14,10 @@
use "slpush"
use "strbuf"
use "strfind"
+use "striter"
use "strsplit"
-use "syswrap-ss"
use "syswrap"
+use "syswrap-ss"
use "types"
use "utf"
use "varargs"
--- a/lib/std/intparse.myr
+++ b/lib/std/intparse.myr
@@ -2,6 +2,7 @@
use "die"
use "hasprefix"
use "option"
+use "striter"
use "types"
use "utf"
--- a/lib/std/ipparse.myr
+++ b/lib/std/ipparse.myr
@@ -1,13 +1,14 @@
+use "chartype"
use "die"
+use "fmt"
use "intparse"
use "option"
-use "strfind"
-use "types"
-use "chartype"
-use "fmt"
use "slcp"
-use "slfill"
use "sleq"
+use "slfill"
+use "strfind"
+use "striter"
+use "types"
/* FIXME: needed for decls which should be pulled in as hidden */
use "hasprefix"
--- a/lib/std/utf.myr
+++ b/lib/std/utf.myr
@@ -6,13 +6,7 @@
const Maxcharlen : size = 4
const Maxcharval : char = 0x10FFFF
- type chariter = struct
- rest : byte[:]
- ;;
- impl iterable chariter -> char
-
- const bychar : (str : byte[:] -> chariter)
const charlen : (chr : char -> size)
const encode : (buf : byte[:], chr : char -> size)
const decode : (buf : byte[:] -> char)
@@ -19,23 +13,6 @@
const strstep : (str : byte[:] -> (char, byte[:]))
;;
-
-impl iterable chariter -> char =
- __iternext__ = {ci, c
- if ci.rest.len == 0
- -> false
- ;;
- (c#, ci.rest) = strstep(ci.rest)
- -> true
- }
-
- __iterfin__ = {ci, c
- }
-;;
-
-const bychar = {str
- -> [.rest = str]
-}
const charlen = {c
if c < 0x80