swarm/app
Brent Yorgey e071252d72
Add format --v0.5 option to port code from older syntax (#1851)
This is a followup on top of #1583 which turns `swarm format` into a tool for porting existing Swarm code into the newest syntax, via an extra `--v0.5` argument.  In particular, this PR:

- Generalizes the parser to take a configuration record, which among other things contains the language version being parsed.
- Adds code to allow the parser to parse either the current syntax or one version ago (when types did not start with capital letter) depending on the version in the configuration.
    - The idea is to have the parser always support the current version and one older version, so we can always upgrade version n to version n+1.
- Adds a new flag `--v0.5` to the `format` subcommand which causes the input to be parsed in v0.5 mode.  However, the output of `format` will always use the latest syntax.  Thus, `swarm format --v0.5` reads code in v0.5 format and prints it in the latest format, so this can be used to automatically port existing `.sw` files.

This PR also makes a few minor improvements to pretty-printing.
2024-05-22 00:09:31 +00:00
..
doc Split out swarm-doc and swarm-tui sublibraries (#1834) 2024-05-11 02:08:49 +00:00
scene preview rendered world with inotify (#1756) 2024-01-31 19:23:43 +00:00
Swarm Remove Benchmark dependence on AppState and TUI (#1746) 2024-01-26 17:56:39 +00:00
tournament Use sqlite and static binary (#1837) 2024-05-12 20:45:08 +00:00
Main.hs Add format --v0.5 option to port code from older syntax (#1851) 2024-05-22 00:09:31 +00:00