It is currently Sun Oct 20, 2019 7:39 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 10:46 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
Here with Macro,Procedure -prefix
Code:
         <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


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 10:58 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
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)

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:06 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
Need to add other tokens: ProcedureC ProcedureCDLL ProcedureDLL


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:10 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
Argg! Forgot about those. Gonna make the parser slow again?
Procedure$ too

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:18 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
Code:
(?x)(?mi)^\h*    \K (?:Procedure[CDL$]{0,4}?(?:\.[abcdifqwsu])?|Macro)    \s+  [A-Za-z_]\w*     \s*\([^()]*?\)

Procedure[CDL$]{0,4}?

Quote:
Procedure$
Where is it used? Does she have a standard look?


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:25 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
Procedure$ returns String.
ProcedureDLL$ returns String.
ProcedureC$ returns String.
Code:
         <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!

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Last edited by skywalk on Fri Apr 19, 2019 11:33 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:33 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
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


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:35 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
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.

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Fri Apr 19, 2019 11:48 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
Code:
(?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:
(?x)(?mi)^\h*(?:Procedu\Kre[CDL$]{0,5}?(?:\h*\.[abcdfilqsuw])?|Macro)\h+[A-Za-z_]\w*\h*(?=\()

Procedu\Kre - So shorter
Quote:
re.s GetLineText
re SetLineText



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

Quote:
.i GetLineBookmark
.s GetLineText
SetLineText
Macro x


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Sat Apr 20, 2019 2:21 am 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
Great idea to shorten the list horizontally. :D
I think it better to keep the Procedur\Ke to catch eDLL, e$, eC, etc.
Code:
(?x)(?mi)^\h*(?:Procedur\Ke[CDL$]{0,5}?(?:\.[abcdfilqsuw])?|Macr\Ko)\s+[A-Za-z_]\w*\s*\([^()]*?\)

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Sun Apr 21, 2019 6:35 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
1. Check this:
Code:
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Sun Apr 21, 2019 7:38 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Dec 23, 2009 10:14 pm
Posts: 3084
Location: Boston, MA
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.

_________________
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum


Top
 Profile  
Reply with quote  
 Post subject: Re: Notepad++ language template for PureBasic?
PostPosted: Sun Apr 21, 2019 9:05 pm 
Offline
User
User

Joined: Sun May 14, 2017 1:48 am
Posts: 22
Quote:
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:
;{
;}


I managed to add "Module"
Code:
 <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>


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 58 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye