From 7aa5a138cfcb6ec77d58200a240e6c3618b6ffe8 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 4 Aug 2008 15:49:04 +0000 Subject: [PATCH] a little progress svn: r11063 --- collects/redex/redex.scrbl | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/collects/redex/redex.scrbl b/collects/redex/redex.scrbl index 321693facb..ea6256f456 100644 --- a/collects/redex/redex.scrbl +++ b/collects/redex/redex.scrbl @@ -2,10 +2,18 @@ @(require scribble/manual scribble/bnf scribble/eval + (for-syntax scheme/base) (for-label scheme/base scheme/contract redex)) +@(define-syntax (defpattech stx) + (syntax-case stx () + [(_ arg) + (identifier? #'arg) + (with-syntax ([as (symbol->string (syntax-e #'arg))]) + #'@index['("Redex Pattern" as)]{@deftech{as}})])) + @;{ I usually use an `ellipsis' non-terminal to make it more explicit that @@ -101,7 +109,7 @@ this tool: ====================================================================== -The _reduction-semantics.ss_ library defines a pattern +The _reduction-semantics.ss_ library defines a @deftech{pattern} language, used in various ways: @(schemegrammar* #:literals (any number string variable variable-except variable-prefix variable-not-otherwise-mentioned hole name in-hole in-named-hole side-condition cross) @@ -125,12 +133,21 @@ language, used in various ways: scheme-constant] [pattern-sequence pattern - ... ;; literal ellipsis + (code:line ... (code:comment "literal ellipsis")) ..._id]) -The patterns match sexpressions. The _any_ pattern matches -any sepxression. The _number_ pattern matches any -number. The _string_ pattern matches any string. Those three +@itemize{ + +@item{The any +@;{@defpattech[any]} +pattern matches +any sepxression.} + +@item{The number +@;{@defpattech[number]} +pattern matches any number.}} + +The _string_ pattern matches any string. Those three patterns may also be suffixed with an underscore and another identifier, in which case they bind the full name (as if it were an implicit `name' pattern) and match the portion