reconstant icon indicating copy to clipboard operation
reconstant copied to clipboard

Support the Go language

Open mvasilkov opened this issue 5 years ago • 3 comments

Hi, that's a great project! How do you feel about adding Go support, is that in scope?

mvasilkov avatar Mar 07 '21 09:03 mvasilkov

Sure, do you want to take a shot at adding this yourself? It's very easy and I can point you at the code to change.

On Sun, 7 Mar 2021, 11:32 я котик пур-пур, [email protected] wrote:

Hi, that's a great project! How do you feel about adding Go support, is that in scope?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aantn/reconstant/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADYUB55BO52VDTPN3QNYZ3TCNB35ANCNFSM4YXVNSIA .

aantn avatar Mar 07 '21 09:03 aantn

Yep, I'll take a look if nobody beats me to it.

mvasilkov avatar Mar 07 '21 09:03 mvasilkov

Cool, there are basically three easy steps to adding a new language:

  1. Write a new subclass of Outputer which implements output_enum(self, enum: Enum) and output_constant(self, constant: Constant). In many you can just call the base-class implementation. To start, I recommend copying the JavascriptOutputer class
  2. Add one line to the AllOutputs class to automatically parse parameters for your outputer from yaml.
  3. Add example output of test.yaml to the README file.

That is all there is to it.

aantn avatar Mar 07 '21 10:03 aantn