retroforth/example/retro-locate.retro
crc 45a1619f9e examples: refactor retro-locate
FossilOrigin-Name: 1f82401f2f13a624482fb585ae0e87b1645950504fb1c1c7126aa1bebc287e8b
2021-01-27 14:49:39 +00:00

11 lines
343 B
Forth
Executable file

#!/usr/bin/env retro
~~~
'Line var
:parse (s-a) ASCII:HT s:tokenize dup !Line ;
:word (-s) #0 script:get-argument ;
:match? (a-f) #0 a:fetch word s:eq? ;
:fields (-ss) @Line [ #2 a:fetch ] [ #1 a:fetch ] bi ;
:display (-) fields s:put $: c:put s:put nl ;
'tags [ &Heap [ parse match? [ display ] if ] v:preserve ] file:for-each-line
~~~