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 345911 - Support for OCL files
Support for OCL files
Product: gtksourceview
Classification: Platform
Component: Syntax files
Other All
: Normal enhancement
: ---
Assigned To: GTK Sourceview maintainers
GTK Sourceview maintainers
Depends on:
Reported: 2006-06-25 22:39 UTC by Mario Carrion
Modified: 2007-07-03 10:21 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14

Proposed OCL syntax (1.40 KB, text/plain)
2006-06-25 22:40 UTC, Mario Carrion
OCL Language file (5.57 KB, text/plain)
2007-07-02 06:07 UTC, Mario Carrion
OCL Language file, fixed (5.29 KB, text/plain)
2007-07-02 19:18 UTC, Mario Carrion

Description Mario Carrion 2006-06-25 22:39:20 UTC
Object Constraint Language[1] is a formal language to describe expressions on UML models.

Comment 1 Mario Carrion 2006-06-25 22:40:25 UTC
Created attachment 67996 [details]
Proposed OCL syntax
Comment 2 Mario Carrion 2006-06-25 22:43:33 UTC
My fault, this bug doesn't belongs to gnome-mime-data, belongs to gtksourceview. Sorry
Comment 3 Mario Carrion 2006-06-25 22:47:00 UTC
Moved bug from gnome-mime-data to gtksourceview.
Comment 4 Paolo Borelli 2006-07-03 11:07:37 UTC
Thanks for the lang file.

We have a policy of holding up inclusions of lang files until the mime type is included in the mime db. I see you already filed the relative bug in, so we are blocking on:
Comment 5 Don Scorgie 2006-08-06 17:25:26 UTC
Changing default asignee and QA to gtksourceview-maint@gnome.bugs (correct asignee).  Sorry for the spam
Comment 6 Mario Carrion 2007-02-05 22:21:11 UTC
FreeDesktop team have applied the patch:
Comment 7 Paolo Borelli 2007-06-27 10:17:00 UTC
Hi Mario, sorry if this is taking so long, we were waiting for the freedesktop mime type... the next version of gtksourceview will have a new more powerful format for lang files:, can you update your file? It should be really easy in this case...

Also, to have your lang file included in gtksourceview it should licensed under LGPL license
Comment 8 Mario Carrion 2007-06-27 19:09:47 UTC
Sure Paolo. I'll update both lang file and its license as soon as possible. 
Comment 9 Mario Carrion 2007-07-02 06:07:50 UTC
Created attachment 91008 [details]
OCL Language file

Language file upgraded to use new Gtksourceview syntax.
Comment 10 Paolo Borelli 2007-07-02 08:22:33 UTC
Comment on attachment 91008 [details]
OCL Language file

File looks mostly ok, except for a couple of things noted below:

>                <!-- Comments -->
>                <context id="comment" style-ref="comment">
>                    <start>--</start>
>                    <end>$</end>
>                    <include>
>                        <context id="comment-continue">
>                            <match>\\\n</match>
>                        </context>

I have not tested, but I doubt that trying to match \n works. You probably want something like

        <context id="line-continue" style-ref="escape">

In fact that is defined in def.lang and so you should probably just use <context ref="def:line-continue"/>

>                        <context ref="def:comment:*"/>

This looks strange too... apart from the fact that I don't see any contetx matching def:comment:*, I don't think that blanket context inclusion is a good idea: in the future def: contexts could be added that you don't want there.

I think you should just include <context ref="def:in-comment"/>

>                    </include>
>                </context>
>                <!-- Strings -->
>                <context id="string" end-at-line-end="true" style-ref="string">
>                    <start>"</start>
>                    <end>"</end>
>                    <include>
>                        <context id="string-continue" style-ref="escape">
>                            <match>\\\n</match>
>                        </context>

same as above: use def:line-continue

>                        <context ref="def:c-style-escape"/>
>                    </include>
>                </context>
>		<!-- Operators used on all types -->
>                <context id="operators" style-ref="keyword">

You probably want style-ref="operators" here since you defined such style
Comment 11 Mario Carrion 2007-07-02 19:18:45 UTC
Created attachment 91052 [details]
OCL Language file, fixed

I've updated the lang file based on your comments and some other minor problems are solved.

BTW. Is possible to validate syntax with this new engine and show an error? For example show error on 

if 1 = 1

because "then" is missing due to the rule is defined as:

if 1 = 1 then
Comment 12 Paolo Borelli 2007-07-03 10:21:24 UTC
Thanks I committed the file. (with some really minor modifications, in particular we prefer to avoid using the style def:preprocessor for something like operators)

> BTW. Is possible to validate syntax with this new engine and show an error? For
> example show error on

Well, engine understands regexes, so it depends if you manage to express the error condition with a regex... for instance in C we detect '*/' when not ending a comment, but with contexts that can nest it may be way more difficult.