TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: ChrisCarlson on March 26, 2015, 09:42:09 AM

Title: Notepad+++
Post by: ChrisCarlson on March 26, 2015, 09:42:09 AM
Does anyone have a function parser (functionList.xml) for notepad+++?
Title: Re: Notepad+++
Post by: huiz on March 26, 2015, 09:45:12 AM
Here is one.
Title: Re: Notepad+++
Post by: ChrisCarlson on March 26, 2015, 10:00:39 AM
Looks to be the "stock" functionList.xml file?

My regex skills are severely lacking but I think it would be something along these lines?

Code: [Select]

<association ext = ".lsp" id="autolisp_function"/>

<parser id="autolisp_function" displayname="AutoLisp">
<function
mainExpr="mainExpr="/([(defun])\w+$/ig"
displayMode="$functionName">
        <functionName>
<nameExpr expr="/[_]\w+/igm"/>
</functionName>
</function>
</parser>


But that's not it :confused:
Title: Re: Notepad+++
Post by: huiz on March 26, 2015, 10:56:36 AM
Looks to be the "stock" functionList.xml file?

..

You didn't want that one?
Title: Re: Notepad+++
Post by: ChrisCarlson on March 26, 2015, 12:13:44 PM
No, that file comes default with the installation. The end user has the ability to add in custom function traps. Which in turn, add the function to the function list for easy finding or referencing.
Title: Re: Notepad+++
Post by: huiz on March 26, 2015, 01:14:23 PM
In your AppData path you can find the personal file which you can edit. Mine is exact the same as the original so I never added or changed something :-)

Title: Re: Notepad+++
Post by: ymg on March 27, 2015, 03:06:56 PM
Chris,

Not too good at regex but this one
seems to work for me.

Code: [Select]
<parser id="lisp_function" displayName="Lisp">
<function
mainExpr="[ \t]*\([ \t]*defun[ \t][a-zA-Z0-9_+\-*/<>=:.!?@%&|]+"
displayMode="$className->$functionName">
</function>
</parser>

Also added the following line in association

Code: [Select]
<association langID="30" id="lisp_function"/>
Probably would need to add a regex to catch the comments.

ymg
Title: Re: Notepad+++
Post by: ymg on March 27, 2015, 03:40:21 PM
Chris,

Here, may be a bit better with the argument to the function.

Code: [Select]
<parser id="lisp_function" displayName="Lisp">
     <function
  mainExpr="[ \t]*\([ \t]*defun[ \t]+[a-zA-Z0-9_+\-*/<>=:.!?@%&|]+[ \t]+\([a-zA-Z0-9_+\-*/<>=:.!?@%&| \t]*\)"
displayMode="$className->$functionName">
     </function>
</parser>
Title: Re: Notepad+++
Post by: ChrisCarlson on March 27, 2015, 03:49:10 PM
Very nice! Thanks!
Title: Re: Notepad+++
Post by: ymg on March 28, 2015, 04:24:18 AM
Chris,

This regex
Code: [Select]
(?s);\|.*?\|; will find multiple lines comments,

while this one
Code: [Select]
;.*$ will find single-line comment.

However, I could not make it work in the parser for Function list.
Maybe you have better luck than me.

ymg
Title: Re: Notepad+++
Post by: ymg on March 28, 2015, 03:21:05 PM
Chris,

Here the parser with a much simpler regex.

Code: [Select]
                        <parser id="lisp_function" displayName="Lisp">
<function
     mainExpr="\(defun.*?\)"
     displayMode="$functionName">
</function>
</parser>

Still haven't found the trick to exclude comments though.

And a few regex that could be handy in Autolisp:

Single Line Comments in Autolisp:       ;.*$                               
Multiple Lines Comments Autolisp:       (?s);\|.*?\|;                 
Comments Single or Multilines:            (((?s);\|.*?\|;)|(;.*$)) 
Function Name with Parameters:         \(defun.*?\)                   
Function Name without (defun  :         (?<=defun).*?\)           
Within Double or Single Quotes:          (["'])(\\?.)*?\1               
Within Balanced Parentheses:              \((?>[^()]|(?R))*\)       



Most of the above was pulled or derived  from http://www.regular-expressions.info

ymg
Title: Re: Notepad+++
Post by: 77077 on May 27, 2015, 08:46:39 PM
New version no function list plug-in  ,I still use old version
Title: Re: Notepad+++
Post by: roy_043 on May 28, 2015, 11:51:33 PM
New version no function list plug-in  ,I still use old version
In the latest version V6.7.8.2 the function list works just fine.
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 03:21:18 AM
New version no function list plug-in  ,I still use old version
In the latest version V6.7.8.2 the function list works just fine.

I just download v6.7.8.2  , but function list  is  null
Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 07:52:26 AM
@ 77077: Can you post your functionList.xml?
Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 07:59:58 AM
@ ymg:
About your regular expressions:
1.
What does (?s) do?
2.
To catch single line comments use ;.*?$ instead of ;.*$
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 08:01:47 AM
@ 77077: Can you post your functionList.xml?

Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 08:05:07 AM
But that's the default file. You have to edit the file. That is what this topic is about...
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 08:11:50 AM
But that's the default file. You have to edit the file. That is what this topic is about...

Hi roy ,Where has the edited file ?
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 08:24:40 AM
Hi roy
Here is simple routine
Can add something like this ?

 (defun c:Test (/ st ss)
Select the TAG you want to change its value:[TAG1(1)/TAG2(2)/TAG3(3)/TAG4(4)/TAG5(5)] <TAG1>:



Title: Re: Notepad+++
Post by: ymg on May 29, 2015, 09:05:49 AM
Roy,

The (?s) was to allow multilines in Notepad++ without having to
check the box.

But I am far from being very fluent with regex, like the song
I still have 10 miles to go on a 9 miles road.

ymg
Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 09:09:10 AM
But that's the default file. You have to edit the file. That is what this topic is about...
Hi roy ,Where has the edited file ?

This is the parser I have used:
Code: [Select]
<parser id="lisp_function" displayName="lsp" commentExpr="((;\|.*?\|;)|(;.*?$))">
  <function
    mainExpr="(?&lt;=[\s\(]defun\s)\s*[^\s\(]*"
    displayMode="$functionName">
  </function>
</parser>

I have attached my file.
Title: Re: Notepad+++
Post by: ChrisCarlson on May 29, 2015, 09:14:36 AM
That works pretty smoothly Roy, thanks!
Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 09:23:33 AM
Hi roy
Here is simple routine...
You should start a new topic for this problem. But IMO your request is strange. Tags are not restricted to the "TAG?" format. Except for quick tests I would never use "TAG1", "TAG2" etc.
Title: Re: Notepad+++
Post by: roy_043 on May 29, 2015, 09:25:37 AM
That works pretty smoothly Roy, thanks!
Thanks. Note that if you want the list to also contain the arguments then you should study ymg's suggestions.
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 11:37:18 AM
roy , thanks a lot.  function list is nice .
Title: Re: Notepad+++
Post by: 77077 on May 29, 2015, 10:29:30 PM
roy ,I have a new question .
set language ----> L--->LISP  , ok, function list is ok
set language ----> user define language---> function list not ok .

Title: Re: Notepad+++
Post by: roy_043 on May 31, 2015, 11:22:35 AM
roy ,I have a new question .
set language ----> L--->LISP  , ok, function list is ok
set language ----> user define language---> function list not ok .
The info you need is in the file...
Title: Re: Notepad+++
Post by: 77077 on May 31, 2015, 12:04:20 PM
roy ,I have a new question .
set language ----> L--->LISP  , ok, function list is ok
set language ----> user define language---> function list not ok .
The info you need is in the file...

Yes , I open functionlist .xml , but ,I can't understand , can you tell me where I need modify ?
Title: Re: Notepad+++
Post by: roy_043 on June 01, 2015, 03:59:47 AM
Info in the file:
Code: [Select]
for User Defined Languages:
<association userDefinedLangName="my user defined language" id="my_udl_passer_id"/>
<association userDefinedLangName="Autocad" id="my_autocad_passer_id"/>

So after:
Code: [Select]
<association langID="30" id="lisp_function"/>Insert:
Code: [Select]
<association userDefinedLangName="LSP" id="lisp_function"/>Change "LSP" to match your name.
Title: Re: Notepad+++
Post by: 77077 on June 01, 2015, 04:49:52 AM
Info in the file:
Code: [Select]
for User Defined Languages:
<association userDefinedLangName="my user defined language" id="my_udl_passer_id"/>
<association userDefinedLangName="Autocad" id="my_autocad_passer_id"/>

So after:
Code: [Select]
<association langID="30" id="lisp_function"/>Insert:
Code: [Select]
<association userDefinedLangName="LSP" id="lisp_function"/>Change "LSP" to match your name.

Thank you ,roy, now is successful !
Title: Re: Notepad+++
Post by: Q1241274614 on July 07, 2015, 06:57:00 AM
(startapp "notepad.exe" FILENAME)
Title: Re: Notepad+++
Post by: Jota123457 on May 13, 2017, 08:21:31 AM
You are great!
I'm still using Notepadd++  ( :knuppel2:) with autolisp and finaly the functionlist is working.
1000 Thanks! :yay!: