|
|
@ -260,7 +260,7 @@
|
|
|
|
(let loop ([a-pattern a-pattern]
|
|
|
|
(let loop ([a-pattern a-pattern]
|
|
|
|
[implicit implicit]
|
|
|
|
[implicit implicit]
|
|
|
|
[explicit explicit])
|
|
|
|
[explicit explicit])
|
|
|
|
(syntax-case a-pattern (id lit token choice repeat maybe elide seq)
|
|
|
|
(syntax-case a-pattern (id lit token choice elide repeat maybe seq)
|
|
|
|
[(id val)
|
|
|
|
[(id val)
|
|
|
|
(values implicit explicit)]
|
|
|
|
(values implicit explicit)]
|
|
|
|
[(lit val)
|
|
|
|
[(lit val)
|
|
|
@ -275,12 +275,15 @@
|
|
|
|
[explicit explicit])
|
|
|
|
[explicit explicit])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
(loop v implicit explicit))]
|
|
|
|
(loop v implicit explicit))]
|
|
|
|
|
|
|
|
[(elide vals ...)
|
|
|
|
|
|
|
|
(for/fold ([implicit implicit]
|
|
|
|
|
|
|
|
[explicit explicit])
|
|
|
|
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
|
|
|
|
(loop v implicit explicit))]
|
|
|
|
[(repeat min val)
|
|
|
|
[(repeat min val)
|
|
|
|
(loop #'val implicit explicit)]
|
|
|
|
(loop #'val implicit explicit)]
|
|
|
|
[(maybe val)
|
|
|
|
[(maybe val)
|
|
|
|
(loop #'val implicit explicit)]
|
|
|
|
(loop #'val implicit explicit)]
|
|
|
|
[(elide val)
|
|
|
|
|
|
|
|
(loop #'val implicit explicit)]
|
|
|
|
|
|
|
|
[(seq vals ...)
|
|
|
|
[(seq vals ...)
|
|
|
|
(for/fold ([implicit implicit]
|
|
|
|
(for/fold ([implicit implicit]
|
|
|
|
[explicit explicit])
|
|
|
|
[explicit explicit])
|
|
|
@ -344,7 +347,7 @@
|
|
|
|
(define (pattern-collect-used-ids a-pattern acc)
|
|
|
|
(define (pattern-collect-used-ids a-pattern acc)
|
|
|
|
(let loop ([a-pattern a-pattern]
|
|
|
|
(let loop ([a-pattern a-pattern]
|
|
|
|
[acc acc])
|
|
|
|
[acc acc])
|
|
|
|
(syntax-case a-pattern (id lit token choice repeat maybe elide seq)
|
|
|
|
(syntax-case a-pattern (id lit token choice elide repeat maybe seq)
|
|
|
|
[(id val)
|
|
|
|
[(id val)
|
|
|
|
(cons #'val acc)]
|
|
|
|
(cons #'val acc)]
|
|
|
|
[(lit val)
|
|
|
|
[(lit val)
|
|
|
@ -355,12 +358,14 @@
|
|
|
|
(for/fold ([acc acc])
|
|
|
|
(for/fold ([acc acc])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
(loop v acc))]
|
|
|
|
(loop v acc))]
|
|
|
|
|
|
|
|
[(elide vals ...)
|
|
|
|
|
|
|
|
(for/fold ([acc acc])
|
|
|
|
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
|
|
|
|
(loop v acc))]
|
|
|
|
[(repeat min val)
|
|
|
|
[(repeat min val)
|
|
|
|
(loop #'val acc)]
|
|
|
|
(loop #'val acc)]
|
|
|
|
[(maybe val)
|
|
|
|
[(maybe val)
|
|
|
|
(loop #'val acc)]
|
|
|
|
(loop #'val acc)]
|
|
|
|
[(elide val)
|
|
|
|
|
|
|
|
(loop #'val acc)]
|
|
|
|
|
|
|
|
[(seq vals ...)
|
|
|
|
[(seq vals ...)
|
|
|
|
(for/fold ([acc acc])
|
|
|
|
(for/fold ([acc acc])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
([v (in-list (syntax->list #'(vals ...)))])
|
|
|
@ -389,7 +394,7 @@
|
|
|
|
a-leaf)
|
|
|
|
a-leaf)
|
|
|
|
|
|
|
|
|
|
|
|
(define (process-pattern a-pattern)
|
|
|
|
(define (process-pattern a-pattern)
|
|
|
|
(syntax-case a-pattern (id lit token choice repeat maybe elide seq)
|
|
|
|
(syntax-case a-pattern (id lit token choice elide repeat maybe seq)
|
|
|
|
[(id val)
|
|
|
|
[(id val)
|
|
|
|
(free-id-table-ref toplevel-rule-table #'val)]
|
|
|
|
(free-id-table-ref toplevel-rule-table #'val)]
|
|
|
|
[(lit val)
|
|
|
|
[(lit val)
|
|
|
@ -403,6 +408,13 @@
|
|
|
|
(define a-child (process-pattern v))
|
|
|
|
(define a-child (process-pattern v))
|
|
|
|
(sat:add-child! an-or-node a-child))
|
|
|
|
(sat:add-child! an-or-node a-child))
|
|
|
|
an-or-node)]
|
|
|
|
an-or-node)]
|
|
|
|
|
|
|
|
[(elide vals ...)
|
|
|
|
|
|
|
|
(begin
|
|
|
|
|
|
|
|
(define an-or-node (sat:make-or))
|
|
|
|
|
|
|
|
(for ([v (in-list (syntax->list #'(vals ...)))])
|
|
|
|
|
|
|
|
(define a-child (process-pattern v))
|
|
|
|
|
|
|
|
(sat:add-child! an-or-node a-child))
|
|
|
|
|
|
|
|
an-or-node)]
|
|
|
|
[(repeat min val)
|
|
|
|
[(repeat min val)
|
|
|
|
(syntax-case #'min ()
|
|
|
|
(syntax-case #'min ()
|
|
|
|
[0
|
|
|
|
[0
|
|
|
@ -411,8 +423,6 @@
|
|
|
|
(process-pattern #'val)])]
|
|
|
|
(process-pattern #'val)])]
|
|
|
|
[(maybe val)
|
|
|
|
[(maybe val)
|
|
|
|
(make-leaf)]
|
|
|
|
(make-leaf)]
|
|
|
|
[(elide val)
|
|
|
|
|
|
|
|
(make-leaf)]
|
|
|
|
|
|
|
|
[(seq vals ...)
|
|
|
|
[(seq vals ...)
|
|
|
|
(begin
|
|
|
|
(begin
|
|
|
|
(define an-and-node (sat:make-and))
|
|
|
|
(define an-and-node (sat:make-and))
|
|
|
|