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