ed

[hare] The standard editor
Log | Files | Refs | README | LICENSE

commit 2329ba5d505805f0439141ae80aa8bdaf777cc23
parent 580ce39ee60bd6ff30ab7c1db2c4a2608e70944f
Author: Byron Torres <b@torresjrjr.com>
Date:   Wed, 10 Jan 2024 22:50:33 +0000

rm InputMode; tidy main.ha

Diffstat:
Mmain.ha | 17+++++++++--------
Mparse.ha | 5-----
2 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/main.ha b/main.ha @@ -9,15 +9,16 @@ use types; type Session = struct{ input: *bufio::scanner, buf: *Buffer, - mode: InputMode, - helpmode: bool, - lasterror: (void | Error), - suppressmode: bool, + promptmode: bool, prompt: str, + suppressmode: bool, + helpmode: bool, + warned: bool, - lastshcmd: (void | str), + lasterror: (void | Error), lastregex: (void | str), + lastshcmd: (void | str), }; def proghelp: [_]getopt::help = [ @@ -70,9 +71,9 @@ export fn main() void = { if (len(progcmd.args) == 1) switch (progcmd.args[0]) { case "-" => - fmt::fatal("Invalid filename '-'"); + return fmt::errorln("Invalid filename '-'"): void; case "" => - fmt::fatal("Invalid filename ''"); + return fmt::errorln("Invalid filename ''"): void; case => s.buf.filename = strings::dup(progcmd.args[0]); }; @@ -105,7 +106,7 @@ export fn main() void = { match (execute(&s, &cmd)) { case Quit => - debug("main() for match (exec) case Quit"); + debug("main() Quit"); break; case => void; diff --git a/parse.ha b/parse.ha @@ -5,11 +5,6 @@ use regex; use strconv; use strings; -type InputMode = enum{ - COMMAND, - TEXT, -}; - type ParseError = !( UnknownCommand | UnexpectedSuffix