AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto-Syntax-Tidy v12
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Sat Aug 12, 2006 7:56 pm    Post subject: Reply with quote

i tried v10 and that was on my laptop... now i'm usig my desktop and v11, and there's no error... i'll let you know if i can find something, though i don't think it matters now as it seems to be gone (atleast on this machine!)
_________________
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Wed Aug 16, 2006 12:56 pm    Post subject: Reply with quote

I just shortened the code by 150 lines, but that's not worth an update.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon Sep 04, 2006 11:35 am    Post subject: Reply with quote

An update to version 12. First post is updated.
Quote:
changes since version 11:
- tray icon allows to toggle show/hide of GUI and to exit script
- added progressbar if identation is done inside an editor and blockinput is used to limit interference
- shortend code with functions, with new features the line numbers stay equal
- log text is scrolled to the end
- on /hidden, gui is created but hidden, tray icon is visible in both cases.
- on "/watch hwnd" , gui is hidden and closes itself when hwnd closes
- on /toggle, script checks if another instance is running and closes both scripts
- improved possibilty to find path of AHK
- added warning message if syntax files do not exist
- OwnHotkey is stored in INI file and has a control in the GUI

_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Demokos



Joined: 28 Dec 2005
Posts: 84

PostPosted: Mon Sep 04, 2006 4:39 pm    Post subject: Reply with quote

For me the link in the first page is out.
Back to top
View user's profile Send private message
mosaic



Joined: 25 Apr 2007
Posts: 20

PostPosted: Sun May 06, 2007 5:21 pm    Post subject: Syntax-Tidy Newest Version? Reply with quote

What's the newest version? is v14 out there? I only managed to get v13.

I am interested in this script. Thank you for the wonderful work, toralf. I am a autohotkey newbie (used for several weeks now, loved it), I am learning how to use Notepad++ to edit ahk script, with syntax hightlighting and function list, to my dismay, the insertExt.ini fails quite frequently, I spend at least 4 hours today trying to fix up. After did many research and readings, I came to the conclusion that with my own retricted syntax, I could make it out. See my posting in this thread for details.

However, I would like to hear any expert's opinion here on how to make it work better. One thing I would like to improve is function call such as:

Code:

DllCall(arg1, arg2)


Should not be listed as function even if it is not indented, but I have no idea how to do that.

Thank you all in advance.
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon May 07, 2007 8:30 am    Post subject: Reply with quote

Hi mosaic,

I do not know where you got version 13 from. My latest version is number 12. :)

Regarding NotePad++ I can't help you since I'm not using it and this is off topic in this thread. Sorry, you'll have to try to fing help somewhere else, since I doubt that people that use NotePad++ will look here frequently.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mosaic



Joined: 25 Apr 2007
Posts: 20

PostPosted: Mon May 07, 2007 12:37 pm    Post subject: Reply with quote

toralf wrote:
Hi mosaic,

I do not know where you got version 13 from. My latest version is number 12. Smile

Regarding NotePad++ I can't help you since I'm not using it and this is off topic in this thread. Sorry, you'll have to try to fing help somewhere else, since I doubt that people that use NotePad++ will look here frequently.


toralf,

Thanks for your reply.

I got it in a zip file some where in this forum. the name of the zip file is PSPad_AHK_Toolbar_v1a.zip (in there, there is a v13, dated Aug 23, 2006)

The reason I am asking v14 is in the screen shot you posted in the very first message, it says v14.

I personally like the rajat style in the syntax tidy choice (after I tried both BoBo/Toralf style). However, it is slight off for function definition(for my own tast anyway). I am not so sure it's intentional or not. The following is the function definition iff from Auto-Syntax-Tidy.ahk

Code:

iif(exp,a,b=""){
      If exp
         Return a
      Return b
   }


I applied rajat style with Indentation 1xTab and Indentation of Method 1 continuation Lines: 1 Tab. As you can see, the last parances } is lined up with (, instead, I want it to line up with iif, in this case, should be the very first character in the line, like the following:


Code:

iif(exp,a,b=""){
      If exp
         Return a
      Return b
}


Is it easy to make this customization?

Finally, in terms of Notepad++'s insetExt.ini, I am sorry it is off-topic to this thread, I actually started to think about that after I read this thread. I do have a small question to ask, just bear with me. It's obviously doing some RegEx checking to get the function name. I just noticed Laszlo used the following function in this thread:

Code:

Value@(Ptr, Type="Int") { ; Extract Type binary value pointed to by Ptr
   VarSetCapacity(Value,99)
   DllCall("RtlMoveMemory", Type . "*",Value, UInt,Ptr, UInt ; #Bytes:
   , InStr("UChar",Type) ? 1 : InStr("UShort",Type) ? 2 : InStr("UIntFloat",Type) ? 4 : 8)
   Return Value
}


So obviously @ is an acceptable character in function names, 'cause my insertExt.ini won't be able to pick it up. As it is using the following RegEx to pick up function names (the ^ in the first line is a pre-condition that the function name should appear in the beginning of the line, is this an acceptable practice to rely on this to pick up function names?, it works for me for now, well, with one exception):

Code:

^
[a-zA-Z0-9_]+


So, I made the change to include the @ character:

Code:

^
[a-zA-Z0-9@_]+



Now, it can pick up Value@ as function names as well. What other character you or others can think of which are allowed in function names? Also in the same thread, Lazslo's example code made lots of DllCall without indentation, my function definition "successfull" picked them up as function names. Bummer.

Thanks a lot.
Back to top
View user's profile Send private message
mosaic



Joined: 25 Apr 2007
Posts: 20

PostPosted: Mon May 07, 2007 1:20 pm    Post subject: Reply with quote

Ok, by experiment, I have found a bug:

The following code could not be Syntax-Tidied, because they use special characters(?, @) in the function, however, they are valid function names (I just tested):

Code:

isthisvalid?(){
MsgBox, is this valid?
}

Value@(Ptr, Type="Int") { ; Extract Type binary value pointed to by Ptr
VarSetCapacity(Value,99)
DllCall("RtlMoveMemory", Type . "*",Value, UInt,Ptr, UInt ; #Bytes:
   , InStr("UChar",Type) ? 1 : InStr("UShort",Type) ? 2 : InStr("UIntFloat",Type) ? 4 : 8)
Return Value
}
Back to top
View user's profile Send private message
mosaic



Joined: 25 Apr 2007
Posts: 20

PostPosted: Mon May 07, 2007 1:24 pm    Post subject: Reply with quote

I also have a feature request for your next version:

Could you add a feature that I can highlight a piece of code and press a key (say F3) to insert tabs in the front)???

Thanks.
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Mon May 07, 2007 2:55 pm    Post subject: Reply with quote

True there has been a special version for AHK toolbar, that I forgot about. I do not knwo if I have a version 14 somewhere. Maybe it was a mistake. I have version 13 in the AHK toolbar script. I'll have to sort it out.

Regrading your RegEx, the manual says:
Quote:
Variable names: Variable names are not case sensitive (for example, CurrentDate is the same as currentdate). Variable names may be up to 254 characters long and may consist of letters, numbers and the following punctuation: # _ @ $ ? [ ]
Thus a RegEx would be:

Code:
identifierRE = ][#@$?\w                  ; Legal characters for AHK identifiers (variables and function names)
parameterListRE = %identifierRE%,=".\s-  ; Legal characters in function definition parameter list
RegExMatch(CurrLine, "^\s*(?P<Name>[" . identifierRE . "]+)"
                              . "\((?P<Parameters>[" . parameterListRE . "]*)"
                              . "(?P<ClosingParen>\)\s*(?P<OpeningBrace>\{)?)?"
                              . lineCommentRE, function)
taken from PhiLho
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mosaic



Joined: 25 Apr 2007
Posts: 20

PostPosted: Mon May 07, 2007 3:22 pm    Post subject: Reply with quote

Thanks toralf,

I will make change in the insertExt.ini to use this new rule.

Could you confirm whether there is indeed a bug in auto-syntax-tidy.ahk when function names having those special characters in it?

Thanks for your help.
Back to top
View user's profile Send private message
fincs



Joined: 05 May 2007
Posts: 82
Location: Seville, Spain

PostPosted: Thu Jul 12, 2007 9:48 pm    Post subject: Reply with quote

Hi,
I viewed and tried your script and it's great!
But I have discovered one bug with menus:

Original script menu bar:



Tidy-ed script menu bar:



The case is incorrect in "Ayuda" ("help" in english) menu and in the "Herramientas" (tools) menu the item "Calculadora" (calculator) appears in lowercase (and the item "Acerca de..." (about) in the "Ayuda" menu).
_________________
Sorry my poor English
Fincs

MsgBox % RegExReplace("Fernando Incs.", "^(\w).*\s+I(\w{3})\w*\.$", "$1i$2")
Back to top
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Fri Jul 13, 2007 4:18 pm    Post subject: Reply with quote

Sorry, that the script screwed up the cases. If this happens to you, you have to turn off the case correction.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Fri Jul 13, 2007 4:20 pm    Post subject: Reply with quote

Have you ever thought about converting the script to a function so it can be reused?
_________________

RegExReplace("irc.freenode.net/ahk", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2")
Back to top
View user's profile Send private message Visit poster's website
urlwolf



Joined: 16 Mar 2006
Posts: 100

PostPosted: Thu Jan 03, 2008 3:11 pm    Post subject: Reply with quote

Another feature request:
Could you add an option to covert functions to the K&R format, i.e. function (params) { ? That's OTB for functions.

This would be handy to make this script complement this solution for editor-independent function lists:

http://www.autohotkey.com/forum/viewtopic.php?t=27176&highlight=ctags

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 3 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group