[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/lua-mode 4141c85 222/468: Make builtin font-locking more s
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/lua-mode 4141c85 222/468: Make builtin font-locking more stable; enable it after ".." operator |
Date: |
Thu, 5 Aug 2021 04:58:40 -0400 (EDT) |
branch: elpa/lua-mode
commit 4141c85a3e23a7c1e9ba4b9cfb614a5b3375582b
Author: immerrr <immerrr+lua@gmail.com>
Commit: immerrr <immerrr+lua@gmail.com>
Make builtin font-locking more stable; enable it after ".." operator
Instability was caused by an attempt to handle multiline 'funcname'
nonterminals which is useless unless font-lock region is expanded
properly.
---
ert-tests/test-builtin-font-lock.el | 30 ++++++++++++++++++++++++++++++
lua-mode.el | 10 ++++++----
2 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/ert-tests/test-builtin-font-lock.el
b/ert-tests/test-builtin-font-lock.el
index f170c83..3f35940 100644
--- a/ert-tests/test-builtin-font-lock.el
+++ b/ert-tests/test-builtin-font-lock.el
@@ -6,6 +6,36 @@
"lua-font-lock-test-helpers.el"))
+(ert-deftest lua-font-lock-builtins ()
+ (should-lua-font-lock-equal
+ "\
+table.sort(foobar)
+ table.sort(foobar)
+ table .sort(foobar)
+ table. sort(foobar)"
+ '(("table" builtin "sort" builtin)
+ ("table" builtin "sort" builtin)
+ ("table" builtin "sort" builtin)
+ ("table" builtin "sort" builtin)))
+
+ (should-lua-font-lock-equal
+ ;; Neither of these should be highlighted, thing that looks like a builtin
+ ;; is in fact a member of some user table.
+ "\
+foo.table.sort(foobar)
+foo. table.sort(foobar)
+foo .table.sort(foobar)
+foo:table.sort(foobar)
+foo: table.sort(foobar)
+foo :table.sort(foobar)"
+ '(nil nil nil nil nil nil))
+
+ (should-lua-font-lock-equal
+ ;; After concatenation operator builtins should be highlighted too.
+ "a .. table.concat(foobar, delim)"
+ '(("table" builtin "concat" builtin))))
+
+
(ert-deftest lua-font-lock-builtin-constants()
(should-lua-font-lock-equal
"a = { nil, true, false}"
diff --git a/lua-mode.el b/lua-mode.el
index bf20c05..59a6a0a 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -394,11 +394,13 @@ traceback location."
"")))
(concat
- ;; common prefix - beginning-of-line or neither of [ '.', ':' ] to
- ;; exclude "foo.string.rep"
- "\\(?:\\`\\|[^:. \n\t]\\)"
+ ;; common prefix:
+ ;; - beginning-of-line
+ ;; - or neither of [ '.', ':' ] to exclude "foo.string.rep"
+ ;; - or concatenation operator ".."
+ "\\(?:^\\|[^:. \t]\\|[.][.]\\)"
;; optional whitespace
- "[ \n\t]*"
+ "[ \t]*"
"\\(?:"
;; any of modules/functions
(mapconcat (lambda (x) (concat (module-name-re x)
- [nongnu] elpa/lua-mode d128a74 170/468: Add initial version of test/indentation/README.md, (continued)
- [nongnu] elpa/lua-mode d128a74 170/468: Add initial version of test/indentation/README.md, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4399254 177/468: Merge pull request #39, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 08ff6ea 183/468: Merge remote-tracking branch 'origin/master', Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8aa98ae 185/468: Non-functional refactoring, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 7605d2c 186/468: lua-font-lock-keywords: rewrite poorly written regexp (issue #47), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c24f16e 188/468: Put Lua reference resources into TODO file, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 5d81110 196/468: Wrap symbols required during compilation into (eval-when compile ...), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 040bc8f 213/468: Bump NEWS, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 1d8dc55 214/468: Rename lua--function-name-rx, use it in font-lock keywords init, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d552910 218/468: Add a test for defun font-locking; add make check target to run it, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4141c85 222/468: Make builtin font-locking more stable; enable it after ".." operator,
Philip Kaludercic <=
- [nongnu] elpa/lua-mode 1716660 223/468: Fix interaction with electric-pair-mode (issue #54), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 4217513 230/468: Remove highlighting of numbers for consistency with other major-modes, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 248bea3 233/468: Remove syntax hacks for '.' & '_' characters, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode c5e9620 238/468: Fix stacktrace parsing in inferior process buffer, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode f834c21 105/468: lua-mark-all-multiline-literals: fix missed rename, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode aec4eea 117/468: lua-mark/-unmark-all-multiline-literals: fix error occurring on empty buffer (fixes #4 ?), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 535ca1b 128/468: lua-mark-char-multiline-delim, lua-unmark-multiline-literals: inhibit after-change-functions to avoid running automarking twice on the same text, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode bb9330f 132/468: Fix string contents indentation (issue #6), Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode d57fdaf 134/468: String content indentation: put back code that forbidden ANY indentation unless it's enabled, Philip Kaludercic, 2021/08/05
- [nongnu] elpa/lua-mode 8435a96 137/468: Major modifications to indentation logic., Philip Kaludercic, 2021/08/05