Commit graph

15 commits

Author SHA1 Message Date
5064a768e7 [all] A whole new style for grammars
Say good by to the sea of `self.`!
2024-11-09 11:21:30 -08:00
071cd29d8f [readme] Rewrite the readme and add a helper
The helper is nice actually.
2024-09-21 08:45:49 -07:00
1a3ce02d48 [wadler] Re-factor into multiple modules
Hard split between builder and runtime, as is proper.
2024-09-21 07:42:52 -07:00
1f84752538 [wadler] Refactor: data and runtime split
Now we convert the grammar into data for a pretty-printer, so in
theoryw e could write the pretty-printer in a different language.
2024-09-21 06:44:53 -07:00
e4585170d8 [wadler] Fixup EOF trivia
Trivia handling feels pretty good now actually.
2024-09-19 20:23:02 -07:00
8a17cfd586 [wadler] Prettier handling of trivia
Split the rules for pre- and post- trivia, understand when we want to
do either, handle multi-line-break (in an unsatisfying way, I guess)
but otherwise lay the groundwork for thinking about it better.

Also now we don't generate lazy "Text" nodes because I thought I might
want to actually look at the newlines in the source but I don't yet.
I *can* now, though. (I can also detect EOF so there's that.)
2024-09-19 16:39:32 -07:00
c31d527077 [wadler] Trivia escapes groups
This means that forced breaks from comments don't screw up the
following single-line things. But this still isn't right; we need to
fine tune how we represent trivia.
2024-09-15 08:51:18 -07:00
9d55588a35 [wadler] Cons has a list of documents in it
I think I want to start thinking about "leftmost" and "rightmost" and
it's just easier and faster if cons has an actual list in it instead
of dotted pairs.
2024-09-15 08:12:30 -07:00
d7a6891519 Finish annotating test grammar, forced breaks, fixes
Forced breaks force a newline in a spot, which is sometimes what we
want. (Like, this syntax should *never* be on a single line.)
2024-09-13 11:57:16 -07:00
938f0e5c69 Support newline replacements
This allows us to do maybe more complicated spacing.

Still unclear about identifier/punctuation spacing.
2024-09-12 11:09:14 -07:00
8a80bcad64 Fix broken test
(Update snapshot to be correct.)
2024-09-11 11:28:53 -07:00
276449287d Allow for text to follow tokens in pretty-printing
It's weird that it counts against the line length though, like if you
were going to break you could ignore it right? At least, for the
grammar I'm working here....
2024-09-11 11:22:41 -07:00
d6dd54f4df Actual pretty-printing!
Now we're cooking with gas ALTHOUGH now we have to deal with the fact
that we're gluing everything together where there *should* be spaces.

Many more improvements to come.
2024-09-11 11:08:02 -07:00
5d88b459b9 Spiffy up the json parser with pretty-printing marks 2024-09-10 12:06:29 -07:00
667273369e A test for the printer, to get started 2024-09-10 11:57:10 -07:00