aboutsummaryrefslogtreecommitdiff
path: root/skribe/doc/user/src/prgm3.skb
diff options
context:
space:
mode:
authorLudovic Court`es2005-06-15 13:00:39 +0000
committerLudovic Court`es2005-06-15 13:00:39 +0000
commitfc42fe56a57eace2dbdb31574c2e161f0eacf839 (patch)
tree18111570156cb0e3df0d81c8d104517a2263fd2c /skribe/doc/user/src/prgm3.skb
downloadskribilo-fc42fe56a57eace2dbdb31574c2e161f0eacf839.tar.gz
skribilo-fc42fe56a57eace2dbdb31574c2e161f0eacf839.tar.lz
skribilo-fc42fe56a57eace2dbdb31574c2e161f0eacf839.zip
Initial import of Skribe 1.2d.
Initial import of Skribe 1.2d. git-archimport-id: lcourtes@laas.fr--2004-libre/skribilo--devel--1.2--base-0
Diffstat (limited to 'skribe/doc/user/src/prgm3.skb')
-rw-r--r--skribe/doc/user/src/prgm3.skb55
1 files changed, 55 insertions, 0 deletions
diff --git a/skribe/doc/user/src/prgm3.skb b/skribe/doc/user/src/prgm3.skb
new file mode 100644
index 0000000..51cb564
--- /dev/null
+++ b/skribe/doc/user/src/prgm3.skb
@@ -0,0 +1,55 @@
+(define (makefile-fontifier string)
+ (with-input-from-string string
+ (lambda ()
+ (read/rp (regular-grammar ()
+ ((: #\# (+ all))
+ ;; makefile comment
+ (let ((cmt (the-string)))
+ (cons (it cmt) (ignore))))
+ ((bol (: (+ (out " \t\n:")) #\:))
+ ;; target
+ (let ((prompt (the-string)))
+ (cons (bold prompt) (ignore))))
+ ((bol (: (+ alpha) #\=))
+ ;; variable definitions
+ (let* ((len (- (the-length) 1))
+ (var (the-substring 0 len)))
+ (cons (list (color :fg "#bb0000" (bold var)) "=")
+ (ignore))))
+ ((+ (out " \t\n:=$"))
+ ;; plain strings
+ (let ((str (the-string)))
+ (cons str (ignore))))
+ ((: #\$ #\( (+ (out " )\n")) #\))
+ ;; variable references
+ (let ((str (the-string))
+ (var (the-substring 2 (- (the-length) 1))))
+ (cons (underline str) (ignore))))
+ ((+ (in " \t\n:"))
+ ;; separators
+ (let ((nl (the-string)))
+ (cons nl (ignore))))
+ (else
+ ;; default
+ (let ((c (the-failure)))
+ (if (eof-object? c)
+ '()
+ (skribe-error 'makefile "Unexpected char" c)))))
+ (current-input-port)))))
+
+(define makefile
+ (language :name "Makefile"
+ :fontifier makefile-fontifier))
+
+(frame :width 100.
+ (prog (source :language makefile [
+SKRIBE=skribe
+
+all: demo.html demo.man
+
+demo.html: demo.skb
+ $(SKRIBE) demo.skb -o demo.html
+
+demo.man: demo.skb
+ $(SKRIBE) demo.skb -o demo.man
+])))