Page 1 of 2

XYS syntax highlighting for Notepad++

Posted: 15 Jun 2013 17:51
by Filehero
Hi,

I would like to share my definitions as well.

Notepad++ supports themes. As far as I understood they provide global color defaults as well as specific settings for the in-build supported languages. However, those settings appear to be somehow linked to the internal lexer (e.g., you can define keywords but no operators or delimiters). Fortunately there are User Defined Languages, which build upon any theme and offer great detail for customization. Attached you will find my current definition. I'm sure it can be tweaked/optimized much further, but it fits my needs so far quite well.

Downloads
NP++_XYS.zip
(13.9 KiB) Downloaded 504 times
Install
You should close any running Notepad++ instance before going ahead.

Unzip, and
1. Either put UserDefineLang.xml simply into the $Notepad++_home folder, or if you already have created some own language definitions just copy the XY section over into the existing UserDefineLang.xml.
Note: I left in two further definitions for Batch and Powershell files. Just remove or don't copy them if not needed.

2. Put the theme file myDark.xml into $Notepad++_home\themes

3. Start Notepad++ and load the theme via Settings>Style Configurator, make sure global override for background color is checked.
NP++_StyleConfigurator.png
NP++_StyleConfigurator.png (39.24 KiB) Viewed 7180 times
4. Now the "XYS"-entry should be available in the User section (below the separator) of the Language menu.


Expected Outcome
Notepad++.png
Notepad++.png (122.67 KiB) Viewed 7180 times
Enjoy!

Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 15 Jun 2013 18:52
by binocular222
Impressive :appl:
But you still need to highlight variables/Numeric inside quotes. That's the hard part

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 01:47
by PeterH
binocular222 wrote:Impressive :appl:
But you still need to highlight variables/Numeric inside quotes. That's the hard part
But variables only inside double quotes, I think :biggrin:
Inside single quotes they are just text :whistle:

No question: numbers are always numbers :ugeek:

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 07:40
by Filehero
PeterH wrote:
binocular222 wrote:Impressive :appl:
But you still need to highlight variables/Numeric inside quotes. That's the hard part
But variables only inside double quotes, I think :biggrin:
Like this?
NP++_quoting.png
NP++_quoting.png (20.21 KiB) Viewed 7121 times
PeterH wrote:Inside single quotes they are just text :whistle:
Look at output of String_2. :wink:
At String_2 output the lexer seems to "fail" so far.


Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 13:28
by klownboy
Hi FileHero,
How are you? Doesn't your msg line have String_3 twice and no String_2 in the NP++_quoting.png capture?
Ken

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 15:51
by Filehero
Hi Ken,

I'm fine. Just came back from a 4 hour trekking tour, it was quite hot and sweaty. How are you?
klownboy wrote:Doesn't your msg line have String_3 twice and no String_2 in the NP++_quoting.png capture?
Ken
Bingo! You have become a real XY coder, haven't you? :appl:
I have updated the image. Thanks for the pointer. :D

Now off for a long shower.


Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 17:41
by PeterH
Filehero wrote:
PeterH wrote:
binocular222 wrote:Impressive :appl:
But you still need to highlight variables/Numeric inside quotes. That's the hard part
But variables only inside double quotes, I think :biggrin:
Like this?
NP++_quoting.png
PeterH wrote:Inside single quotes they are just text :whistle:
Look at output of String_2. :wink:
At String_2 output the lexer seems to "fail" so far.


Cheers,
Filehero
It seems you changed something here, in between the time?
As on the left side the msg() shows $string_3 instead of $string_2, but the right side shows the corrected output for $string_2?

When the 1st $string_3 in msg() would be changed to _2, I think everything looks very correct; colors as well as values! Very good indeed! :appl: :appl: :appl:

Re: XYS syntax highlighting for Notepad++

Posted: 16 Jun 2013 18:50
by Filehero
PeterH wrote:When the 1st $string_3 in msg() would be changed to _2, I think everything looks very correct; colors as well as values! Very good indeed! :appl: :appl: :appl:
Thanks for checking, I'm happy with it, too. :D

This was the code I actually ran for the popup shot (actually the highlighting example is from an existing file where I - lazy me - just put in the lines):

Code: Select all

  $VarSingleQuote = "SingleQuoted"; 
  $VarDoubleQuote = "DoubleQuoted"; 
  $String_1 = '$VarDoubleQuote\$VarSingleQuote 1 2 3 4 5';
  $String_2 = '$VarDoubleQuote\"$VarSingleQuote" 1 2 3 4 5'; 
  $String_3 = "$VarDoubleQuote\$VarSingleQuote 1 2 3 4 5";
  $String_4 = "$VarDoubleQuote\'$VarSingleQuote' 1 2 3 4 5";
  msg($String_1<br>$String_2<br>$String_3<br>$String_4);
So, no more number confusion. :oops:

And here's the updated UserDefineLang.xml:
userDefineLang.zip
(6.69 KiB) Downloaded 286 times
Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 28 Jun 2013 00:18
by mithrin
If anyone is interested this is my Syntax Highlighting files that I've been using for years. I see the interest, so I'm offering my files scrutiny.

Re: XYS syntax highlighting for Notepad++

Posted: 23 Nov 2013 00:46
by Enternal
So, I took quite a bit of time to make another UDL theme for Notepad++ but make more use of the features that UDL 2.0 have to offer.

It supports XYplorer's variables (<curitems>), special items ({Fullname}), system and XYplorer's own system variables (%osbitness%), Xyplorer's variables within strings ("This is a $String"), and other things.

Still not the best I think but of an improvement. Hope you like it! I probably will work on it more later but for now, I think it's quite usable. Also, it works best with dark themes. In the example pictures, I'm using the Twilight theme.
2013-11-22_153945.png
2013-11-22_153945.png (26.46 KiB) Viewed 6760 times
2013-11-22_154051.png
2013-11-22_154051.png (37.4 KiB) Viewed 6760 times

Re: XYS syntax highlighting for Notepad++

Posted: 26 Nov 2013 11:14
by Enternal
Working on this for days and so far everything work except literal strings and heredoc. Literal strings generally work but when you start using words like "Don't" "Won't" "It's" and more, it will fail. Here doc can't be done at the moment due to limitations of the current lexer engine for NP++. Loreia2, the developer for the lexer enginer said the next major version should have even more support for complex scenarios.

Anyway, I extracted all those variables for <variable> and %variable% and {variable} from the help manual and then modified and finally implemented them into the user defined language file. I know my color choices suck but for the moment I'm still testing them to make sure if it works well enough. Can you guys test them and give me comments? Try to break it so that I can see if I can hopefully fix it.

As I said before, literal strings and heredoc don't work so I already know that's "broken" (removed them). Thank you!

Re: XYS syntax highlighting for Notepad++

Posted: 26 Nov 2013 12:26
by Filehero
Hi Enternal,

thanks for keeping this thread alive and your recent UDL theme. Don't know wether I like it better, but I will use it to check your "implementation". :wink:


Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 27 Nov 2013 08:43
by Enternal
Haha you want to "steal" my implementation?! :lol: Anyway, what do you think of it so far? Working well for most cases? Also what do you think about this color choices:
Image 1.jpg
Image 1.jpg (278.52 KiB) Viewed 6642 times
EDIT: Uhh... I think that was a horrible joke I made. This UDL thing is already free to do whatever you want with it so the "steal" is bad taste of a joke. Sorry for that.

Re: XYS syntax highlighting for Notepad++

Posted: 27 Nov 2013 09:23
by Filehero
Enternal wrote:Haha you want to "steal" my implementation?! :lol:
No - it's about understanding "only".

Cheers,
Filehero

Re: XYS syntax highlighting for Notepad++

Posted: 27 Nov 2013 21:46
by Enternal
Filehero wrote:
Enternal wrote:Haha you want to "steal" my implementation?! :lol:
No - it's about understanding "only".

Cheers,
Filehero
Haha. I was hoping there would be more UDL around that is similar to the XYScripting language but not really. As a result, there's also a lot of trial and error. Also the documentation is a bit lacking since I did saw some really funky way of doing things with UDL which I don't think it was meant to support but it did work... or maybe it was supposed to do that... I don't know.

But were you able to break it with certain script?