Skip to content

Commit

Permalink
lua-font-lock-keywords: rewrite poorly written regexp (issue #47)
Browse files Browse the repository at this point in the history
Said regexp caused O(4^N) match attempts on lines containing N
underscores, because underscore had 'word' syntax class.
  • Loading branch information
immerrr committed Mar 16, 2013
1 parent 8aa98ae commit 7605d2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7605d2c

Please sign in to comment.