[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 94aadfd 221/468: Font-lock "nil", "true" and "fal
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 94aadfd 221/468: Font-lock "nil", "true" and "false" as constants rather than keywords |
Date: |
Thu, 5 Aug 2021 04:58:40 -0400 (EDT) |
branch: elpa/lua-mode
commit 94aadfd8f7b0414ba58de2c10b0a52da5832f43f
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Font-lock "nil", "true" and "false" as constants rather than keywords
---
Makefile | 4 +++-
ert-tests/test-builtin-font-lock.el | 18 ++++++++++++++++++
lua-mode.el | 12 ++++++++----
3 files changed, 29 insertions(+), 5 deletions(-)
diff --git a/Makefile b/Makefile
index 921b196..18b230a 100644
--- a/Makefile
+++ b/Makefile
@@ -6,7 +6,9 @@ DISTFILE = lua-mode-$(VERSION).zip
# EMACS value may be overridden
EMACS?=emacs
-TESTS=ert-tests/test-defun-font-lock.el
+TESTS=
+TESTS += ert-tests/test-defun-font-lock.el
+TESTS += ert-tests/test-builtin-font-lock.el
default:
@echo version is $(VERSION)
diff --git a/ert-tests/test-builtin-font-lock.el
b/ert-tests/test-builtin-font-lock.el
new file mode 100644
index 0000000..f170c83
--- /dev/null
+++ b/ert-tests/test-builtin-font-lock.el
@@ -0,0 +1,18 @@
+(require 'ert)
+(require 'lua-font-lock-test-helpers
+ ;; let's try a bit to help Emacs find the helpers, just in case
+ (concat (file-name-directory (or load-file-name (buffer-file-name)
+ default-directory))
+ "lua-font-lock-test-helpers.el"))
+
+
+(ert-deftest lua-font-lock-builtin-constants()
+ (should-lua-font-lock-equal
+ "a = { nil, true, false}"
+ '(("nil" constant "true" constant "false" constant)))
+
+ (should-lua-font-lock-equal
+ "a = { foo.true, foo:false }"
+ '(;; This case won't work while '.' has symbol syntax
+ ;; ("true" constant "false" constant)
+ ("false" constant))))
diff --git a/lua-mode.el b/lua-mode.el
index ca99bb8..bf20c05 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -508,11 +508,15 @@ Groups 6-9 can be used in any of argument regexps."
`(;; highlight the hash-bang line "#!/foo/bar/lua" as comment
("^#!.*$" . font-lock-comment-face)
- ;; Keywords.
+ ;; Builtin constants
+ (,(rx symbol-start (or "true" "false" "nil") symbol-end)
+ . font-lock-constant-face)
+
+ ;; Keywords
(,(rx symbol-start
- (or "and" "break" "do" "else" "elseif" "end" "false"
- "for" "function" "if" "in" "local" "nil" "not"
- "or" "repeat" "return" "then" "true" "until"
+ (or "and" "break" "do" "else" "elseif" "end"
+ "for" "function" "if" "in" "local" "not"
+ "or" "repeat" "return" "then" "until"
"while")
symbol-end)
. font-lock-keyword-face)
- [nongnu] elpa/lua-mode ff3f5e1 199/468: lua-font-lock-keywords: don't eval-when-compile initial value, (continued)
- [nongnu] elpa/lua-mode ff3f5e1 199/468: lua-font-lock-keywords: don't eval-when-compile initial value, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2a0314b 200/468: Improve multiline highlighting via font-lock-syntactic-keywords, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cd5c071 201/468: Clean up lua-mode start-up function a bit, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b195cdc 205/468: Bump TODO, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cee511c 206/468: for/local varname highlighting: match '=' at EOL properly, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode a1dc850 207/468: Post-refactoring fix: evaluate string variables in font-lock-defaults value, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8ffd075 208/468: lua-calculate-indentation-info: non-functional refactoring, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4484128 215/468: lua-calculate-indentation-override: unindent to the last block-close token, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 79e6815 216/468: Rewrite lua-beginning-of-proc, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f2e7138 220/468: Move font-lock test helpers into a separate file, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 94aadfd 221/468: Font-lock "nil", "true" and "false" as constants rather than keywords,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 617c392 224/468: make test: test both compiled and uncompiled variants, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 7157658 225/468: Create cask project; pull in ert.el to enable testing emacs23, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode ed76a6e 227/468: .gitignore: ignore all *.elc, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 67a9022 229/468: test-electric-mode: check interaction with electric-pair-skip-self flag, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode b10d6ae 232/468: Add missing modulo operator (%) to line-continuation tokens, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 2d308e8 237/468: Move "no-query-on-exit" initialization to lua-start-process, update it, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 397b883 236/468: Send code to inferior process via loadstring to avoid tempfile issues, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 24cc45e 239/468: Skip shebang line when sending to inferior buffer (issue #61), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c53d071 344/468: travis: disable git-snapshot, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode cccb649 346/468: Cask: specify minimum version for buttercup, Philip Kaludercic, 2021/08/05