ed

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

commit 1688cc17562b1216b8efa45ffee320587a2cd2c1
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 | 19++++++++++---------
Mparse.ha | 5-----
2 files changed, 10 insertions(+), 14 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, + promptmode: bool, + 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