Hallo.

> ...Indices to `highlighting_styles_UNI` are completely independent.

You are right. I was confused by the comment. 

> > So I plan to assign to SCE_UNI_K_.. values from 100 and to SCE_UNI_S_.. 
> > values from 200.
> 
> You can't do that (at least if you plan to submit your lexer to Lexilla) ...

If Keyword indices are completely independant from Style indices, as you told 
above, that's o.k. for me. No need to number it from 100 or 200 in real world. 
It would only have prooved independance to me.

>  `highlighting_keywords_UNI` will just have to use the correct indices.

For me, that's a great drawback of geany vs. lexilla source code. Every time 
any lexer feature is added to lexilla, `highlightingmappings.h` needs to be 
updated **manually**, keeping order troublesomly. I'm not sure, but even now, 
there are differences. 

A summary of what is defined for each lexer in `highlightingmappings.h` is 
attached:
[geany_2.0.0_20241219_lexer_definitions.zip](https://github.com/user-attachments/files/18197627/geany_2.0.0_20241219_lexer_definitions.zip)

Examples of discrepancies:  
 * lexer Pascal has properties `lexer.pascal.smart.highlighting` `fold.comment` 
`fold.preprocessor` and `fold.compact` Geany does use 
`lexer.pascal.smart.highlighting` (in filetype.pascal 
`lexer.pascal.smart.highlighting=1`), but in `highlightingmappings.h` there is 
entry `#define highlighting_properties_PASCAL        EMPTY_PROPERTIES`.
   
 * lexer CPP has about 20 properties defined. Two of them are used in geany (in 
filetype.c `styling.within.preprocessor=1` and 
`lexer.cpp.track.preprocessor=0`), but in `highlightingmappings.h` there is 
entry `"fold.cpp.comment.explicit", "0"`.
 
 * lexer CPP currently has defined 6 keyword lists. In `highlightingmappings.h` 
there is entry only for `0 primary` `1 secondary` and `2 docComment`. The 
drawback extends deep into the source code. For example, here geany uses 
wordlist 3: 
https://github.com/geany/geany/blob/7a017c764038bcdfcb99db7365c3196fd8aebdbf/src/document.c#L2766
 Also there is used a constant `3`. If you read this part of source only, you 
have no idea, what `3` means.

I propose to introduce keywordlist constants: `SCE_[LANG]_K_[DESCRIPTION]` and 
rename existing style constants `SCE_[LANG]_[DESCRIPTION]` to 
`SCE_[LANG]_S_[DESCRIPTION]`. Keywordlist constants can be used in 
`highlighting_keywords_[LANG]` and in source code (e.g. in document.c, see 
above) and will improve readability and reduce fault liability `SciLexer.h: 
SCE_C_K_GLOBALCLASSESANDTYPES = 3;` and `document.c: keyword_idx = 
SCE_C_K_GLOBALCLASSESANDTYPES;`.

> In any case, if you plan to submit a pull request with the lexer to Geany, 
> you have to get it merged to the Lexilla project first - we only accept 
> official lexers.

That's the plan. A feature update to LexPascal will be offered to Lexilla 
project whithin next days. After that, I'll finish work on new Lexer and offer 
to Lexilla, too.

Thank you for your answer and time.
br HoTschir



-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany/discussions/4154#discussioncomment-11617458
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany/repo-discussions/4154/comments/[email protected]>

Reply via email to