Nested double quotes

Issue #1353 new
Anonymous created an issue

Pygments does not currently seem to support nested quotes, as displayed in this demo:

sub red($text) { return "\e[31;1m$text\e[0m" }

say "This is valid { red("Perl 6") } code!";

The { } within "" holds an arbitrary expression, in this case a function call with a single string literal as an argument. It's valid syntax to use "" in there, because Perl 6 uses a single-pass parser which understands nesting.

The interpolation works just like "Hello $name", and it even supports method calls without the use of { }, for example with a comma joined list of items: "Current selection: @items.join(", ")" -- within the ( ) is another arbitrary expression.

Comments (0)

  1. Log in to comment