Skip to content

Conversation

@eric-therond
Copy link
Contributor

Added a protobuf printer. To do this, I had to slightly modify the base printer class and renderers:

  • Everything specific to a "format" is now handled by the child classes. Rendering methods return a "low level structure" and it's up to the child class to format it according to the printer type. For instance, in renderer/Operand/Temporary.php, we previously returned an id prefixed with #, this kind of transformation in now performed in Printer/Text.php.
  • A bit out by laziness, but it's maybe not a bad thing, most of the op are rendered in a similar way. In the past, we had specific style for Phi, Assertion or AttributesGroup, with this PR, we have the same style of rendering. That's why you'll see diff in code tests related to these ops. We lose a bit of readability for Text printer but I think we have a more generic rendering, and it could be ok?
  • I don't know exactly how to test this new protobuf printer class, I didn't want to duplicate all the "code tests" (but maybe we should?) so I took only two test code files for the moment.

@eric-therond eric-therond changed the title Proto printer refactor Protobuf printer refactor Oct 26, 2025
@eric-therond
Copy link
Contributor Author

I will check later why CI is failing, I suspect something not working with loadRenderers ?

@eric-therond eric-therond mentioned this pull request Oct 26, 2025
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.

1 participant