See excerpt below for code used in emacs Cadence SKILL mode:
(cons (concat "\\<" (regexp-opt '("nil" "t") t) "\\>") 'font-lock-constant-face)
it does a brilliant job at highlighting nil and t.
The issue is that if I have the string " nil_finder " anywhere within the code, it would highlight the part of the word which is "nil", and keep the _finder not highlighted. I want none of the " nil_finder " highlighted.
I have tried replacing the
'symbols or with
'words, and it did not work.
I can generate my own (many/ 1 huge) regular expression(s) to get the behavior that I need, but I read the regexp-opt returns a much more efficient regexp.