branch: elpa/lua-mode
commit 7605d2c3d9cd6df4c89870a54c14c2c119102a2e
Author: immerrr <[email protected]>
Commit: immerrr <[email protected]>
lua-font-lock-keywords: rewrite poorly written regexp (issue #47)
Said regexp caused O(4^N) match attempts on lines containing N
underscores, because underscore had 'word' syntax class.
---
lua-mode.el | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lua-mode.el b/lua-mode.el
index 8fd0b23..acd11be 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -432,8 +432,8 @@ index of respective Lua reference manuals.")
(1 font-lock-builtin-face) (2 font-lock-builtin-face nil noerror))
;; Handle function names in assignments
- '("\\(\\(\\sw:\\|\\sw\\.\\|\\sw_\\|\\sw\\)+\\)[ \t]*=[
\t]*\\(function\\)\\_>"
- (1 font-lock-function-name-face nil t) (3 font-lock-keyword-face))
+ '("\\([[:alnum:]_]+\\(?:[:.][[:alnum:]_]+\\)*\\)[ \t]*=[ \t]*function\\_>"
+ (1 font-lock-function-name-face))
;; octal numbers
'("\\_<0x[[:xdigit:]]+\\_>" . font-lock-constant-face)