Use pre operations for ~before and ~after. Documented that. Bugfix ~before ~after and their try- variants
This commit is contained in:
parent
75fa5aea07
commit
15ceea43fc
|
@ -279,40 +279,40 @@
|
|||
(syntax-case stx ()
|
||||
[(_ other message pat …)
|
||||
(and (identifier? #'other)
|
||||
(string? (syntax-e #'message))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~post-fail message #:when (order-point> pt other)}})])))
|
||||
(string? (syntax-e #'message)))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~pre-fail message #:when (order-point> pt other)}}])))
|
||||
|
||||
(define-eh-mixin-expander ~after
|
||||
(λ (stx)
|
||||
(syntax-case stx ()
|
||||
[(_ other message pat …)
|
||||
(and (identifier? #'other)
|
||||
(string? (syntax-e #'message))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~post-fail message #:when (order-point< pt other)}})])))
|
||||
(string? (syntax-e #'message)))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~pre-fail message #:when (order-point< pt other)}}])))
|
||||
|
||||
(define-eh-mixin-expander ~try-before
|
||||
(λ (stx)
|
||||
(syntax-case stx ()
|
||||
[(_ other message pat …)
|
||||
(and (identifier? #'other)
|
||||
(string? (syntax-e #'message))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~post-fail message #:when (try-order-point> pt other)}})])))
|
||||
(string? (syntax-e #'message)))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~pre-fail message #:when (try-order-point> pt other)}}])))
|
||||
|
||||
(define-eh-mixin-expander ~try-after
|
||||
(λ (stx)
|
||||
(syntax-case stx ()
|
||||
[(_ other message pat …)
|
||||
(and (identifier? #'other)
|
||||
(string? (syntax-e #'message))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~post-fail message #:when (try-order-point< pt other)}})])))
|
||||
(string? (syntax-e #'message)))
|
||||
#'{~order-point pt
|
||||
{~seq pat …}
|
||||
{~pre-fail message #:when (try-order-point< pt other)}}])))
|
||||
|
||||
(define-syntax ~omitable-lifted-rest
|
||||
(pattern-expander
|
||||
|
|
|
@ -146,7 +146,10 @@
|
|||
auto-detects if the @racket[other] order-point is not defined as part of the
|
||||
current @racket[~no-order]. Do not rely on comparisons with order points
|
||||
somehow defined outside the current @racket[~no-order], as that behaviour may
|
||||
change in the future.}
|
||||
change in the future.
|
||||
|
||||
This is implemented as a @seclink["Pre__global_and_post_operations"]{pre
|
||||
operation}.}
|
||||
|
||||
@defform[#:kind "eh-mixin-expander"
|
||||
(~after other message pat ...)]{
|
||||
|
@ -161,7 +164,10 @@
|
|||
auto-detects if the @racket[other] order-point is not defined as part of the
|
||||
current @racket[~no-order]. Do not rely on comparisons with order points
|
||||
somehow defined outside the current @racket[~no-order], as that behaviour may
|
||||
change in the future.}
|
||||
change in the future.
|
||||
|
||||
This is implemented as a @seclink["Pre__global_and_post_operations"]{pre
|
||||
operation}.}
|
||||
|
||||
@defform[#:kind "eh-mixin-expander"
|
||||
(~try-before other message pat ...)]{
|
||||
|
@ -177,7 +183,10 @@
|
|||
|
||||
Note: Hopefully @racket[~before] will be modified in the future so that it
|
||||
auto-detects if the @racket[other] order-point is missing. This form will then
|
||||
be removed.}
|
||||
be removed.
|
||||
|
||||
This is implemented as a @seclink["Pre__global_and_post_operations"]{pre
|
||||
operation}.}
|
||||
|
||||
@defform[#:kind "eh-mixin-expander"
|
||||
(~try-after other message pat ...)]{
|
||||
|
@ -192,5 +201,8 @@
|
|||
|
||||
Note: Hopefully @racket[~after] will be modified in the future so that it
|
||||
auto-detects if the @racket[other] order-point is missing. This form will then
|
||||
be removed.}
|
||||
be removed.
|
||||
|
||||
This is implemented as a @seclink["Pre__global_and_post_operations"]{pre
|
||||
operation}.}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#lang scribble/manual
|
||||
|
||||
@title{Post operations and global operations}
|
||||
@title{Pre, global and post operations}
|
||||
|
||||
Pre operations happen before the @racket[~!] backtracking cut, so they can
|
||||
affect what combination of alternative clauses the parser will choose. Post
|
||||
|
|
Loading…
Reference in New Issue
Block a user