Skip to content

Conversation

@ikappaki
Copy link
Contributor

@ikappaki ikappaki commented Sep 19, 2024

Hi,

can you please a fix for the line number in the metadata generated by the reader. It fixes #1063.

We now check the char at -2 only if it’s:

  • \n (for \nC or \r\nC case)
  • \r (for the \rC, but not \r\n, case).

where C is any other char.

Added tests for the same.

Thanks

@pytest.mark.parametrize(
"evalstr,first,second",
[
("[5]\n(def n 123)", (1, 1, 0, 3), (2, 2, 0, 11)),
Copy link
Member

Choose a reason for hiding this comment

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

Can you add cases for buffers starting with \n and \r\n as well since we're looking back in the last 2 characters?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the following, is this what you had in mind?

            ("\n[5]\n(def n 123)", (2, 2, 0, 3), (3, 3, 0, 11)),
            ("\r[5]\r(def n 123)", (2, 2, 0, 3), (3, 3, 0, 11)),
            ("\r\n[5]\r\n(def n 123)", (2, 2, 0, 3), (3, 3, 0, 11)),

Copy link
Member

Choose a reason for hiding this comment

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

Indeed. Thanks!

@chrisrink10 chrisrink10 merged commit dd7d239 into basilisp-lang:main Sep 19, 2024
12 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.

Double counting of CRLF newline seq in metadata

2 participants