Skip to content

Fix CRLF handling in line continuation escapes#1564

Merged
HT154 merged 1 commit into
apple:mainfrom
KushalP:crlf-escapes
Apr 29, 2026
Merged

Fix CRLF handling in line continuation escapes#1564
HT154 merged 1 commit into
apple:mainfrom
KushalP:crlf-escapes

Conversation

@KushalP

@KushalP KushalP commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

This is only really an issue if you're using Windows, or save a file using CRLF line endings.

Also fix the "whitespace before continuation" error to detect \r as a newline.

Example programs

x = """
  hello \
  world
  """

y = #"""
  hello \#
  world
  """#

This is only really an issue if you're using Windows, or save a file
using CRLF line endings.

Also fix the "whitespace before continuation" error to detect `\r` as
a newline.

## Example programs

```pkl
x = """
  hello \
  world
  """

y = #"""
  hello \#
  world
  """#
```
assertThat(lexer.next()).isEqualTo(Token.ASSIGN)
assertThat(lexer.next()).isEqualTo(Token.STRING_MULTI_START) // """
assertThat(lexer.next()).isEqualTo(Token.STRING_NEWLINE)
assertThat(lexer.next()).isEqualTo(Token.STRING_PART) // " hello "

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to remove all of these comments. I annotated the tests like this for my own sanity to figure this out.

@KushalP KushalP requested a review from HT154 April 29, 2026 20:28

@HT154 HT154 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@HT154 HT154 merged commit d3a3a14 into apple:main Apr 29, 2026
21 checks passed
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 this pull request may close these issues.

2 participants