summaryrefslogtreecommitdiff
path: root/legacy/bigloo/asm.scm
diff options
context:
space:
mode:
authorLudovic Courtes2005-10-31 16:16:54 +0000
committerLudovic Courtes2005-10-31 16:16:54 +0000
commit89a424521b753ee7c2c67ebdc957865657f647c4 (patch)
tree7d15f69ef9aa87cd6e89153d34240baa031177c2 /legacy/bigloo/asm.scm
parentfe831fd1e716de64a1b92beeabe4d865546dd986 (diff)
downloadskribilo-89a424521b753ee7c2c67ebdc957865657f647c4.tar.gz
skribilo-89a424521b753ee7c2c67ebdc957865657f647c4.tar.lz
skribilo-89a424521b753ee7c2c67ebdc957865657f647c4.zip
Moved the STkLos and Bigloo code to `legacy'.
Moved the STkLos and Bigloo code from `src' to `legacy'. git-archimport-id: lcourtes@laas.fr--2005-mobile/skribilo--devel--1.2--patch-9
Diffstat (limited to 'legacy/bigloo/asm.scm')
-rw-r--r--legacy/bigloo/asm.scm99
1 files changed, 99 insertions, 0 deletions
diff --git a/legacy/bigloo/asm.scm b/legacy/bigloo/asm.scm
new file mode 100644
index 0000000..03196ac
--- /dev/null
+++ b/legacy/bigloo/asm.scm
@@ -0,0 +1,99 @@
+;*=====================================================================*/
+;* serrano/prgm/project/skribe/src/bigloo/asm.scm */
+;* ------------------------------------------------------------- */
+;* Author : Manuel Serrano */
+;* Creation : Mon Sep 1 12:08:39 2003 */
+;* Last change : Tue Jan 20 06:07:44 2004 (serrano) */
+;* Copyright : 2003-04 Manuel Serrano */
+;* ------------------------------------------------------------- */
+;* ASM fontification */
+;*=====================================================================*/
+
+;*---------------------------------------------------------------------*/
+;* The module */
+;*---------------------------------------------------------------------*/
+(module skribe_asm
+
+ (include "new.sch")
+
+ (import skribe_types
+ skribe_lib
+ skribe_resolve
+ skribe_eval
+ skribe_api
+ skribe_param
+ skribe_source)
+
+ (export asm))
+
+;*---------------------------------------------------------------------*/
+;* asm ... */
+;*---------------------------------------------------------------------*/
+(define asm
+ (new language
+ (name "asm")
+ (fontifier asm-fontifier)
+ (extractor #f)))
+
+;*---------------------------------------------------------------------*/
+;* asm-fontifier ... */
+;*---------------------------------------------------------------------*/
+(define (asm-fontifier s)
+ (let ((g (regular-grammar ()
+ ((: "/*" (* (or (out #\*) (: (+ #\*) (out #\/ #\*))))
+ (+ #\*) "/")
+ ;; bold comments
+ (let ((c (new markup
+ (markup '&source-line-comment)
+ (body (the-string)))))
+ (cons c (ignore))))
+ ((: "//" (* all))
+ ;; italic comments
+ (let ((c (new markup
+ (markup '&source-comment)
+ (body (the-string)))))
+ (cons c (ignore))))
+ ((: "#" (* all))
+ ;; italic comments
+ (let ((c (new markup
+ (markup '&source-comment)
+ (body (the-string)))))
+ (cons c (ignore))))
+ ((+ (or #\Newline #\Space))
+ ;; separators
+ (let ((str (the-string)))
+ (cons str (ignore))))
+ ((: (* (in #\tab #\space))
+ (+ (out #\: #\Space #\Tab #\Newline)) #\:)
+ ;; labels
+ (let ((c (new markup
+ (markup '&source-define)
+ (body (the-string)))))
+ (cons c (ignore))))
+ ((or (in "<>=!/\\+*-([])")
+ #\/
+ (+ (out #\; #\Space #\Tab #\Newline #\( #\) #\[ #\] #\" #\< #\> #\= #\! #\/ #\/ #\+ #\* #\-)))
+ ;; regular text
+ (let ((s (the-string)))
+ (cons s (ignore))))
+ ((: "\"" (* (or (out #a000 #\\ #\") (: #\\ all))) "\"")
+ ;; strings
+ (let ((str (split-string-newline (the-string))))
+ (append (map (lambda (s)
+ (if (eq? s 'eol)
+ "\n"
+ (new markup
+ (markup '&source-string)
+ (body s))))
+ str)
+ (ignore))))
+ ((+ (or #\; #\" #\# #\tab))
+ (let ((str (the-string)))
+ (cons str (ignore))))
+ (else
+ (let ((c (the-failure)))
+ (if (eof-object? c)
+ '()
+ (error "source(asm)" "Unexpected character" c)))))))
+ (read/rp g (open-input-string s))))
+