1 ! Copyright (C) 2012 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
3 USING: accessors combinators.short-circuit compiler.units kernel
4 lexer math multiline parser sequences splitting ;
8 TUPLE: literate-lexer < lexer ;
10 : <literate-lexer> ( text -- lexer ) literate-lexer new-lexer ;
12 M: literate-lexer skip-blank
16 [ [ 2 + ] change-column call-next-method ]
17 [ [ nip length ] change-lexer-column ]
20 ] [ call-next-method ] if ;
23 "LITERATE>" parse-multiline-string string-lines [
24 <literate-lexer> (parse-lines) append!
25 ] with-nested-compilation-unit ;