[Github-comments] [geany/geany] Add Prolog filetype support (PR #3171)

Robert Di Pardo notifications at github.com
Tue Apr 26 22:04:37 UTC 2022


@techee, I think we're finally done with keywords. :+1:

Now, on to a messier issue I just detected.

In SWI-Prolog, relational operators are prefixed with `@` when used as arguments; for example, in the overloaded form of the very common [`sort` predicate][0].

Visual Prolog interprets the `@` token as the start of a verbatim string, and [Lexilla's lexer][1] imposes that style on every Prolog document:

~~~cpp
        if (sc.state == SCE_VISUALPROLOG_DEFAULT) {
            if (sc.Match('@') && isOpenStringVerbatim(sc.chNext, closingQuote)) {
                sc.SetState(SCE_VISUALPROLOG_STRING_VERBATIM);
~~~                

![geany_himbeere_swi-pl-sort-4](https://user-images.githubusercontent.com/59004801/165398111-5f5b43db-6ba2-4f95-94ec-d2604404d54e.png)

I guess Geany could always intercept or override the `SCE_VISUALPROLOG_STRING_VERBATIM` lexical class, or simply ignore it. In my view it's the lexer that needs adapting to comply better with the Prolog implementation that users will actually use. That said, I don't think this warrants an upstream patch, since the lexer is just working as advertised.


[0]: https://www.swi-prolog.org/pldoc/doc_for?object=sort/4
[1]: https://github.com/ScintillaOrg/lexilla/blob/843bb9e1688305cd64484f09bac0b0e085f4ab5d/lexers/LexVisualProlog.cxx#L420-L423

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/pull/3171#issuecomment-1110294854
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/pull/3171/c1110294854 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220426/02e27634/attachment-0001.htm>


More information about the Github-comments mailing list