A number of people have asked the questions I had about defining your own language but there were no answers. I've now solved most of my questions and so I thought I'd share what I know about creating languages.
* You get the tool for creating your language from View> User Define Dialog. Be patient, it takes quite a while to load.
* Some of the 'standard' or 'more common' languages are not built with this tool. For example, Batch.
* If you want to modify a language that was not built with the User Define Dialog then you use the Style Configurator (Settings>). Note, there are some features in the 'more common' languages you can't modify. For example, you can't add to the list of operators in Batch.
* If you want to replace an 'inbuilt' language such as Batch, do the following.
(*) Go to Language Menu tab of Settings> Preferences. Disable Batch by moving it to the right hand panel. Now there is no definition for the '.bat' extension.
(*) Create a new language with User Define Dialog and specify the extension (.bat for batch files)
* User created languages appear on the Language menu, below the divider.
* Once a language has been saved there is no need to save it again. Any changes made on the dialog page are immediately saved. A nice effect of this is that if you have the appropriate file open in NPP, any changes made to the language are immediately reflected in the NPP file window.
The only thing I haven't resolved is what Keyword 'Prefix mode' means. Does anyone know?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm very glad to be able to make a useful contribution to the project. Sorry about the terminology. I'm new to NPP and was grabbing words that seemed to be the ones used in the program.
--Greg
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
:-) Actually, it was my mistake. I created the page and then thought of a better name for it, but there doesn't seem to be a way of moving/renaming it. Ah well!
- Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
> The only thing I haven't resolved is what Keyword 'Prefix mode' means. Does anyone know?
If Prefix mode is checked, then all the words with the prefixes defined will be recognized.
For example, with definition "bla", all the following words are recognized :
blapu blabla blablablabla blabc ...
Don
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
On a related point, do you happen to know if there is a wildcard that can be used to mean anything? I would like to be able to catch, and colour, all lines that have not been caught by the keywords in sets 1-3. The aim is to highlight lines that shouldn't be there. (I'm redefining the formatting for Batch files.)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(Note for a wiki admin - the page title is not great. It would be better at 'User-defined languages', but I couldn't find a way to move it. Perhaps you can?)
Cheers
- Mark
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Another Sourceforge irritation! It has added a full-stop to the URL, so if you are looking at this via the web-interface it will link to the wrong place. The correct URL is:
A number of people have asked the questions I had about defining your own language but there were no answers. I've now solved most of my questions and so I thought I'd share what I know about creating languages.
* You get the tool for creating your language from View> User Define Dialog. Be patient, it takes quite a while to load.
* Some of the 'standard' or 'more common' languages are not built with this tool. For example, Batch.
* If you want to modify a language that was not built with the User Define Dialog then you use the Style Configurator (Settings>). Note, there are some features in the 'more common' languages you can't modify. For example, you can't add to the list of operators in Batch.
* If you want to replace an 'inbuilt' language such as Batch, do the following.
(*) Go to Language Menu tab of Settings> Preferences. Disable Batch by moving it to the right hand panel. Now there is no definition for the '.bat' extension.
(*) Create a new language with User Define Dialog and specify the extension (.bat for batch files)
* User created languages appear on the Language menu, below the divider.
* Once a language has been saved there is no need to save it again. Any changes made on the dialog page are immediately saved. A nice effect of this is that if you have the appropriate file open in NPP, any changes made to the language are immediately reflected in the NPP file window.
The only thing I haven't resolved is what Keyword 'Prefix mode' means. Does anyone know?
Mark,
I'm very glad to be able to make a useful contribution to the project. Sorry about the terminology. I'm new to NPP and was grabbing words that seemed to be the ones used in the program.
--Greg
:-) Actually, it was my mistake. I created the page and then thought of a better name for it, but there doesn't seem to be a way of moving/renaming it. Ah well!
- Mark
Thank you, this helped a lot!!!
Thanks very much!
> The only thing I haven't resolved is what Keyword 'Prefix mode' means. Does anyone know?
If Prefix mode is checked, then all the words with the prefixes defined will be recognized.
For example, with definition "bla", all the following words are recognized :
blapu blabla blablablabla blabc ...
Don
Thanks Don. That's useful for me to know.
On a related point, do you happen to know if there is a wildcard that can be used to mean anything? I would like to be able to catch, and colour, all lines that have not been caught by the keywords in sets 1-3. The aim is to highlight lines that shouldn't be there. (I'm redefining the formatting for Batch files.)
> The aim is to highlight lines that shouldn't be there.
> (I'm redefining the formatting for Batch files.)
What you want is not possible in the current implementation.
The token unit is separated by white space.
Don
Thanks Don. Much appreciated.
--Greg
Very useful! I hope you don't mind, but I have added this information to the wiki at http://notepad-plus.wiki.sourceforge.net/Customise+languages.
(Note for a wiki admin - the page title is not great. It would be better at 'User-defined languages', but I couldn't find a way to move it. Perhaps you can?)
Cheers
- Mark
Another Sourceforge irritation! It has added a full-stop to the URL, so if you are looking at this via the web-interface it will link to the wrong place. The correct URL is:
http://notepad-plus.wiki.sourceforge.net/Customise+languages
- Mark