lunaryorn/puppet-mode — pull request #39 by lunaryorn (2014-03-25 16:37:18+00:00)
Title: This PR reworks the handling of regular expression literals

Puppet Mode now marks regular expressions as strings in `syntax-propertize-function`, and later applies the regular expression face in a similar way to how we handle variable expansion in strings already.

It's a lot more complicated than the old approach, but has two distinct advantages imho:

1. `forward-sexp` and friends behave more reasonably now on regexp literals. They'll treat the entire literal as a single expression, so when point is at the beginning of a regexp literal, and you press C-M-f, Emacs will move over the entire regexp literal instead of stopping at any expression inside.
2. It'll make our future SMIE grammar easier, since we can now just treat regexps as strings without having to explicitly tokenize them, which isn't that easy.

Additionally, Puppet Mode will now highlight regexp literals only when they in valid contexts, i.e. in node names, selectors, cases and after match operators, so an expression like "x / 2 > y / 5" won't be highlighted as regular expression literal anymore.