~ecs/public-inbox

madeline: update for language changes v1 PROPOSED

Curtis Arthaud: 1
 update for language changes

 10 files changed, 37 insertions(+), 37 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~ecs/public-inbox/patches/51667/mbox | git am -3
Learn more about email & git

[PATCH madeline] update for language changes Export this patch

Signed-off-by: Curtis Arthaud <uku82@gmx.fr>
---
 graph/boundary.ha | 10 +++++-----
 made/complete.ha  |  4 ++--
 made/config.ha    | 20 ++++++++++----------
 made/hist.ha      |  4 ++--
 made/input.ha     |  2 +-
 made/line.ha      |  4 ++--
 made/split.ha     | 20 ++++++++++----------
 made/term.ha      |  2 +-
 made/types.ha     |  4 ++--
 made/util.ha      |  4 ++--
 10 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/graph/boundary.ha b/graph/boundary.ha
index 8c469ad..b53f77a 100644
--- a/graph/boundary.ha
+++ b/graph/boundary.ha
@@ -10,7 +10,7 @@ export fn boundary(buf: []u8, idx: size) (bool | utf8::invalid) = {
	};
	let next = strings::iter(strings::fromutf8(buf[idx..])!);
	let next = match (strings::next(&next)) {
	case void =>
	case done =>
		// GB1
		return true;
	case let r: rune =>
@@ -18,7 +18,7 @@ export fn boundary(buf: []u8, idx: size) (bool | utf8::invalid) = {
	};
	let prev = strings::riter(strings::fromutf8(buf[..idx])?);
	let prev = match (strings::next(&prev)) {
	case void =>
	case done =>
		// GB2
		return true;
	case let r: rune =>
@@ -40,7 +40,7 @@ export fn boundary(buf: []u8, idx: size) (bool | utf8::invalid) = {
		let it = strings::riter(strings::fromutf8(buf[..idx])?);
		strings::next(&it) as rune;
		for (true) match (strings::next(&it)) {
		case void =>
		case done =>
			break;
		case let r: rune =>
			if (!hasprop(r, EXTEND)) {
@@ -55,14 +55,14 @@ export fn boundary(buf: []u8, idx: size) (bool | utf8::invalid) = {
		let it = strings::riter(strings::fromutf8(buf[..idx])?);
		strings::next(&it) as rune;
		for (true) match (strings::next(&it)) {
		case void =>
		case done =>
			return false; // GB12
		case let r: rune =>
			if (!hasprop(r, REGIONAL_INDICATOR)) {
				return false; // GB13
			};
			match (strings::next(&it)) {
			case void =>
			case done =>
				break;
			case let r: rune =>
				if (!hasprop(r, REGIONAL_INDICATOR)) break;
diff --git a/made/complete.ha b/made/complete.ha
index 390f8cf..db9dfad 100644
--- a/made/complete.ha
+++ b/made/complete.ha
@@ -27,7 +27,7 @@ export fn complete_fs(ctx: *context, buf: []u8, pos: size) (str, [](str, str)) =
	let (first, rest) = strings::cut(buf, "/");
	let first = strings::iter(first);
	match (strings::next(&first)) {
	case void => void;
	case done => void;
	case let r: rune =>
		if (r != '~') yield;
		let user = strings::iterstr(&first);
@@ -72,7 +72,7 @@ export fn complete_fs(ctx: *context, buf: []u8, pos: size) (str, [](str, str)) =

	let ret: [](str, str) = [];
	for (true) match (fs::next(it)) {
	case void => break;
	case done => break;
	case let d: fs::dirent =>
		if (base == "" && (d.name == "." || d.name == "..")) continue;
		if (strings::hasprefix(d.name, base)) {
diff --git a/made/config.ha b/made/config.ha
index b14b786..1cb2847 100644
--- a/made/config.ha
+++ b/made/config.ha
@@ -58,7 +58,7 @@ export fn config_free(cfg: config) void = {

fn config_finalize(cfg: *config) (void | error) = for (true) {
	let found = false;
	let done = true;
	let compl = true;
	for (let i = 0z; i < len(cfg); i += 1) {
		let m = match (cfg[i].inherit) {
		case void => continue;
@@ -66,7 +66,7 @@ fn config_finalize(cfg: *config) (void | error) = for (true) {
		};

		if (cfg[m].inherit is mode) {
			done = false;
			compl = false;
			continue;
		};

@@ -85,8 +85,8 @@ fn config_finalize(cfg: *config) (void | error) = for (true) {
			append(ib, binding_dup(mb[j]));
		};
	};
	if (!done && !found) return "Inheritance loop in config file": config_error;
	if (done) return;
	if (!compl && !found) return "Inheritance loop in config file": config_error;
	if (compl) return;
};

export fn config_default(name: str) (config | error) = {
@@ -163,7 +163,7 @@ export fn config_handle(cfg: config, in: io::handle) (config | error) = {

		let tok = strings::tokenize(e.2, " ");
		for (true) match (strings::next_token(&tok)) {
		case void => break;
		case done => break;
		case let t: str =>
			append(b.action, parse_action(t)?);
		};
@@ -197,7 +197,7 @@ case =>
fn parse_event(tok: *strings::tokenizer, b: *binding) (event | void | error) = {
	let m: mods = 0;
	for :loop (true) match (strings::next_token(tok)) {
	case void => return void;
	case done => return void;
	case let t: str =>
		switch (t) {
		case "_action" =>
@@ -224,19 +224,19 @@ fn parse_event(tok: *strings::tokenizer, b: *binding) (event | void | error) = {

		let it = strings::iter(t);
		match :error (strings::next(&it)) {
		case void => void;
		case done => void;
		case let r: rune =>
			if (r == '\\') {
				let r = match (strings::next(&it)) {
				case void => yield :error;
				case done => yield :error;
				case let r: rune =>
					yield r;
				};
				if (r != 'u') yield :error;
				r = strconv::stou32b(strings::iterstr(&it),
				r = strconv::stou32(strings::iterstr(&it),
					strconv::base::HEX)?: rune;
				return (r, m): event;
			} else if (strings::next(&it) is void) {
			} else if (strings::next(&it) is done) {
				return (r, m): event;
			};
		};
diff --git a/made/hist.ha b/made/hist.ha
index cbcb323..e41e62a 100644
--- a/made/hist.ha
+++ b/made/hist.ha
@@ -30,7 +30,7 @@ export fn histmem() history = history {
// it doesn't already exist.
export fn histfile(p: str) (history | error) = {
	const file = os::create(p, fs::mode::USER_RW,
		fs::flag::RDWR, fs::flag::CREATE, fs::flag::APPEND)?;
		fs::flag::RDWR | fs::flag::CREATE | fs::flag::APPEND)?;
	let store = histhandle(file)?;
	store.source = os::open(p)?;
	let off = io::seek(store.storage, 0, io::whence::CUR)?;
@@ -97,7 +97,7 @@ fn histhandle_mmap(file: io::file) (history | error) = {
	defer table_finish(seen);
	let tok = strings::rtokenize(data, "\n");
	for (true) match (strings::next_token(&tok)) {
	case void =>
	case done =>
		break;
	case let line: str =>
		if (line == "" || !table_insert(&seen, line)) {
diff --git a/made/input.ha b/made/input.ha
index 6cfbf6f..56cc021 100644
--- a/made/input.ha
+++ b/made/input.ha
@@ -176,7 +176,7 @@ fn get_csi(s: *state) (event | signal | error) = {
		case void =>
			return (symbol::NOP, 0): event;
		case let ret: str =>
			return ret: done: signal;
			return ret: compl: signal;
		};
	case => return (symbol::NOP, 0): event;
	};
diff --git a/made/line.ha b/made/line.ha
index 72efb4e..48d7a1c 100644
--- a/made/line.ha
+++ b/made/line.ha
@@ -36,7 +36,7 @@ export fn line(ctx: *context) (str | void | io::EOF | error) = {
		case let sig: signal =>
			match (sig) {
			case exit => return void;
			case let ret: done => return ret: str;
			case let ret: compl => return ret: str;
			case io::EOF => return io::EOF;
			};
		};
@@ -57,7 +57,7 @@ export fn line(ctx: *context) (str | void | io::EOF | error) = {
		case let sig: signal =>
			match (sig) {
			case exit => return void;
			case let ret: done => return ret: str;
			case let ret: compl => return ret: str;
			case io::EOF => return io::EOF;
			};
		};
diff --git a/made/split.ha b/made/split.ha
index 671b1da..46b83e1 100644
--- a/made/split.ha
+++ b/made/split.ha
@@ -25,7 +25,7 @@ fn default_split(buf: str, idx: size) (str, size, bool) = {
	let ntok = 0z;
	let it = strings::tokenize(buf, " ");
	for (true) match (strings::next_token(&it)) {
	case void => break;
	case done => break;
	case let tok: str =>
		last = tok;
		if (ntok == idx) break;
@@ -56,7 +56,7 @@ fn sh_split(buf: str, idx: size) (str, size, bool) = {

	let it = strings::iter(buf);
	for (true) match (strings::next(&it)) {
	case void => break;
	case done => break;
	case let r: rune =>
		if (r == ' ' || r == '\t' || r == '\n') {
			if (!ws) {
@@ -75,7 +75,7 @@ fn sh_split(buf: str, idx: size) (str, size, bool) = {
			memio::appendrune(&out, r)!;

			if (r == '>') match (strings::next(&it)) {
			case void => void;
			case done => void;
			case let r: rune =>
				if (r == '>') {
					memio::appendrune(&out, r)!;
@@ -101,7 +101,7 @@ fn sh_split(buf: str, idx: size) (str, size, bool) = {
			backslash(&out, &it);
		case '\'' =>
			for (true) match (strings::next(&it)) {
			case void =>
			case done =>
				break;
			case let r: rune =>
				if (r == '\'') break;
@@ -110,7 +110,7 @@ fn sh_split(buf: str, idx: size) (str, size, bool) = {
			};
		case '"' =>
			for (true) match (strings::next(&it)) {
			case void =>
			case done =>
				break;
			case let r: rune =>
				if (r == '"') break;
@@ -126,7 +126,7 @@ fn sh_split(buf: str, idx: size) (str, size, bool) = {

fn backslash(out: io::handle, in: *strings::iterator) void = {
	let r = match (strings::next(in)) {
	case void =>
	case done =>
		yield '\\';
	case let r: rune =>
		yield r;
@@ -145,7 +145,7 @@ fn sh_escape(ctx: str, buf: str) (str, str, bool) = {
	let need_esc = false;
	let it = strings::iter(ctx);
	for (true) match (strings::next(&it)) {
	case void =>
	case done =>
		break;
	case let r: rune =>
		switch (r) {
@@ -155,7 +155,7 @@ fn sh_escape(ctx: str, buf: str) (str, str, bool) = {
			strings::next(&it);
		case '\'' =>
			for (true) match (strings::next(&it)) {
			case void =>
			case done =>
				ectx = escapectx::SINGLE;
				break;
			case let r: rune =>
@@ -165,7 +165,7 @@ fn sh_escape(ctx: str, buf: str) (str, str, bool) = {
			};
		case '"' =>
			for (true) match (strings::next(&it)) {
			case void =>
			case done =>
				ectx = escapectx::DOUBLE;
				break;
			case let r: rune =>
@@ -180,7 +180,7 @@ fn sh_escape(ctx: str, buf: str) (str, str, bool) = {
	let out = memio::dynamic();
	it = strings::iter(buf);
	for (true) match (strings::next(&it)) {
	case void => break;
	case done => break;
	case let r: rune =>
		need_esc ||= needsesc(r);
		let esc = switch (ectx) {
diff --git a/made/term.ha b/made/term.ha
index 0367cae..cfd5613 100644
--- a/made/term.ha
+++ b/made/term.ha
@@ -22,7 +22,7 @@ fn draw(s: *state) (void | error) = {
fn dumpstr(out: io::handle, s: str) (void | io::error) = {
	let it = strings::iter(s);
	for (true) match (strings::next(&it)) {
	case void =>
	case done =>
		break;
	case let r: rune =>
		if (!ascii::iscntrl(r) || r == '\n') {
diff --git a/made/types.ha b/made/types.ha
index a712eab..48b1b02 100644
--- a/made/types.ha
+++ b/made/types.ha
@@ -26,9 +26,9 @@ export type mode = enum {

export type exit = void;

export type done = str;
export type compl = str;

export type signal = (exit | done | io::EOF);
export type signal = (exit | compl | io::EOF);

export type state = struct {
	ctx: *context,
diff --git a/made/util.ha b/made/util.ha
index 8b55ae1..f3b13b4 100644
--- a/made/util.ha
+++ b/made/util.ha
@@ -44,14 +44,14 @@ fn prefix(strs: [](str, str)) str = {
	let ret = memio::dynamic();
	for :loop (len(its) > 0) {
		let r = match (strings::next(&its[0])) {
		case void =>
		case done =>
			break;
		case let r: rune =>
			yield r;
		};
		for (let i = 1z; i < len(its); i += 1) {
			match (strings::next(&its[i])) {
			case void =>
			case done =>
				break :loop;
			case let r2: rune =>
				if (r != r2) break :loop;
--
2.45.0