Skip to content
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

[FEATURE]: Provide a encloseInParenthesis helper function #1252

Open
1 task done
vil1 opened this issue Nov 28, 2024 · 0 comments
Open
1 task done

[FEATURE]: Provide a encloseInParenthesis helper function #1252

vil1 opened this issue Nov 28, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@vil1
Copy link
Contributor

vil1 commented Nov 28, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Category of feature request

Transpile

Problem statement

We need a reusable way to enclose a bit of generated code in parenthesis

Proposed Solution

In CodeGenerator, add a function looking like

def encloseInParenthesis(codeGen: Transformation[String]): Transformation[String] = 
  codeGen.map{ c =>
     if (c.startsWith("(") && c.endsWith(")")) c
    else "(" + c + ")"
 }

and make sure it is used whenever we need to ensure a chunk of generated code needs to be enclosed in parenthesis

Additional Context

No response

@vil1 vil1 added the enhancement New feature or request label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant