[cl-ppcre-devel] debugging of RE matching

Hans Hübner hans.huebner at gmail.com
Sun Sep 30 08:52:55 UTC 2012


Phil,

your change seems useful, but I wonder why you added an extra lambda
layer instead of doing the binding in the function returned by
create-scanner-aux match-fn.  Is there a reason for that?

The html document is the source for the documentation.  I'd give the
symbol that enables debugging a more specific name which contains the
fact that match debugging is enabled and export it from the :cl-ppcre
package.

-Hans

On Sun, Sep 30, 2012 at 9:53 AM, Philipp Marek <philipp at marek.priv.at> wrote:
>
> Hello everybody,
>
> to make it easier to see how/where a RE does (or does not) match I've started
> a branch on github:
>
>   https://github.com/phmarek/cl-ppcre/tree/debugging
>
> During compile-time cl-ppcre::*do-debug* decides whether some tracing output
> is returned by the compiled match function.
>
> Example for a successful match:
>
>   > (cl-ppcre:scan-to-strings #?r(^abc(d|(e+)|fff)[xyz]+) "abcfffzzxzx")
>   *string*: "abcfffzzxzx"
>   SEQ                  [  0   0[
>     ANCHOR             [  0   0[ ANCHOR
>     STR                [  0   3[ "abc"
>     REGISTER           [  3   3[ $1
>       ALTERNATION      [  3   3[
>         STR            [  3   3[ ""
>         REGISTER       [  3   3[ $2
>           SEQ          [  3   3[
>             STR        [  3   3[ ""
>         STR            [  3   6[ "fff"
>     CHAR-CLASS         [  6   7[ [#<CLOSURE (LAMBDA (CHAR) ...
>     REPETITION         [  7  11[
>   "abcfffzzxzx"
>   #("fff" NIL)
>
>
> Example for a non-matching try:
>
>   > (cl-ppcre:scan-to-strings #?r(^abc(d|(e+)|fff)[xyz]+) "abcffffz")
>   *string*: "abcffffz"
>   SEQ                  [  0   0[
>     ANCHOR             [  0   0[ ANCHOR
>     STR                [  0   3[ "abc"
>     REGISTER           [  3   3[ $1
>       ALTERNATION      [  3   3[
>         STR            [  3   3[ ""
>         REGISTER       [  3   3[ $2
>           SEQ          [  3   3[
>             STR        [  3   3[ ""
>         STR            [  3   6[ "fff"
>     CHAR-CLASS         NO  MATCH [#<CLOSURE (LAMBDA (CHAR) :IN ...
>   NIL
>
> I think this might be useful for other people, so please provide some
> feedback.
>
> Is the documentations' source doc/index.html? Then I'd provide some text
> there, too.
>
>
>
> Regards,
>
> Phil
>
>
>
>
> _______________________________________________
> cl-ppcre-devel site list
> cl-ppcre-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/cl-ppcre-devel




More information about the Cl-ppcre-devel mailing list