Hi,
I'm scripting in AutoHotkey (doesn't matter if you don't know it, just to let you know it's not a built-in language), and I have setup pretty good lexing using the User Define dialog. My only problem is that I can't seem to make the lexer recognize hex characters. In AHK, hex characters are in the format 0xFFFFFFFF. Therefore, it is safe to assume that anytning that starts with "0x" is a hex number. I tried adding "0x" in one of the keywords list with the prefix mode on, but it seems to have no effect. The 0 before the x however is always coloured blue which means that the lexer sees it as a number. So, my theory is that the fact that 0 is a number takes priority over the fact that the term starts with 0x and is therefore a registered prefix.
Is there any way to change this behaviour?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right now there are two different versions available.
The original 1.0 release of NppExternalLexers is available at Jaykul's PoshCode site ( since that was the original reason for creating it ) at http://poshcode.org/notepad++lexer/ ( just download the source version).
The both will provide the same end result, yet since your focus looks to be purely on the lexing capabilities I think I'd suggest using the NppExternalLexers.
Hope that helps!
almostautomated
If you have any other questions on it, please feel free to post them to either of these threads:
The User Defined Languages areall assumed to look like C or Java, and a plurality of actual languages not built in just won't fit.
Currently, if you can compile a dll written in C++, the solution is to take an existing lexer for a builtin language that is as close as possible as yours, tweak it your way, adjust a couple .h files in N++ sources and recompile the whole bunch.
There is an NppExtrenalLexer plugin out there which allows to separately compile the dll and then does the integration with N++ at run time without a need to recompile the latter. I didn't try it yet. See the following post, in Plugin Development:
I haven't attempted this myself, the biggest hurdle being installing yet another compiler - if only I could build under OpenWatcom, this would simplify everything for me.
CChris
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Just as a side note; for the test I configured the keyword list to use the darker of the two orange shades with bold enabled and then the number format to use the lighter shade of orange without the bold. It stands out fairly nicely.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you both for the replies.
aathell, I like your answer because it's easy to implement. :P
But thanks also cchris because there are a few little things that are just too specific to the language. I'll see if it wouldn't be too hard to do my own external lexer.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I'm scripting in AutoHotkey (doesn't matter if you don't know it, just to let you know it's not a built-in language), and I have setup pretty good lexing using the User Define dialog. My only problem is that I can't seem to make the lexer recognize hex characters. In AHK, hex characters are in the format 0xFFFFFFFF. Therefore, it is safe to assume that anytning that starts with "0x" is a hex number. I tried adding "0x" in one of the keywords list with the prefix mode on, but it seems to have no effect. The 0 before the x however is always coloured blue which means that the lexer sees it as a number. So, my theory is that the fact that 0 is a number takes priority over the fact that the term starts with 0x and is therefore a registered prefix.
Is there any way to change this behaviour?
Hey aathell, how can I obtain the Notepad++ External Lexers Plugin?
Can you email it to me?
Right now there are two different versions available.
The original 1.0 release of NppExternalLexers is available at Jaykul's PoshCode site ( since that was the original reason for creating it ) at http://poshcode.org/notepad++lexer/ ( just download the source version).
Or you can select the newer version that is part of the NppPluginIface library available at:
http://cid-71a486ea08eb407c.skydrive.live.com/browse.aspx/.Public/NppPluginIface?view=details
The both will provide the same end result, yet since your focus looks to be purely on the lexing capabilities I think I'd suggest using the NppExternalLexers.
Hope that helps!
almostautomated
If you have any other questions on it, please feel free to post them to either of these threads:
NppPluginIface thread: https://sourceforge.net/forum/forum.php?thread_id=3174036&forum_id=482781
NppExternalLexer thread: https://sourceforge.net/forum/message.php?msg_id=6360852
The User Defined Languages areall assumed to look like C or Java, and a plurality of actual languages not built in just won't fit.
Currently, if you can compile a dll written in C++, the solution is to take an existing lexer for a builtin language that is as close as possible as yours, tweak it your way, adjust a couple .h files in N++ sources and recompile the whole bunch.
There is an NppExtrenalLexer plugin out there which allows to separately compile the dll and then does the integration with N++ at run time without a need to recompile the latter. I didn't try it yet. See the following post, in Plugin Development:
RE: Notepad++ External Lexers Plugin (New)
By: Thell Fowler (aathell) - 2009-02-17 21:58
I haven't attempted this myself, the biggest hurdle being installing yet another compiler - if only I could build under OpenWatcom, this would simplify everything for me.
CChris
Try this and see if it does the job for you:
Set a keyword List to be prefix mode use a space in front of the x, configure this keyword list to match your number format.
Now it should work fine except for words that start with a lower case x. Which you may not be using much of in bare code. :P
lol, just thought of something funny; with this setup you could always use x prefixed var names for numeric vars too.
almostautomated
Just as a side note; for the test I configured the keyword list to use the darker of the two orange shades with bold enabled and then the number format to use the lighter shade of orange without the bold. It stands out fairly nicely.
Thank you both for the replies.
aathell, I like your answer because it's easy to implement. :P
But thanks also cchris because there are a few little things that are just too specific to the language. I'll see if it wouldn't be too hard to do my own external lexer.