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

Fix lexer span panic with carriage return #799

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

vgel
Copy link
Contributor

@vgel vgel commented Oct 5, 2020

Switch to treating bare carriage return as an OS9-style newline, like v8.
Fixes #771

  • In Cursor::next_char, when we get a '\r', we now try to consume a '\n', and regardless of whether we find one we advance a newline. This has the effect of treating all of ["\r\n", "\n", "\r"] as identical.
  • Removed Cursor::carriage_return, as it's now unused.

Switch to treating bare carriage return as an OS9-style
newline, like v8.
@codecov
Copy link

codecov bot commented Oct 5, 2020

Codecov Report

Merging #799 into master will increase coverage by 0.04%.
The diff coverage is 75.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #799      +/-   ##
==========================================
+ Coverage   59.21%   59.26%   +0.04%     
==========================================
  Files         155      155              
  Lines        9908     9924      +16     
==========================================
+ Hits         5867     5881      +14     
- Misses       4041     4043       +2     
Impacted Files Coverage Δ
boa/src/syntax/lexer/cursor.rs 60.68% <75.00%> (-1.71%) ⬇️
boa/src/builtins/error/mod.rs 66.66% <0.00%> (+23.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6bcfc7a...c62e83c. Read the comment docs.

@HalidOdat HalidOdat added bug Something isn't working lexer Issues surrounding the lexer labels Oct 5, 2020
@HalidOdat HalidOdat added this to the v0.11.0 milestone Oct 5, 2020
@Lan2u
Copy link

Lan2u commented Oct 6, 2020

Spec reference https://tc39.es/ecma262/#sec-line-terminators

@Lan2u Lan2u merged commit 7a52e26 into boa-dev:master Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lexer Issues surrounding the lexer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The lexer might create invalid spans
3 participants