mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-13 01:15:32 +00:00
Add better support for keywords.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35386 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ccc44add81
commit
d4eeb80043
@ -1,32 +1,51 @@
|
|||||||
;; Maintainer: The LLVM team, http://llvm.org/
|
;; Maintainer: The LLVM team, http://llvm.org/
|
||||||
;; Description: Major mode for TableGen description files (part of LLVM project)
|
;; 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.
|
;; Create mode-specific tables.
|
||||||
(defvar tablegen-mode-syntax-table nil
|
(defvar tablegen-mode-syntax-table nil
|
||||||
"Syntax table used while in TableGen mode.")
|
"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
|
(defvar tablegen-font-lock-keywords
|
||||||
(list
|
(let ((kw (mapconcat 'identity
|
||||||
;; Comments
|
'("class" "def" "defm" "field" "in" "include"
|
||||||
'("\/\/.*" . font-lock-comment-face)
|
"let" "multiclass")
|
||||||
;; Strings
|
"\\|"))
|
||||||
'("\"[^\"]+\"" . font-lock-string-face)
|
(type-kw (mapconcat 'identity
|
||||||
;; Hex constants
|
'("bit" "bits" "code" "dag" "int" "list" "string")
|
||||||
'("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face)
|
"\\|"))
|
||||||
;; Binary constants
|
)
|
||||||
'("0b[01]+" . font-lock-preprocessor-face)
|
(list
|
||||||
;; Integer literals
|
;; Comments
|
||||||
'("[-]?[0-9]+" . font-lock-preprocessor-face)
|
'("\/\/" . font-lock-comment-face)
|
||||||
;; Floating point constants
|
;; Strings
|
||||||
'("[-+]?[0-9]+\.[0-9]*\([eE][-+]?[0-9]+\)?" . font-lock-preprocessor-face)
|
'("\"[^\"]+\"" . font-lock-string-face)
|
||||||
;; Keywords
|
;; Hex constants
|
||||||
'("include\\|def\\|let\\|in\\|code\\|dag\\|field" . font-lock-keyword-face)
|
'("0x[0-9A-Fa-f]+" . font-lock-preprocessor-face)
|
||||||
;; Types
|
;; Binary constants
|
||||||
'("class\\|int\\|string\\|list\\|bits?" . font-lock-type-face)
|
'("0b[01]+" . font-lock-preprocessor-face)
|
||||||
)
|
;; Integer literals
|
||||||
"Syntax highlighting for TableGen"
|
'("[-]?[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 ---------------------------
|
;; ---------------------- Syntax table ---------------------------
|
||||||
;; Shamelessly ripped from jasmin.el
|
;; Shamelessly ripped from jasmin.el
|
||||||
|
Loading…
x
Reference in New Issue
Block a user