GNOME Bugzilla – Bug 697054
vala syntax highlighting confused by double quote in regexp literal
Last modified: 2016-02-07 18:20:37 UTC
Vala has experimental support for regular expression literals enclosed in slash characters. If a regexp literal contains a double quote character, the syntax highlighter erroneously considers that character to start a (highlighted) string. To see this, look at this Vala code in gedit: === test.vala === void main() { bool b = /"/.match("""haf"oop"""); stdout.puts(b.to_string() + "\n"); } === end ===
Created attachment 251663 [details] [review] Vala String literals Very simple definition, uses def:string as style.
Did you test if you get false positives with int i = 12 / 3 + c / 4; ?
Was too simple... No, doesn't work (even single slash). Is there a possibility to don't process already highlighted stuff? Perhaps a regex only whitespaces or the "=" operator and "(" are allowed is sufficient enough? Or the other way round with variable names and numbers aren't allowed.
Created attachment 320558 [details] [review] vala.lang: Add context for regular expressions The current lang file for vala is missing a context for regular expressions. This patch adds the regex definition from the javascript file which is an existing and very mature implementation. https://bugzilla.gnome.org/show_bug.cgi?id=697054 Fixes #697054
Created attachment 320580 [details] [review] vala.lang: Add context for regular expressions The current lang file for vala is missing a context for regular expressions. This patch adds the regex definition from the javascript file which is an existing and very mature implementation. https://bugzilla.gnome.org/show_bug.cgi?id=697054 Fixes #697054
Thanks!