Skip to content

Incorrect source location when line ends with backslash #220

Description

@haugli

It looks like an escaped backslash at the end of a line (which should just render as a backslash) causes the newline to be ignored when determining the source location.

Sample code:

let source = """
Line 1\\
Line 2
"""

let document = Document(parsing: source, options: [])
print(document.debugDescription(options: .printSourceLocations))

Result:

Document @1:1-2:7
└─ Paragraph @1:1-2:7
   ├─ Text @1:1-1:7 "Line 1"
   ├─ LineBreak
   └─ Text @1:9-1:15 "Line 2"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions