blob: a4b584872419d4c0a898e39097d3e55da9802b09 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
(define-module (c cpp-environment function-like-macro)
:use-module (hnh util object)
:use-module (hnh util type)
:use-module ((c lex2) :select (lexeme?))
:use-module ((c unlex) :select (unlex))
:export (function-like-macro
function-like-macro?
identifier
identifier-list
body
variadic?))
(define-type (function-like-macro
printer: (lambda (r p)
(format p "#<#define ~a(~a) ~a>"
(identifier r)
(append (identifier-list r)
(if (variadic? r)
'("...") '()))
(unlex (body r)))))
(identifier type: string?)
(identifier-list type: (list-of string?))
(body type: (list-of lexeme?))
(variadic? type: boolean?
default: #f))
|