semi as lib
This commit is contained in:
parent
608f2e38fc
commit
f177276df1
|
@ -1,17 +1,13 @@
|
|||
#lang racket/base
|
||||
(require (for-syntax racket/base
|
||||
(require remix/semi
|
||||
(for-syntax racket/base
|
||||
syntax/parse))
|
||||
|
||||
(define-syntax (#%semi stx)
|
||||
(raise-syntax-error '#%semi "illegal outside of block" stx))
|
||||
|
||||
(define-syntax (remix-module-begin stx)
|
||||
(syntax-parse stx
|
||||
#:literals (#%semi)
|
||||
[(_ (~seq (~and semi-form (~not #%semi)) ... #%semi) ...
|
||||
(~and tail-form (~not #%semi)) ...)
|
||||
[(_ s:semi-seq)
|
||||
(syntax/loc stx
|
||||
(#%module-begin (semi-form ...) ... tail-form ...))]))
|
||||
(#%module-begin s.semi-form ... s.tail-form ...))]))
|
||||
|
||||
(provide (rename-out
|
||||
[remix-module-begin #%module-begin])
|
||||
|
|
17
remix/semi.rkt
Normal file
17
remix/semi.rkt
Normal file
|
@ -0,0 +1,17 @@
|
|||
#lang racket/base
|
||||
(require (for-syntax racket/base
|
||||
syntax/parse))
|
||||
|
||||
(define-syntax (#%semi stx)
|
||||
(raise-syntax-error '#%semi "illegal outside of block" stx))
|
||||
|
||||
(begin-for-syntax
|
||||
(define-splicing-syntax-class semi-seq
|
||||
#:literals (#%semi)
|
||||
#:attributes ([semi-form 1] [tail-form 1])
|
||||
(pattern (~seq (~seq (~and semi-piece-form (~not #%semi)) ... #%semi) ...
|
||||
(~and tail-form (~not #%semi)) ...)
|
||||
#:attr [semi-form 1] (syntax->list #'((semi-piece-form ...) ...)))))
|
||||
|
||||
(provide #%semi
|
||||
(for-syntax semi-seq))
|
|
@ -5,6 +5,7 @@
|
|||
racket/generic
|
||||
racket/syntax
|
||||
syntax/parse)
|
||||
remix/semi
|
||||
syntax/quote
|
||||
syntax/parse/define
|
||||
remix/stx/singleton-struct0
|
||||
|
|
Loading…
Reference in New Issue
Block a user