diff options
author | Case Duckworth | 2023-03-21 09:45:57 -0500 |
---|---|---|
committer | Case Duckworth | 2023-03-21 09:45:57 -0500 |
commit | 89948b23c4aca41a5eab6aab4e7baca196da3ecf (patch) | |
tree | 773e2946b391ec99a4e34b1029c9b975cb2ca7dd | |
parent | Capture all of comments (diff) | |
download | fff-89948b23c4aca41a5eab6aab4e7baca196da3ecf.tar.gz fff-89948b23c4aca41a5eab6aab4e7baca196da3ecf.zip |
Change parsing to require fewer newlines
-rwxr-xr-x | fff.scm | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/fff.scm b/fff.scm index 93602a5..686ea87 100755 --- a/fff.scm +++ b/fff.scm | |||
@@ -63,17 +63,20 @@ FLAT FUCK FORMAT : Specification | |||
63 | (+ array-item))) | 63 | (+ array-item))) |
64 | 64 | ||
65 | (define-peg-pattern item all | 65 | (define-peg-pattern item all |
66 | object-item) | 66 | (and object-item |
67 | (* NEWLINE))) | ||
67 | 68 | ||
68 | (define-peg-pattern object-item body | 69 | (define-peg-pattern object-item body |
69 | (and key (* WHITESPACE) | 70 | (and key (* WHITESPACE) |
70 | COLON (* WHITESPACE) | 71 | COLON (* WHITESPACE) |
71 | (or ref val))) | 72 | (or ref val) |
73 | (? NEWLINE))) | ||
72 | 74 | ||
73 | (define-peg-pattern array-item body | 75 | (define-peg-pattern array-item body |
74 | (and (* WHITESPACE) | 76 | (and (* WHITESPACE) |
75 | COLON (* WHITESPACE) | 77 | COLON (* WHITESPACE) |
76 | (or ref val))) | 78 | (or ref val) |
79 | (? NEWLINE))) | ||
77 | 80 | ||
78 | (define-peg-pattern name all | 81 | (define-peg-pattern name all |
79 | (and key COLON COLON (* WHITESPACE) NEWLINE)) | 82 | (and key COLON COLON (* WHITESPACE) NEWLINE)) |
@@ -83,11 +86,10 @@ FLAT FUCK FORMAT : Specification | |||
83 | nonl))) | 86 | nonl))) |
84 | 87 | ||
85 | (define-peg-pattern val all | 88 | (define-peg-pattern val all |
86 | (and (* nonl) | 89 | (and (* nonl))) |
87 | NEWLINE)) | ||
88 | 90 | ||
89 | (define-peg-pattern ref all | 91 | (define-peg-pattern ref all |
90 | (and AT key NEWLINE)) | 92 | (and AT key)) |
91 | 93 | ||
92 | (define-peg-pattern escaped body | 94 | (define-peg-pattern escaped body |
93 | (and BACKSLASH (or (and NEWLINE (* WHITESPACE)) | 95 | (and BACKSLASH (or (and NEWLINE (* WHITESPACE)) |