Skip to content

Use replace_regex to replace all occurrences of "." with "/" - #1315

Merged
Thirumalai-Shaktivel merged 1 commit into
lcompilers:mainfrom
Thirumalai-Shaktivel:nested_modules_03
Nov 19, 2022
Merged

Thirumalai-Shaktivel merged 1 commit into
lcompilers:mainfrom
Thirumalai-Shaktivel:nested_modules_03

Conversation

@Thirumalai-Shaktivel

Copy link
Copy Markdown
Collaborator

Related: #1305

@Thirumalai-Shaktivel Thirumalai-Shaktivel added the ready for review PRs that are ready for review label Nov 19, 2022

@czgdp1807 czgdp1807 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM.

// Example: from x.y import z
if (mod_sym.find(".") != std::string::npos) {
mod_sym.replace(mod_sym.find("."), 1, "/");
mod_sym = replace(mod_sym, "[.]", "/");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Seems like this was hard coded before.

@Thirumalai-Shaktivel Thirumalai-Shaktivel Nov 19, 2022 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Previously, I thought replace() would replace every occurrence in the string. Now, I realize that it replaces only the first occurrence, or simply the index of the find().

@Thirumalai-Shaktivel

Copy link
Copy Markdown
Collaborator Author

Thanks for the approval. Let's merge this.

@Thirumalai-Shaktivel
Thirumalai-Shaktivel merged commit 5a8b50f into lcompilers:main Nov 19, 2022
@Thirumalai-Shaktivel
Thirumalai-Shaktivel deleted the nested_modules_03 branch November 19, 2022 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review PRs that are ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants