[cl-ppcre-devel] debugging of RE matching

Philipp Marek philipp at marek.priv.at
Sun Sep 30 07:53:58 UTC 2012


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







More information about the Cl-ppcre-devel mailing list