RDL unstable

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

RDL unstable

Vijay Lakshminarayanan
Hi all,

logs/Language/rdl.lisp will be very unstable over the next few days.
I'm making a series of changes to it both bug fixes and feature
additions.

I don't know exactly where I'm going but here is an outline.

* bug: in the matching function,

  (rule matching "x" and "y") produces

  (MAKE-INSTANCE
   'ORG.PREWETT.LOGS:RULE
   :MATCH
   (LAMBDA (#:MESSAGE1389)
     (MULTIPLE-VALUE-BIND
           (#:MATCHES1390 #:SUB-MATCHES1391)
         (LET ((#:MSGMSG1392
                (ORG.PREWETT.LOGS::MESSAGE #:MESSAGE1389)))
           (AND (CL-PPCRE:SCAN-TO-STRINGS "abc" #:MSGMSG1392)
                (CL-PPCRE:SCAN-TO-STRINGS "x" #:MSGMSG1392)))
       (WHEN #:MATCHES1390
         (VALUES T (LIST (LIST 'SUB-MATCHES #:SUB-MATCHES1391)))))))

  which is fine, but if we use a keyword (from the keyword package)
  for AND or OR we get poor results:

  (rule matching regexp "abvc" :or "ef" :and "xy") produces

  (MAKE-INSTANCE
   'ORG.PREWETT.LOGS:RULE
   :MATCH
   (LAMBDA (#:MESSAGE1393)
     (MULTIPLE-VALUE-BIND
         (#:MATCHES1394 #:SUB-MATCHES1395)
         (LET ((#:MSGMSG1396
                (ORG.PREWETT.LOGS::MESSAGE #:MESSAGE1393)))
           (:OR (CL-PPCRE:SCAN-TO-STRINGS "abvc" #:MSGMSG1396)
                (:AND (CL-PPCRE:SCAN-TO-STRINGS "ef" #:MSGMSG1396)
                      (CL-PPCRE:SCAN-TO-STRINGS "xy" #:MSGMSG1396))))
       (WHEN #:MATCHES1394
         (VALUES T (LIST (LIST 'SUB-MATCHES #:SUB-MATCHES1395)))))))

  which is WRONG.

  I have fixed this but not checked it in.  OR and AND are filled in
  as CL:OR CL:AND respectively.

* bug: setenv does not take its values from the environment

  (let* ((value 10)
         (rule (rule with x = value)))
    (logs::environment rule)) ==> ((x value))

  And since the environment is quote'd, it means that X takes 'VALUE
  as its value.

  This also has been fixed but not checked in.  The environment alist
  is not quote'd, rather generated as a list of lists.

* feature: make precedence optional in matches.

  (rule matching "string literal"
                 or regexp (format () "generated string")
                 and ("precedence" and (concatenate 'string "enforced")))

* feature: remove the FILTER rdl keyword and include it in match using
  NOT as in

  (rule matching "some? regexp*" and not "some (other)? regexps")

  would give

  (lambda (message)
    (multiple-value-bind
          (matches sub-matches)
        (let ((msgmsg (logs::message message)))
          (and (cl-ppcre:scan-to-strings "some? regexp*" msgmsg)
               (not
                (cl-ppcre:scan-to-strings "some (other)? regexps"))))
      (when matches
        (values t (list (list 'sub-matches sub-matches))))))

This is what I have planned so far.  Also, I will probably stop all
development where it is so i can add unit tests.

More suggestions welcome.  I hope to pick the bones out of your
current rLoGS.lisp and abstract it into a good RDL syntax for
contexts, adding dynamic rules into contexts, rulesets and with
relation to other rules.

Thanks
Vijay


_______________________________________________
LoGS-devel mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/logs-devel