aboutsummaryrefslogtreecommitdiff
path: root/module/c/preprocessor2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-20 16:25:35 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-21 14:27:23 +0200
commit37dc6cc5ab804da964f22787561d030898115809 (patch)
treeb8d0acd2fcc8f0c2c51b2d76a4d1e5d942143a2b /module/c/preprocessor2.scm
parentCleanup in lex2 test. (diff)
downloadcalp-37dc6cc5ab804da964f22787561d030898115809.tar.gz
calp-37dc6cc5ab804da964f22787561d030898115809.tar.xz
Acknowledge string prefixes.
Diffstat (limited to 'module/c/preprocessor2.scm')
-rw-r--r--module/c/preprocessor2.scm20
1 files changed, 13 insertions, 7 deletions
diff --git a/module/c/preprocessor2.scm b/module/c/preprocessor2.scm
index c6be3936..3f9552c5 100644
--- a/module/c/preprocessor2.scm
+++ b/module/c/preprocessor2.scm
@@ -397,11 +397,15 @@
body: (lambda (environment arguments)
(typecheck arguments (and (list-of (list-of lexeme?))
(not null?)))
- (aif (string-token? (caar arguments))
- (values (handle-pragma environment (lex it)) '())
- (scm-error 'cpp-pragma-error "_Pragma"
- "Invalid argument to _Pragma: ~s"
- (list (car arguments)) #f)))))
+ (cond ((string-token? (caar arguments))
+ (lambda (a . _) a)
+ ;; TODO handle rest
+ => (lambda (encoding it . rest)
+ (values (handle-pragma environment (lex it))
+ '())))
+ (else (scm-error 'cpp-pragma-error "_Pragma"
+ "Invalid argument to _Pragma: ~s"
+ (list (car arguments)) #f))))))
@@ -591,10 +595,12 @@
(remaining (drop-whitespace (cdr tokens))))
(cond ((null? remaining) (set environment current-line (1- line)))
((string-token? (car remaining))
- => (lambda (file)
+ (lambda (a . _) a)
+ => (lambda (encoding . fragments)
(-> environment
(set current-line (1- line))
- (set current-file file))))
+ ;; TODO properly join string
+ (set current-file (car fragments)))))
;; no newlines in #line
(%first-time (loop #f ((unval resolve-token-stream 1) environment tokens)))
(else (err))))))