Permalink
Browse files

literate: adding some literate programming ideas.

  • Loading branch information...
mrjbq7 committed Aug 29, 2012
1 parent b829109 commit 43586752938e4d8cfde036614de8275f1c34f0c3
Showing with 27 additions and 0 deletions.
  1. +1 −0 extra/literate/authors.txt
  2. +25 −0 extra/literate/literate.factor
  3. +1 −0 extra/literate/summary.txt
@@ -0,0 +1 @@
John Benediktsson
@@ -0,0 +1,25 @@
! Copyright (C) 2012 John Benediktsson
! See http://factorcode.org/license.txt for BSD license
USING: accessors combinators.short-circuit compiler.units kernel
lexer math multiline parser sequences splitting ;
IN: literate
TUPLE: literate-lexer < lexer ;
: <literate-lexer> ( text -- lexer ) literate-lexer new-lexer ;
M: literate-lexer skip-blank
dup column>> zero? [
dup line-text>> [
"> " head?
[ [ 2 + ] change-column call-next-method ]
[ [ nip length ] change-lexer-column ]
if
] [ drop ] if*
] [ call-next-method ] if ;
SYNTAX: <LITERATE
"LITERATE>" parse-multiline-string string-lines [
<literate-lexer> (parse-lines) over push-all
] with-nested-compilation-unit ;
@@ -0,0 +1 @@
Literate programming techniques

0 comments on commit 4358675

Please sign in to comment.