Re: Fwd: polite request about syntax - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Fwd: polite request about syntax
Date
Msg-id 450AD7F1.1010806@dunslane.net
Whole thread Raw
In response to Fwd: polite request about syntax  ("Ricardo Malafaia" <rmalafaia@gmail.com>)
List pgsql-hackers
Ricardo Malafaia wrote:
>
> And the $$ is indeed needed for allowing languages with different
> syntaxes.  agreed.  However, Tom, i could counter example your plperl
> example:
>
>> realize that qq/end/ does not represent a matching "end"?
>
> What happens then when it sees something like a double variable
> interpolation as in $$foobar? ;)
>


The delimiter does not have to be $$. It can be 
$any_unquoted_identifier_without_a_dollar_sign$.

the lexer says:

/* $foo$ style quotes ("dollar quoting")* The quoted string starts with $foo$ where "foo" is an optional string* in the
formof an identifier, except that it may not contain "$",* and extends to the first occurrence of an identical string.
*There is *no* processing of the quoted text.**/
 
dolq_start      [A-Za-z\200-\377_]
dolq_cont       [A-Za-z\200-\377_0-9]
dolqdelim       \$({dolq_start}{dolq_cont}*)?\$


So for a plperl function you just use something like $func$ at each end.

cheers

andrew




pgsql-hackers by date:

Previous
From: "Ricardo Malafaia"
Date:
Subject: Re: Fwd: polite request about syntax
Next
From: Alvaro Herrera
Date:
Subject: Re: Fwd: polite request about syntax