Commit graph

12 commits

Author SHA1 Message Date
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
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
2be47871da Add "module" program variant 2022-11-20 18:10:15 +01:00
ea7518b183 Create each main parser only once 2022-11-19 20:56:10 +01:00
b291619d10 Remove unnecessary Clone bounds 2022-11-19 19:36:10 +01:00
0099277644 Parse named function definitions 2022-11-19 19:24:23 +01:00
9a1bb92dfe Prepare parser for function definitions 2022-11-19 18:58:39 +01:00
9c8d09e3cb Box pub parsers and adjust visibility 2022-11-19 13:00:43 +01:00
408219073a Parse binary operators
For now, they're all left associative.
2022-11-19 12:40:52 +01:00
4fdce864d3 Forbid using keywords as identifiers 2022-11-18 21:05:57 +01:00
41723eb4ca Parse comments in whitespace 2022-11-18 20:59:51 +01:00
a559966c1d Split up parser
The structure mostly follows the ast structure, with some slight
changes. Each parser submodule documents which ast submodule it
corresponds to.

This parser is not yet complete, and I have yet to go through its
modules one-by-one to fix and complete them.
2022-11-18 20:20:37 +01:00