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 741305 - Scanner issue with enum containing value ='{'
Scanner issue with enum containing value ='{'
Status: RESOLVED FIXED
Product: gtk-doc
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: 1.22
Assigned To: gtk-doc maintainers
gtk-doc maintainers
Depends on:
Blocks:
 
 
Reported: 2014-12-09 17:58 UTC by Xavier Claessens
Modified: 2014-12-29 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Special case fo FOO = '}' in enumerations (947 bytes, patch)
2014-12-12 21:01 UTC, Xavier Claessens
needs-work Details | Review
Special case for FOO = '}' in enumerations (997 bytes, patch)
2014-12-12 21:31 UTC, Xavier Claessens
committed Details | Review
Special case for FOO = '}' in enumerations (1014 bytes, patch)
2014-12-29 14:51 UTC, Stefan Sauer (gstreamer, gtkdoc dev)
committed Details | Review

Description Xavier Claessens 2014-12-09 17:58:35 UTC
GLib's GTokenType doc does not contain all enum values, the scanner stops parsing values when it encounters:

  G_TOKEN_LEFT_CURLY		= '{',
  G_TOKEN_RIGHT_CURLY		= '}',

It works if I replace those 2 lines with

  G_TOKEN_LEFT_CURLY        = 0x7b, /* gtk-doc doesn't like '{' */
  G_TOKEN_RIGHT_CURLY        = 0x7d, /* gtk-doc doesn't like '}' */
Comment 1 Xavier Claessens 2014-12-12 20:42:04 UTC
As far as I understand, the bug is in gtkdoc-common.pl, ParseEnumDeclaration.

while ($declaration =~ m/\s*([^,\}]+)([,\}])/msg)

That would indeed treat = '}' as the end of the enum.
Comment 2 Xavier Claessens 2014-12-12 21:01:27 UTC
Created attachment 292635 [details] [review]
Special case fo FOO = '}' in enumerations
Comment 3 Allison Karlitskaya (desrt) 2014-12-12 21:11:33 UTC
Review of attachment 292635 [details] [review]:

::: gtkdoc-common.pl.in
@@ +281,3 @@
+    # See https://bugzilla.gnome.org/show_bug.cgi?id=741305
+
+    $declaration =~ s/\'\}\'/\'\'/g;

Looks like you're missing a slash at the end there.  Should read //g if I understand your intent correctly.

I'd also argue that this approach is ugly, except I look up a couple of lines and see more of the same...
Comment 4 Allison Karlitskaya (desrt) 2014-12-12 21:15:01 UTC
Review of attachment 292635 [details] [review]:

I'd maybe consider dropping any single character you find between single quotes... the comment on the stanza just above makes me believe that ',' could also be problematic.
Comment 5 Xavier Claessens 2014-12-12 21:31:30 UTC
Created attachment 292640 [details] [review]
Special case for FOO = '}' in enumerations
Comment 6 Stefan Sauer (gstreamer, gtkdoc dev) 2014-12-29 14:51:03 UTC
The following fix has been pushed:
fb2f1b9 Special case for FOO = '}' in enumerations
Comment 7 Stefan Sauer (gstreamer, gtkdoc dev) 2014-12-29 14:51:11 UTC
Created attachment 293440 [details] [review]
Special case for FOO = '}' in enumerations