diff options
-rw-r--r-- | src/guile/skribilo/source/c-lex.l | 9 | ||||
-rw-r--r-- | src/guile/skribilo/source/c-lex.scm | 8 |
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)))) |