(define-module (c cpp-types) :use-module (c lex2) :use-module (ice-9 match) :use-module (c cpp-util) :export (whitespace-token? comment-token? preprocessing-token? newline-token? identifier-token?)) (define (whitespace-token? x) (eq? 'whitespace (lexeme-type x))) (define (comment-token? x) (eq? 'comment (lexeme-type x))) (define (preprocessing-token? x) (eq? 'preprocessing-token (lexeme-type x))) (define (newline-token? x) (and (whitespace-token? x) (string=? "\n" (lexeme-body x)))) (define (identifier-token? token) (and (preprocessing-token? token) (match (lexeme-body token) (`(identifier ,id) id) (_ #f))))