UDL for DXL (C LIke) Number processing issues.
-
@Sean-F Not yet. I’m still working thru the DXL reference manual for v9.7. As you can see, the various issues I’m having. I’m still in the learning phase of NPP. If I get this working, I may move from UDL to the full blown DXL language support like the other languages included in NPP so that function lists can be shown on the sidebar.
I’m not sure if DOORS Next has a newer version of DXL. Google doesn’t show one specific to DOORS Next and I don’t have this particular product version.
Which version of DOORS does the copy you have support?
See below for IBM’s partner. One will have to play with the different versions they have free/licensed versions to see how they work.
SodiusWillert has Editor Pro.
Their old version is Smart DXL and is supposed to be Eclipse compatible. -
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
I may move from UDL to the full blown DXL language support like the other languages included in NPP so that function lists can be shown on the sidebar.
FYI: while it may be a good idea to write a Syntax-Highlighter Plugin for DXL, you do not need to wait for doing that before you have function lists. As described in the online User Manual, you define the function list for a UDL in the same way that you define one for a builtin syntax highlighter or plugin syntax highlighter:
There is even a section in the User Defined Languages Collection for also including the functionList XML file for that UDL. So once you get the UDL and Function List working for DXL, make sure to submit it there.
-
@PeterJones Thanks. I’ll need to look more into it. Since the parsers are more regular expression, I’m not sure if there is a typical structural layout for any language. That’s why I posted this below to see if that tool would create the parser/regular expression in XML so that all I would do is copy and paste the answer based on the tools user friendly input (???)
Still working on the UDL right now. -
@swegmike How can one configure the UDL such that it will colorize differently if the same string name for a keyword is used to denote a built-in function while the same name is used for a property and a value? The DXL scripting language does this alot.
I’ve tried to specify ie. keyword 1 for abc be the builtin function name, and then keyword 2 be abc or .abc for the property, and keyword 3 be abc for a constant and the same for a value. The resulting color is based on the matching the first keyword symbol table created by npp+ and then npp+ stops searching the rest of the keywords that have the same keyword. For the case of the property where it may be a function name or a value such as a or a.description() or a.description, the colorization is based on the first match found in the keyword list 1-8. Luckily, the resuse of the name as a type for this language doesn’t occur. I have builtin types also assigned to a keyword #.
-
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
How can one configure the UDL such that it will colorize differently if the same string name for a keyword is used to denote a built-in function while the same name is used for a property and a value?
That is not a feature of UDL.
UDL is meant as a simple interface for simple keyword, operator, and delimiter highlighting of langauges that Notepad++ does not offer; it is not meant to be as powerful as a custom-coded lexer for a given language (though it’s usually sufficient for most people’s actual needs). If the power of UDL is not sufficient for your needs, then you need to write a custom lexer plugin.
I’m not sure if there is a typical structural layout for any language
Every language is unique. As far as I know, no one has written a tool to help Notepad++ users write regex specifically for function lists definitions. There are plenty of regex-helper tools out there; you seem to have already linked to one in that other thread; if that, or another existing tool, is useful to you in the development of your function-list definition regex, great, use it! But if not, then you are going to have to just dig in and create the regex yourself. Start with a simple regex that doesn’t cover every edge case, but just gives simple functions and then work your way toward something more complicated, making sure it’s working at every step along the way – that’s how I’ve done it.
-
@PeterJones I was looking thru the notepad online manual for the valid delimiter escape codes allowed.
This also applies to the close field too. In my case, I’d like to specify a non-printable character such as a tab along with a printable character such as space. Thus the open delimiter would be a period and when it parses to the end of the string and sees a “space” or “tab” after the string the escape or close part of the delimiter would stop the coloring and continue on to the end of the line. I realize there is a special ((EOL)) which isn’t mentioned n the user manual delimiter section. Are there any other undocumented special codes?
I have tried both the \t \r \n along with the hexadecimal codes ie. \0x020 for the space etc and none of these will work either.Also the npp+ keywords screen has the prefix checkbox for each one, it would be nice to have a postfix/suffix checkbox whereby one can check either one or both. I think this would eliminate the escape characters stated above but in the end both the escape characters and the check boxes would be great to have…
-
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
@PeterJones I was looking thru the notepad online manual for the valid delimiter escape codes allowed.
There aren’t any, that I’m aware of.
This also applies to the close field too. In my case, I’d like to specify a non-printable character such as a tab along with a printable character such as space. Thus the open delimiter would be a period and when it parses to the end of the string and sees a “space” or “tab” after the string the escape or close part of the delimiter would stop the coloring and continue on to the end of the line.
As far as I know, that’s not possible.
I realize there is a special ((EOL)) which isn’t mentioned n the user manual delimiter section. Are there any other undocumented special codes?
Really? “Notice how UDL’s special operator
(( ))
transforms stringEOL
into an end of line character”. Yes, that’s in Ivan Radić’s site, not the npp-user-manual.org site, but that’s because Don agreed that Ivan’s documentation was so good that when we created npp-user-manual.org, we weren’t going to try to re-create it – it has been officially linked through the Define Your Language dialog since before npp-user-manual.org existed, and the npp-user-manual.org has throughout its existence always linked to Ivan’s site.Also the npp+ keywords screen has the prefix checkbox for each one, it would be nice to have a postfix/suffix checkbox whereby one can check either one or both. I think this would eliminate the escape characters stated above but in the end both the escape characters and the check boxes would be great to have…
This forum cannot help you with feature requests (I am sure you can find the forum’s FAQ on that topic). But, so you know, Notepad++ developers have shown no interest in adding new features to UDL in years, and have only rarely fixed bugs in it, despite the number of open UDL issues.
If you want more power than UDL offers, but don’t want to go so far as to write your own lexer plugin (which is the intended next step beyond UDL), there is the EnhanceAnyLexer plugin. It could handle some of your space/tab desires (as long as you just want to change the foreground color; it doesn’t have background colors, and cannot affect folding).
-
@PeterJones I pretty much have my first cut on the DXL language via UDL. I’ve also copied the “C” language parser since DXL is “C” like into a dxl.xml file and changed various entries from “C” to “DXL” etc. in the functionlist subdirectory for NPP. I’ve done the same using the “C” file in the autocomplete subdirectory but copied as DXL with the appropriate changes.
Here’s list of the files changed based on corresponding c.xml files or entries. I created the
language ID as 61 temporarily for the DXL language as also similarly in the roaming directory:autoCompletion/dxl.xml
functionList/dxl.xml
Notepad++/
functionList.xml
langs.model.xml
langs.xmlSo the goal here, is to get my DXL language, autocomplete list, and functionlist to show up in the NPP menubar->Language drop down list so that I can see it working for my DXL source code. However, DXL doesn’t showup in the Language list drop down. However, if I select the “C” language for use on my DXL source code, it will find the functions and display in the function list, and the autocomplete popup of keywords will show up. Along with applying the default “C” language colorization of the code.
Thus, what am I missing to get my “DXL” language to show up in the language drop down list vs. the UDL language entry based on dxl.xml colorization file?
Hopefully the NPP langs are hardcoded into the npp executable binary file.
-
@swegmike When I try to edit the post above for content and submit it, the forum thinks its spam…
-
UDLs show up below the line, under the User Defined Language menu – like the Markdown UDL
You cannot get a UDL to show up above the line, in the alphabetized section.
Hopefully the NPP langs are hardcoded into the npp executable binary file.
They are.
I created the language ID as 61 temporarily for the DXL language
UDLs do not get their own language ID – they are all handled by the UDL lexer. Just arbitrarily inserting that language ID into the other config files will not change that fact.
To make sure your DXL auto-complete and functionlist are working, all you have to do is activate the UDL selection for DXL.
-
I don’t see you listing the overrideMap.xml as a file that has a change, as is necessary for a UDL to associate the “proper” menu name entry with the UDL created xml file.
For instance, I’m able to associate the UDL that I created that connects all the files together with the overrideMap.xml file entry like so:
<association id= "dbaseplus.xml" userDefinedLangName="dBASEPlus"/> <association id= "dbaseplus.xml" userDefinedLangName="Dark_dBASEPlus"/>
This is clearly layed out in the documentation. Notice I have capitalized names that show in the menu, but they are linked to the dbaseplus.xml UDL file. This is possibly what you’re missing. Do make sure that the same case is used that you use to identify the UDL in the dxl.xml UDL file. The numbers, you say you’re using, are for the compiled languages that are in the Notepad++ object files, of which a UDL can not be.
I hope this helps, if not, please disregard.
-
@Lycan-Thrope I’ve looked at the overrideMap.xml and also noticed that the id name specifies the language with xml on the end. So in my case I would specify “dxl.xml” which is specified in the functionList and autoCompletion subdirectories.
However, the overrideMap.xml is not present when npp was installed so I’m not sure if I have to create one and where to put it. Most of the online docs specify testing things and shows a “powereditor” directory path which I don’t have nor this particular editor.
I did modify the functionList.xml file which is similar to the overrideMap.xml, but in the userdefined area it doesn’t show as examples that the id as “mylang.xml” but specifies “mylang_function” thus I had done this as “dxl_function” and inserted a copy of the “C” lang parser which specifies “c_function” as its id but I renamed it as “dxl_function” and the language as “DXL”. Moreover, this change was made to the dxl.xml files in the autoCompletion and functionList subdirectories.
So if I’m understanding you, the id must be “dxl.xml” and not “dxl_function” so it can find the files to use. But I’m not clear on whether I just edit the functionList.xml in the notepad++ directory or if I need to create an overrideMap.xml that has only my userdefined associations and parser in it and notepad will then use the functionList.xml for the other languages or use the overridMap.xml that only has my language when needed?
Moreover, the “C” language specifies c.xml in the autoComplete and functionList subdirs and yet the functList.xml for the id doesn’t specify “c.xml” but “c_function”
-
@swegmike I’ve changed the id from “dxl_function” to “dxl.xml” everywhere, and restared npp, and the one function my dxl code has doesn’t showup in the functionlist with the udl “dxl” selected as the language.
If I switch to the builtin “C” language and select view->function list, it finds my one function and displays it correctly in the functionlist.
So I dont know where the mismatch is for my DXL UDL and the files that I have changed.
I even copied the functionList.xml that was modified for the udl associations as overrideMap.xml and still can’t display the one function in the functionlist when I select dxl as the udl language, but it will showup when the “C” language is selected.
-
All these things – for the Function List with its override map, and the autoCompletion files, and where they all go – are described in the usermanual,
- Function List - https://npp-user-manual.org/docs/config-files/#function-list
- Auto Completion - https://npp-user-manual.org/docs/auto-completion/
I did modify the functionList.xml file which is similar to the overrideMap.xml,
Nope. The old
functionList.xml
is no longer used, starting with v7.9.2. Since you say you are on 8.4.6, you will never need to edit that file; if you have that file, delete it, as it will only confuse you, and will not do anything with v8.4.6.overrideMap.xml
goes in%AppData%\Notepad++\functionList
– it should exist with a fresh install, but if you updated from an ancient Notepad++ at some point, it might never have been created. In which case, I recommend copying the default one from a portable zipfile and putting it in the right location.So if I’m understanding you, the id must be “dxl.xml” and not “dxl_function” so it can find the files to use.
The ID in the
overrideMap.xml
must match your autoCompletion filename. If you autocompletion filename isdxl.xml
, then the id should bedxl.xml
. If your UDL’s name isDXL
, then theuserDefinedlangName
should be set toDXL
.<association id="DXL.xml" userDefinedLangName="DXL"/>
ID was a bad name for that attribute, IMO; it should have been “filename” or something.
dxl_function
That’s the standard nomenclature inside the Function List definition XML file (in your
dxl.xml
). It doesn’t need to match anything from overrideMap, but than it cannot match any of the internal IDs of any of the other languages’ functionList definitions.Think of it this way: Notepad++ reads overrideMap to find the filename, to be able to map the UDL name to a filename for the function list file. Then once it has that, Notepad++ reads the appropriate file from the
functionList\
folder to get the definition.Moreover, the “C” language specifies c.xml in the autoComplete and functionList subdirs and yet the functList.xml for the id doesn’t specify “c.xml” but “c_function”
That’s because the functionList.xml file was the old way of doing things, which has been irrelevant since v7.9.2. And neither the old functionList.xml nor the modern overrideMap.xml have any effect on the autoCompletion; autoCompletion has its own set of rules.
Most of the online docs specify testing things and shows a “powereditor” directory path which I don’t have nor this particular editor.
There is no official Notepad++ documentation that tells you to do anything with a “powereditor” directory path.
-
@PeterJones Yes, Ive been updating npp using its update feature. I would of thought npp would cleanup and get rid of old files for a given newer version.
So is langs.xml and langs.model.xml obsolete in the main program files directory ? They seem to have the same content and yet only the langs.xml shows up in the roaming directory.
I moved the overrideMap.xml to the functionList subdir for Program Files directory and the roaming directory and now it can find the one function in my DXL code and show it in the functionlist panel. Now I can modify the “C” language parser I reused for dxl and modify it as needed for dxl.
Moreover, when I delete my functions void attribute and start to retype it, the popup box appears like the “C” language does so I know autoCompletion works.
I can then modify this file for all my DXL builtin Attributes and functions (which there are quite a few) I’m not sure if I could make it also show the builtin constants and properties. Since these are quite large, and editing the xml file to keep it up to date is tedius everytime the language comes out with a new version, it would be great if the xml could point to them in my UDL keyword lists. Yes, I know this feature won;t be done…So here’s my one callback function list name although the void attribute doesn’t show up with the name in the functionlist panel even when its changed to “int”.
Moreover, operator overloading doesn’t show up with the :: although the function name after it does - so the my dxl parser will need fixing in time.void doGet(DB SectNo) { // used for apply()
void ::doGet(DB SectNo) { // used for apply()
-
@swegmike Here’s my overrideMap.xml entry for dxl
and an excerpt of the copied “C” language parser. However, there is a dxl.xml parser in the functionList subdir that duplicates this.
<association id= "dxl.xml" userDefinedLangName="DXL" /> <association id= "dxl.xml" ext=".dxl" /> <!-- ======================================================================== -->
An excerpt of the “C” lang parser for dxl.
<!-- =========================================================== [ DXL ] --> <!-- IBM DOORS Extension Language --> <parser displayName="DXL" id ="dxl.xml" commentExpr="(?x) # Utilize inline comments (see `RegEx - Pattern Modifiers`) (?s:\x2F\x2A.*?\x2A\x2F) # Multi Line Comment | (?m-s:\x2F{2}.*$) # Single Line Comment | (?s:\x22(?:[^\x22\x5C]|\x5C.)*\x22) # String Literal - Double Quoted | (?s:\x27(?:[^\x27\x5C]|\x5C.)*\x27) # String Literal - Single Quoted " >
-
@swegmike Here is the autoComplete excerpt for dxl too.
<NotepadPlus>
<AutoComplete language=“DXL”>
<Environment ignoreCase=“no” startFunc=“(” stopFunc=“)” paramSeparator=“,” terminal=“;” />
<KeyWord name=“#define” />I made the following changes in both the langs.xml and langs.model.xml using the “C” lang entry for dxl.
Not sure if this is needed or not!<Language name="dxl" ext="dxl" commentLine="//" commentStart="/*" commentEnd="*/"> <Keywords name="instre1">if else switch case default break goto return for while do continue typedef sizeof NULL</Keywords> <Keywords name="type1">void struct union enum char short int long double float signed unsigned const static extern auto register volatile bool uint8_t uint16_t uint32_t uint64_t int8_t int16_t int32_t int64_t size_t time_t clock_t wchar_t FILE</Keywords> </Language>
-
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
I made the following changes in both the langs.xml and langs.model.xml using the “C” lang entry for dxl.
Not sure if this is needed or not!Absolutely, positively not. The langs.xml is only for builtin lexers.
Here’s my overrideMap.xml entry for dxl
You do not need the second line. After v7.9.1, Notepad++ no longer uses the “ext” version.
Based on the recent questions about langs.xml and similar, you really need to read the entirety of https://npp-user-manual.org/docs/config-files/ . if this doesn’t answer your questions, read it again.
-
@swegmike just an FYI. When I try to edit one of my posts above within the 4 hour window, it thinks I’m spamming it. I can edit the last post, but a previous post by me or someone else on the forum that is posted already stops me from editing the post since it thinks my edit to correct spelling or wording is spam.
-
@swegmike Now that the autocomplete,functionlist and udl seem to be working. I think the best thing to do is to uninstall npp and reinstall to start with a fresh install since one doesn’t know which of the files have been deprecated. This will mean one having to reinstall all the pluggins too.