[Cl-irc-cvs] CVS update: cl-irc/example/cliki.lisp

Brian Mastenbrook bmastenbrook at common-lisp.net
Wed Jul 28 15:45:42 UTC 2004


Update of /project/cl-irc/cvsroot/cl-irc/example
In directory common-lisp.net:/home/bmastenbrook/cl-irc/example

Modified Files:
	cliki.lisp 
Log Message:
MORE GRAMMAR

Date: Wed Jul 28 08:45:42 2004
Author: bmastenbrook

Index: cl-irc/example/cliki.lisp
diff -u cl-irc/example/cliki.lisp:1.20 cl-irc/example/cliki.lisp:1.21
--- cl-irc/example/cliki.lisp:1.20	Wed Jul 28 07:36:25 2004
+++ cl-irc/example/cliki.lisp	Wed Jul 28 08:45:42 2004
@@ -1,4 +1,4 @@
-;;;; $Id: cliki.lisp,v 1.20 2004/07/28 14:36:25 bmastenbrook Exp $
+;;;; $Id: cliki.lisp,v 1.21 2004/07/28 15:45:42 bmastenbrook Exp $
 ;;;; $Source: /project/cl-irc/cvsroot/cl-irc/example/cliki.lisp,v $
 
 ;;;; cliki.lisp - CLiki as an infobot; only works on SBCL.
@@ -477,7 +477,7 @@
                 (progn
                   (setf first-pass (regex-replace-all "(:|/|\\\\|\\#)" first-pass ""))
                   (setf first-pass (regex-replace-all "^(?i)(.*[^, ])(,|)\\s*please$" first-pass "\\1"))
-                  (setf first-pass (regex-replace-all "^(?i)please(,|)\\s*(.*[^, ])$" first-pass "\\1"))
+                  (setf first-pass (regex-replace-all "^(?i)please(,|)\\s*(.*[^, ])$" first-pass "\\2"))
                   (when (and (scan "^(?i)lisppaste(\\s|!|\\?|\\.|$)*" first-pass)
                              (find-package :lisppaste)
                              channel
@@ -490,7 +490,7 @@
                    (let ((strings
                           (or
                            (aif
-                            (nth-value 1 (scan-to-strings "^(?i)(direct|tell|show|inform|teach)\\s+(\\S+)\\s+(about|on|in|to|through|for|)\\s*(.+)$" first-pass))
+                            (nth-value 1 (scan-to-strings "^(?i)(direct|tell|show|inform|teach|give)\\s+(\\S+)\\s+(about|on|in|to|through|for|some|)\\s*(.+)$" first-pass))
                             (cons :forward it))
                            (aif
                             (nth-value 1 (scan-to-strings "^(?i)(look\\s+up\\s+|)\\s*(.+)\\s+(for|to|at)\\s+(\\S+)$" first-pass))
@@ -597,16 +597,16 @@
                                       (or sender channel "you")
                                       (elt str 1))
                                   (random-advice))))
-                   (let ((str (nth-value 1 (scan-to-strings "^(?i)advi[cs]e\\s+(for\\s+|)(\\S+)\\s+(on|about)\\s+(.+)$" first-pass))))
+                   (let ((str (nth-value 1 (scan-to-strings "^(?i)(any\\s+|some\\s+|)advi[cs]e\\s+(for\\s+|)(\\S+)\\s+(on|about)\\s+(.+)$" first-pass))))
                      (and str
                           (format nil "~A: ~A"
-                                  (if (string-equal (elt str 1) "me")
+                                  (if (string-equal (elt str 2) "me")
                                       (or sender channel "you")
-                                      (elt str 1))
-                                  (search-advice (elt str 3)))))
-                   (let ((str (nth-value 1 (scan-to-strings "^(?i)advi[cs]e\\s+(on|about)\\s+(.+)$" first-pass))))
+                                      (elt str 2))
+                                  (search-advice (elt str 4)))))
+                   (let ((str (nth-value 1 (scan-to-strings "^(?i)(any\\s+|some\\s+|)advi[cs]e\\s+(on|about)\\s+(.+)$" first-pass))))
                      (and str
-                          (search-advice (elt str 1))))
+                          (search-advice (elt str 2))))
                    (let ((str (nth-value 1 (scan-to-strings "^(?i)advice\\W+(\\d+)$" first-pass))))
                      (and str
                           (lookup-advice (elt str 0))))





More information about the cl-irc-cvs mailing list