summaryrefslogtreecommitdiff
path: root/src/guile
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
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')
-rw-r--r--src/guile/skribilo/source/c-lex.l9
-rw-r--r--src/guile/skribilo/source/c-lex.scm8
2 files changed, 8 insertions, 9 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)
diff --git a/src/guile/skribilo/source/c-lex.scm b/src/guile/skribilo/source/c-lex.scm
index 72c4929..e2134b3 100644
--- a/src/guile/skribilo/source/c-lex.scm
+++ b/src/guile/skribilo/source/c-lex.scm
@@ -1163,13 +1163,11 @@
(markup '&source-string)
(body yytext))
;; Comments
-;; FIXME: We shouldn't exclude `/' from comments but we do so to match the
-;; shortest multi-line comment.
))
#t
(lambda (yycontinue yygetc yyungetc)
(lambda (yytext yyline)
- (let* ((not-line (char-set-complement (char-set #\newline)))
+ (let* ((not-line (char-set-complement (char-set #\newline)))
(lines (string-tokenize yytext not-line)))
(reverse!
(pair-fold (lambda (line* result)
@@ -1233,8 +1231,8 @@
(65 2 err)) (97 2 (123 err 2)))) (48 (42 (= 34 err 2) (43 err (47 2
err))) (95 (65 2 (91 4 2)) (97 (96 3 2) (123 4 2)))) (95 (65 err (91 4
err)) (97 (96 4 err) (123 4 err))) (43 (42 8 10) (= 47 9 8)) (= 34 11
- 6) err err (= 10 err 12) (43 (42 10 13) (= 47 err 10)) err (= 10 err
- 12) (43 (42 10 13) (= 47 14 10)) err)
+ 6) err err (= 10 err 12) (= 42 13 10) err (= 10 err 12) (43 (42 10 13)
+ (= 47 14 10)) err)
'#((#f . #f) (#f . #f) (4 . 4) (3 . 3) (3 . 3) (#f . #f) (#f . #f) (6 .
6) (5 . 5) (2 . 2) (#f . #f) (0 . 0) (2 . 2) (#f . #f) (1 . 1))))