commit 15ceea43fceb4162c5cd8372fcb9a5e9cb376815
parent 75fa5aea07b8f1b7fda217a60e118e20574bfdee
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Thu, 22 Sep 2016 23:06:57 +0200
Use pre operations for ~before and ~after. Documented that. Bugfix ~before ~after and their try- variants
Diffstat:
3 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/private/no-order.rkt b/private/no-order.rkt
@@ -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
diff --git a/scribblings/no-order.scrbl b/scribblings/no-order.scrbl
@@ -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}.}
diff --git a/scribblings/pre-global-post-section.scrbl b/scribblings/pre-global-post-section.scrbl
@@ -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