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

Prettyprint option for expr.toString() #231

Open
ylieder opened this issue Aug 30, 2020 · 2 comments
Open

Prettyprint option for expr.toString() #231

ylieder opened this issue Aug 30, 2020 · 2 comments

Comments

@ylieder
Copy link

ylieder commented Aug 30, 2020

As documented, the toString method of an expression surrounds every sub-expression with parentheses. For pretty printing, it would be good to have a pretty option in the toString method, putting only required parentheses.

For example:

const exprString = Parser.parse('3 + ((4 - 5) * 12)').toString(); 
const exprStringPretty = Parser.parse('3 + ((4 - 5) * 12)').toString({pretty: true}); 
// exprString: (3 + ((4 - 5) * 12))
// exprStringPretty: 3 + (4 - 5) * 12
@pedroaugusto
Copy link

I would appreciate if is there any solution for this...

@thiagonuic
Copy link

That would be great actually 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants