defunkt / coffee-mode

Emacs Major Mode for CoffeeScript
http://ozmm.org/posts/coffee_mode.html
574 stars 147 forks source link

fix lambda regexp #330

Closed cosmicexplorer closed 8 years ago

cosmicexplorer commented 8 years ago

Add guard in regexp to allow multiple lambdas on one line.

Previously, (a) -> (b) -> would match (a) with b's arrow, resulting in a's arrow not getting highlighted by font-lock. This fixes the issue, and shouldn't create any more problems (it handles lambdas as default arguments, e.g. a = (f = (b) ->) -> as well).

old: old buggy version new: new fixed version

If you look closely and check what it matches for the string a = (f = (b) ->) ->, it really doesn't handle lambdas as default arguments appropriately (it should be using a backreference), but it still works: nested lambda example

syohex commented 8 years ago

Thanks