summaryrefslogtreecommitdiff
path: root/utils/emacs
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2007-03-27 20:23:56 +0000
committerBill Wendling <isanbard@gmail.com>2007-03-27 20:23:56 +0000
commitd4eeb800439da892c73be63919eb7a289140ced6 (patch)
treeaaaf35504509ad211a0791f5e5c24e3e4fdc393e /utils/emacs
parentccc44add81630c880197beb39a6e083f62a97d5e (diff)
downloadllvm-d4eeb800439da892c73be63919eb7a289140ced6.tar.gz
llvm-d4eeb800439da892c73be63919eb7a289140ced6.tar.bz2
llvm-d4eeb800439da892c73be63919eb7a289140ced6.tar.xz
Add better support for keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/emacs')
-rw-r--r--utils/emacs/tablegen-mode.el61
1 files changed, 40 insertions, 21 deletions
diff --git a/utils/emacs/tablegen-mode.el b/utils/emacs/tablegen-mode.el
index 56a672321e..af33cbd37f 100644
--- a/utils/emacs/tablegen-mode.el
+++ b/utils/emacs/tablegen-mode.el
@@ -1,32 +1,51 @@
;; Maintainer: The LLVM team, http://llvm.org/
;; Description: Major mode for TableGen description files (part of LLVM project)
-;; Updated: 2003-08-11
+;; Updated: 2007-03-26
+
+(require 'comint)
+(require 'custom)
+(require 'ansi-color)
;; Create mode-specific tables.
(defvar tablegen-mode-syntax-table nil
"Syntax table used while in TableGen mode.")
+(defvar td-decorators-face 'td-decorators-face
+ "Face method decorators.")
+(make-face 'td-decorators-face)
+
(defvar tablegen-font-lock-keywords
- (list
- ;; Comments
- '("\/\/.*" . font-lock-comment-face)
- ;; Strings
- '("\"[^\"]+\"" . font-lock-string-face)
- ;; Hex constants
- '("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face)
- ;; Binary constants
- '("0b[01]+" . font-lock-preprocessor-face)
- ;; Integer literals
- '("[-]?[0-9]+" . font-lock-preprocessor-face)
- ;; Floating point constants
- '("[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?" . font-lock-preprocessor-face)
- ;; Keywords
- '("include\\|def\\|let\\|in\\|code\\|dag\\|field" . font-lock-keyword-face)
- ;; Types
- '("class\\|int\\|string\\|list\\|bits?" . font-lock-type-face)
- )
- "Syntax highlighting for TableGen"
- )
+ (let ((kw (mapconcat 'identity
+ '("class" "def" "defm" "field" "in" "include"
+ "let" "multiclass")
+ "\\|"))
+ (type-kw (mapconcat 'identity
+ '("bit" "bits" "code" "dag" "int" "list" "string")
+ "\\|"))
+ )
+ (list
+ ;; Comments
+ '("\/\/" . font-lock-comment-face)
+ ;; Strings
+ '("\"[^\"]+\"" . font-lock-string-face)
+ ;; Hex constants
+ '("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face)
+ ;; Binary constants
+ '("0b[01]+" . font-lock-preprocessor-face)
+ ;; Integer literals
+ '("[-]?[0-9]+" . font-lock-preprocessor-face)
+ ;; Floating point constants
+ '("[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?" . font-lock-preprocessor-face)
+
+ '("^[ \t]*\\(@.+\\)" 1 'td-decorators-face)
+ ;; Keywords
+ (cons (concat "\\<\\(" kw "\\)\\>[ \n\t(]") 1)
+
+ ;; Type keywords
+ (cons (concat "\\<\\(" type-kw "\\)[ \n\t(]") 1)
+ ))
+ "Additional expressions to highlight in TableGen mode.")
+(put 'tablegen-mode 'font-lock-defaults '(tablegen-font-lock-keywords))
;; ---------------------- Syntax table ---------------------------
;; Shamelessly ripped from jasmin.el