ref: a77a83ee673ab4bef38e336345f3196c814bdcf7
parent: b585eb744cebded7abbf014c3430f05b64122371
author: Ori Bernstein <ori@eigenstate.org>
date: Wed Aug 2 09:20:59 EDT 2017
Switch to use ':' for loops.
--- a/lib/http/client.myr
+++ b/lib/http/client.myr
@@ -140,7 +140,7 @@
| `std.Some d: ioput(s, "Content-Length: {}\r\n", d.len)
| `std.None: /* nothing to do */
;;
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
ioput(s, "{}: {}\r\n", k, v)
;;
ioput(s, "\r\n")
@@ -272,7 +272,7 @@
}
const freeresp = {r
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
std.slfree(k)
std.slfree(v)
;;
--- a/lib/http/h.myr
+++ b/lib/http/h.myr
@@ -23,7 +23,7 @@
data = ""
hdrs = [][:]
out = ""
- for opt in cmd.opts
+ for opt : cmd.opts
match opt
| ('m', m): method = m
| ('d', d): data = d
@@ -34,7 +34,7 @@
;;
;;
- for url in cmd.args
+ for url : cmd.args
if !std.hasprefix(url, "http")
url = std.fmt("http://{}", url)
;;
@@ -56,7 +56,7 @@
| `std.Ok resp:
if showhdr
std.put("status: {}\n", resp.status)
- for (k, v) in resp.hdrs
+ for (k, v) : resp.hdrs
std.put("{}: {}\n", k, v)
;;
;;
--- a/lib/http/parse.myr
+++ b/lib/http/parse.myr
@@ -229,7 +229,7 @@
}
const findhdr = {r, name
- for (k, v) in r.hdrs
+ for (k, v) : r.hdrs
if std.strcaseeq(k, name)
-> `std.Some v
;;
--- a/lib/http/server.myr
+++ b/lib/http/server.myr
@@ -59,7 +59,7 @@
bio.put(s.f, "HTTP/1.1 {} {}\r\n", resp.status, statusstr(resp.status))
bio.put(s.f, "Content-Length: {}\r\n", resp.body.len)
bio.put(s.f, "Encoding: {}\r\n", resp.enc)
- for (k, v) in resp.hdrs
+ for (k, v) : resp.hdrs
bio.put(s.f, "{}: {}\r\n", k, v)
;;
bio.put(s.f, "\r\n")
--- a/lib/http/srvdot.myr
+++ b/lib/http/srvdot.myr
@@ -9,7 +9,7 @@
.opts = [[.opt='a', .arg="ann", .desc="announce on `ann`"]][:]
])
ann = "tcp!localhost!8080"
- for opt in cmd.opts
+ for opt : cmd.opts
match opt
| ('a', a): ann = a
| _: std.die("unreachable")
--- a/lib/http/url.myr
+++ b/lib/http/url.myr
@@ -25,7 +25,7 @@
showhost = true
url = std.vanext(ap)
- for o in opts
+ for o : opts
match o
| ("p", ""): showhost = false
| _: std.fatal("unknown param\n")
@@ -52,7 +52,7 @@
if url.params.len > 0
sep = '?'
- for (k, v) in url.params
+ for (k, v) : url.params
std.sbfmt(sb, "{}{}={}", sep, k, v)
sep = '&'
;;
@@ -155,7 +155,7 @@
;;
params = [][:]
- for sp in std.bysplit(url#, "&")
+ for sp : std.bysplit(url#, "&")
if std.bstrsplit(kvp[:], sp, "=").len != 2
-> `std.Err `Esyntax
;;
@@ -169,7 +169,7 @@
var len, host
len = 0
- for c in std.bychar(url#)
+ for c : std.bychar(url#)
match c
| ':': break
| '/': break