[emacs] llvm-mode: fix parens, font-lock i*

In llvm-mode, with electric-pair-mode turned on, typing a literal '['
would print out '[[', and '(' would print a '(('. This was a very
annoying bug caused by overzealous syntax-table entries: the parens are
already part of the '(' and ')' class by default. Fix this.

While at it, notice that i32, i64, i1 etc. are not font-locked despite a
clear intent to do so. The issue is that regexp-opt doesn't accept
regular expressions. So, spell out the common literal integers with
different widths.

Differential Revision: http://reviews.llvm.org/D7036

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226931 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Ramkumar Ramachandra
2015-01-23 19:45:35 +00:00
parent 66e2ddc870
commit ae597a058a

View File

@ -23,7 +23,7 @@
;; Unnamed variable slots ;; Unnamed variable slots
'("%[-]?[0-9]+" . font-lock-variable-name-face) '("%[-]?[0-9]+" . font-lock-variable-name-face)
;; Types ;; Types
`(,(regexp-opt '("void" "i[0-9]+" "float" "double" "type" "label" "opaque") 'words) . font-lock-type-face) `(,(regexp-opt '("void" "i1" "i8" "i16" "i32" "i64" "i128" "float" "double" "type" "label" "opaque") 'words) . font-lock-type-face)
;; Integer literals ;; Integer literals
'("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face) '("\\b[-]?[0-9]+\\b" . font-lock-preprocessor-face)
;; Floating point constants ;; Floating point constants
@ -83,7 +83,7 @@
;; word constituents (`w') ;; word constituents (`w')
;;[?< "w"] ;;[?< "w"]
;;[?> "w"] ;;[?> "w"]
[?\% "w"] [?% "w"]
;;[?_ "w "] ;;[?_ "w "]
;; comments ;; comments
[?\; "< "] [?\; "< "]
@ -93,16 +93,9 @@
;; symbol constituents (`_') ;; symbol constituents (`_')
;; punctuation (`.') ;; punctuation (`.')
;; open paren (`(') ;; open paren (`(')
[?\( "("]
[?\[ "("]
[?\{ "("]
;; close paren (`)') ;; close paren (`)')
[?\) ")"]
[?\] ")"]
[?\} ")"]
;; string quote ('"') ;; string quote ('"')
[?\" "\""] [?\" "\""]))))
))))
;; --------------------- Abbrev table ----------------------------- ;; --------------------- Abbrev table -----------------------------