AutoHotkey Community

It is currently May 27th, 2012, 9:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: March 19th, 2006, 2:29 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 2:34 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
Oh right. You could replace the styles bit with a simple checkbox saying 'Double indent IF statements' or something of the sort.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 2:42 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
The text has to be short (by my standards).

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 2:55 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
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.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 12:35 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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.

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 12:56 pm 
Offline

Joined: June 11th, 2005, 9:34 am
Posts: 264
Location: England ish
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. ^.^

_________________
::
I Have Spoken
::


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 19th, 2006, 1:14 pm 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
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!

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2006, 9:08 am 
@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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2006, 9:51 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 16th, 2006, 1:09 pm 
Number of tests: 1
Succes Rate: 100%

I will wait for version 11


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 11th, 2006, 11:06 pm 
Offline

Joined: March 28th, 2004, 3:53 pm
Posts: 1870
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!

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 12:37 am 
My prefered notation :
Code:
Loop x
   {
   If i = 1
      {
      Do that
      }
   Else
      {
      Do This
      }
   }


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 9:18 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 9:19 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
Bobo afficionnado wrote:
My prefered notation :
I'll look into the code if I can add a BoBo style. :)

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 4:05 pm 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 63 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 9 guests


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

Search for:
Powered by phpBB® Forum Software © phpBB Group