| View previous topic :: View next topic |
| Author |
Message |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sun Mar 19, 2006 2:29 am Post subject: |
|
|
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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Sun Mar 19, 2006 2:34 am Post subject: |
|
|
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 |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sun Mar 19, 2006 2:42 am Post subject: |
|
|
The text has to be short (by my standards). _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Sun Mar 19, 2006 2:55 am Post subject: |
|
|
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 |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun Mar 19, 2006 12:35 pm Post subject: |
|
|
| 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 |
|
 |
TheLeO
Joined: 11 Jun 2005 Posts: 165 Location: England ish
|
Posted: Sun Mar 19, 2006 12:56 pm Post subject: |
|
|
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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5068 Location: imaginationland
|
Posted: Sun Mar 19, 2006 1:14 pm Post subject: |
|
|
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 |
|
 |
robiandi Guest
|
Posted: Sat Jul 15, 2006 9:08 am Post subject: |
|
|
@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
|
Posted: Sun Jul 16, 2006 9:51 am Post subject: |
|
|
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 |
|
 |
robiandi Guest
|
Posted: Sun Jul 16, 2006 1:09 pm Post subject: |
|
|
Number of tests: 1
Succes Rate: 100%
I will wait for version 11 |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Aug 11, 2006 11:06 pm Post subject: |
|
|
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 |
|
 |
Bobo afficionnado Guest
|
Posted: Sat Aug 12, 2006 12:37 am Post subject: |
|
|
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
|
Posted: Sat Aug 12, 2006 9:18 am Post subject: |
|
|
| 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 |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sat Aug 12, 2006 9:19 am Post subject: |
|
|
| Bobo afficionnado wrote: | | My prefered notation : | I'll look into the code if I can add a BoBo style. :) _________________ Ciao
toralf  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sat Aug 12, 2006 4:05 pm Post subject: |
|
|
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 |
|
 |
|