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

Robert Di Pardo notifications at github.com
Thu Apr 28 00:01:28 UTC 2022


> It's not something we need to implement - it's already implemented by the lexer.

To be exact, underscores denote an *unused* variable (called a "singleton"). The lexer [maps them][0] to `SCE_VISUALPROLOG_ANONYMOUS`:

~~~cpp
  } else if (sc.Match('_')) {
      sc.SetState(SCE_VISUALPROLOG_ANONYMOUS);
~~~

Only words in proper title-case [are styled][1] as `SCE_VISUALPROLOG_VARIABLE`:

~~~cpp
  } else if (isUpperLetter(sc.ch)) {
      sc.SetState(SCE_VISUALPROLOG_VARIABLE);
~~~

![vpl-singleton](https://user-images.githubusercontent.com/59004801/165650011-e7d48c7f-b1b7-4c5b-888d-746c49d6d18b.png)


[0]: https://github.com/ScintillaOrg/lexilla/blob/b7b401a2b169aa58dffa96888aca96b38c292a3c/lexers/LexVisualProlog.cxx#L431-L432
[1]: https://github.com/ScintillaOrg/lexilla/blob/b7b401a2b169aa58dffa96888aca96b38c292a3c/lexers/LexVisualProlog.cxx#L429-L430


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

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


More information about the Github-comments mailing list