Skip to content

Commit e42a901

Browse files
authored
Merge 81396ae into e873795
2 parents e873795 + 81396ae commit e42a901

File tree

10 files changed

+974
-935
lines changed

10 files changed

+974
-935
lines changed

qi-lib/flow.rkt

Lines changed: 9 additions & 626 deletions
Large diffs are not rendered by default.

qi-lib/flow/aux-syntax.rkt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#lang racket/base
2+
3+
(provide literal
4+
subject
5+
clause
6+
starts-with)
7+
8+
(require syntax/parse
9+
racket/string)
10+
11+
(define-syntax-class literal
12+
(pattern
13+
(~or* expr:boolean
14+
expr:char
15+
expr:string
16+
expr:bytes
17+
expr:number
18+
expr:regexp
19+
expr:byte-regexp
20+
;; We'd like to treat quoted forms as literals as well. This
21+
;; includes symbols, and would also include, for instance,
22+
;; syntactic specifications of flows, since flows are
23+
;; syntactically lists as they inherit the elementary syntax of
24+
;; the underlying language (Racket). Quoted forms are read as
25+
;; (quote ...), so we match against this
26+
((~datum quote) expr:expr)
27+
((~datum quasiquote) expr:expr)
28+
((~datum quote-syntax) expr:expr)
29+
((~datum syntax) expr:expr))))
30+
31+
(define-syntax-class subject
32+
#:attributes (args arity)
33+
(pattern
34+
(arg:expr ...)
35+
#:with args #'(arg ...)
36+
#:attr arity (length (syntax->list #'args))))
37+
38+
(define-syntax-class clause
39+
(pattern
40+
expr:expr))
41+
42+
(define-syntax-class (starts-with pfx)
43+
(pattern
44+
i:id #:when (string-prefix? (symbol->string
45+
(syntax-e #'i)) pfx)))
46+

0 commit comments

Comments
 (0)