From 8961601aefd03518bd0ac41afcee08a1b2fe3883 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 21 Mar 2023 09:45:11 -0500 Subject: Capture all of comments Ignore them further down the stack --- fff.scm | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'fff.scm') 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 (* NEWLINE) (not-followed-by peg-any))) -(define-peg-pattern comment none - (and HASH (* WHITESPACE) +(define-peg-pattern comment all + (and (+ HASH) (* WHITESPACE) (* (and (not-followed-by NEWLINE) peg-any)))) @@ -131,6 +131,11 @@ FLAT FUCK FORMAT : Specification #f)) +;;; Parameters + +(define fff/comments? + (make-parameter #f)) + (define (fff? x) (and (pair? x) (eq? (car x) 'fff))) @@ -161,6 +166,10 @@ FLAT FUCK FORMAT : Specification (`(item . ,pair) (cons (fff-pair->scm pair) it)) + (`(comment ,comment) + (if (fff/comments?) + (cons (car xs) it) + it)) (_ it)))))) (define* (fff-ref-resolve tree #:optional environment keep-dupes?) -- cgit 1.4.1-21-gabe81