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

core: Make print_string aware of indentation #2809

Merged
merged 3 commits into from
Jul 2, 2024

Conversation

Moxinilian
Copy link
Contributor

This PR makes the print_string function in the printer aware of indentation, and will print newlines in strings accordingly.

For cases where this is not desired (such as printing a newline character in the indentation-aware newline logic), print_string_raw has been added to print the string ignoring indentation.

Additionally, a helper indented function for with statements has been added to control indentation within a scope. Feedback on this would be much appreciated, as a possible concern is that it may not be super intuitive (it indents newlines, not lines).

@Moxinilian Moxinilian added enhancement New feature or request core xDSL core (ir, textual format, ...) labels Jul 1, 2024
@Moxinilian Moxinilian self-assigned this Jul 1, 2024
Copy link

codecov bot commented Jul 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.82%. Comparing base (043b8e8) to head (e7c6d50).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2809   +/-   ##
=======================================
  Coverage   89.81%   89.82%           
=======================================
  Files         396      396           
  Lines       49010    49047   +37     
  Branches     7503     7508    +5     
=======================================
+ Hits        44018    44056   +38     
+ Misses       3803     3802    -1     
  Partials     1189     1189           

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

@superlopuh
Copy link
Member

Amazing, I was just implementing it locally!

Copy link
Member

@superlopuh superlopuh left a comment

Choose a reason for hiding this comment

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

great timing, I also need it for pretty syntax in the kernel ops

@superlopuh
Copy link
Member

I would say that the previous behaviour was also not intuitive, and the new functions add some more structure, so we're better off with the new functionality.

Copy link
Collaborator

@math-fehr math-fehr left a comment

Choose a reason for hiding this comment

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

Very cool

@Moxinilian Moxinilian merged commit 01640fc into xdslproject:main Jul 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core xDSL core (ir, textual format, ...) enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants