in reply to Understanding someone else's parser

See YAPE::Regex::Explain from japhy - The release announcement for this module can be found on this site here.

Also have a look at the node Learning Perl's Regular Expressions which includes links to Regex::Diagram and GraphViz::Regex which may also be of use.

 

perl -le 'print+unpack("N",pack("B32","00000000000000000000001000001101"))'

  • Comment on Re: Understanding someone else's parser

Replies are listed 'Best First'.
Re^2: Understanding someone else's parser
by diotalevi (Canon) on Jan 02, 2003 at 04:59 UTC

    I also recall japhy noting that the base module doesn't yet support all the really funky things[1] you can do with regexen. It's really a string parser and in general parsing regexes also reduces to requiring a Perl parser in Perl that isn't perl.

    [1] - my definition of funky starts at (?{}) / (??{}) so maybe it's good for everything normal programmers use. ;-)


    Fun Fun Fun in the Fluffy Chair

      Here's the kind of stuff I'm looking at:
      while ( $line =~ s/([[:alpha:]][[:alpha:]\']{0,44})[_\-,\.\"\' +\)\?!:;\/&]{0,5}([ \t\n\r]|$)/ / ) { update_word($self,$1, $encoded, '', '[_\-,\.\"\'\)\?!:;\/ +&\t\n\r]') if (length $1 >= 3);
      The first line is what POPfile considers a "word", after dealing with some other special cases first. I want to tinker with this program a bit. So, there is nothing funky about it. Just someone else's code to read and understand.

      —John

        You should check the module's (and I forget it's name or I'd mention it here) documentation to see which constructs aren't supported. You'll have it locally once you get that ::Explain module installed since it depends on it.


        Fun Fun Fun in the Fluffy Chair