By: Tom Sydney Kerckhove <syd@cs-syd.eu>
Add comments within declarations
A comment used to be a declaration of its own, so a comment between the lines
of a transaction was either a parse error or was moved onto its own line by
the formatter.
A comment can now be written on an indented line of its own within a
declaration, where it belongs to the line below it. That means a comment
cannot be the last line of a declaration: it would belong to no line at all,
which is an error that points at the comment.
A comment at the first column still starts a new declaration, so the lines
that a declaration cannot contain, an import, a currency, a tag, a price, an
account line and a timestamp line, hold no comments of their own: a comment
above those is a comment declaration already.
Note that the lines of a transaction are one chain of productions rather than
three lists. The comments above a line have to be read before it is known
which kind of line follows them, so a list per kind of line makes the
description/posting and posting/extra boundaries reduce/reduce conflicts.
Fix two bugs in the process:
* A comment whose text was only whitespace swallowed the declaration below
it. Nothing could match the rest of the line, so '$white+' matched the
newline instead and left the lexer in the comment start code, reading the
next declaration as comment text. A comment is now a single token, so
there is no start code left to be stranded in.
* A description could be empty, or contain an empty line, neither of which
can be written down: an empty description formatted to no line at all and
was silently lost.
| Time to Start | Worker time | Duration | Time to finish | Idle | |
| Config | 0s | 1s | 1s | 1s | 0s |
| Eval | 1s | 13s | 13s | 14s | 0s |
| Build | 13s | 4m33s | 2m21s | 2m35s | 0s |
| Suite | 0s | 4m48s | 2m35s | 2m35s | 0s |