0

incorrect parsing of UTF-8 Javascript variable names

Leonard Hecker il y a 11 ans mis à jour il y a 11 ans 1
Sublime Text's rules are incorrect and don't work with UTF-8 characters. For instance the rule:
([a-zA-Z_?$][\w?$]*)\s*(=)\s*(function)\s*(\()(.*?)(\))
which should "match stuff like: play = function() { … }".
But Javascript allows much more valid characters - see: http://stackoverflow.com/a/9337047

A rule like
([^\s\d]\S*)\s*(=)\s*(function)\s*(\()(.*?)(\))
is also incorrect, but works much better than the current one.

If I replace those 3
([a-zA-Z_?.$][\w?.$]*)
([a-zA-Z_?$][\w?$]*)
([a-zA-Z_$]\w*)
in JavaScript/JavaScript.tmLanguage with
([^\s\d]\S*)
it works again.