alixinne / glsl-lang

LALR parser for GLSL
https://alixinne.github.io/glsl-lang/glsl_lang/
BSD 3-Clause "New" or "Revised" License
23 stars 4 forks source link

feat(transpiler): overhaul formatting and customizability #20

Closed AlexTMjugador closed 1 year ago

AlexTMjugador commented 1 year ago

While the current GLSL transpiler output format is quite customizable, I needed to further extend its customizability to better support outputting GLSL in both pretty and minified formats. To that end, these changes overhaul the transpiler's formatting logic and implement some minor format changes and fixes. The fixes included are complementary to those in https://github.com/vtavernier/glsl-lang/pull/19.

I considered splitting this PR into several smaller ones, but decided against it because the changes are so closely related that doing so would make them harder to review. Please let me know your thoughts on this!

The full list of changes, in no particular order, is as follows:

AlexTMjugador commented 1 year ago

Thanks for the review!

I didn't know that the pretty crate was a thing. In hindsight, it probably would have been a good idea to refactor the transpiler to use it, since it allows a greater degree of abstraction over low-level formatting details, as you've said. But I'm glad that this PR was able to cobble together a better transpiler without resorting to that crate, at least for now :wink: