Page 2 of 3
Re: R: a better lexer to CudaText
Posted: 09.05.2024 13:02
by jcfaria.uesc
comments in R are shown with 2 styles inTinn-R. do you want the same? which comments are special? I may apply theme style 'comments doc'.
In fact, the "comments" on Tinn-R are on 4 levels:
- #. note level 1 (is a comment subtype)
- #.. note level 2 (is a comment subtype)
- #... note level 3 (is a comment subtype)
If you can do this in R's Lexer I think it will be great!
It was a user who asked me to create a note-type identifier (derived from the comment) in the R highlighter in Tinn-R.
I initially made
, then I liked it so much that I made the other two
and
I use it a lot in my R scripts to give a sense of hierarchy and facilitate presentation in classes.
I use the same ones in the Tinn-R text file highlighter (*.txt).
Best,
Re: R: a better lexer to CudaText
Posted: 09.05.2024 14:06
by main Alexey
As you see in the "Options / Themes / Settings-theme-syntax" dlg, we have 3 theme colors for comments
Comment - ok
Comment2 - ok
CommentDoc - this is for documentation comments, not ok to use as one of 4 colors
but I may use
Comment
Comment2
String2
String3
styles.
Re: R: a better lexer to CudaText
Posted: 09.05.2024 14:21
by jcfaria.uesc
As long as the way they are presented can be configured by the user - by customizing the R lexer styles - I don't see any problems.
I believe that these new styles (notes) should be identified - for the user - by:
Note1
Note2
Note3
Do you agree?
Re: R: a better lexer to CudaText
Posted: 09.05.2024 14:47
by jcfaria.uesc
Or perhaps create in "Options / Themes / Settings-theme-syntax" dlg the styles for notes (Note1, Note2, Note3, etc). Maybe it can be used in other Lexers... you are the one who knows the degree of difficulty involved in each option.
Re: R: a better lexer to CudaText
Posted: 10.05.2024 00:56
by main Alexey
>create in "Options / Themes / Settings-theme-syntax" dlg the styles for notes (Note1, Note2, Note3, etc).
No, it is not good: all themes then must be updated to include these styles. even themes in addons. so better use existing styles:
e.g.
Comment2
String2
String3
--
One thing, can you give the link to docs, which describe these special comments?
or is it your invention?
Re: R: a better lexer to CudaText
Posted: 10.05.2024 03:10
by jcfaria.uesc
Originally it wasn't my invention, it was a suggestion from a Tinn-R user. I liked the idea, increased the levels (to three) and extended it to other highlighters, for example to *.txt.
I find it very useful for highlighters that accept comments with a single character, like R. In the case of *.txt, I only know it in Tinn-R as I had never seen comments for pure *.txt.
But I can't say it was my invention!
I've been using it for so many years...
Re: R: a better lexer to CudaText
Posted: 10.05.2024 03:17
by main Alexey
So it is not official...
in this case, pls do the copy of my lexer to e.g. R_.lcf (you must rename 'R' to 'R_' inside LCF file).
in the copy, make new parsers. in SynWrite editor. like tutorials tell
https://github.com/Alexey-T/CudaText/tr ... /tutorials
- RegEx for level 3: \#\.\.\..*
- RegEx for level 2, must be AFTER level 3: \#\.\..*
- RegEx for level 1, must be AFTER level 3+2: \#\..*
- RegEx for usual comment must be after levels 3/2/1 !
and make 3 new lexer styles. note1, note2, note3.
assign them to 3 new 'lexer parsers'.
note:
when you open R file in CudaText, it will ask for STYLE_MAPPING! assign new 3 styles to Comment2/String2/String3.
--
if you cannot do it, i will do it for you. but you must read tutors so next time you will do it yourself.
https://github.com/Alexey-T/CudaText/tr ... /tutorials
Re: R: a better lexer to CudaText
Posted: 10.05.2024 03:27
by jcfaria.uesc
Okay, thanks for your attention!
I'll try and let you know if I succeed.
Best,
Re: R: a better lexer to CudaText
Posted: 10.05.2024 04:17
by jcfaria.uesc
Alexey,
I managed to get it!
See attached figures.
The only problem I noticed is that I couldn't underline on the Note1. I had to choose edge in the Options/Lexers/Lexer properties option. That's it?
Re: R: a better lexer to CudaText
Posted: 10.05.2024 04:22
by jcfaria.uesc
More pictures...