diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-10 23:51:25 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-07-10 23:53:01 +0200 |
commit | bc8768984e07c567337a899b861c009fb7cc9ce7 (patch) | |
tree | 69e35cff23185bc5c44003b5974f804c7510cd01 /module/c/cpp-types.scm | |
parent | Resolve recursive macros. (diff) | |
download | calp-bc8768984e07c567337a899b861c009fb7cc9ce7.tar.gz calp-bc8768984e07c567337a899b861c009fb7cc9ce7.tar.xz |
Fix #line
Diffstat (limited to '')
-rw-r--r-- | module/c/cpp-types.scm | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/module/c/cpp-types.scm b/module/c/cpp-types.scm index 64bf6a7b..e21a8f0c 100644 --- a/module/c/cpp-types.scm +++ b/module/c/cpp-types.scm @@ -6,7 +6,11 @@ comment-token? preprocessing-token? newline-token? - identifier-token?)) + identifier-token? + punctuator-token? + number-token? + string-token? + )) (define (whitespace-token? x) (eq? 'whitespace (lexeme-type x))) @@ -26,3 +30,21 @@ (match (lexeme-body token) (`(identifier ,id) id) (_ #f)))) + +(define (punctuator-token? token) + (and (preprocessing-token? token) + (match (lexeme-body token) + (`(punctuator ,x) x) + (_ #f)))) + +(define (number-token? token) + (and (preprocessing-token? token) + (match (lexeme-body token) + (`(pp-number ,x) x) + (_ #f)))) + +(define (string-token? token) + (and (preprocessing-token? token) + (match (lexeme-body token) + (`(string-literal ,x) x) + (_ #f)))) |