llvm.org GIT mirror llvm / 7e28460
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 Misha Brukman 9 years ago
2 changed file(s) with 17 addition(s) and 14 deletion(s). Raw diff Collapse all Expand all
1818 ;; Unnamed variable slots
1919 '("%[-]?[0-9]+" . font-lock-variable-name-face)
2020 ;; Types
21 '("\\bvoid\\b\\|\\bi[0-9]+\\b\\|\\float\\b\\|\\bdouble\\b\\|\\btype\\b\\|\\blabel\\b\\|\\bopaque\\b" . font-lock-type-face)
21 `(,(regexp-opt '("void" "i[0-9]+" "float" "double" "type" "label" "opaque") 'words) . font-lock-type-face)
2222 ;; Integer literals
2323 '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
2424 ;; Floating point constants
2626 ;; Hex constants
2727 '("\\b0x[0-9A-Fa-f]+\\b" . font-lock-preprocessor-face)
2828 ;; Keywords
29 '("\\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)
29 `(,(regexp-opt '("begin" "end" "true" "false" "zeroinitializer" "declare"
30 "define" "global" "constant" "const" "internal" "linkonce" "linkonce_odr"
31 "weak" "weak_odr" "appending" "uninitialized" "implementation" "..."
32 "null" "undef" "to" "except" "not" "target" "endian" "little" "big"
33 "pointersize" "deplibs" "volatile" "fastcc" "coldcc" "cc") 'words) . font-lock-keyword-face)
3034 ;; Arithmetic and Logical Operators
31 '("\\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)
35 `(,(regexp-opt '("add" "sub" "mul" "div" "rem" "and" "or" "xor"
36 "setne" "seteq" "setlt" "setgt" "setle" "setge") 'words) . font-lock-keyword-face)
3237 ;; Special instructions
33 '("\\bphi\\b\\|\\btail\\b\\|\\bcall\\b\\|\\bcast\\b\\|\\bselect\\b\\|\\bto\\b\\|\\bshl\\b\\|\\bshr\\b\\|\\bvaarg\\b\\|\\bvanext\\b" . font-lock-keyword-face)
38 `(,(regexp-opt '("phi" "tail" "call" "cast" "select" "to" "shl" "shr" "vaarg" "vanext") 'words) . font-lock-keyword-face)
3439 ;; Control instructions
35 '("\\bret\\b\\|\\bbr\\b\\|\\bswitch\\b\\|\\binvoke\\b\\|\\bunwind\\b\\|\\bunreachable\\b" . font-lock-keyword-face)
40 `(,(regexp-opt '("ret" "br" "switch" "invoke" "unwind" "unreachable") 'words) . font-lock-keyword-face)
3641 ;; Memory operators
37 '("\\bmalloc\\b\\|\\balloca\\b\\|\\bfree\\b\\|\\bload\\b\\|\\bstore\\b\\|\\bgetelementptr\\b" . font-lock-keyword-face)
42 `(,(regexp-opt '("malloc" "alloca" "free" "load" "store" "getelementptr") 'words) . font-lock-keyword-face)
3843 )
3944 "Syntax highlighting for LLVM"
4045 )
1111 (make-face 'td-decorators-face)
1212
1313 (defvar tablegen-font-lock-keywords
14 (let ((kw (mapconcat 'identity
15 '("class" "defm" "def" "field" "include" "in"
14 (let ((kw (regexp-opt '("class" "defm" "def" "field" "include" "in"
1615 "let" "multiclass")
17 "\\|"))
18 (type-kw (mapconcat 'identity
19 '("bit" "bits" "code" "dag" "int" "list" "string")
20 "\\|"))
16 'words))
17 (type-kw (regexp-opt '("bit" "bits" "code" "dag" "int" "list" "string")
18 'words))
2119 )
2220 (list
2321 ;; Comments
3533
3634 '("^[ \t]*\\(@.+\\)" 1 'td-decorators-face)
3735 ;; Keywords
38 (cons (concat "\\<\\(" kw "\\)\\>[ \n\t(]") 1)
36 (cons (concat kw "[ \n\t(]") 1)
3937
4038 ;; Type keywords
41 (cons (concat "\\<\\(" type-kw "\\)[ \n\t(]") 1)
39 (cons (concat type-kw "[ \n\t(]") 1)
4240 ))
4341 "Additional expressions to highlight in TableGen mode.")
4442 (put 'tablegen-mode 'font-lock-defaults '(tablegen-font-lock-keywords))