UDL for DXL (C LIke) Number processing issues.
-
@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.
-
@swegmike After editing my post two times, on the third edit, it gives a popup that thinks I’m spamming.
-
@swegmike
I’ve been working on my DXL autocomplete xml file and have been able to get it to pass the XML pluggin validation. However, when I try to save it, I get a popup as shown below regardless if I run the “Convert to UTF-8” or “convert to ANSI” even though the first line in the xml file specifies UTF-8.Am I really missing a DTD although I have NPP 8.4.7 now?
-
@swegmike ,
Good question. It looks legitimate, however, my Autocompletion file is encoding 1252 for the Windows standard, unless that’s changed by NPP. If I had to guess, perhaps the XML tools are what’s flagging it and doesn’t recognize it?It could also be a typo or other syntax violation later that doesn’t have a closing match or some such that is misplacing the error for you. Mind you, I’m not an expert, but if the tool is making the warning, it’s not NPP I don’t suspect. In my functionList.xml file, even though my file works, it gives an error ‘suspicion’ in my regex for the comment characters…so I don’t put a lot of stock in errors always showing where they are being where they really are. :) Sometimes, it’s elsewhere, but it’s easier for it to flag it somewhere else. ::shrug::.
-
The select file dialog is from the xml validation process.
I assume theenable auto validation
from the xml menu has been checked.