Commit Graph

6 Commits

Author SHA1 Message Date
Martin Atkins
cb768a591a zclwrite: parsing of blocks
There's something a little off here, as illustrated by the failing
round trip test. Will figure that out later.
2017-06-10 17:16:19 -07:00
Martin Atkins
1565d4f906 zclwrite: formatting round-trip test
The existing round trip test was testing that we can pass through a set
of tokens through the AST entirely unmodified.

This new round-trip test passes the source through the Format function
and then checks that it has the same semantics, by evaluating it both
before and after and expecting an identical set of values.
2017-06-10 14:14:01 -07:00
Martin Atkins
5477fecfad zclsyntax: require newlines after block items
Previously we tolerated EOF as an alias for newline, but a file without
a newline at the end is a edge case primarily limited to contrived
examples in unit tests, and requiring it simplifies tasks such as code
generation in zclwrite, since we can always assume that every block item
comes with a built-in line terminator.
2017-06-09 08:19:47 -07:00
Martin Atkins
c88641b147 zclwrite: absorb lead comments into attributes
The native parser's ranges don't include any surrounding comments, so we
need to do a little more work to pick them out of the surrounding token
sequences.

This just takes care of _lead_ comments, which are those that appear as
whole line comments above the item in question. Line comments, which
appear after the item on the same line, will follow in a later commit.
2017-06-08 09:04:27 -07:00
Martin Atkins
15b38d8a48 zclwrite: correct silly misplaced colon in round_trip_test 2017-06-07 08:01:30 -07:00
Martin Atkins
598740b638 zclwrite: method for writing tokens to a writer
This now allows for round-tripping some input from bytes to tokens and
then back to bytes again. With no other changes, we expect this to produce
an identical result.
2017-06-07 07:06:23 -07:00