Skip to content

Fix lexer span panic with carriage return#799

Merged
Lan2u merged 1 commit into
boa-dev:masterfrom
vgel:fix-lexer-span-panic
Oct 6, 2020
Merged

Fix lexer span panic with carriage return#799
Lan2u merged 1 commit into
boa-dev:masterfrom
vgel:fix-lexer-span-panic

Conversation

@vgel
Copy link
Copy Markdown
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
Copy Markdown

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 A-Bug Something isn't working lexer labels Oct 5, 2020
@HalidOdat HalidOdat added this to the v0.11.0 milestone Oct 5, 2020
@Lan2u
Copy link
Copy Markdown

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

A-Bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The lexer might create invalid spans

3 participants