Bug 333608 - [PATCH] Prolog highlighting marks Swi-Prolog 7.x new dict syntax as warning
Summary: [PATCH] Prolog highlighting marks Swi-Prolog 7.x new dict syntax as warning
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: syntax (show other bugs)
Version: Git
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-19 06:46 UTC by Raivo Laanemets
Modified: 2014-06-07 13:45 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 4.14
Sentry Crash Report:


Attachments
Pathc to remove dot warning in relevant contexts. (1.68 KB, patch)
2014-04-19 06:50 UTC, Raivo Laanemets
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Raivo Laanemets 2014-04-19 06:46:36 UTC
Swi-Prolog (a rather popular Prolog implementation) uses special syntax involving the dot (.) operator for their new dict feature:
http://swi-prolog.org/pldoc/man?section=dicts

Current Kate's Prolog highlighter marks such usages of dot as warnings. This makes it harder to see actual warnings.

Reproducible: Always

Steps to Reproduce:
1. Enter p:- (a -> X = Y.c ; true) into a new file.
2. Save file as a Prolog file.
Actual Results:  
Observe that dot in X.c is marked as warning (red background).

Expected Results:  
Dot in X.c should not be marked as a warning.

I have created a patch that removes dot warning markers in the relevant contexts (nested, curly, nested_expr). Nested context: usually inside if-then-else (->;), curly: inside dicts themself and dcg {} blocks, nested_expr: arithmetic expressions like X is A * (Y.c + 3). I have tested it with some files.

Previously I used a workaround by avoiding the dot operator but recent changes in Swi made that impossible:
http://swi-prolog.996271.n3.nabble.com/Ann-SWI-Prolog-7-1-13-td14825.html
Comment 1 Raivo Laanemets 2014-04-19 06:50:09 UTC
Created attachment 86164 [details]
Pathc to remove dot warning in relevant contexts.

Uploading possible patch.
Comment 2 Dominik Haumann 2014-04-29 18:51:31 UTC
@Raivo: Is there any negative side effect of this patch? Otherwise, we'll commit this.
Comment 3 Raivo Laanemets 2014-05-02 09:24:20 UTC
@Dominik: I hoped to get a comment from the original author (added to CC) but that has not happened. This is my first time to modify an highlight file. Someone with a deeper knowledge of highlight definitions should review my patch that it does exactly what it says: removes 3 warning markers. As far as I see it does not touch any other rules or context transitions and thus can't have negative side effects. I use the patched file on my system and daily work on Prolog projects using Kate, no issues so far.
Comment 4 Torsten Eichstädt 2014-05-15 14:37:00 UTC
answer(Patch) :-
        Patch is ok + well.done;
        commit(Patch).
Comment 5 Dominik Haumann 2014-06-07 13:38:25 UTC
Git commit ab1e932a6d9ea88b2219f23f3a5b0628ba7d5fce by Dominik Haumann.
Committed on 07/06/2014 at 13:37.
Pushed by dhaumann into branch 'master'.

fix: Prolog highlighting marks Swi-Prolog 7.x new dict syntax as warning

Thanks to Raivo Laanemets for the patch!

M  +1    -4    part/syntax/data/prolog.xml

http://commits.kde.org/kate/ab1e932a6d9ea88b2219f23f3a5b0628ba7d5fce
Comment 6 Dominik Haumann 2014-06-07 13:39:33 UTC
Git commit babe8751b504200a354029216c1250aaf8fc3d3d by Dominik Haumann.
Committed on 07/06/2014 at 13:38.
Pushed by dhaumann into branch 'master'.

fix: Prolog highlighting marks Swi-Prolog 7.x new dict syntax as warning

M  +1    -4    src/syntax/data/prolog.xml

http://commits.kde.org/ktexteditor/babe8751b504200a354029216c1250aaf8fc3d3d