Commit graph

12 commits

Author SHA1 Message Date
78d08968eb Move BoundedSeparated helper functions into ast 2022-11-22 16:45:31 +01:00
5a977e6dde Simplify creating TableLit and TableConstr 2022-11-22 15:21:40 +01:00
c769d9e16f Simplify creating BoundedSeparated
Along with this comes the decision to no longer track whitespace and
comments across desugarings in most cases. The main reason for this
decision is that not having to track whitespace simplifies the code and
reasoning necessary.

While implementing desugarings, I also realized that the current comment
model doesn't let me accurately track whitespace across desugarings. I'm
fairly sure I haven't yet found a good model for whitespace and
comments. Once I find one, adding pretty printing support for those
should hopefully be easy though.
2022-11-22 15:21:35 +01:00
94ea196933 Remove Separated 2022-11-22 00:00:43 +01:00
a1867fdc4e Add BoundedSeparated with parser and printer
This type should be able to replace Separated (with a bit of effort).

The hope is that this type is a better representation for table-like
syntax with optional trailing delimiter that will let me remove_map
elements without too much difficulty. This is necessary for desugaring
table constructors.
2022-11-21 22:56:50 +01:00
290cef06cb Desugar from the outside in 2022-11-21 14:35:10 +01:00
5c8dd1969f Desugar function calls with argument 2022-11-21 13:35:36 +01:00
8b21acac9e Add desugar command and desugar programs 2022-11-21 09:33:34 +01:00
03e7f10739 Satisfy warnings 2022-11-20 22:16:10 +01:00
6533c9dcf7 Handle things separated by things differently
I noticed that programs like '{} would parse correctly while '{ } would
expect an inner element. This was because the leading space was actually
part of the element parser, which is a violation of the (as of yet
unspoken) rule that parsers should not parse surrounding whitespace.

Because whitespace whas treated differently from everywhere else and
because this implementation was wrong, I decided to reimplement it,
abstracting the concept of things separated by other things with
optional trailing things. I did this in such a way that surrounding
whitespace is not touched.
2022-11-20 21:09:59 +01:00
41723eb4ca Parse comments in whitespace 2022-11-18 20:59:51 +01:00
037a0f69a3 Split up and expand ast 2022-11-18 19:37:51 +01:00