aboutsummaryrefslogtreecommitdiff
path: root/module/c/cpp-types.scm
diff options
context:
space:
mode:
Diffstat (limited to 'module/c/cpp-types.scm')
-rw-r--r--module/c/cpp-types.scm24
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))))