dodexahedron / Terminal.Gui

Cross Platform Terminal UI toolkit for .NET
MIT License
1 stars 0 forks source link

Create exemplar/prototype type to serve as model for enum replacement generator #40

Open dodexahedron opened 6 months ago

dodexahedron commented 6 months ago

What it says on the tin.

A good first step in writing a generator is to actually write the code that you want it to be able to generate, as you would normally write it, format it how you want, and then put in attributes and other changes that are prudent to be in generated source, like [GeneratedCode] and fully-qualified names for EVERYTHING, etc.

You can then test that code to prove it's good in the first place.

Then, when implementing the actual generator, you now have a template against which you can compare the generator's output.

This issue is for exactly that - the prototype/template/sample/etc struct for the new generator to follow.

dodexahedron commented 6 months ago

Starting work on this from the end of #41.

A rough spec can be found here in the opening post of the issue.

The final design may not (read: probably won't) match that perfectly, depending on time, mostly, but also any of the typical things that happen along the way, like finding out an idea wasn't as good as one had originally hoped. 😅

dodexahedron commented 6 months ago

Right now, I'm using the name EnumWrapper32 as the base name for the wrapper structs.

The prototype class I'm writing is named EnumWrapper32Prototype.

These names are not final, and the actual generated types are more likely to follow a similar style as the extension method generator, where the name of the enum has something appended to it. Probably something very simple, which I haven't decided on, yet.

dodexahedron commented 6 months ago

Added the beginnings of the prototype and some supporting types to the branch both to show current thinking and because I have some other stuff to do.

Will get back to it later tonight or tomorrow.