Darn, I knew it was too much work!

I am happy that I can add at least one extra group (although I'm
curious what "highlighted identifiers" is *really* supposed to be
referring to), but there is more than one group of words that I'd like
to add, with different styles for each. I'm just a little surprised
that, as flexible as Scite's options are, the syntax highlighting is
so rigid.

I also see an entry in my python.properties file called:

# Identifiers
style.python.11=

What are "identifiers" in this context? And why is there no style
associated with them by default? Is this perhaps something I can
commandeer as well? :)



On 8/21/06, Robert Roessler <[EMAIL PROTECTED]> wrote:
John Salerno wrote:
> Well, I peaked at the (scary) lexer file and found these lines of interest:
>
> WordList &keywords = *keywordlists[0];
> WordList &keywords2 = *keywordlists[1];
>
> static const char * const pythonWordListDesc[] = {
>     "Keywords",
>     "Highlighted identifiers",
>     0
> };
>
> They look like they are begging to be added to, but I know I'll just
> end up breaking everything. What I *didn't* see, though, was how these
> keywords lists are tied to style numbers, so even if I could add a
> third or fourth group, I'm not adept enough with C++ to read how they
> are being treated.

You are almost there... ;)

Note the "Highlighted identifiers" in the static array, and connect
this to the "Highlighted identifiers" comment in the .properties
file... the latter certainly suggests that "Highlighted identifiers"
are going to use style# 14.

If you now examine the lone place in the code where the keywords2 list
is *used*, you will see both that these get assigned the style
SCE_P_WORD2 (which SciLexer.h says is 14)... AND both appearances of
keywords2 (plus what you can deduce about how the number of keyword
lists gets communicated to a lexer container) should show you how to
add a keywords3 list.

But it does require a mod to the C++ code of the Python lexer, and
then you need to look into actually building a new version of
Scintilla incorporating this updated lexer, and... by this point,
wouldn't you be happy with just defining a single additional set of
keywords to be syntax colored and listing them in a
keywords2.$(file.patterns.py) entry? :)

> On 8/21/06, Robert Roessler <[EMAIL PROTECTED]> wrote:
>> John Salerno wrote:
>> > Hi again. I did what you said last time about adding a new group
>> > called keyword2, and that's fine, but I guess my question this time
>> > was something along the lines of, can I add a keyword3 group and then
>> > how would I know which style number is associated with it?
>> >
>> > I asked about the lexer again, but I have no knowledge of C++, so I
>> > don't want to mess anything up.
>>
>> OK.  No, you would not be able to add a "keyword3" group - "keyword2"
>> works because the [Python] lexer's code is written to use it if present.
>>
>> Look in the .properties file(s) - they are by convention commented
>> enough to show the correspondence between syntactic constructs and
>> style numbers.
>>
>> Note that while the Scintilla *client* (SciTE in this case) loads the
>> styling information from the .properties file, it is only the lexer
>> itself that *sets* those style bytes in the buffer.
>>
>> > On 8/21/06, Robert Roessler <[EMAIL PROTECTED]> wrote:
>> >> John Salerno wrote:
>> >> > Is it possible to open and edit a lexer file like a normal text
>> file,
>> >> > for example? I'm still looking for a fairly simple way to add extra
>> >> > keyword groups to for Python.
>> >>
>> >> I gave a fairly lengthy reply to this last week... and told you how to
>> >> do this.

Robert Roessler
[EMAIL PROTECTED]
http://www.rftp.com
_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

_______________________________________________
Scite-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scite-interest

Reply via email to