diff lisp/comint/gdb.el @ 171:929b76928fce r20-3b12

Import from CVS: tag r20-3b12
author cvs
date Mon, 13 Aug 2007 09:47:52 +0200
parents 15872534500d
children e45d5e7c476e
line wrap: on
line diff
--- a/lisp/comint/gdb.el	Mon Aug 13 09:47:00 2007 +0200
+++ b/lisp/comint/gdb.el	Mon Aug 13 09:47:52 2007 +0200
@@ -214,6 +214,29 @@
 			     (not gdb-display-mode)
 			   (> (prefix-numeric-value arg) 0))))
 
+;; Using cc-mode's syntax table is broken.
+(defvar gdb-mode-syntax-table nil
+  "Syntax table for GDB mode.")
+
+;; This is adapted from CC Mode 5.11.
+(unless gdb-mode-syntax-table
+  (setq gdb-mode-syntax-table (make-syntax-table))
+  ;; DO NOT TRY TO SET _ (UNDERSCORE) TO WORD CLASS!
+  (modify-syntax-entry ?_  "_" gdb-mode-syntax-table)
+  (modify-syntax-entry ?\\ "\\" gdb-mode-syntax-table)
+  (modify-syntax-entry ?+  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?-  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?=  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?%  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?<  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?>  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?&  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?|  "." gdb-mode-syntax-table)
+  (modify-syntax-entry ?\' "\"" gdb-mode-syntax-table)
+  ;; add extra comment syntax
+  (modify-syntax-entry ?/  ". 14"  gdb-mode-syntax-table)
+  (modify-syntax-entry ?*  ". 23"  gdb-mode-syntax-table))
+
 
 (defun gdb-mode ()
   "Major mode for interacting with an inferior Gdb process.
@@ -243,9 +266,7 @@
   (interactive)
   (comint-mode)
   (use-local-map gdb-mode-map)
-  (when (not c-mode-syntax-table)
-    (require 'cc-lang))
-  (set-syntax-table c-mode-syntax-table)
+  (set-syntax-table gdb-mode-syntax-table)
   (make-local-variable 'gdb-last-frame-displayed-p)
   (make-local-variable 'gdb-last-frame)
   (make-local-variable 'gdb-delete-prompt-marker)