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: properly locates closing parenthesis in the presence of quotes #400

Merged
merged 1 commit into from
May 19, 2024

Conversation

gnikit
Copy link
Member

@gnikit gnikit commented May 19, 2024

Fixes #250

Copy link

codecov bot commented May 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.17%. Comparing base (f29b02d) to head (c71e8a8).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #400      +/-   ##
==========================================
+ Coverage   88.14%   88.17%   +0.03%     
==========================================
  Files          35       35              
  Lines        4790     4795       +5     
==========================================
+ Hits         4222     4228       +6     
+ Misses        568      567       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gnikit gnikit force-pushed the fix/complicated-kind-args branch from 6c879dc to c71e8a8 Compare May 19, 2024 22:51
@gnikit gnikit merged commit c8df48b into master May 19, 2024
30 checks passed
@gnikit gnikit deleted the fix/complicated-kind-args branch May 19, 2024 22:56
if char in quote_state:
quote_state[char] = not quote_state[char]
if any(quote_state.values()):
continue
Copy link
Member

Choose a reason for hiding this comment

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

Does this logic work with code like len('ab"c)')?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

In LFortran we parse the string (handling the inner " and such correctly), and then you can locate the parentheses on top (when you see ", just parse the string).

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.

Two bugs in parsing related to parentheses in strings
2 participants