From 37dc6cc5ab804da964f22787561d030898115809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 20 Jul 2022 16:25:35 +0200 Subject: Acknowledge string prefixes. --- module/c/unlex.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'module/c/unlex.scm') diff --git a/module/c/unlex.scm b/module/c/unlex.scm index 1f8ba0a1..e467a50f 100644 --- a/module/c/unlex.scm +++ b/module/c/unlex.scm @@ -59,21 +59,26 @@ ;; Returns the "source" of the token, as a preprocessing string literal token (define (stringify-token preprocessing-token) (match (lexeme-body preprocessing-token) - (('string-literal `(encoding-prefix ,prefix) parts ...) - (stringify-string-tokens parts)) - (('string-literal parts ...) + (('string-literal `(encoding-prefix . ,prefix) parts ...) (stringify-string-tokens parts)) + (`(header-name (q-string ,s)) (format #f "~s" s)) + (`(header-name (h-string ,s)) (format #f "<~a>" s)) + (`(identifier ,id) id) + (`(pp-number ,n) n) - (`(character-constant ,c) + + ;; TODO remaining parts + (('character-constant `(character-encoding . ,x) c parts ...) (format #f "'~a'" c)) + (`(punctuator ,p) p))) ;; takes a token list, and return a single string literal token (define (stringify-tokens tokens) (lexeme type: 'preprocessing-token - body: `(string-literal ,(unlex-aggressive tokens)))) + body: `(string-literal (encoding-prefix) ,(unlex-aggressive tokens)))) -- cgit v1.2.3