about summary refs log tree commit diff homepage
path: root/utils/emacs
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-05-21 04:36:41 +0000
commit6f290d8f9e9d7faac295cb51fc96884a18f4ded4 (patch)
tree46e7d426abc0c9f06ac472ac6f7f9e661b5d78cb /utils/emacs
parenta55960edd4dcd7535526de8d2277642522aa0209 (diff)
downloadklee-6f290d8f9e9d7faac295cb51fc96884a18f4ded4.tar.gz
Initial KLEE checkin.
 - Lots more tweaks, documentation, and web page content is needed,
   but this should compile & work on OS X & Linux.


git-svn-id: https://llvm.org/svn/llvm-project/klee/trunk@72205 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/emacs')
-rw-r--r--utils/emacs/klee-pc-mode.el64
1 files changed, 64 insertions, 0 deletions
diff --git a/utils/emacs/klee-pc-mode.el b/utils/emacs/klee-pc-mode.el
new file mode 100644
index 00000000..a398adbf
--- /dev/null
+++ b/utils/emacs/klee-pc-mode.el
@@ -0,0 +1,64 @@
+(provide 'klee-pc-mode)
+
+(require 'font-lock)
+
+(defvar klee-pc-mode-syntax-table nil 
+  "Syntax table used while in ft-bt mode.")
+
+;;; --------------------------------------------------
+;;;setup the syntax table
+;;; --------------------------------------------------
+(unless klee-pc-mode-syntax-table
+  (setq klee-pc-mode-syntax-table (make-syntax-table))
+  ;;misc
+  (modify-syntax-entry ?\_   "w"       klee-pc-mode-syntax-table)
+  (modify-syntax-entry ?\.   "."       klee-pc-mode-syntax-table))
+
+;;;------------------------------------------------------------
+;;; local keymap
+;;;------------------------------------------------------------
+
+(defvar klee-pc-local-keymap nil)
+
+;;; --------------------------------------------------
+;;; set keywords
+;;; --------------------------------------------------
+
+(defvar klee-pc-mode-font-lock-keywords
+  (list
+   ;; Comments
+   '("#.*" . font-lock-comment-face)
+   ;; Identifiers
+   '("%[_a-zA-Z][a-zA-Z_.0-9]*" . font-lock-variable-name-face)
+   ;; Numbers
+   '("[+-]?0b[01_]+" . font-lock-preprocessor-face)
+   '("[+-]?0o[0-7_]+" . font-lock-preprocessor-face)
+   '("[+-]?0x[a-zA-Z0-9_]+" . font-lock-preprocessor-face)
+   '("[+-]?[0-9]+" . font-lock-preprocessor-face)
+   ;; Keywords
+   '("\\bdef\\b\\|\\bvar\\b\\|\\btrue\\b\\|\\barray\\b\\|\\bfalse\\b\\|\\bquery\\b\\|\\bdefine\\b\\|\\bdeclare\\b" . font-lock-keyword-face)
+   )
+  "klee-PC mode keywords")
+
+;;; --------------------------------------------------
+;;; major mode function
+;;; --------------------------------------------------
+(defun klee-pc-mode ()
+  "Switch to the klee-pc major mode"
+  (interactive)
+  (kill-all-local-variables)
+  (setq major-mode 'klee-pc-mode)
+  (setq mode-name "klee-pc")
+
+  ;; handle keymap
+  (use-local-map klee-pc-local-keymap)
+
+  ;;handle syntax table
+  (set-syntax-table klee-pc-mode-syntax-table)
+  ;;handle fontlock
+  (make-local-variable 'font-lock-defaults)
+  (setq font-lock-defaults '(klee-pc-mode-font-lock-keywords
+			     nil t))
+
+  ;;handle hook
+  (run-hooks 'klee-pc-mode-hook))