www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

post.scrbl (1880B)


      1 #lang scribble/manual
      2 @require[scribble/example
      3          "utils.rkt"
      4          @for-label[phc-toolkit/untyped
      5                     extensible-parser-specifications
      6                     generic-syntax-expanders
      7                     racket/base
      8                     syntax/parse
      9                     (only-in racket/base [... …])]]
     10 
     11 @title{Post operations}
     12 
     13 @defform*[#:kind "eh-mixin expander"
     14           [(~post-check #,ntax-pattern #,A-patte)
     15            (~post-check #,A-patte)]]{
     16  Matches @racket[#,ntax-pattern], and executes the given @racket[#,A-patte]
     17  after the whole @racket[~seq-no-order] or @racket[~no-order] finished matching
     18  its contents.
     19  
     20  If unspecified, the @racket[_syntax-pattern] defaults to @racket[(~nop)].}
     21 
     22 @defform*[#:kind "eh-mixin expander"
     23           [(~post-fail message #:when condition)
     24            (~post-fail #:when condition message)
     25            (~post-fail message #:unless unless-condition)
     26            (~post-fail #:unless unless-condition message)]]{
     27                                                    
     28  After the whole @racket[~seq-no-order] or @racket[~no-order] finished matching
     29  its contents, checks whether @racket[condition] or @racket[unless-condition] is
     30  true or false, respectively.  If this is the case the whole
     31  @racket[~seq-no-order] or @racket[~no-order] is rejected with the given
     32  @racket[_message].
     33 
     34  Note that there is an implicit cut (@racket[~!]) between the no-order patterns
     35  and the "post" checks, so after a @racket[~post-fail] fails,
     36  @racket[syntax-parse] does not backtrack and attempt different combinations of
     37  patterns to match the sequence, nor does it backtrack and attempt to match a
     38  shorter sequence. This is by design, as it allows for better error messages
     39  (syntax-parse would otherwise attempt and possibly succeed in matching a
     40  shorter sequence, then just treat the remaining terms as "unexpected terms").}