Permalink
Browse files

Add optima.ppcre system

  • Loading branch information...
Tomohiro Matsuyama
Tomohiro Matsuyama committed Nov 25, 2012
1 parent 9a40e34 commit ef3ac4f02a6954c25b7e757896d85f89214e33f6
Showing with 70 additions and 114 deletions.
  1. +38 −41 README.md
  2. +0 −5 contrib/package.lisp
  3. +2 −2 gendoc.sh
  4. +20 −1 {contrib → lib}/ppcre.lisp
  5. +0 −63 optima.contrib.asd
  6. +8 −0 optima.ppcre.asd
  7. +1 −1 optima.test.asd
  8. +1 −1 test/suite.lisp
View
@@ -450,6 +450,39 @@ Examples:
[Package] optima.extra
----------------------
+
+### [Pattern] alist
+
+Syntax:
+
+ (alist (KEY . PATTERN)*)
+
+Expansion:
+
+ (alist (k . p)*) => (and (assoc k p)*)
+
+Examples:
+
+ (match '((1 . :one) (2 . :two) (3 . :three))
+ ((alist (1 . x) (3 . y)) (list x y)))
+ => (:ONE :THREE)
+
+### [Pattern] plist
+
+Syntax:
+
+ (plist {KEY PATTERN}*)
+
+Expansion:
+
+ (plist {k p}*) => (and (passoc k p)*)
+
+Examples:
+
+ (match '(:name "John" :age 23)
+ ((plist :name "John" :age age) age))
+ => 23
+
## [Macro] if-match
if-match pattern arg &body (then &optional else)
@@ -497,47 +530,14 @@ License
LLGPL
-optima.contrib - Contribution library for optima
-================================================
-
-Contribution library for optima.
+optima.ppcre - CL-PPCRE support for optima
+==========================================
-Available Patterns
-------------------
-
-### ALIST
-
-Syntax:
-
- (alist (KEY . PATTERN)*)
-
-Expansion:
-
- (alist (k . p)*) => (and (assoc k p)*)
-
-Examples:
-
- (match '((1 . :one) (2 . :two) (3 . :three))
- ((alist (1 . x) (3 . y)) (list x y)))
- => (:ONE :THREE)
-
-### PLIST
-
-Syntax:
-
- (plist {KEY PATTERN}*)
-
-Expansion:
-
- (plist {k p}*) => (and (passoc k p)*)
+[Package] optima.ppcre
+----------------------
-Examples:
- (match '(:name "John" :age 23)
- ((plist :name "John" :age age) age))
- => 23
-
-### PPCRE
+### [Pattern] ppcre
Syntax:
@@ -553,9 +553,6 @@ Examples:
(list year month day)))
=> ("2012" "11" "04")
-[Package] optima.contrib
-------------------------
-
Authors
-------
View
@@ -1,5 +0,0 @@
-(defpackage :optima.contrib
- (:use :cl :optima)
- (:import-from :alexandria
- #:plist-alist)
- (:export #:ppcre))
View
@@ -2,10 +2,10 @@
sbcl --quit \
--eval '(ql:quickload :optima)' \
- --eval '(ql:quickload :optima.contrib)' \
+ --eval '(ql:quickload :optima.ppcre)' \
--eval '(ql:quickload :parendoc)' \
--eval '(parendoc:render-markdown-to-file
(list (parendoc.generate:generate (asdf:find-system :optima))
(parendoc:page-feed)
- (parendoc.generate:generate (asdf:find-system :optima.contrib)))
+ (parendoc.generate:generate (asdf:find-system :optima.ppcre)))
"README.md" :if-exists :supersede)'
@@ -1,4 +1,23 @@
-(in-package :optima.contrib)
+(defpackage :optima.ppcre
+ (:use :cl :optima)
+ (:export #:ppcre)
+ (:documentation "
+### [Pattern] ppcre
+
+Syntax:
+
+ (ppcre REGEXP PATTERN*)
+
+Matches REGEXP against the target string. Sub-PATTERNs will be used to
+match the matched groups, if REGEXP matched.
+
+Examples:
+
+ (match \"2012-11-04\"
+ ((ppcre \"^\\\\d{4}-\\\\d{2}-\\\\d{2}$\" year month day)
+ (list year month day)))
+ => (\"2012\" \"11\" \"04\")"))
+(in-package :optima.ppcre)
(defstruct (ppcre-pattern (:include optima::constructor-pattern)
(:constructor make-ppcre-pattern (regex &rest subpatterns)))
View
@@ -1,63 +0,0 @@
-(asdf:defsystem :optima.contrib
- :description "Contribution library for optima"
- :long-description "Contribution library for optima.
-
-Available Patterns
-------------------
-
-### ALIST
-
-Syntax:
-
- (alist (KEY . PATTERN)*)
-
-Expansion:
-
- (alist (k . p)*) => (and (assoc k p)*)
-
-Examples:
-
- (match '((1 . :one) (2 . :two) (3 . :three))
- ((alist (1 . x) (3 . y)) (list x y)))
- => (:ONE :THREE)
-
-### PLIST
-
-Syntax:
-
- (plist {KEY PATTERN}*)
-
-Expansion:
-
- (plist {k p}*) => (and (passoc k p)*)
-
-Examples:
-
- (match '(:name \"John\" :age 23)
- ((plist :name \"John\" :age age) age))
- => 23
-
-### PPCRE
-
-Syntax:
-
- (ppcre REGEXP PATTERN*)
-
-Matches REGEXP against the target string. Sub-PATTERNs will be used to
-match the matched groups, if REGEXP matched.
-
-Examples:
-
- (match \"2012-11-04\"
- ((ppcre \"^\\\\d{4}-\\\\d{2}-\\\\d{2}$\" year month day)
- (list year month day)))
- => (\"2012\" \"11\" \"04\")"
- :version "0.2"
- :author "Tomohiro Matsuyama"
- :license "LLGPL"
- :depends-on (:optima
- :cl-ppcre)
- :components ((:module "contrib"
- :serial t
- :components ((:file "package")
- (:file "ppcre")))))
View
@@ -0,0 +1,8 @@
+(asdf:defsystem :optima.ppcre
+ :description "CL-PPCRE support for optima"
+ :version "0.2"
+ :author "Tomohiro Matsuyama"
+ :license "LLGPL"
+ :depends-on (:optima
+ :cl-ppcre)
+ :components ((:file "lib/ppcre")))
View
@@ -1,3 +1,3 @@
(asdf:defsystem :optima.test
- :depends-on (:eos :optima :optima.contrib)
+ :depends-on (:eos :optima :optima.ppcre)
:components ((:file "test/suite")))
View
@@ -1,5 +1,5 @@
(defpackage :optima.test
- (:use :cl :eos :optima :optima.extra :optima.contrib)
+ (:use :cl :eos :optima :optima.extra :optima.ppcre)
(:shadowing-import-from :optima #:fail))
(in-package :optima.test)

0 comments on commit ef3ac4f

Please sign in to comment.