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/unlex.scm | |
parent | Cleanup in lex2 test. (diff) | |
download | calp-37dc6cc5ab804da964f22787561d030898115809.tar.gz calp-37dc6cc5ab804da964f22787561d030898115809.tar.xz |
Acknowledge string prefixes.
Diffstat (limited to '')
-rw-r--r-- | module/c/unlex.scm | 15 |
1 files changed, 10 insertions, 5 deletions
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)))) |