aboutsummaryrefslogtreecommitdiff
path: root/src/guile
diff options
context:
space:
mode:
Diffstat (limited to 'src/guile')
-rw-r--r--src/guile/skribilo/coloring/Makefile.am20
-rw-r--r--src/guile/skribilo/coloring/c-lex.scm (renamed from src/guile/skribilo/coloring/c-lex.l.scm)10
-rw-r--r--src/guile/skribilo/coloring/c.scm123
-rw-r--r--src/guile/skribilo/coloring/lisp-lex.scm (renamed from src/guile/skribilo/coloring/lisp-lex.l.scm)10
-rw-r--r--src/guile/skribilo/coloring/lisp.scm102
-rw-r--r--src/guile/skribilo/coloring/parameters.scm33
-rw-r--r--src/guile/skribilo/coloring/xml-lex.scm (renamed from src/guile/skribilo/coloring/xml-lex.l.scm)10
-rw-r--r--src/guile/skribilo/coloring/xml.scm2
8 files changed, 178 insertions, 132 deletions
diff --git a/src/guile/skribilo/coloring/Makefile.am b/src/guile/skribilo/coloring/Makefile.am
index 2f68f5e..9a3e043 100644
--- a/src/guile/skribilo/coloring/Makefile.am
+++ b/src/guile/skribilo/coloring/Makefile.am
@@ -1,6 +1,6 @@
guilemoduledir = $(GUILE_SITE)/skribilo/coloring
-dist_guilemodule_DATA = c.scm lisp.scm xml.scm \
- lisp-lex.l.scm xml-lex.l.scm c-lex.l.scm
+dist_guilemodule_DATA = parameters.scm c.scm lisp.scm xml.scm \
+ lisp-lex.scm xml-lex.scm c-lex.scm
EXTRA_DIST = lisp-lex.l xml-lex.l c-lex.l
@@ -10,9 +10,21 @@ EXTRA_DIST = lisp-lex.l xml-lex.l c-lex.l
#
# Note: Those files should normally be part of the distribution, making
# this rule useless to the user.
-%.l.scm: %.l
+.l.scm:
$(GUILE) -L $(top_srcdir)/src/guile/silex \
- -c '(load-from-path "lex.scm") (lex "$^" "$@")'
+ -c '(load-from-path "lex.scm") (lex "$^" "$@")' && \
+ mv "$@" "$@.tmp" && \
+ echo '(define-module (skribilo coloring $(^:%.l=%))' > "$@" && \
+ echo ' :use-module (skribilo lib)' >> "$@" && \
+ echo ' :use-module (skribilo coloring parameters)' \
+ >> "$@" && \
+ echo ' :export (lexer-init lexer' >> "$@" && \
+ echo ' lexer-get-func-column' >> "$@" && \
+ echo ' lexer-get-func-offset' >> "$@" && \
+ echo ' lexer-get-line lexer-getc' >> "$@" && \
+ echo ' lexer-ungetc))' >> "$@" && \
+ cat "$@.tmp" >> "$@" && \
+ rm "$@.tmp"
include $(top_srcdir)/guile-lint.am
diff --git a/src/guile/skribilo/coloring/c-lex.l.scm b/src/guile/skribilo/coloring/c-lex.scm
index d78e09e..8ed6160 100644
--- a/src/guile/skribilo/coloring/c-lex.l.scm
+++ b/src/guile/skribilo/coloring/c-lex.scm
@@ -1,3 +1,11 @@
+(define-module (skribilo coloring c-lex)
+ :use-module (skribilo lib)
+ :use-module (skribilo coloring parameters)
+ :export (lexer-init lexer
+ lexer-get-func-column
+ lexer-get-func-offset
+ lexer-get-line lexer-getc
+ lexer-ungetc))
; *** This file starts with a copy of the file multilex.scm ***
; SILex - Scheme Implementation of Lex
; Copyright (C) 2001 Danny Dube'
@@ -14,7 +22,7 @@
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Gestion des Input Systems
diff --git a/src/guile/skribilo/coloring/c.scm b/src/guile/skribilo/coloring/c.scm
index d2a2b9f..28533b4 100644
--- a/src/guile/skribilo/coloring/c.scm
+++ b/src/guile/skribilo/coloring/c.scm
@@ -1,67 +1,59 @@
-;;;;
-;;;; c.stk -- C fontifier for Skribe
-;;;;
-;;;; Copyright © 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
-;;;;
-;;;;
-;;;; This program is free software; you can redistribute it and/or modify
-;;;; it under the terms of the GNU General Public License as published by
-;;;; the Free Software Foundation; either version 2 of the License, or
-;;;; (at your option) any later version.
-;;;;
-;;;; This program is distributed in the hope that it will be useful,
-;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;;; GNU General Public License for more details.
-;;;;
-;;;; You should have received a copy of the GNU General Public License
-;;;; along with this program; if not, write to the Free Software
-;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-;;;; USA.
-;;;;
-;;;; Author: Erick Gallesio [eg@essi.fr]
-;;;; Creation date: 6-Mar-2004 15:35 (eg)
-;;;; Last file update: 7-Mar-2004 00:12 (eg)
-;;;;
-
-(require "lex-rt") ;; to avoid module problems
+;;; c.scm -- C fontifier.
+;;;
+;;; Copyright 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
+;;; Copyright 2007 Ludovic Courtès <ludo@chbouib.org>
+;;;
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+;;; USA.
(define-module (skribilo c)
- :export (c java)
- :import (skribe runtime))
-
-(include "c-lex.stk") ;; SILex generated
+ :use-module (skribilo lib)
+ :use-module (skribilo utils syntax)
+ :use-module (skribilo coloring c-lex) ;; SILex generated
+ :use-module (skribilo coloring parameters)
+ :use-module (srfi srfi-39)
+ :export (c java))
+(fluid-set! current-reader %skribilo-module-reader)
-(define *the-keys* #f)
+
+;;;
+;;; Generic fontifier.
+;;;
-(define *c-keys* #f)
-(define *java-keys* #f)
+(define (fontifier s)
+ (lexer-init 'port (open-input-string s))
+ (let loop ((token (lexer))
+ (res '()))
+ (if (eq? token 'eof)
+ (reverse! res)
+ (loop (lexer)
+ (cons token res)))))
+
+;;;
+;;; C.
+;;;
-(define (fontifier s)
- (let ((lex (c-lex (open-input-string s))))
- (let Loop ((token (lexer-next-token lex))
- (res '()))
- (if (eq? token 'eof)
- (reverse! res)
- (Loop (lexer-next-token lex)
- (cons token res))))))
-
-;;;; ======================================================================
-;;;;
-;;;; C
-;;;;
-;;;; ======================================================================
-(define (init-c-keys)
- (unless *c-keys*
- (set! *c-keys* '(for while return break continue void
- do if else typedef struct union goto switch case
- static extern default)))
- *c-keys*)
+(define %c-keys
+ '(for while return break continue void do if else typedef struct union
+ goto switch case static extern default))
(define (c-fontifier s)
- (fluid-let ((*the-keys* (init-c-keys)))
+ (parameterize ((*the-keys* %c-keys))
(fontifier s)))
(define c
@@ -70,19 +62,17 @@
(fontifier c-fontifier)
(extractor #f)))
-;;;; ======================================================================
-;;;;
-;;;; JAVA
-;;;;
-;;;; ======================================================================
-(define (init-java-keys)
- (unless *java-keys*
- (set! *java-keys* (append (init-c-keys)
- '(public final class throw catch))))
- *java-keys*)
+
+;;;
+;;; Java.
+;;;
+
+(define %java-keys
+ (append %c-keys
+ '(public final class throw catch)))
(define (java-fontifier s)
- (fluid-let ((*the-keys* (init-java-keys)))
+ (parameterize ((*the-keys* %java-keys))
(fontifier s)))
(define java
@@ -90,4 +80,3 @@
(name "java")
(fontifier java-fontifier)
(extractor #f)))
-
diff --git a/src/guile/skribilo/coloring/lisp-lex.l.scm b/src/guile/skribilo/coloring/lisp-lex.scm
index 6ae7fe6..f68f320 100644
--- a/src/guile/skribilo/coloring/lisp-lex.l.scm
+++ b/src/guile/skribilo/coloring/lisp-lex.scm
@@ -1,3 +1,11 @@
+(define-module (skribilo coloring lisp-lex)
+ :use-module (skribilo lib)
+ :use-module (skribilo coloring parameters)
+ :export (lexer-init lexer
+ lexer-get-func-column
+ lexer-get-func-offset
+ lexer-get-line lexer-getc
+ lexer-ungetc))
; *** This file starts with a copy of the file multilex.scm ***
; SILex - Scheme Implementation of Lex
; Copyright (C) 2001 Danny Dube'
@@ -14,7 +22,7 @@
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Gestion des Input Systems
diff --git a/src/guile/skribilo/coloring/lisp.scm b/src/guile/skribilo/coloring/lisp.scm
index 13bb6db..46e8c59 100644
--- a/src/guile/skribilo/coloring/lisp.scm
+++ b/src/guile/skribilo/coloring/lisp.scm
@@ -1,41 +1,37 @@
-;;;; lisp.scm -- Lisp Family Fontification
-;;;;
-;;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
-;;;; Copyright 2005, 2006 Ludovic Courtès <ludovic.courtes@laas.fr>
-;;;;
-;;;;
-;;;; This program is free software; you can redistribute it and/or modify
-;;;; it under the terms of the GNU General Public License as published by
-;;;; the Free Software Foundation; either version 2 of the License, or
-;;;; (at your option) any later version.
-;;;;
-;;;; This program is distributed in the hope that it will be useful,
-;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;;;; GNU General Public License for more details.
-;;;;
-;;;; You should have received a copy of the GNU General Public License
-;;;; along with this program; if not, write to the Free Software
-;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
-;;;; USA.
+;;; lisp.scm -- Lisp Family Fontification
+;;;
+;;; Copyright 2003, 2004 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
+;;; Copyright 2005, 2006, 2007 Ludovic Courtès <ludovic.courtes@laas.fr>
+;;;
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+;;; USA.
(define-module (skribilo coloring lisp)
:use-module (skribilo utils syntax)
:use-module (skribilo source)
+ :use-module (skribilo coloring parameters)
:use-module (skribilo lib)
- :use-module (skribilo utils strings)
:use-module (srfi srfi-39)
:use-module (ice-9 match)
- :autoload (ice-9 regex) (make-regexp)
- :autoload (skribilo reader) (make-reader)
+ :autoload (skribilo reader) (make-reader)
+ :autoload (skribilo coloring lisp-lex) (lexer-init)
:export (skribe scheme stklos bigloo lisp))
-(define *bracket-highlight* (make-parameter #t))
-(define *class-highlight* (make-parameter #t))
-(define *the-keys* (make-parameter '()))
-
(define %lisp-keys #f)
(define %scheme-keys #f)
(define %skribe-keys #f)
@@ -43,9 +39,11 @@
(define %lisp-keys #f)
+
;;;
-;;; DEFINITION-SEARCH
+;;; definition-search
;;;
+
(define (definition-search inp read tab def?)
(let Loop ((exp (read inp)))
(unless (eof-object? exp)
@@ -55,9 +53,6 @@
(source-read-lines (port-filename inp) start stop tab))
(Loop (read inp))))))
-;; Load the SILex-generated lexer.
-(load-from-path "skribilo/coloring/lisp-lex.l.scm")
-
(define (lisp-family-fontifier s)
(lexer-init 'port (open-input-string s))
(let loop ((token (lexer))
@@ -68,11 +63,10 @@
(cons token res)))))
-;;;; ======================================================================
-;;;;
-;;;; LISP
-;;;;
-;;;; ======================================================================
+;;;
+;;; Lisp.
+;;;
+
(define (lisp-extractor iport def tab)
(definition-search
iport
@@ -111,11 +105,10 @@
(extractor lisp-extractor)))
-;;;; ======================================================================
-;;;;
-;;;; SCHEME
-;;;;
-;;;; ======================================================================
+;;;
+;;; Scheme.
+;;;
+
(define (scheme-extractor iport def tab)
(definition-search
iport
@@ -156,11 +149,10 @@
(extractor scheme-extractor)))
-;;;; ======================================================================
-;;;;
-;;;; STKLOS
-;;;;
-;;;; ======================================================================
+;;;
+;;; STkLos.
+;;;
+
(define (stklos-extractor iport def tab)
(definition-search
iport
@@ -211,11 +203,10 @@
(extractor stklos-extractor)))
-;;;; ======================================================================
-;;;;
-;;;; SKRIBE
-;;;;
-;;;; ======================================================================
+;;;
+;;; Skribe.
+;;;
+
(define (skribe-extractor iport def tab)
(definition-search
iport
@@ -274,11 +265,10 @@
(extractor skribe-extractor)))
-;;;; ======================================================================
-;;;;
-;;;; BIGLOO
-;;;;
-;;;; ======================================================================
+;;;
+;;; Bigloo.
+;;;
+
(define (bigloo-extractor iport def tab)
(definition-search
iport
diff --git a/src/guile/skribilo/coloring/parameters.scm b/src/guile/skribilo/coloring/parameters.scm
new file mode 100644
index 0000000..cb4e9bb
--- /dev/null
+++ b/src/guile/skribilo/coloring/parameters.scm
@@ -0,0 +1,33 @@
+;;; lisp.scm -- Lisp Family Fontification
+;;;
+;;; Copyright 2007 Ludovic Courtès <ludo@chbouib.org>
+;;;
+;;;
+;;; This program is free software; you can redistribute it and/or modify
+;;; it under the terms of the GNU General Public License as published by
+;;; the Free Software Foundation; either version 2 of the License, or
+;;; (at your option) any later version.
+;;;
+;;; This program is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;; GNU General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU General Public License
+;;; along with this program; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+;;; USA.
+
+(define-module (skribilo coloring parameters)
+ :use-module (srfi srfi-39)
+ :export (*bracket-highlight* *class-highlight* *the-keys*))
+
+;;;
+;;; Parameters used by the fontifiers.
+;;;
+
+(define *bracket-highlight* (make-parameter #t))
+(define *class-highlight* (make-parameter #t))
+(define *the-keys* (make-parameter '()))
+
+;;; arch-tag: 232c250e-0022-418f-9219-03b4446d0b55
diff --git a/src/guile/skribilo/coloring/xml-lex.l.scm b/src/guile/skribilo/coloring/xml-lex.scm
index d58e42b..d14aa5d 100644
--- a/src/guile/skribilo/coloring/xml-lex.l.scm
+++ b/src/guile/skribilo/coloring/xml-lex.scm
@@ -1,3 +1,11 @@
+(define-module (skribilo coloring xml-lex)
+ :use-module (skribilo lib)
+ :use-module (skribilo coloring parameters)
+ :export (lexer-init lexer
+ lexer-get-func-column
+ lexer-get-func-offset
+ lexer-get-line lexer-getc
+ lexer-ungetc))
; *** This file starts with a copy of the file multilex.scm ***
; SILex - Scheme Implementation of Lex
; Copyright (C) 2001 Danny Dube'
@@ -14,7 +22,7 @@
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
-; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;
; Gestion des Input Systems
diff --git a/src/guile/skribilo/coloring/xml.scm b/src/guile/skribilo/coloring/xml.scm
index e3db36f..f6d69fd 100644
--- a/src/guile/skribilo/coloring/xml.scm
+++ b/src/guile/skribilo/coloring/xml.scm
@@ -20,9 +20,7 @@
(define-module (skribilo coloring xml)
:export (xml)
- :use-module (skribilo source)
:use-module (skribilo lib)
- :use-module (ice-9 rdelim)
:use-module (ice-9 regex))