Continuation Section Options Not Working

Get help with using AutoHotkey and its commands and hotkeys
rhinox202
Posts: 10
Joined: 30 Sep 2015, 10:22

Continuation Section Options Not Working

30 Sep 2015, 10:48

For starters, I am running AHK_L 1.1.22.07 Unicode x32 on Windows 8.1.

Anyway, I've been working on some code that "requires" an expression to be inside a continuation section. Really I could go another route but it would be much easier this way. I've included my test script at the bottom. Now the documentation says that a closing parenthesis in the CS options will allow expressions, but I can't get it to work and "just me" says that it is not an option either (see below). So, I would just like some clarification on this issue. If it's not supported, the offending lines should probably be removed to prevent further confusion. I would imagine that the Devs are busy, but his post is from almost a year ago.
just me wrote:Never noticed it and had to read the docs more than once:
) [v1.1.01+]: If a closing parenthesis appears in the continuation section's options (except as a parameter of the Join option), the line is reinterpreted as an expression instead of the beginning of a continuation section. This allows expressions like (x.y)[z]() to work without the need to escape the opening parenthesis.
It's not an option of a continuation section, though mentioned there.
Also, in testing this out I found that the documentation says that adding "Com" to the CS options will allow semi-colon comments but not block ones. In my testing, the opposite is true. Semi-colon comments are removed and blocks are allowed. Is this the way it should be?
Comments (or Comment or Com or C) [v1.0.45.03+]: Allows semicolon comments inside the continuation section (but not /*..*/). Such comments (along with any spaces and tabs to their left) are entirely omitted from the joined result rather than being treated as literal text. Each comment can appear to the right of a line or on a new line by itself.
Thank you for your time.

Code: Select all

test =
( LTrim Com ; ")" commented out because the script errors out
asdfasldkf
/*testing*/
/**/ ;test
; testing
	asdfalsdfkasdf`n
tes(3)
asdfasd
f
)
msgbox, % test
exitapp
tes(x)
{
	Return, x+2
}
RHCP
Posts: 196
Joined: 30 Sep 2013, 10:59

Re: Continuation Section Options Not Working

30 Sep 2015, 11:30

Code: Select all

test := "
( LTrim Com ; 
    asdfasldkf
    /* testing
     test */ ; Note this multi-line comment doesnt work
    ; testing
        asdfalsdfkasdf`n
    " tes(3) "
    asdfasd
    f
)"
msgbox, % test
exitapp
tes(x)
{
    Return, x+2
}
rhinox202
Posts: 10
Joined: 30 Sep 2015, 10:22

Re: Continuation Section Options Not Working

30 Sep 2015, 13:08

Thanks RHCP, works exactly how I would expect. However, my actual use case has quotes in it (I'm creating an XML file), so I would have to escape every quote to stop the script from breaking. Any ideas on that front? Thanks nonetheless.
RHCP
Posts: 196
Joined: 30 Sep 2013, 10:59

Re: Continuation Section Options Not Working

30 Sep 2015, 13:24

Code: Select all

v = 
( Ltrim
    
    a
    b
    c

)
v .= abs(9.9)
v = %v%
( ltrim 
    
    1
    2
    3
)
msgbox % v
rhinox202
Posts: 10
Joined: 30 Sep 2015, 10:22

Re: Continuation Section Options Not Working

30 Sep 2015, 13:59

That was the other option. Thanks for the help.
lexikos
Posts: 6963
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Continuation Section Options Not Working

30 Sep 2015, 20:28

rhinox202 wrote:Now the documentation says that a closing parenthesis in the CS options will allow expressions,
It will allow the line to be an expression, instead of the beginning of a continuation section, as it says in the quote. I will see if I can make the documentation clearer.

Code: Select all

(x = y) ? true_branch : false_branch   ; This is an expression, not a continuation section.

MsgBox % "
(  ; This is a continuation section.
one
two
)"
MsgBox % "
(Join()  ; This is a continuation section (")" is allowed only where it is meaningful - i.e. with the Join option).
one
two
)"
; NOTE: Most syntax highlighters (including the forum's) do not handle continuation sections correctly.
You do not need any special options to allow expressions inside a continuation section.
Also, in testing this out I found that the documentation says that adding "Com" to the CS options will allow semi-colon comments but not block ones. In my testing, the opposite is true. Semi-colon comments are removed and blocks are allowed. Is this the way it should be?
Yes. I think you're misinterpreting it. "Com" allows you to use semi-colon comments. Omitting "Com" allows you to write semi-colons without them being interpreted as comments. Either way, /* inside a continuation section is never interpreted as a comment flag. (They are not comments, just ordinary literal characters.)
However, my actual use case has quotes in it (I'm creating an XML file), so I would have to escape every quote to stop the script from breaking.
That is correct. The continuation section does not change how the expression is interpreted (in v1.x). You have to "escape" (by doubling up) every literal quote mark regardless of whether the expression is in a continuation section.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], DaveT1, hackkk745 and 54 guests