Permalink
Browse files

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.
  • Loading branch information...
1 parent 8aa98ae commit 7605d2c3d9cd6df4c89870a54c14c2c119102a2e @immerrr committed Mar 16, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lua-mode.el
View
4 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)

0 comments on commit 7605d2c

Please sign in to comment.