aboutsummaryrefslogtreecommitdiff
path: root/module/c/cpp-util.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-11 19:48:47 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-11 19:48:47 +0200
commitf743e08220883eef86effdac8a5e7c94deddc302 (patch)
tree053da1a51b7262721e1fcb1324994122ce427bc6 /module/c/cpp-util.scm
parentFix whitespace for rest args. (diff)
downloadcalp-f743e08220883eef86effdac8a5e7c94deddc302.tar.gz
calp-f743e08220883eef86effdac8a5e7c94deddc302.tar.xz
Cleanup + fix __LINE__.
Diffstat (limited to 'module/c/cpp-util.scm')
-rw-r--r--module/c/cpp-util.scm8
1 files changed, 7 insertions, 1 deletions
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))))))