From cbddc0ec9431b759567fa631dd0c19526d0ff775 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Wed, 13 Jul 2022 17:15:27 +0200 Subject: Basis of token convertion. --- module/c/cpp-types.scm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'module/c/cpp-types.scm') diff --git a/module/c/cpp-types.scm b/module/c/cpp-types.scm index 82ebb922..b08e9810 100644 --- a/module/c/cpp-types.scm +++ b/module/c/cpp-types.scm @@ -10,10 +10,11 @@ newline-token? identifier-token? punctuator-token? - number-token? + pp-number? string-token? h-string-token? q-string-token? + character-constant? )) (define (whitespace-token? x) @@ -52,19 +53,26 @@ (`(punctuator ,x) x) (_ #f)))) -(define (number-token? token) +(define (pp-number? token) (and (preprocessing-token? token) (match (lexeme-body token) (`(pp-number ,x) x) (_ #f)))) ;; TODO this fails if there are multiple components in the string token +;; TODO rename to string-literal-token? (define (string-token? token) (and (preprocessing-token? token) (match (lexeme-body token) (`(string-literal ,x) x) (_ #f)))) +(define (character-constant? token) + (and (preprocessing-token? token) + (match (lexeme-body token) + (`(character-constant ,x) x) + (_ #f)))) + (define (h-string-token? token) (and (preprocessing-token? token) -- cgit v1.2.3