Skip to content

Prettyprint option for expr.toString() #231

Open
@ylieder

Description

@ylieder

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions