hszinc presently barfs on the \$ construct. Strings are presently escaped using C-style escapes. However, \$ is not a C-style escape string, not in any dialect of C that I've ever encountered anyway (ANSI or K&R).
Replace \$ with $ in the raw grid, and everything works.
So, if I see a dollar sign, with or without a proceeding backslash, what am I supposed to emit?
Thanks in advance.
Brian FrankTue 28 Jun 2016
Its just an escape for the $ character which can be used for interpolation. See the grammar:
Ahh fair enough, I tried looking around but as I say, no dialect of C I've ever come across had an escape sequence for \$. Haven't seen it in other languages either.
The grammar is great for telling me what is valid, however it doesn't tell me what it maps to (e.g. \r does not become r, it becomes a carriage return character).
I've now resolved that issue and a new release of hszinc is out that corrects the issue seen.
Steve EynonWed 29 Jun 2016
Hi Stuart,
I think the reason why \$ is an allowed escape sequence is historical and would have been because SkySpark is written in Fantom.
The escape sequence \$ is then used to print the $ symbol.
msg := "Show me the \$\$\$!"
Whereas the escape sequence \$ is not particularly useful to zinc (since it simply maps to $), it does allows Fantom programs to use some in-built serialisation mechanisms when printing zinc strings.
Stuart Longland Thu 23 Jun 2016
Hi all,
I'm debugging an issue that
hszinc
encountered parsing a grid from SkySpark. I've distilled it down to the offending row and have anonymised the data.hszinc
presently barfs on the\$
construct. Strings are presently escaped using C-style escapes. However,\$
is not a C-style escape string, not in any dialect of C that I've ever encountered anyway (ANSI or K&R).Replace
\$
with$
in the raw grid, and everything works.So, if I see a dollar sign, with or without a proceeding backslash, what am I supposed to emit?
Thanks in advance.
Brian Frank Tue 28 Jun 2016
Its just an escape for the
$
character which can be used for interpolation. See the grammar:Stuart Longland Wed 29 Jun 2016
Ahh fair enough, I tried looking around but as I say, no dialect of C I've ever come across had an escape sequence for
\$
. Haven't seen it in other languages either.The grammar is great for telling me what is valid, however it doesn't tell me what it maps to (e.g.
\r
does not becomer
, it becomes a carriage return character).I've now resolved that issue and a new release of
hszinc
is out that corrects the issue seen.Steve Eynon Wed 29 Jun 2016
Hi Stuart,
I think the reason why
\$
is an allowed escape sequence is historical and would have been because SkySpark is written in Fantom.In Fantom, the
$
symbol is used to interpolate strings:The escape sequence
\$
is then used to print the$
symbol.Whereas the escape sequence
\$
is not particularly useful to zinc (since it simply maps to$
), it does allows Fantom programs to use some in-built serialisation mechanisms when printing zinc strings.Hope this helps,
Steve.