add default meanings, change a default string thing, update docs
This commit is contained in:
parent
fca8612d98
commit
ca1f63c993
28
udelim/defaults.rkt
Normal file
28
udelim/defaults.rkt
Normal file
|
@ -0,0 +1,28 @@
|
|||
#lang racket/base
|
||||
|
||||
(provide
|
||||
#%ornate-parens
|
||||
#%double-parens
|
||||
#%inequality-brackets
|
||||
#%double-inequality-brackets
|
||||
#%moon-faces
|
||||
|
||||
#%cjk-corner-quotes
|
||||
)
|
||||
|
||||
(require (for-syntax racket/base))
|
||||
|
||||
(define-syntax (pass-through-list stx)
|
||||
(syntax-case stx ()
|
||||
[(ptm e ...) #'(e ...)]))
|
||||
(define-syntax #%ornate-parens (make-rename-transformer #'pass-through-list))
|
||||
(define-syntax #%double-parens (make-rename-transformer #'pass-through-list))
|
||||
(define-syntax #%inequality-brackets (make-rename-transformer #'pass-through-list))
|
||||
(define-syntax #%double-inequality-brackets (make-rename-transformer #'pass-through-list))
|
||||
(define-syntax #%moon-faces (make-rename-transformer #'pass-through-list))
|
||||
|
||||
(define-syntax (pass-through-one stx)
|
||||
(syntax-case stx ()
|
||||
[(ptm e) #'e]))
|
||||
(define-syntax #%cjk-corner-quotes (make-rename-transformer #'pass-through-one))
|
||||
|
|
@ -23,8 +23,8 @@
|
|||
(make-list-delim-readtable/wrap
|
||||
#\⸨ #\⸩ '#%double-parens
|
||||
#:base-readtable
|
||||
(make-string-delim-readtable
|
||||
#\“ #\”
|
||||
(make-string-delim-readtable/wrap
|
||||
#\「 #\」 '#%cjk-corner-quotes
|
||||
#:base-readtable
|
||||
(make-string-delim-readtable #\« #\»))))))))
|
||||
(define (wrap-reader p)
|
||||
|
|
|
@ -10,10 +10,13 @@
|
|||
|
||||
@defmodule[udelim]
|
||||
|
||||
@section{Stability}
|
||||
Don't consider this library to be stable right now. Particularly the udelim metalanguage -- I'm not sure what extra parens would be a good default (eg. which ones are distinctive enough, have good font support, are desired by people...). I am definitely keen on «» as nestable string delimiters that aren't wrapped in anything (I would like to always have a nestable string delimiter that just gives me a string). I think I would like one nestable string delimiter that is wrapped with some #%symbol, and several paren types also wrapped.
|
||||
|
||||
@section{Guide}
|
||||
This is a library I wrote primarily to help make nestable embedding of different syntax in #lang rash, but is generally useful for adding extra types of parenthesis or string delimiters to a language. After watching Jay McCarthy's talk at Sixth Racketcon, I also decided to steal his idea of making different types of parenthesis wrap their contents with an additional #%symbol.
|
||||
|
||||
You can use the udelim meta-language (eg #lang udelim racket/base) to add a few extra parenthesis types and string types to any language. Specifically, «» and “” are nestable non-escaping string delimiters, ﴾foo bar﴿ reads as (#%ornate-parens foo bar), ⦓foo bar⦔ reads as (#%inequality-brackets foo bar), ⦕foo bar⦖ reads as (#%double-inequality-brackets foo bar), 🌜foo bar🌛 reads as (#%moon-faces foo bar), and ⸨foo bar⸩ reads as (#%double-parens foo bar).
|
||||
You can use the udelim meta-language (eg #lang udelim racket/base) to add a few extra parenthesis types and string types to any language. Specifically, «» are nestable non-escaping string delimiters (IE «foo «bar»» reads as "foo «bar»"), 「」 are like «» but wrapped so 「foo bar」 produces (#%cjk-corner-quotes "foo bar"), ﴾foo bar﴿ reads as (#%ornate-parens foo bar), ⦓foo bar⦔ reads as (#%inequality-brackets foo bar), ⦕foo bar⦖ reads as (#%double-inequality-brackets foo bar), 🌜foo bar🌛 reads as (#%moon-faces foo bar), and ⸨foo bar⸩ reads as (#%double-parens foo bar). To get default meanings for the #% identifiers (currently just pass-through macros), use (require udelim/defaults).
|
||||
|
||||
@section{Reference}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user