[cl-ppcre-devel] debugging of RE matching

Edi Weitz edi at agharta.de
Sun Sep 30 09:17:56 UTC 2012


In addition to what Hans said I'd consider using a special variable
like *debug-stream* instead of *do-debug* so that you can direct
debugging information to a particular stream.

Also, not only the HTML documentation should be patched, all
newly-introduced functions should also have meaningful docstrings, and
the docstrings for the new special variables should adhere to the
style rules of the rest of the code - use whole sentences, don't start
with lower-case chars, don't use abbreviations, etc.

Finally, the documentation should explain that the debugging output
will not always reflect the regular expression that was originally
entered because the regex engine might have optimized it before
debugging kicks in.

Thanks,
Edi.


On Sun, Sep 30, 2012 at 10:52 AM, Hans Hübner <hans.huebner at gmail.com> wrote:
> 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
>
> _______________________________________________
> 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