diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 17:15:27 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-13 17:15:27 +0200 |
commit | cbddc0ec9431b759567fa631dd0c19526d0ff775 (patch) | |
tree | baec265016b2357939ed00d7704c96762d50e3e9 /module/c/cpp-types.scm | |
parent | Comment out typechecks on token stream. (diff) | |
download | calp-cbddc0ec9431b759567fa631dd0c19526d0ff775.tar.gz calp-cbddc0ec9431b759567fa631dd0c19526d0ff775.tar.xz |
Basis of token convertion.
Diffstat (limited to '')
-rw-r--r-- | module/c/cpp-types.scm | 12 |
1 files changed, 10 insertions, 2 deletions
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) |