Greedy triple-quoted string literals

liorean liorean at
Mon Feb 18 02:52:46 PST 2008

On 18/02/2008, Lars T Hansen <lth at> wrote:
> The correct interpretation is that a triple quoted string starts with
> three quotes of the same kind and ends when the same three quotes are
> seen in sequence provided that the character following the three is
> not that same quote character.
> (Whether you want to call that greedy or not depends on whether you
> think it's greedy to take what you can when you can take it, or
> whether you think it's greedy to avoid taking something now because
> you think you can take more later.  Generally speaking a greedy
> algorithm is one that makes a locally optimal choice about what is
> best, so I think the description on the wiki is OK.  The above
> description is more precise.)

I think that's a confusion waiting to happen that I certainly wouldn't
want to see in spec text. The concept of "greedy" matching that I have
would mean that the last triple quote delimiter in the source would be
considered to be the endpoint of the literal that started with the
first triple quote delimiter in the source.
David "liorean" Andersson

More information about the Es4-discuss mailing list