Commit graph

16 commits

Author SHA1 Message Date
d5ccd5b147 Really messing around with trivia, it's not good yet
It's really not clear how to track it and how to compose it with
groups yet. Really very difficult.
2024-09-14 17:14:07 -07:00
f3a4c4348a Custom indentation 2024-09-14 07:28:18 -07:00
39ae937ddc Comments
Not really.
2024-09-13 23:16:46 -07:00
c8fef52c0c Support prefix newlines, stop generating empty productions
This required rebuilding the matcher compiler significantly, and it
was a lot a lot of work. But now we don't generate so many spurious
newlines and the document we produce is a lot a lot better.
2024-09-13 22:41:33 -07:00
709ba060b4 Hack for metadata in the document 2024-09-13 16:53:51 -07:00
8845bcfdab Fix accidental group duplication
Leading to unnecessary ambiguities
2024-09-13 15:28:50 -07:00
ca240906c9 Remove the text follow stuff
I think we have a good solution to the problem.
2024-09-13 12:02:44 -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
b3b2102864 Record trivia in tokens
This will make our formatting better I think.
2024-09-12 06:22:49 -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
443bf8bd33 Move formatting meta around, actually mark stuff up 2024-09-10 11:47:22 -07:00
7edf5e06bf Rebuild the matcher on grammars
Well that wasn't so bad now was it? Eh? Nice to have a parser
generator lying around. Let's keep working to see if I can actually
finish it.
2024-09-09 11:40:14 -07:00
1d28c82007 Saving this for posterity, but it is doomed
Remember that tree levels are generated by context free languages, not
regular languages, and so they can only be recognized by push-down
automatons, not finite state machines.

What happened was that I failed to account for transparent rules.
Without transparent rules the children of a tree node do not have any
recursion in them (by definition!) and so therefore *are* a regular
language. But transparent rules change that: there *can be* recursion
hidden on the same tree level, and it should have been clear from a
moment's reflection that the recursion there meant that tree levels
were once again a context free language.

Fortunately we have a recognizer for context free languages lying
around, so we can just use that I guess.
2024-09-09 06:23:25 -07:00
a2c6390c23 Start to work on a prettier system.
Still very garbage but I think the "hard" part of building a Wadler
document from a parse tree might be there. It's a backtracking matcher
which might turn out to be too slow for alternatives but maybe will be
fine?

Still needs lots of tests.
2024-09-07 13:02:09 -07:00