Skip to content

Stop parsing continuation lines in number literals #5

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

Merged

Conversation

inaki-amatria
Copy link
Member

The previous algorithm incorrectly handled line continuations in number literals. Instead of attempting to parse them incorrectly, we now treat them as a parsing error. This allows library users to handle such cases explicitly.

@inaki-amatria inaki-amatria requested a review from a team April 2, 2025 07:23
@inaki-amatria inaki-amatria self-assigned this Apr 2, 2025
@inaki-amatria inaki-amatria requested review from alvrogd and igarcia0 and removed request for a team April 2, 2025 07:23
src/scanner.c Outdated
Comment on lines 76 to 82
// Return an error if a line continuation is found. This scanner cannot
// handle line continuations, particularly in cases like:
//
// ```fortran
// b = 6& ! foo
// 7;
// ```
Copy link

@alvrogd alvrogd Apr 2, 2025

Choose a reason for hiding this comment

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

This code wouldn't even compile, right? To clarify that it's not a limitation of the scanner.

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice catch! I have now updated the example. TYSM

The previous algorithm incorrectly handled line continuations in number
literals. Instead of attempting to parse them incorrectly, we now treat
them as a parsing error. This allows library users to handle such cases
explicitly.
@inaki-amatria inaki-amatria force-pushed the feature/ErrorOnContinuationLinesInNumberLiterals branch from 6231225 to d563cbf Compare April 3, 2025 06:41
@inaki-amatria inaki-amatria merged commit d563cbf into codee Apr 3, 2025
1 check passed
@inaki-amatria inaki-amatria deleted the feature/ErrorOnContinuationLinesInNumberLiterals branch April 3, 2025 06:43
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.

2 participants