about summary refs log tree commit diff stats
path: root/fff.scm
diff options
context:
space:
mode:
authorCase Duckworth2023-03-21 09:45:11 -0500
committerCase Duckworth2023-03-21 09:45:36 -0500
commit8961601aefd03518bd0ac41afcee08a1b2fe3883 (patch)
treef2bc4f4c5a469cc90ee4ed1cbe9335a6008d24ce /fff.scm
parentAdd header and change perms (diff)
downloadfff-8961601aefd03518bd0ac41afcee08a1b2fe3883.tar.gz
fff-8961601aefd03518bd0ac41afcee08a1b2fe3883.zip
Capture all of comments
Ignore them further down the stack
Diffstat (limited to 'fff.scm')
-rwxr-xr-xfff.scm13
1 files changed, 11 insertions, 2 deletions
diff --git a/fff.scm b/fff.scm index e4409e8..93602a5 100755 --- a/fff.scm +++ b/fff.scm
@@ -49,8 +49,8 @@ FLAT FUCK FORMAT : Specification
49 (* NEWLINE) 49 (* NEWLINE)
50 (not-followed-by peg-any))) 50 (not-followed-by peg-any)))
51 51
52(define-peg-pattern comment none 52(define-peg-pattern comment all
53 (and HASH (* WHITESPACE) 53 (and (+ HASH) (* WHITESPACE)
54 (* (and (not-followed-by NEWLINE) 54 (* (and (not-followed-by NEWLINE)
55 peg-any)))) 55 peg-any))))
56 56
@@ -131,6 +131,11 @@ FLAT FUCK FORMAT : Specification
131 #f)) 131 #f))
132 132
133 133
134;;; Parameters
135
136(define fff/comments?
137 (make-parameter #f))
138
134(define (fff? x) 139(define (fff? x)
135 (and (pair? x) 140 (and (pair? x)
136 (eq? (car x) 'fff))) 141 (eq? (car x) 'fff)))
@@ -161,6 +166,10 @@ FLAT FUCK FORMAT : Specification
161 (`(item . ,pair) 166 (`(item . ,pair)
162 (cons (fff-pair->scm pair) 167 (cons (fff-pair->scm pair)
163 it)) 168 it))
169 (`(comment ,comment)
170 (if (fff/comments?)
171 (cons (car xs) it)
172 it))
164 (_ it)))))) 173 (_ it))))))
165 174
166(define* (fff-ref-resolve tree #:optional environment keep-dupes?) 175(define* (fff-ref-resolve tree #:optional environment keep-dupes?)