Paste: works now!
Author: | foo |
Mode: | factor |
Date: | Mon, 17 Nov 2008 22:32:37 |
Plain Text |
USING: arrays io io.files kernel math parser strings system
tools.test words namespaces make io.encodings.utf8
io.encodings.binary sequences splitting hashtables assocs peg peg.ebnf peg.search memoize ;
IN: indexes
: db-path "resource:work/indexes/db" ;
: load-db db-path utf8 file-lines ;
: index-lines load-db harvest ;
: indices [ 6 head ] map ;
: names [ 7 tail ] map ;
MEMO: i-n# index-lines [ indices ] [ names ] bi zip >hashtable ;
: src-path "resource:work/indexes/kolo" ;
: load-src src-path utf8 file-contents ;
: replaced load-src
[EBNF index = ([0-9][0-9][0-9][0-9][0-9][0-9]) => [[ >string i-n# at ]]
non-index = (!(index).)+ => [[ >string ]]
text = (index | non-index)*
EBNF] concat ;
New Annotation