moontalk/server/eventloop-server-experiment/motd-parser.4th
2024-02-17 18:26:14 +00:00

19 lines
428 B
Forth

require libs/parser/parser.4th
create motd-parser PARSER_SIZE allot
create motd-line-delim 10 c,
: (motd-delim) ( -- str )
motd-line-delim 1 ;
variable (append-xt)
: (append) ( str -- )
(append-xt) @ execute ;
: parse-motd ( motd-str append-line-xt -- )
(append-xt) ! motd-parser new-parser
BEGIN
parser-mark (motd-delim) parser>>string
WHILE
parser-extract (append)
(motd-delim) nip parser>>
REPEAT ;