aboutsummaryrefslogtreecommitdiff
path: root/module/c/unlex.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-13 11:35:39 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-13 11:35:39 +0200
commit7b78cf68200118fac395592da3d78b22b4be0cd7 (patch)
tree9cd8411147b6732a7288e4ba40ade220658d73c3 /module/c/unlex.scm
parentEnsure #error works. (diff)
downloadcalp-7b78cf68200118fac395592da3d78b22b4be0cd7.tar.gz
calp-7b78cf68200118fac395592da3d78b22b4be0cd7.tar.xz
Add support for "other" in preprocessing-tokens.
Diffstat (limited to 'module/c/unlex.scm')
-rw-r--r--module/c/unlex.scm6
1 files changed, 4 insertions, 2 deletions
diff --git a/module/c/unlex.scm b/module/c/unlex.scm
index e3d36f86..e714816d 100644
--- a/module/c/unlex.scm
+++ b/module/c/unlex.scm
@@ -13,7 +13,8 @@
(typecheck tokens (list-of lexeme?))
(string-concatenate
(map (lambda (x) (cond (x preprocessing-token? => stringify-token)
- ((whitespace-token? x) (lexeme-body x))))
+ ((whitespace-token? x) (lexeme-body x))
+ ((other-token? x) (lexeme-body x))))
tokens)))
;; takes a list of preprocessing-token's, and return a "source" string
@@ -22,7 +23,8 @@
(string-concatenate
(map (lambda (x)
(cond ((preprocessing-token? x) (stringify-token x))
- ((whitespace-token? x) " ")))
+ ((whitespace-token? x) " ")
+ ((other-token? x) (lexeme-body x))))
(squeeze-whitespace tokens))))
(define (stringify-escape-sequence sub-token)