aboutsummaryrefslogtreecommitdiff
path: root/module/c/lex2.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/c/lex2.scm')
-rw-r--r--module/c/lex2.scm26
1 files changed, 20 insertions, 6 deletions
diff --git a/module/c/lex2.scm b/module/c/lex2.scm
index c09f6423..85c9be19 100644
--- a/module/c/lex2.scm
+++ b/module/c/lex2.scm
@@ -374,12 +374,26 @@
(`(comment ,body)
(lexeme body: body type: 'comment ))
(`(preprocessing-token ,body)
- (case body
- ;; "unflatten"
- ((string-literal)
- (lexeme body: '(string-literal "") type: 'preprocessing-token))
- (else
- (lexeme body: body type: 'preprocessing-token))))
+ (match body
+ ('string-literal
+ ;; Unflatten case
+ (lexeme body: '(string-literal (encoding-prefix) "")
+ type: 'preprocessing-token))
+ (('string-literal `(encoding-prefix ,px) args ...)
+ (lexeme body: `(string-literal (encoding-prefix . ,px) ,@args)
+ type: 'preprocessing-token))
+ (('string-literal args ...)
+ (lexeme body: `(string-literal (encoding-prefix) ,@args)
+ type: 'preprocessing-token))
+ (('character-constant `(character-prefix ,px) args ...)
+ (lexeme body: `(character-constant (character-prefix . ,px)
+ ,@args)
+ type: 'preprocessing-token))
+ (('character-constant args ...)
+ (lexeme body: `(character-constant (character-prefix) ,@args)
+ type: 'preprocessing-token))
+ (body (lexeme body: body type: 'preprocessing-token))))
+
;; "unflatten"
('comment (lexeme body: "" type: 'comment))))