Open
Description
Is your feature request related to a problem? Please describe.
There is currently no way to automatically format a pomsky expression.
Describe the solution you'd like
A tool, part of pomsky-bin, that accepts several configuration options similar to prettier, parses a pomsky expression losslessly (preserving comments and whitespace), and returns a pomsky expression that is beautifully formatted, without changing its semantic meaning. Here are some things it can do:
- Add/remove white space
- Add/remove a leading pipe
- Remove unnecessary parentheses
- Convert double quotes to single quotes or vice versa
- Simplify repetitons (e.g.
{1,}
->+
) - Wrap comments
- Replace deprecated syntax
Things it can not (or should not) do:
- Do anything that changes what the expression can match
- Rename identifiers
- Remove or reorder comments
- Reorder alternatives or character set contents
- Remove unreachable expressions