From f743e08220883eef86effdac8a5e7c94deddc302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 11 Jul 2022 19:48:47 +0200 Subject: Cleanup + fix __LINE__. --- module/c/cpp-util.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'module/c/cpp-util.scm') diff --git a/module/c/cpp-util.scm b/module/c/cpp-util.scm index 420c8739..fff3cc9e 100644 --- a/module/c/cpp-util.scm +++ b/module/c/cpp-util.scm @@ -3,13 +3,15 @@ :use-module ((hnh util) :select (->)) :use-module (hnh util type) :use-module ((c lex2) :select (lex lexeme?)) + :use-module ((c unlex) :select (unlex)) :use-module (c cpp-types) :export (tokens-until-eol squeeze-whitespace drop-whitespace drop-whitespace-right drop-whitespace-both - cleanup-whitespace)) + cleanup-whitespace + concatenate-tokens)) ;; Returns two values: ;; - tokens until a newline token is met @@ -60,3 +62,7 @@ (define (cleanup-whitespace tokens) (typecheck tokens (list-of lexeme?)) (-> tokens drop-whitespace-both squeeze-whitespace)) + +(define (concatenate-tokens a b) + (car (lex (string-append (unlex (list a)) + (unlex (list b)))))) -- cgit v1.2.3