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....
This commit is contained in:
John Doty 2024-09-11 11:22:41 -07:00
parent d6dd54f4df
commit 276449287d
2 changed files with 42 additions and 7 deletions

View file

@ -57,7 +57,7 @@ class JsonGrammar(Grammar):
LCURLY = Terminal("{")
RCURLY = Terminal("}")
COMMA = Terminal(",")
COLON = Terminal(":")
COLON = Terminal(":", format_follow=" ")
LSQUARE = Terminal("[")
RSQUARE = Terminal("]")
TRUE = Terminal("true")
@ -164,8 +164,8 @@ def test_layout_basic():
result
== """
{
"a":true,
"b":[
"a": true,
"b": [
1,
2,
3