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

Support formatting options when unparsing ASTs to strings #559

Merged
merged 7 commits into from Jul 11, 2022
Merged

Support formatting options when unparsing ASTs to strings #559

merged 7 commits into from Jul 11, 2022

Conversation

l46kok
Copy link
Collaborator

@l46kok l46kok commented Jun 29, 2022

This change adds formatting capability to unparser by introducing new functional optionUnparseOption. Unparse function will accept any number of UnparseOption augment the behavior of unparsing an AST.

This will allow support adding new lines for any desired non-unary operators when the length of a string exceeds the defined column limit.

Resolves #293

@jnthntatum
Copy link
Collaborator

/gcbrun

parser/unparser.go Outdated Show resolved Hide resolved
@jnthntatum
Copy link
Collaborator

/gcbrun

parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser_test.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
This change adds formatting capability to unparser by introducing a new function
named `UnparseFormatted`. The function will accept any number of
`UnparserFormattingOption` to support adding new lines for any desired
non-unary operators.
@l46kok l46kok marked this pull request as ready for review July 7, 2022 20:14
@l46kok l46kok changed the title [Draft] Support formatting options when unparsing ASTs to strings (#293) Support formatting options when unparsing ASTs to strings (#293) Jul 7, 2022
@TristonianJones
Copy link
Collaborator

/gcbrun

parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser.go Outdated Show resolved Hide resolved
parser/unparser_test.go Show resolved Hide resolved
parser/unparser_test.go Outdated Show resolved Hide resolved
parser/unparser_test.go Show resolved Hide resolved
@l46kok l46kok changed the title Support formatting options when unparsing ASTs to strings (#293) Support formatting options when unparsing ASTs to strings Jul 7, 2022
@l46kok
Copy link
Collaborator Author

l46kok commented Jul 11, 2022

PTAL

@TristonianJones TristonianJones merged commit c8adb77 into google:master Jul 11, 2022
2 checks passed
@l46kok l46kok deleted the feature/format-unparse branch July 12, 2022 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support formatting options when unparsing ASTs to strings
3 participants