[PATCH] D68002: [emacs] simplify and improve keyword highlighting in tablegen-mode.el

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 22:29:40 PDT 2019


MaskRay accepted this revision.
MaskRay added a comment.
This revision is now accepted and ready to land.

> This is unnecessary, because those regular expressions already include word boundaries.

Yes, `(regexp-opt ... 'words)` includes word boundaries.

Raw type-kw and kw can be used because of this rule in `(elisp) Search-based Fontification`:

     Each element of ‘font-lock-keywords’ should have one of these forms:
  
  ‘REGEXP’
       Highlight all matches for REGEXP using ‘font-lock-keyword-face’.
       For example,
  
            ;; Highlight occurrences of the word ‘foo’
            ;; using ‘font-lock-keyword-face’.
            "\\<foo\\>"
  
       Be careful when composing these regular expressions; a poorly
       written pattern can dramatically slow things down!  The function
       ‘regexp-opt’ (*note Regexp Functions::) is useful for calculating
       optimal regular expressions to match several keywords.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68002/new/

https://reviews.llvm.org/D68002





More information about the llvm-commits mailing list