mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-28 04:33:05 +00:00
Using regexp-opt for keyword regex declarations makes the word lists more
readable and easier to edit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114308 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
313a94c3d0
commit
7e28460ee9
@ -19,7 +19,7 @@
|
||||
;; Unnamed variable slots
|
||||
'("%[-]?[0-9]+" . font-lock-variable-name-face)
|
||||
;; Types
|
||||
'("\\bvoid\\b\\|\\bi[0-9]+\\b\\|\\float\\b\\|\\bdouble\\b\\|\\btype\\b\\|\\blabel\\b\\|\\bopaque\\b" . font-lock-type-face)
|
||||
`(,(regexp-opt '("void" "i[0-9]+" "float" "double" "type" "label" "opaque") 'words) . font-lock-type-face)
|
||||
;; Integer literals
|
||||
'("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
|
||||
;; Floating point constants
|
||||
@ -27,15 +27,20 @@
|
||||
;; Hex constants
|
||||
'("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
|
||||
;; Keywords
|
||||
'("\\bbegin\\b\\|\\bend\\b\\|\\btrue\\b\\|\\bfalse\\b\\|\\bzeroinitializer\\b\\|\\bdeclare\\b\\|\\bdefine\\b\\|\\bglobal\\b\\|\\bconstant\\b\\|\\bconst\\b\\|\\binternal\\b\\|\\blinkonce\\b\\|\\blinkonce_odr\\b\\|\\bweak\\b\\|\\bweak_odr\\b\\|\\bappending\\b\\|\\buninitialized\\b\\|\\bimplementation\\b\\|\\b\\.\\.\\.\\b\\|\\bnull\\b\\|\\bundef\\b\\|\\bto\\b\\|\\bexcept\\b\\|\\bnot\\b\\|\\btarget\\b\\|\\bendian\\b\\|\\blittle\\b\\|\\bbig\\b\\|\\bpointersize\\b\\|\\bdeplibs\\b\\|\\bvolatile\\b\\|\\bfastcc\\b\\|\\bcoldcc\\b\\|\\bcc\\b" . font-lock-keyword-face)
|
||||
`(,(regexp-opt '("begin" "end" "true" "false" "zeroinitializer" "declare"
|
||||
"define" "global" "constant" "const" "internal" "linkonce" "linkonce_odr"
|
||||
"weak" "weak_odr" "appending" "uninitialized" "implementation" "..."
|
||||
"null" "undef" "to" "except" "not" "target" "endian" "little" "big"
|
||||
"pointersize" "deplibs" "volatile" "fastcc" "coldcc" "cc") 'words) . font-lock-keyword-face)
|
||||
;; Arithmetic and Logical Operators
|
||||
'("\\badd\\b\\|\\bsub\\b\\|\\bmul\\b\\|\\bdiv\\b\\|\\brem\\b\\|\\band\\b\\|\\bor\\b\\|\\bxor\\b\\|\\bset\\(ne\\b\\|\\beq\\b\\|\\blt\\b\\|\\bgt\\b\\|\\ble\\b\\|\\bge\\b\\)" . font-lock-keyword-face)
|
||||
`(,(regexp-opt '("add" "sub" "mul" "div" "rem" "and" "or" "xor"
|
||||
"setne" "seteq" "setlt" "setgt" "setle" "setge") 'words) . font-lock-keyword-face)
|
||||
;; Special instructions
|
||||
'("\\bphi\\b\\|\\btail\\b\\|\\bcall\\b\\|\\bcast\\b\\|\\bselect\\b\\|\\bto\\b\\|\\bshl\\b\\|\\bshr\\b\\|\\bvaarg\\b\\|\\bvanext\\b" . font-lock-keyword-face)
|
||||
`(,(regexp-opt '("phi" "tail" "call" "cast" "select" "to" "shl" "shr" "vaarg" "vanext") 'words) . font-lock-keyword-face)
|
||||
;; Control instructions
|
||||
'("\\bret\\b\\|\\bbr\\b\\|\\bswitch\\b\\|\\binvoke\\b\\|\\bunwind\\b\\|\\bunreachable\\b" . font-lock-keyword-face)
|
||||
`(,(regexp-opt '("ret" "br" "switch" "invoke" "unwind" "unreachable") 'words) . font-lock-keyword-face)
|
||||
;; Memory operators
|
||||
'("\\bmalloc\\b\\|\\balloca\\b\\|\\bfree\\b\\|\\bload\\b\\|\\bstore\\b\\|\\bgetelementptr\\b" . font-lock-keyword-face)
|
||||
`(,(regexp-opt '("malloc" "alloca" "free" "load" "store" "getelementptr") 'words) . font-lock-keyword-face)
|
||||
)
|
||||
"Syntax highlighting for LLVM"
|
||||
)
|
||||
|
@ -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
|
||||
@ -36,10 +34,10 @@
|
||||
|
||||
'("^[ \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))
|
||||
|
Loading…
Reference in New Issue
Block a user