-
Notifications
You must be signed in to change notification settings - Fork 74
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
API: split out MLIR-independent printing into BasePrinter and use in STIM [NFC] #3613
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3613 +/- ##
==========================================
- Coverage 90.41% 90.15% -0.27%
==========================================
Files 471 465 -6
Lines 59138 58716 -422
Branches 5611 5625 +14
==========================================
- Hits 53471 52934 -537
- Misses 4224 4344 +120
+ Partials 1443 1438 -5 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a great change to me
|
||
@dataclass(eq=False, repr=False) | ||
class StimPrinter(BasePrinter): | ||
@contextmanager | ||
def in_braces(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly for a future PR, but I wonder if context managers for each delimiter pair should be added to BasePrinter
. It's always annoyed me that there is in_angle_brackets
(at least in the parser) but not the equivalents for braces, square brackets, and parentheses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hundo p, just trying to make the API changes small, so we can have a focused discussion about the API in a separate PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me'
xdsl/utils/base_printer.py
Outdated
from dataclasses import dataclass, field | ||
from typing import IO, Any, TypeVar | ||
|
||
indentNumSpaces = 2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
O think this should stay in the printer no? Or as an option?
I'd also like to use the indentation logic in ASL, WGSL, and the assembly dialects, PRs incoming.