Re: Hash mark prefix to a string

2022-05-28 Thread Chris Angelico
On Sun, 29 May 2022 at 10:21, Duke Normandin  wrote:
>
> I asked this question on the Pike channel on libera.chat but nobody
> is lurking at the moment. :)
>
> what does the # mean herein the following?
>
> [code]
> str =
> #"This is a multiline string
> terminated by a double-quote like any other string";
> [/code]
>
> I've searched all the available docs that I can find, but have yet
> to stumbled on an explanation of this syntax. TIA ..


A hash-quoted string can go across multiple lines. It's a preprocessor
directive, like #define or #if, so the hash is indicative of that.
(Unlike most preprocessor directives, it can happen anywhere in the
line.)

You can actually see what the preprocessor does by running "pike -E
scriptname.pike", which will print out the code after preprocessing. A
hash-quoted string is replaced with a string containing "\n" newline
escapes, which is what the main parser then works with.

ChrisA



Hash mark prefix to a string

2022-05-28 Thread Duke Normandin
I asked this question on the Pike channel on libera.chat but nobody
is lurking at the moment. :)

what does the # mean herein the following?

[code]
str =
#"This is a multiline string
terminated by a double-quote like any other string";
[/code]

I've searched all the available docs that I can find, but have yet
to stumbled on an explanation of this syntax. TIA ..
--
Duke
** Bottom-posting, text-only is the netiquette way! **