Permalink
Browse files

??

/h2/,/body/i\
bababa
  • Loading branch information...
1 parent c2234c0 commit d3de7d56dc533715c0c68cdab9c1f16bcfc46b82 @quek committed Jan 29, 2012
Showing with 20 additions and 6 deletions.
  1. +2 −5 a.sed
  2. +18 −1 sed.lisp
View
7 a.sed
@@ -1,5 +1,2 @@
-1i\
-hello!!!!!
-3a\
-fooooooooooo
-3d
+/h2/,/body/i\
+bababa
View
@@ -13,7 +13,8 @@
(line-numebr 0)
(eol +lf+)
(before-output nil)
- (after-output nil))
+ (after-output nil)
+ (numomo (make-hash-table)))
(defun do-before-output (sed)
(collect-ignore (funcall (scan 'list (sed-before-output sed)))))
@@ -61,6 +62,18 @@
`(when (match-p ,address-or-address1-and-2)
,@body))
+(defmacro ?? (from to &body body)
+ (alexandria:with-gensyms (in-match-p)
+ `(let ((,in-match-p nil))
+ (when (if (gethash ,in-match-p (sed-numomo *sed*))
+ (progn
+ (when (match-p ,to)
+ (setf (gethash ,in-match-p (sed-numomo *sed*)) nil))
+ t)
+ (when (match-p ,from)
+ (setf (gethash ,in-match-p (sed-numomo *sed*)) t)))
+ ,@body))))
+
(defmacro sed ((&key (in *standard-input*)
(out *standard-output*)
(eol +lf+))
@@ -116,4 +129,8 @@
(a "だいめい"))
(? "<title>"
(d)))
+
+(sed (:in (merge-pathnames "a.html" (asdf:system-source-file :info.read-eval-print.sed)))
+ (?? "h2" "body"
+ (i "bababa")))
|#

0 comments on commit d3de7d5

Please sign in to comment.