Page 4 of 4

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 10:46 pm
by AZJIO
Here with Macro,Procedure -prefix

Code: Select all

         <parser
            displayName="PureBasic"
            id         ="purebasic_function"
            commentExpr="(?x)(?m-s:^\h*;.*?$)  # !Single line comment"
         >
            <function
					mainExpr="(?x)(?mi)^\h*    \K (?:Procedure(?:\.[abcdifqwsu])?|Macro)    \s+  [A-Za-z_]\w*     \s*\([^()]*?\)"
            >
               <functionName>
                  <nameExpr expr="[\w\s.]+"   />
               </functionName>
            </function>
         </parser>
skywalk wrote:What version of Notepad++ are you running?
7.6.6 x86

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 10:58 pm
by skywalk
Whew! My slowness was a malformed functionList.xml.

You are missing Procedure.l?
mainExpr="(?x)(?mi)^\h*\K(?:Procedure(?:\.[abcdfilqsuw])?|Macro)\s+[A-Za-z_]\w*\s*\([^()]*?\)"

Great Job! Yours is running much faster. 8)

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:06 pm
by AZJIO
Need to add other tokens: ProcedureC ProcedureCDLL ProcedureDLL

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:10 pm
by skywalk
Argg! Forgot about those. Gonna make the parser slow again?
Procedure$ too

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:18 pm
by AZJIO

Code: Select all

(?x)(?mi)^\h*    \K (?:Procedure[CDL$]{0,4}?(?:\.[abcdifqwsu])?|Macro)    \s+  [A-Za-z_]\w*     \s*\([^()]*?\)
Procedure[CDL$]{0,4}?
Procedure$
Where is it used? Does she have a standard look?

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:25 pm
by skywalk
Procedure$ returns String.
ProcedureDLL$ returns String.
ProcedureC$ returns String.

Code: Select all

			<parser
				displayName="PureBasic_Dark"
				id         ="purebasic_function"
				commentExpr="(?x)(?m-s:^\h*;.*?$)  # !Single line comment"
			>
				<function
          mainExpr="(?x)(?mi)^\h*\K(?:Procedure[CDL$]{0,5}?(?:\.[abcdfilqsuw])?|Macro)\s+[A-Za-z_]\w*\s*\([^()]*?\)"
				>
					<functionName>
						<nameExpr 
              expr="[\w\s\$.]+"
            />
					</functionName>
				</function>
			</parser>
Don't forget the l for Long!

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:33 pm
by AZJIO
skywalk wrote:Procedure|ProcedureC|ProcedureDLL
Procedure(?:C|DLL|CDLL)?
In your version, the engine will go back 9 characters to check the word first.
For example, we allow a slightly wrong code. But no one will write the wrong code. We don't need to perfectly detect

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:35 pm
by skywalk
Yes, you are a REGEX wizard. This is my 1st use of this nasty scripting. I must say, I still hate it. :twisted:

Main thing is I now have Notepad++ running quicker.
It was like a turtle in sand with my version on large files.

Re: Notepad++ language template for PureBasic?

Posted: Fri Apr 19, 2019 11:48 pm
by AZJIO

Code: Select all

(?x)(?mi)^\h*\K(?:Procedure[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?|Macro)\h+[A-Za-z_]\w*\h*\([^()]*?\)
(?x)(?mi)^\h*\K(?:Procedure[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?|Macro)\h+[A-Za-z_]\w*\h*\([^()]*?\)
Procedure .s - space is allowed
\s+ -> \h+ we only have horizontal spaces

Code: Select all

(?x)(?mi)^\h*(?:Procedu\Kre[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?|Macro)\h+[A-Za-z_]\w*\h*(?=\()
Procedu\Kre - So shorter
re.s GetLineText
re SetLineText

Code: Select all

(?x)(?mi)^\h*(?:Procedure[CDL$]{0,5}?\K(?:\h*\.[abcdfilqsuw])?|Macro)\h+[A-Za-z_]\w*\h*(?=\()
.i GetLineBookmark
.s GetLineText
SetLineText
Macro x

Re: Notepad++ language template for PureBasic?

Posted: Sat Apr 20, 2019 2:21 am
by skywalk
Great idea to shorten the list horizontally. :D
I think it better to keep the Procedur\Ke to catch eDLL, e$, eC, etc.

Code: Select all

(?x)(?mi)^\h*(?:Procedur\Ke[CDL$]{0,5}?(?:\.[abcdfilqsuw])?|Macr\Ko)\s+[A-Za-z_]\w*\s*\([^()]*?\)

Re: Notepad++ language template for PureBasic?

Posted: Sun Apr 21, 2019 6:35 pm
by AZJIO
1. Check this:

Code: Select all

Procedure .s FuncName ()
	ProcedureReturn "Good"
EndProcedure
Debug FuncName ()
Will show it in the list of procedures
2. Look at this https://notepad-plus-plus.org/community ... -purebasic
I think if to offer it for Notepad ++, then it has to show only names of procedures.

Re: Notepad++ language template for PureBasic?

Posted: Sun Apr 21, 2019 7:38 pm
by skywalk
Good deal. I didn't know the L_Purebasic id? I still use userDefinelang because I changed the theme to Dark and built in is not.

Re: Notepad++ language template for PureBasic?

Posted: Sun Apr 21, 2019 9:05 pm
by AZJIO
I still use userDefinelang because I changed the theme to Dark and built in is not.
Color theme is not difficult to do, here is my example. But the parser itself is imperfect, it contains few tokens.
Yesterday I updated userDefineLang-PureBasic. I added the area

Code: Select all

;{
;}
I managed to add "Module"

Code: Select all

 <parser
	displayName="PureBasic"
	id         ="purebasic_function"
	commentExpr="(?x)(?m-s:^\h*;.*?$)  # !Single line comment"
 >
	<classRange
		mainExpr    ="(?x)(?mi)^\h*Module\h+\K[A-Za-z_]\w*\s+.+?(?=EndModule)"
	>
		<className>
			<nameExpr expr="\w+" />
		</className>
		<function
			mainExpr="(?x)(?mi)^\h*(?:Procedure[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?\K|Macro)\h+[A-Za-z_]\w*\h*(?=\()"
		>
			<functionName>
				<funcNameExpr expr="[\w\h.$]+" />
			</functionName>
		</function>
	</classRange>
	<function
			mainExpr="(?x)(?mi)^\h*(?:Procedure[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?\K|Macro)\h+[A-Za-z_]\w*\h*(?=\()"
	>
	   <functionName>
		  <nameExpr expr="[\w\h.$]+"   />
	   </functionName>
	</function>
 </parser>

Re: Notepad++ language template for PureBasic?

Posted: Fri Jan 06, 2023 2:34 pm
by wb2k
The background color for every style makes it hard to read, but it looks very good after removing this in your XML-file:

Code: Select all

bgColor="3F3F3F"
Your template is not listed as user definded language at Notepad++ yet:
https://github.com/notepad-plus-plus/us ... dl-list.md
Probably more will use it, if you list it there. Here is how you can contribute your template: https://github.com/notepad-plus-plus/us ... ll-request