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 707372 - Missing lines in Language Definition Tutorial
Missing lines in Language Definition Tutorial
Status: RESOLVED FIXED
Product: gtksourceview
Classification: Platform
Component: General
git master
Other All
: Normal normal
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-03 11:07 UTC by Ming Hua
Modified: 2013-09-13 11:35 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Updated c-example.lang spec file according to the tutorial (4.87 KB, application/xml)
2013-09-05 03:03 UTC, Ming Hua
  Details
Update the language definitional file to match the tutorial text (5.18 KB, patch)
2013-09-13 06:55 UTC, Ming Hua
none Details | Review
Update the language definitional file to match the tutorial text (5.25 KB, patch)
2013-09-13 07:03 UTC, Ming Hua
committed Details | Review

Description Ming Hua 2013-09-03 11:07:28 UTC
In the documentation "Language Definition v2.0 Tutorial", the full c.lang file is shown at the end of the tutorial.  However, that file is missing multiple lines, and is not even valid XML.

For example, the second line misses ">" at the end, the third line should be "<metadata>" and is completely missing, and so on.

It seems something went wrong when the file was converted to XML and added to the tutorial.  If the origional c.lang file is not available anymore, I'll help to piece together that file from the tutorial and then it should be easy to convert it to XML.

Thanks,
Ming
Comment 1 Sébastien Wilmet 2013-09-03 11:50:29 UTC
The full c.lang file from the tutorial seems outdated. I think there is no standalone version, it is only available in docs/reference/lang-tutorial.xml. The real c.lang in data/language-specs/ is much more longer.
Comment 2 Ming Hua 2013-09-03 12:58:40 UTC
(In reply to comment #1)
> The full c.lang file from the tutorial seems outdated. I think there is no
> standalone version, it is only available in docs/reference/lang-tutorial.xml.
> The real c.lang in data/language-specs/ is much more longer.

It's not exactly "outdated".  The point of the tutorial is not to write a fully featured language definition file for C, but to use C as an example to showcase the ways to define syntax components (single line comment -- //, multi-line comment -- /* */, preprocessor macro -- #, etc.).

Maybe calling it c.lang was not the best idea, let's call it c-example.lang instead.  Anyway, this file can be fully constructed from the instructions and code snippets in the tutorial, the current one is just missing some lines (and half-lines).  It's probably still valid XML though (contrary to what I said in the original report).
Comment 3 Sébastien Wilmet 2013-09-03 14:16:59 UTC
Yes, what I meant by outdated is that the full c-example.lang at the bottom was not updated when modifying other parts of the tutorial.
Comment 4 Ming Hua 2013-09-05 03:03:43 UTC
Created attachment 254148 [details]
Updated c-example.lang spec file according to the tutorial

(In reply to comment #3)
> Yes, what I meant by outdated is that the full c-example.lang at the bottom was
> not updated when modifying other parts of the tutorial.

I understand now.  Apparently the format of the language-spec file changed so much that I mistook an old version of c-example.lang as one with missing lines.

Attached is the updated version of c-example.lang that I constructed from the instructions and code snippets from the tutorial.  It passes the check-language.sh validation and works at a glance here (I didn't check all the implemented features though).  Would you please convert it to XML format and replace the outdated one in the tutorial?

Meanwhile I also found bugs in the tutorial which I'll file as a seperate report.

Thanks,
Ming
Comment 5 Ming Hua 2013-09-05 03:41:57 UTC
(In reply to comment #4)
> Meanwhile I also found bugs in the tutorial which I'll file as a seperate
> report.

Files as #707531.
Comment 6 Sébastien Wilmet 2013-09-06 11:58:33 UTC
The indentation should be 2 spaces.
You forgot one of the fix of bug #707531.

It would be nice to have a patch (created with git format-patch) for the file in docs/reference/lang-tutorial.xml, so we can see directly the differences.
Comment 7 Ming Hua 2013-09-06 15:40:24 UTC
(In reply to comment #6)
> The indentation should be 2 spaces.
> You forgot one of the fix of bug #707531.
> 
> It would be nice to have a patch (created with git format-patch) for the file
> in docs/reference/lang-tutorial.xml, so we can see directly the differences.

I didn't forgot one of the fixes, it's just my file was in XML format, not verbatim quoted format, so the "<" characters are not converted to "&lt;" yet.

I'll prepare a 2-space indentation file (note the old file in the current tutorial is 4-space, which I followed) with git format-patch in a few days.
Comment 8 Ming Hua 2013-09-13 06:55:07 UTC
Created attachment 254833 [details] [review]
Update the language definitional file to match the tutorial text

Here is the patch generated by "git format-patch".  See the git commit comment for details.
Comment 9 Ming Hua 2013-09-13 07:03:51 UTC
Created attachment 254834 [details] [review]
Update the language definitional file to match the tutorial text

This is an updated patch with an extra comment for a change I forgot to comment on last time.
Comment 10 Sébastien Wilmet 2013-09-13 11:34:40 UTC
Review of attachment 254834 [details] [review]:

Thank you very much, I've pushed the commit.