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

attach token location to error tokens #483

Merged

Conversation

WebFreak001
Copy link
Member

Makes invalid strings error at proper location instead of at 0,0

See confusion in https://forum.dlang.org/post/[email protected]

Makes invalid strings error at proper location instead of at 0,0

See confusion in https://forum.dlang.org/post/[email protected]
@codecov
Copy link

codecov bot commented Feb 9, 2023

Codecov Report

Merging #483 (8cb897f) into master (88f247e) will increase coverage by 0.25%.
The diff coverage is 94.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
+ Coverage   83.20%   83.45%   +0.25%     
==========================================
  Files          11       11              
  Lines        8423     8454      +31     
==========================================
+ Hits         7008     7055      +47     
+ Misses       1415     1399      -16     
Impacted Files Coverage Δ
src/dparse/lexer.d 87.85% <94.00%> (+2.18%) ⬆️
src/std/experimental/lexer.d 79.48% <0.00%> (-5.13%) ⬇️

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 88f247e...8cb897f. Read the comment docs.

Copy link
Member Author

@WebFreak001 WebFreak001 left a comment

Choose a reason for hiding this comment

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

since checking for error tokens is done by comparing == tok!"", which only checks the .type property, this should be fully backwards compatible both for valid code and invalid code.

As a result of this PR incomplete strings, broken character literals, etc. now show proper error position when doing things such as x = ''; inside void main() {} in the parser code.

@WebFreak001 WebFreak001 merged commit d42ed27 into dlang-community:master Feb 9, 2023
@WebFreak001 WebFreak001 deleted the error-token-location branch February 9, 2023 22:47
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.

1 participant