mirror of
https://github.com/swarm-game/swarm.git
synced 2025-01-05 23:34:35 +03:00
e071252d72
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. |
||
---|---|---|
.. | ||
doc | ||
scene | ||
Swarm | ||
tournament | ||
Main.hs |