aboutsummaryrefslogtreecommitdiff

resyn

Literal regex syntax for Common Lisp.

Sample REPL session:

* (asdf:load-system :resyn)
T
* (set-dispatch-macro-character #\# #\~ #'org.euandre.resyn:reader)
T
* (defparameter url "https://euandre.org")
URL
* (when (#~m|https?://(.*)| url)
    :is-a-web-url)
:IS-A-WEB-URL
* '(#~m|https?://(.*)| url)
((LAMBDA (ORG.EUANDRE.RESYN::STR)
   (ORG.EUANDRE.RESYN:MATCH "https?://(.*)" ORG.EUANDRE.RESYN::STR :ERE
                            :IGNORE-CASE? NIL :GLOBAL? NIL))
 URL)
* (equal '(#~m/abc/ "")
         '(#~/abc/ ""))
T
* (let ((term "it"))
    (#~s/%(term)/%(term) (the \%term)/i "it works like a charm"))
"it (the %term) works like a charm"
T
* (#~s/(a+)(b+)/\2\1/ "aabbbb")
"bbbbaa"
T

WIP version, with some FIXME markers spread throughout the code, and no documentation yet.