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
toralf



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

PostPosted: Sun Mar 19, 2006 2:29 am    Post subject: Reply with quote

The basic difference is this:

Toralf Style
Code:
If x
  {
    y = mad
  }
Else {
    z = cow
  }

Rajat Style
Code:
If x
{
  y = mad
}
Else {
  z = cow
}


Due to the lag of a describtive name I named it after the proposers. :)
_________________
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: Sun Mar 19, 2006 2:34 am    Post subject: Reply with quote

Oh right. You could replace the styles bit with a simple checkbox saying 'Double indent IF statements' or something of the sort.
_________________

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
toralf



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

PostPosted: Sun Mar 19, 2006 2:42 am    Post subject: Reply with quote

The text has to be short (by my standards).
_________________
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: Sun Mar 19, 2006 2:55 am    Post subject: Reply with quote

Thats only four words. Any shorter name would still be ambiguous (although better than Toralf/Rajat). You could go for 'Double Indent', 'Indent IFs', 'SmartIndent™' or any other pseudo name for double indenting IF statements.
_________________

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
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Sun Mar 19, 2006 12:35 pm    Post subject: Reply with quote

toralf wrote:
Please advice names for the two different styles.

They have traditionnal names:
Code:

K&R (Kernighan & Ritchie, creators of C):
if (foo) {
  F()
}
BSD/Allman: (my choice)
if (foo)
{
  F()
}
GNU:
if (foo)
  {
    F()
  }
Pico:
if (foo)
{ F()
}
Banner: (used by BoBo)
if (foo) {
  F()
  }

etc.
_________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")
Back to top
View user's profile Send private message Visit poster's website
TheLeO



Joined: 11 Jun 2005
Posts: 165
Location: England ish

PostPosted: Sun Mar 19, 2006 12:56 pm    Post subject: Reply with quote

hey nice,,,

VEry very nice tidy,,
although it didnt make much difference to my code since im pretty much of a " indentation, casing and spacing" fanatic any way.
^.^

but hey, cool stuff. ^.^
_________________
And i say: where there is a problem , there is a solution.(well some where that is.)
::
I Have Spoken
::
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Titan



Joined: 11 Aug 2004
Posts: 5068
Location: imaginationland

PostPosted: Sun Mar 19, 2006 1:14 pm    Post subject: Reply with quote

I like the K&R style for AutoHotkey scripting (becuase it's still easy to understand when compacted) and BSD/Allman for C#. Good findings PhiLho, I have yet to understand that the Wikipedia knows all!
_________________

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
robiandi
Guest





PostPosted: Sat Jul 15, 2006 9:08 am    Post subject: Reply with quote

@toralf: I use your excellent script regularly.
Version = v10
ScriptName = Auto-Syntax-Tidy %Version%
; 2006-02-21
I found 2 bugs:
1. Directives
After
Code:
 If FirstWord in %ListOfDirectives%         ;line is directive
we have in line 714
Code:
       String = %String%%Line%`n

2. Hotkeys
After
Code:
 Else If FirstChar in #,!,^,+,<,>,*,~,$     ;line is Hotkey
we have in line 719
Code:
        String = %String%%Line%`n

but in both cases the lines will be added again in line 1143
Code:
              String = %String%%Indent%%Line%`n
To test it, take the following script
Code:
#SingleInstance force
^1::msgbox hello

I propose to deactivate line 714 and line 719
Back to top
toralf



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

PostPosted: Sun Jul 16, 2006 9:51 am    Post subject: Reply with quote

Hi,
Thanks for the bug report. I guess it is related to an Else I forgot to set in line 726(?, i'm already on version 11)
Code:
If (FirstChar = "," OR FirstTwoChars = "||" OR FirstTwoChars = "&&"
Please put an "Else" in front of this line, test, and report your findings. I currently have no time to test, sorry. Thanks again. I'll update the code when I find time.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
robiandi
Guest





PostPosted: Sun Jul 16, 2006 1:09 pm    Post subject: Reply with quote

Number of tests: 1
Succes Rate: 100%

I will wait for version 11
Back to top
Rajat



Joined: 28 Mar 2004
Posts: 1718

PostPosted: Fri Aug 11, 2006 11:06 pm    Post subject: Reply with quote

toralf,
here's a bug report.
i ran it on itself... and the outcome gave error and didn't run. the reason being on line 84 the hotkey section '^d::' comes out twice.

i must say, this script is brilliant work!
_________________
Back to top
View user's profile Send private message
Bobo afficionnado
Guest





PostPosted: Sat Aug 12, 2006 12:37 am    Post subject: Reply with quote

My prefered notation :
Code:
Loop x
   {
   If i = 1
      {
      Do that
      }
   Else
      {
      Do This
      }
   }
Back to top
toralf



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

PostPosted: Sat Aug 12, 2006 9:18 am    Post subject: Reply with quote

Rajat wrote:
i ran it on itself... and the outcome gave error and didn't run. the reason being on line 84 the hotkey section '^d::' comes out twice.
I'll take a look.
_________________
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: Sat Aug 12, 2006 9:19 am    Post subject: Reply with quote

Bobo afficionnado wrote:
My prefered notation :
I'll look into the code if I can add a BoBo style. :)
_________________
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: Sat Aug 12, 2006 4:05 pm    Post subject: Reply with quote

New features in v11:
- Command line options
- New style "BoBo"

I updated the code in the first post.

@Rajat: I can't reproduce the bug. Could you please test the latest code to see if is persists? Thanks.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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 2 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