X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2Femacs%2Ftablegen-mode.el;h=3853ce66a2850ad6d560a01f9c27e691cdd45677;hb=867fe8570f299a058f155f98646d85cabc27155b;hp=fdf8b3f444393ee3556243864d103a85641155cb;hpb=83870769c60b878fe03c04b853164b7404fa506f;p=oota-llvm.git diff --git a/utils/emacs/tablegen-mode.el b/utils/emacs/tablegen-mode.el index fdf8b3f4443..3853ce66a28 100644 --- a/utils/emacs/tablegen-mode.el +++ b/utils/emacs/tablegen-mode.el @@ -12,13 +12,11 @@ (make-face 'td-decorators-face) (defvar tablegen-font-lock-keywords - (let ((kw (mapconcat 'identity - '("class" "defm" "def" "field" "include" "in" + (let ((kw (regexp-opt '("class" "defm" "def" "field" "include" "in" "let" "multiclass") - "\\|")) - (type-kw (mapconcat 'identity - '("bit" "bits" "code" "dag" "int" "list" "string") - "\\|")) + 'words)) + (type-kw (regexp-opt '("bit" "bits" "code" "dag" "int" "list" "string") + 'words)) ) (list ;; Comments @@ -26,20 +24,20 @@ ;; Strings '("\"[^\"]+\"" . font-lock-string-face) ;; Hex constants - '("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face) + '("\\<0x[0-9A-Fa-f]+\\>" . font-lock-preprocessor-face) ;; Binary constants - '("0b[01]+" . font-lock-preprocessor-face) + '("\\<0b[01]+\\>" . font-lock-preprocessor-face) ;; Integer literals - '("[-]?[0-9]+" . font-lock-preprocessor-face) + '("\\<[-]?[0-9]+\\>" . font-lock-preprocessor-face) ;; Floating point constants - '("[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?" . font-lock-preprocessor-face) + '("\\<[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?\\>" . font-lock-preprocessor-face) '("^[ \t]*\\(@.+\\)" 1 'td-decorators-face) ;; Keywords - (cons (concat "\\<\\(" kw "\\)\\>[ \n\t(]") 1) + (cons (concat kw "[ \n\t(]") 1) ;; Type keywords - (cons (concat "\\<\\(" type-kw "\\)[ \n\t(]") 1) + (cons (concat type-kw "[ \n\t(]") 1) )) "Additional expressions to highlight in TableGen mode.") (put 'tablegen-mode 'font-lock-defaults '(tablegen-font-lock-keywords)) @@ -112,6 +110,8 @@ ) (set-syntax-table tablegen-mode-syntax-table) + (make-local-variable 'comment-start) + (setq comment-start "//") (run-hooks 'tablegen-mode-hook)) ; Finally, this permits the user to ; customize the mode with a hook.