summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-03-11 21:50:13 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-07-02 19:06:21 -0300
commit3468f9f2cb65294771e1095a14b7263ae0a6a043 (patch)
tree67614f274b68b36a9d5c1ee202211aac6941255c
parent371c42ab955357d586cf4501762f6e9cf1be53b8 (diff)
Update syntax highlight table and some minor tweaks including:
o Don't cause an warning due to an unused variable after macro expansion in some indentation tables. o Properly handle c++ style comments in preprocessor lines. Also highlight strings and character constants. o Change color of "quote" property in lisp mode. This is mainly due to an undesirable side effect of using the same XrmQuark in different syntax highlight definitions, causing the first one to be used, and later defined ones to be ignored.
-rw-r--r--lisp/modules/indent.lsp6
-rw-r--r--lisp/modules/progmodes/c.lsp24
-rw-r--r--lisp/modules/progmodes/lisp.lsp2
-rw-r--r--lisp/modules/xedit.lsp24
4 files changed, 43 insertions, 13 deletions
diff --git a/lisp/modules/indent.lsp b/lisp/modules/indent.lsp
index 6fd32a9..1ba8b72 100644
--- a/lisp/modules/indent.lsp
+++ b/lisp/modules/indent.lsp
@@ -1038,6 +1038,12 @@
;; Initial input already read
(go :ind-loop)
+ ;; Just to avoid a warning about unused variable, as this
+ ;; variable is somewhat redundant as code should already
+ ;; know before entering indent parser, but useful inside
+ ;; indent macros.
+ *ind-point*
+
;------------------------------------------------------------------------
; Read a text line
:ind-read
diff --git a/lisp/modules/progmodes/c.lsp b/lisp/modules/progmodes/c.lsp
index e49630e..fba6b99 100644
--- a/lisp/modules/progmodes/c.lsp
+++ b/lisp/modules/progmodes/c.lsp
@@ -1099,9 +1099,33 @@
;; Preprocessor includes comments.
(syntoken "/*" :nospec t :begin :comment :contained t)
+ ;; Ignore strings and constants in the same line and finishes table
+ ;; This is kind hackish, but must be done because the current parser
+ ;; will not flag eol. Maybe it could be extended to properly handle
+ ;; and have an internal flag to tell it to pass again if there
+ ;; is a regex that can match eol on an empty string.
+ ;; A test is already done (but at compile time) to not allow patterns
+ ;; that match an empty string (but allow patterns matching
+ ;; bol, eol or both on an empty string).
+ (syntoken "\"([^\\\"]|\\\\.)*\"$" :property *prop-string* :switch -1)
+ (syntoken "'([^']|\\\\.)*'$" :property *prop-constant* :switch -1)
+
+ ;; Ignore strings and constants in the same line
+ (syntoken "\"([^\\\"]|\\\\.)*\"" :property *prop-string*)
+ (syntoken "'([^']|\\\\.)*'" :property *prop-constant*)
+
;; Ignore lines finishing with a backslash.
(syntoken "\\\\$")
+ ;; multiline strings
+ (syntoken "\"" :nospec t :begin :string)
+
+ ;; multiline constants
+ (syntoken "'" :nospec t :begin :character)
+
+ ;; C++ style comments
+ (syntoken "//.*$" :property *prop-comment* :switch -1)
+
;; Return to previous state if end of line found.
(syntoken ".?$" :switch -1)
)
diff --git a/lisp/modules/progmodes/lisp.lsp b/lisp/modules/progmodes/lisp.lsp
index c15352b..2472b72 100644
--- a/lisp/modules/progmodes/lisp.lsp
+++ b/lisp/modules/progmodes/lisp.lsp
@@ -43,7 +43,7 @@
(defsynprop *prop-quote*
"quote"
:font "*courier-bold-r*-12-*"
- :foreground "Red3"
+ :foreground "Red4"
)
(defsynprop *prop-package*
diff --git a/lisp/modules/xedit.lsp b/lisp/modules/xedit.lsp
index 09858ef..25019ec 100644
--- a/lisp/modules/xedit.lsp
+++ b/lisp/modules/xedit.lsp
@@ -54,17 +54,19 @@
;; syntax-p, the entry is removed.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defvar *auto-modes* '(
- ("\\.(c|cc|C|cxx|h|bm|xbm|xpm|l|y)$"
+ ("\\.(c|cc|C|cxx|cpp|h|hpp|bm|xbm|xpm|l|y|h\\.in)$"
"C/C++" "c" . *c-mode*)
("\\.(li?sp|scm)$"
"Lisp/Scheme" "lisp" . *lisp-mode*)
- ("Imakefile|(\\.(cf|rules|tmpl|def|cpp)$)"
- "X imake" "imake" . *imake-mode*)
- ("[Mm]akefile.*|\\.mk$"
- "Makefile" "make" . *make-mode*)
("\\.sh$"
"Unix shell" "sh" . *sh-mode*)
- ("\\.sgml?$"
+ ("\\.(diff|patch)"
+ "Patch file" "patch" . *patch-mode*)
+ ("[Mm]akefile.*|\\.mk$"
+ "Makefile" "make" . *make-mode*)
+ ("\\.spec$"
+ "RPM spec" "rpm" . *rpm-mode*)
+ ("\\.(sgml?|dtd)$"
"SGML" "sgml" . *sgml-mode*)
("\\.html?$"
"HTML" "html" . *html-mode*)
@@ -72,14 +74,12 @@
"Man page" "man" . *man-mode*)
("app-defaults/\\w+|\\u[A-Za-z0-9_-]+\\.ad"
"X resource" "xrdb" . *xrdb-mode*)
- ("\\<XF86Config[^/]*"
+ ("\\<(XF86Config[^/]*|xorg.conf$)"
"XF86Config" "xconf" . *xconf-mode*)
- ("\\.spec$"
- "RPM spec" "rpm" . *rpm-mode*)
- ("\\<XFree86\\.\\d+\\.log$"
+ ("\\<(XFree86|Xorg)\\.\\d+\\.log$"
"XFree86 log" "xlog" . *xlog-mode*)
- ("\\.(diff|patch)"
- "Patch file" "patch" . *patch-mode*)
+ ("Imakefile|(\\.(cf|rules|tmpl|def)$)"
+ "X imake" "imake" . *imake-mode*)
))