Page 1 of 1

✅ [v2] Unable to parse continuation section inside enclosure

Posted: 05 Apr 2019, 15:41
by lvalkov
This issue has been resolved as of:
v2.0-a105-acb6f3cb wrote:Fixed quoted continuation sections inside continuation expressions.

Given:

Code: Select all

boxes := () => (
	MsgBox('
	(
		Multi.
		Line.
		Text.
	)'), 
	MsgBox('Another function.')
)

%boxes%()
A continuation-section nested inside a continuation-by-enclosure cannot be parsed properly, resulting in the following error message:

Code: Select all

E:\enclosure.ahk (1) : ==> Missing "'"
     Specifically: boxes := () => ( MsgBox('Multi.
Line.
Text.'),
To resolve this issue, one can place the first expression on the same line, where the continuation-by-enclosure block began:

Code: Select all

boxes := () => (MsgBox('
	(
		Multi.
		Line.
		Text.
	)'), 
	MsgBox('Another function.')
)
I am of the opinion that this should be supported without having to resort to the workaround, since continuation-by-enclosure blocks, which do not contain nested continuation-sections, are presently being parsed correctly:

Code: Select all

boxes := () => (
	MsgBox('Multi.`nLine.`nText.'),
	MsgBox('Another function.')
)


I was torn between posting in the AHK v2 Dev subforum and here. Apologies if only AHK v1 bugs were meant to be reported here. I did so because it seemed only fitting.

Re: [v2] Unable to parse continuation section inside enclosure

Posted: 21 Sep 2019, 02:39
by lexikos
Continuation sections within continuation expressions can be parsed correctly. For example:

Code: Select all

boxes := () => (
	MsgBox(
	(Join`s.`s
        A_ScriptDir
        Chr(92)
        A_ScriptName
	)), 
	MsgBox('Another function.')
)
%boxes%()
Unlike continuation sections, continuation expressions are not intended to permit strings to span multiple lines. The problem is that if the continuation section is parsed within the continuation expression, the "illegal" unclosed string is detected before the continuation section is considered. (If the continuation section starts on the second line, it is parsed first, since continuation sections apply to all lines of code, not just expressions.)

Commit 919a3c91 should fix it.

Re: [v2] Unable to parse continuation section inside enclosure  Topic is solved

Posted: 27 Sep 2019, 17:27
by lvalkov
Confirmed resolved. Thank you for this update.