Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string literals with embedded newlines #1624

Closed
cgay opened this issue Jul 21, 2024 · 0 comments · Fixed by #1634
Closed

string literals with embedded newlines #1624

cgay opened this issue Jul 21, 2024 · 0 comments · Fixed by #1634

Comments

@cgay
Copy link
Member

cgay commented Jul 21, 2024

https://play.opendylan.org/shared/feae26a75c598856

define constant $template =
  """
    format-out("Hello, world!\n");

  """;
Open Dylan 2024.1
...play-6efce37c1178/main.dylan:8.3-51: Serious warning - Invalid multi-line string literal: "each line must begin with the same whitespace that precedes the end delimiter (got "\")", want "  ")"
        ------------------------------------------------
        """;
        ------------------------------------------------

I think the multi-line string literal handling just needs to remove the shared whitespace prefix before handling escape codes.

cgay added a commit to cgay/opendylan that referenced this issue Dec 2, 2024
cgay added a commit to cgay/opendylan that referenced this issue Dec 2, 2024
@cgay cgay closed this as completed in #1634 Dec 4, 2024
cgay added a commit that referenced this issue Dec 4, 2024
Fixes: #1624

This new split/join way of processing multi-line string literals
allocates more, but is far less complex. Since parsing multi-line string
literals is likely to be a very small part of overall compile time I
don't think we need to worry about it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant