0287339ff9
FossilOrigin-Name: 02f302af576d502ba19eb058deb9236a218bb8d85c0e321c6058686b1a8ce5e8
23 lines
516 B
Forth
23 lines
516 B
Forth
~~~
|
|
{{
|
|
:eol? (c-f)
|
|
[ ASCII:CR eq? ] [ ASCII:LF eq? ] [ ASCII:SPACE eq? ] tri or or ;
|
|
|
|
:valid? (s-sf)
|
|
dup s:length n:-zero? ;
|
|
|
|
:check-bs (c-c)
|
|
dup [ #8 eq? ] [ #127 eq? ] bi or [ buffer:get buffer:get drop-pair ] if ;
|
|
|
|
:c:get (-c) \liii.... `1 ;
|
|
|
|
:s:get (-s) [ #1025 buffer:set
|
|
[ c:get dup buffer:add check-bs eol? ] until
|
|
buffer:start s:chop ] buffer:preserve ;
|
|
|
|
:listen (-)
|
|
repeat s:get valid? &interpret &drop choose again ;
|
|
|
|
&listen #1 store
|
|
}}
|
|
~~~
|