On 28 May 2017 at 00:39, <
thomas_li...@hotmail.com> wrote:
> A huge overhead in using a lexer for a certain language (besides finding
> keywords, which I have addressed in another mail) is to define styles
> corresponding to the lexer-states.
>
> Some lexer states have names that are easy to guess the meaning, but others
> are more cryptic especially if you don't have an in-depth knowledge of the
> particular language.
Well, if nobody has in-depth knowledge of the language then nobody is
using the editor for it, so its probably not worth adding it to your
editor. If people are using the language then they should contribute
their expertise to the mapping, its for their own benefit.
>
> The programmer of the lexer on the other hand must have an in-depth
> knowledge of the lexer and (hopefully) also of the language in question.
> There are more than 1600 lexer states in Scintilla meaning that if I want to
> provide support for allt the laguages then I would need to figure out how
> 1600+ states in lexers for languages that I may never have heard about
> should be styled. This is an "impossible" task and it is one of the reasons
> that (fx) Notepad++ only supports a fragment of the languages that Scintilla
> supports.
See above. Not including languages can also be dependent on your
target platform and target users.
>
> Many lexers have states that seem to refer to the same lexical class (e.g.
> SCE_<language>_COMMENT) but there are more than 600 state-names (i.e. if you
> remove the SCE_<language>_ from the state names you end up with more than
> 600 different names). Some of them are most likely not intended to be
> different:
>
> SCE_<language>_DOUBLEQUOTE_STRING
> SCE_<language>_DOUBLEQUOTEDSTRING
> SCE_<language>_DOUBLEQUOTESTRING
> SCE_<language>_DOUBLESTRING
>
> But it seems that there is in any case a huge number of individual states.
> If there was only a "tractable" amout of different states it would probably
> make sense to map from states to more conceptual global "lexical classes".
>
Geany does this, but it causes issues when users want the style of a
language to look like a common editor for that language. Python users
for example. But because the individual lexer styles are mapped to
"class" styles only one language can match the favourite. Scintilla
should provide maximal flexibility, not make constraining decisions
for its users.
> The point here is that even though COMMENT is part of a large number of
> languages there are also many things that seem to exist only in one or very
> few languages.
> This is unfortunate, because it means that it is very difficult to control
> styling across languages (e.g. to set all major keywords in any language to
> "blue").
See above, making languages look similar is why Geany does it the way
it does, but as I said it has now removed the possibility of a
language looking different. It should be a decision by the user
application, preferable by user configuration, not Scintilla.
>
> Because there are so many language specific lexical classes it seems that
> the only one that can easily provide styling for a certain
> state/lexical-class is the lexer-programmer.
>
> Therefore I suggest that all lexers have default styles for their states (I
> guess that the defaults should not cover the font-face and the font-size,
> because these are normally end user preferences).
Sounds like a great bike-shed opportunity over what those defaults should be :-)
>
> I do not have any precise proposal for how to handle this, but one possible
> way would be to let each lexer provide an additional function that sets the
> styles to their defaults (i.e. as defined by the lexer programmer).
> Programs can then call this function, if they wish to set the default
> styling. Once the styles have been set the program can also inspect them
> and for example list them in a dialog.
>
> For end-users (and middle-programmers) it would of course also be nice if
> each state had a description: "The style used for major keywords: class,
> static, etc".
Documentation always helps, but people who know the language seem to
be able to recognise them ok without, and as I said above, people who
know the language should be contributing to the mapping.
Cheers
Lex
>
> Regards Thomas Linder Puls
>
> --
> You received this message because you are subscribed to the Google Groups
> "scintilla-interest" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
scintilla-inter...@googlegroups.com.
> To post to this group, send email to
scintilla...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/scintilla-interest.
> For more options, visit
https://groups.google.com/d/optout.