|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sat Aug 02, 2008 4:35 pm
[2.35] Parsing error with @{${local}/xyz} |
The following works:
Code: |
$local = "b"
bxyz = "foo"
#SH {${local}xyz = @{${local}xyz}}
#IF (@{${local}xyz} = "foo") {#sh true} {#sh false}
|
But change the variable reference to include a class, and this gets a parsing error, but only in the #IF:
Code: |
$local = "b"
b/xyz = "foo"
#SH {${local}/xyz = @{${local}/xyz}}
#IF (@{${local}/xyz} = "foo") {#sh true} {#sh false}
|
If you comment out the #IF (or remove it), it compiles, and #SHOWs the variable correctly.
A workaround seems to be:
Code: |
$local = "b"
b/xyz = "foo"
#SH {${local}/xyz = @{${local}/xyz}}
$var = "/xyz"
#SH {${local}${var} = @{${local}${var}}}
#IF (@{${local}${var}} = "foo") {#sh true} {#sh false}
|
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Aug 02, 2008 5:00 pm |
Sorry, but the syntax ${local} is not supported. You need to use something like:
@{%concat($local,$var)} |
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sat Aug 02, 2008 5:06 pm |
Too bad, because ${local} is consistent with the @{var} notation. And it does work in places (see the examples), just not in an #IF.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Sat Aug 02, 2008 5:09 pm |
If it works sometimes then it's just a coincidence and side-effect of the parser...it was never intended to work that way and could easily stop working in a future version.
|
|
|
|
Zhiroc Adept
Joined: 04 Feb 2005 Posts: 246
|
Posted: Sat Aug 02, 2008 7:55 pm |
I accept that it isn't currently a supported feature, but I'd advocate that it should be. For one, it's consistent with @{var} and the same reasons to allow that syntax apply. It's convenient in situations where you want to substitute the variable with no punctuation between it and the next. "${local}abc" is nice and concise over "%concat($local, "abc")".
|
|
|
|
|
|