rfcs icon indicating copy to clipboard operation
rfcs copied to clipboard

Embed string literals in string literals

Open SeanTAllen opened this issue 8 years ago • 1 comments

Moving this from the ponyc repo issues.

We need a RFC that proposes a way to embed string literals inside of string literals. This would allow docstrings to have example code that is full and complete in that the code in the example code have docstrings as would "real" pony code.

You can see an example of the problem as it currently exist here: https://github.com/ponylang/ponyc/pull/615/files

Any solution should maintain LL(1) parsing if at all possible. "Less pretty" solutions that maintain LL(1) are strongly preferred.

SeanTAllen avatar Oct 22 '16 14:10 SeanTAllen

We discussed this a bit in Zulip, in which we sort of tentatively decided that the solution here should be to increase the number of quotes to allow embedding other quotes inside.

For example, a six-quote string would work just like a triple-quote, except that it would allow embedding triple-quote literals inside of it.

jemc avatar Apr 02 '19 16:04 jemc