diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-20 16:25:35 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-21 14:27:23 +0200 |
commit | 37dc6cc5ab804da964f22787561d030898115809 (patch) | |
tree | b8d0acd2fcc8f0c2c51b2d76a4d1e5d942143a2b /module/c/lex2.scm | |
parent | Cleanup in lex2 test. (diff) | |
download | calp-37dc6cc5ab804da964f22787561d030898115809.tar.gz calp-37dc6cc5ab804da964f22787561d030898115809.tar.xz |
Acknowledge string prefixes.
Diffstat (limited to 'module/c/lex2.scm')
-rw-r--r-- | module/c/lex2.scm | 26 |
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)))) |