UDL for DXL (C LIke) Number processing issues.
-
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.
-
@swegmike ,
You’ve only got 19 posts to your credit, so it doesn’t consider you, yet, a frequent legitimate poster…just relax, it will come. It did the same thing to me when I started posting in the forums. :) -
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
@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.
::Sigh::, such is the cost of trial and error and mucking about in an environment one is learning. :) Welcome to the madhouse. :)
-
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
When I try to edit one of my posts above within the 4 hour window
I believe it is because you had 0 reputation up until now. Editing privileges require that you have at least 1 upvote on a post. I just gave you one.
Please do not abuse the editing feature: in general, it is considered rude to edit a post in a way that makes future replies not make sense any more. Fixing minor typos is reasonable; changing the meaning of an earlier post, especially after people have replied, is highly frowned upon.
-
@PeterJones my edits on this and other forums are editorial since once I read what I posted, it may not be clear. Some times spell checkers override what one posts and my laptop keys sometimes don’t work depending on the key (10+ year old company laptop).
An update, for future npp users doing UDL stuff.
I used windows 8.1 to uninstall npp and answered yes to all questions to not retain config data. Upon looking at what remained, there was still some subdirs including the NppShell_06.dll. I manually deleted everything, but the dll required me to log out and back in since something was locking it.Moreover, the roaming directories and files weren’t removed. To prevent confusion, I had to remove these after reinstall of the current version of npp, delete them by selecting them by using the npp “open the user defined language folder” and go up and down the directories to select and delete them (the fastest way I know). Starting npp again doesn’t recreate them. Thus I had to reinstall npp again so that the roaming directories get recreated etc. There is no npp repair feature.
Upon reviewing what the program files npp directory contents and roaming directories contained, the following were noted.
a). the roaming directory contains “UserDefinedLangs” subdir but not the program files npp directory as older versions created. Thus I copied all my backup UDLS to the UDL"open the user defined language folder" and pasted them to this directory.
b). the overrideMap.xml is in the program files “functionList” subdir now upon a new install. Apparently doing updates on older npp versions are missing this part of the update to put this file there but will upon a clean install. Moreover, the functionList subdir isn’t in the roaming area of npp anymore upon a clean install.
c). The program files contained langs.model.xml and the old version of langs.xml which isnt there anymore; however, the roaming directory only contains the langs.xml and not the langs.model.xml even though all of them contain the same info. So npp has two different filenames that serve the same purpose with the only difference being which directory they are in - the Program files vs. the roaming directory.Thus, the summary for future reference is,
a) roaming contains these subdirs only.
backups
plugins
themes
userDefinedLangs
b). Program files notepad++ subdir contains these subdirs only.
autoCompletion
functionList
localization
plugins
themes
updater
c). various xml file differences mentioned herein.Now for new issues…
-
@swegmike my new issues which may not in the end be an issue are.
a). In developing my UDL xml file for DXL, I have multiple versions. The xml file names are different
IE.
DXL.xml
DXL_p.xml
DXL-rt.xml
DXL_rt1.xml
DXL_rt2.xmlnote: originally I called rt2 as rt1.1. However, the npp and the UDL docking panel lists wont display rt1.1 as such but will show it as rt1. However, rt1 is a different file so one must keep track of the two even though both are displayed.
Although I can select each under the npp UDL language selection and they will be applied to my DXL code, the issue is with the functionlist (my favorite headache).
I do have different xml filenames in the Program File->notepad+±>functionList subdir as i.e.
dxl.xml and dxl_p.xml.
I’ve edited the overrideMap.xml as follows where they are two different id’s that specify these filenames although the userdefinedlanguage value is “DXL” for both as follows. Note: the overrideMap.xml doesn’t contain the parsers anymore like the old file mentioned in earlier posts.<association id= "dxl.xml" userDefinedLangName="DXL"/> <association id= "dxl_p.xml" userDefinedLangName="DXL"/>
My functionList parser for the my two different DXL versions for development purposes specify this
dxl.xml
NotepadPlus>
<functionList>
<!-- =========================================================== [ DXL ] -->
<!-- IBM DOORS Execution Language -->
<parser
displayName=“DXL”
id =“dxl.xml”
commentExpr="(?x) # Utilize inline comments (seeRegEx - 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
"
>The second file is the same except the id=“dxl.xml”
Moreover, the autoCompletion directory will also contains two different DXL files dxl.xml and dxl_p.xml although they don’t contain an ID but the same entry
<AutoComplete language=DXL">
Hence the issue is that upon selecting which dxl UDL version to apply to my source code and then trying to run the functionlist, npp seems to hang forever and won’t display the one function I have in my dxl source code.
Opinion: is that even the xml filenames are different across the functionList and autoComplet subdirs and the id’s specified are different, npp gets hung up on the share language name DXL.
-
@swegmike Still having editorial spam popups after a few corrections even though no posts afer the previous one were done. So to clarify
The second file is the same except the id=“dxl.xml”
should be,
The second file is the same except the id=“dxl_p.xml” -
@swegmike As for PowerEditor, the following npp manual weblink halfway down the page shows it. NPP doesn’t install it, so how can one follow these steps for a directory that doesn’t exist nor the executable for the editor type. So no unit testing can be done.
-
@swegmike said in UDL for DXL (C LIke) Number processing issues.:
As for PowerEditor, the following npp manual weblink halfway down the page shows it. NPP doesn’t install it, so how can one follow these steps for a directory that doesn’t exist nor the executable for the editor type. So no unit testing can be done.
I forgot about that section. That section is entitled “Contribute your new or enhanced parser rule”. That means, it’s a section if you are going to try to convince the Notepad++ developers to include your function-list parser in the Notepad++ codebase. They will only accept function-list parsers for builtin lexers. You, @swegmike, are not creating a function-list parser for a builtin lexer. So that section doesn’t apply to you. (If it did apply to you, then you would have to fork the Notepad++ source code repository, and create your unit tests in that fork. And when you have that fork, then you would easily see the PowerEditor folder in your fork.) I will update that section of the manual to make it more clear in what situations that applies.
-
The new introductory paragraphs for that section will now say,
You’re welcome to contribute your new or enhanced parser by creating PR on Notepad++ GitHub page.
The following sections describe how to prepare your PR according the different situations, but these instructions assume you already know how to fork a GitHub repository, and how to run unit tests on the source code from your fork.Please note that it is only worthwhile to submit your parser to the Notepad++ codebase if the parser is for one of the builtin lexers. If you have created a parser that is for a UDL, you do not need to follow these instructions for Unit Tests, as they do not get distributed with Notepad++.
-
@PeterJones said in UDL for DXL (C LIke) Number processing issues.:
Please note that it is only worthwhile to submit your parser to the Notepad++ codebase if the parser is for one of the builtin lexers.
I think the sentence is misleading since a parser one is writing and being requested to be added is not “for one of the builtin lexers.” since the requester doesn’t know how many or which builtin lexer to be added to. My understanding is the parser will be added to the list of all the other language parsers/lexers already in npp. So instead of “for” , maybe it should say “added to the list” of builtin lexers.
What are your thoughts about npp being able to handle different language UDL xml files for the same language as a different version for development purpose, but distinguished by separate ids but under the same userdefinedlanguagename? Can npp separate them for the functionlist and autocompletion without hanging in infinite loops?
-
It is not misleading. Not all of the 80+ builtin lexers have an accompanying function list parser, so one could try to fill in the gaps. Secondly, as the documentation specifically mentions, one might also be providing an update or improvement to an existing function list parser.
different language UDL xml files for the same language as a different version for development purpose, but distinguished by separate ids but under the same userdefinedlanguagename?
If it were feasible to do, the developers would have given the Dark Mode and Original Markdown UDLs the same name. And they didn’t. That aside, the Language menu list shows that name, so how would the user know which of the N “Markdown” UDLs to select.
No. I firmly believe that UDL names need to remain unique.
-
@PeterJones said in UDL for DXL (C LIke) Number processing issues.:
It is not misleading
I still do not believe it was misleading. But after sleeping on it, I decided it could be clarified more:
Contribute your new or enhanced parser rule to the Notepad++ codebase
You are welcome to contribute your new or enhanced parser definition file to the Notepad++ codebase by creating PR on the Notepad++ GitHub page. This can be an update for a language that already has a function list definition, or can be a new definition file for one of the builtin lexer languages that does not yet have a function list definition. (This is not necessary if you are creating a function list definition for a UDL: since UDLs do not get distributed with Notepad++, neither do function list definitions for the UDLs. As such, you will not submit your UDL’s function list definition to the Notepad++ GitHub page through a PR, and you do not need to go through the “unit test” procedure described below for your UDL’s function list definition.)
-
@PeterJones I will think more on this.
I have been able to get multiple DXL UDL files that are configured differently for my dev purposes till I get one that works the way I want it to work. I can select each one to see what color changes happen for a given test file. The same on selecting the function list parser although all of these are the same based on a copy of the “C” lang parser but with different Ids and userDefinedLanngName differences.
There is a an inconsistency (although it works) between the user/my udl xml file and the overridMap.xml usage of “userDefinedLangName” such that the user UDL specifies this as “UserLang name” . NPP will determine how to match them, I wonder why they need to be different and couldn’t be the same.
I’m still wondering what displayName with the accompanying id does? I’ve changed this with missing or bogus data but it doesn’t affect anything.
Moreover, the autoCompletion files for my two user UDLs along with a shared lang of “DXL” doesn’t do anything even if they are deleted. Since if I go to a function definition and start typing “void” or “Int” before the function name a popup will appear although I don’t know where this is coming from since the scrowllable list contains things that my DXL language doesn’t have. So where is it getting this list and how can I modify this list for my DXL language. I thought it was controlled by autocompletion.However, I’ve been working another issue with NPP.
Since my DXL language is “C” like, I’ve been having problems such that when the functionlist parser is activated, npp will hang forever and the task manager shows “npp not responding” until I kill the task. I’ve narrowed the problem down to the “C” parser although I didn’t change anything. Moreover, when I select the “C” language to use and apply coloring instead of my udl, and then select functionlist it will also hang. It doesn’t do this with C#, C++, objective C or any other language ie. fortran, java, jscript, rust, etc.
My test file that I have is very simple for test purposes. It contains 1500 lines of plain text strings up to 20 characters max. These represent the copy and past of the UDL keyword 1-8 contents. Each keyword is a list of the following: builtin attributes, constants, properties, functions, statements, operators, then some arbitrary if logic, andnumber formats, The purpose isn’t to get a working program. It’'s to test that npp will be able to correctly apply the UDL coloring set for the keyword, delimiters, numerics, comments, operators etc. It does colorize as expected. Moreover, this test file doesn’t contain any function name declaration. So I expect when I turn on the “C” parser I borrowed for DXL or check the language as “C” so it uses its copy that the functionlist will be empty but only display the filename that this test sequence is in.
When I only have about 150 strings, after a few seconds it does display only the filename the test code is in. However, anything more than this causes the C parser to run forever i.e. with the 1500 strings that represent all the entries in keywords etc copied to the test file it is still trying to find a function after 15 plus minutes. So I have to kill npp in the task manager.In the case of a working DXL program that is 825 lines of code, it can find my one function and display it in the functionlist without problem.
Thus, I think there is a problem with the “C” lexer although other “C” language types such as C#, Cpp and objective-C don’t have this issue. So, what is the upper limit for the number of characters per line that the regular expression routine that npp uses have? In unix input streams have an upper limit of around 8k characters. However, in my case it is about 25 chars per line. I haven’t dug into the C parser to see why this issue is occurring. Maybe it has to do with the regular expression memory usage. My laptop has 8 gigs of memory and it never gets close to this when running into the above problem.