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/lex2.scm | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'module/c/lex2.scm') 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)))) -- cgit v1.2.3