After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 697054 - vala syntax highlighting confused by double quote in regexp literal
vala syntax highlighting confused by double quote in regexp literal
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: Syntax files
3.7.x
Other Linux
: Normal minor
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2013-04-01 16:29 UTC by Adam Dingle
Modified: 2016-02-07 18:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Vala String literals (1.67 KB, patch)
2013-08-14 22:50 UTC, Dominique Lasserre
needs-work Details | Review
vala.lang: Add context for regular expressions (2.63 KB, patch)
2016-02-06 20:55 UTC, Tobias Schönberg
none Details | Review
vala.lang: Add context for regular expressions (2.71 KB, patch)
2016-02-07 18:08 UTC, Tobias Schönberg
committed Details | Review

Description Adam Dingle 2013-04-01 16:29:25 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 ===
Comment 1 Dominique Lasserre 2013-08-14 22:50:11 UTC
Created attachment 251663 [details] [review]
Vala String literals

Very simple definition, uses def:string as style.
Comment 2 Paolo Borelli 2013-08-15 05:55:33 UTC
Did you test if you get false positives with 


int i = 12 / 3 + c / 4;

?
Comment 3 Dominique Lasserre 2013-08-15 18:23:39 UTC
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.
Comment 4 Tobias Schönberg 2016-02-06 20:55:00 UTC
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
Comment 5 Tobias Schönberg 2016-02-07 18:08:55 UTC
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
Comment 6 Paolo Borelli 2016-02-07 18:20:22 UTC
Thanks!