summary refs log tree commit diff
path: root/src/guile/skribilo/source/c-lex.l
diff options
context:
space:
mode:
authorLudovic Courtès2008-02-05 19:10:16 +0100
committerLudovic Courtès2008-02-05 19:10:16 +0100
commit93d003395b34b9a6da59fbbe155ae2b770350e49 (patch)
treeac02afb723cc29830a7a7d4f41a516e5b736937d /src/guile/skribilo/source/c-lex.l
parent98182136994de2b437feb0c37592aeb95aba3c9e (diff)
downloadskribilo-93d003395b34b9a6da59fbbe155ae2b770350e49.tar.gz
skribilo-93d003395b34b9a6da59fbbe155ae2b770350e49.tar.lz
skribilo-93d003395b34b9a6da59fbbe155ae2b770350e49.zip
source: Fix comment regexp for C.
* src/guile/skribilo/source/c-lex.l (comment): New regexp, use it.

* src/guile/skribilo/source/c-lex.scm: Regenerated.
Diffstat (limited to 'src/guile/skribilo/source/c-lex.l')
-rw-r--r--src/guile/skribilo/source/c-lex.l9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/guile/skribilo/source/c-lex.l b/src/guile/skribilo/source/c-lex.l
index b28a91a..fed347e 100644
--- a/src/guile/skribilo/source/c-lex.l
+++ b/src/guile/skribilo/source/c-lex.l
@@ -1,7 +1,7 @@
 ;;; c-lex.l  --  C fontifier for Skribilo.
 ;;;
+;;; Copyright 2007, 2008  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2004  Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
-;;; Copyright 2007  Ludovic Courtès <ludo@gnu.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
@@ -18,6 +18,9 @@
 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 ;;; USA.
 
+;; Comment regexp stolen from http://ostermiller.org/findcomment.html .
+comment  /\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/
+
 space	 [ \n\9]
 letter   [_a-zA-Z]
 alphanum [_a-zA-Z0-9]
@@ -29,9 +32,7 @@ alphanum [_a-zA-Z0-9]
 			     (markup '&source-string)
 			     (body yytext))
 ;; Comments
-;; FIXME: We shouldn't exclude `/' from comments but we do so to match the
-;; shortest multi-line comment.
-/\*(\n|[^/])*\*/	(let* ((not-line (char-set-complement (char-set #\newline)))
+{comment}               (let* ((not-line (char-set-complement (char-set #\newline)))
                                (lines    (string-tokenize yytext not-line)))
                           (reverse!
                            (pair-fold (lambda (line* result)