2021-06-04 13:56:03 +00:00
|
|
|
;;; SPDX-License-Identifier: LGPL-3.0-or-later
|
|
|
|
;;; SPDX-FileCopyrightText: Copyright © 2010-2021 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
|
2021-06-01 15:19:24 +00:00
|
|
|
|
2018-04-08 06:39:39 +00:00
|
|
|
#lang racket/base
|
|
|
|
;; Common syntax classes.
|
|
|
|
|
|
|
|
(provide (for-syntax assertions
|
2018-04-29 21:27:55 +00:00
|
|
|
name
|
|
|
|
snapshot))
|
2018-04-08 06:39:39 +00:00
|
|
|
|
|
|
|
(require racket/set)
|
|
|
|
|
|
|
|
(require (for-syntax racket/base))
|
|
|
|
(require (for-syntax syntax/parse))
|
|
|
|
(require (for-syntax syntax/srcloc))
|
|
|
|
|
|
|
|
(begin-for-syntax
|
|
|
|
(define-splicing-syntax-class assertions
|
|
|
|
(pattern (~seq #:assertions [exprs ...]))
|
2018-04-19 16:55:52 +00:00
|
|
|
(pattern (~seq) #:attr (exprs 1) '()))
|
2018-04-08 06:39:39 +00:00
|
|
|
|
|
|
|
(define-splicing-syntax-class name
|
|
|
|
(pattern (~seq #:name N))
|
2018-04-29 21:27:55 +00:00
|
|
|
(pattern (~seq) #:attr N #'#f))
|
|
|
|
|
|
|
|
(define-splicing-syntax-class snapshot
|
|
|
|
(pattern (~seq #:snapshot) #:attr dynamic? #'#f)
|
|
|
|
(pattern (~seq) #:attr dynamic? #'#t)))
|