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

Robert Di Pardo notifications at github.com
Fri May 6 07:23:10 UTC 2022


@techee,
> > Upshot: you'll need to merge SCE_VISUALPROLOG_ANONYMOUS and SCE_VISUALPROLOG_VARIABLE into one style to emulate what Vim does:
>
> So should we do that?

Yes, that looks right. "Interpretive" styles like muted colours for singletons have some value for learners, but Prologists won't need visual aids.

> There seem to be many lexers having configuration options like this so I don't expect there would be a problem upstream. If it works as expected here, I'll send a patch upstream.

Your PR will need [unit tests], and, to separate the mutually incompatible lexer options, those will need to be configured with [conditional properties]. There are no existing Prolog lexer tests, so a language-specific `SciTE.properties` is also needed.

It's [now possible][1] to easily assign lexer properties to a definite number of diverse file types, like this:

~~~
lexer.*.pro;*.P;*.pl=visualprolog
~~~

The test file doesn't have to be a coherent program. Like [AllStyles.rb], it can simply iterate all the lexical classes. The same content can be saved twice, once each with the *.pro and *.pl extensions. The feature under test is that, for example, a sequence like `@"verbatim string"` maps to `SCE_VISUALPROLOG_STRING_VERBATIM` in the *.pro file only, whereas the same text in the *.pl file is lexed with `@` styled as `SCE_VISUALPROLOG_OPERATOR` and the rest as `SCE_VISUALPROLOG_STRING`.  Separating properties [by file type][2] can be done like this:

~~~ini
# Visual Prolog properties
match test01.pro
    lexer.visualprolog.verbatim.strings=1
    lexer.visualprolog.backquoted.strings=0

# ISO/SWI-Prolog properties
match test01.pl
    lexer.visualprolog.verbatim.strings=0
    lexer.visualprolog.backquoted.strings=1
~~~

You can simply copy the keyword groups from SciTE's [default configuration], and assign them all to the *.pro extension. Leftover keyword groups can be filled with SWI-Prolog lexemes and assigned to the *.pl extension.


[unit tests]: https://github.com/ScintillaOrg/lexilla/blob/master/test#readme
[conditional properties]: https://github.com/ScintillaOrg/lexilla/commit/1499a42c12e454e8d6e3c1a6ada1ddc3a52e0407
[default configuration]: https://sourceforge.net/p/scintilla/scite/ci/default/tree/src/visualprolog.properties
[AllStyles.rb]: https://github.com/ScintillaOrg/lexilla/blob/master/test/examples/ruby/AllStyles.rb
[0]: https://github.com/ScintillaOrg/lexilla/commit/1499a42c12e454e8d6e3c1a6ada1ddc3a52e0407
[1]: https://github.com/ScintillaOrg/lexilla/commit/ef547f878b41e45612c7f14d0a8bdc939670572f
[2]: https://github.com/ScintillaOrg/lexilla/commit/2c9e00442f1876254694ebb2fd6ae4f9ab1a5662


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

Message ID: <geany/geany/pull/3171/c1119331035 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.geany.org/pipermail/github-comments/attachments/20220506/08f771dd/attachment.htm>


More information about the Github-comments mailing list