February 2006
Intermediate to advanced
304 pages
6h 16m
English
In order to be able to graph a regular expression, you first must figure out what's in it. That's the job of the parse.pm module.
1 # 2 # parse_re -- Parse a regular expression 3 # 4 use strict; 5 use warnings; 6 7 package parse; 8 require Exporter; 9 10 use English; 11 12 use vars qw/@ISA @EXPORT/; 13 14 @ISA = qw/Exporter/; 15 @EXPORT = qw/parse_re/; 16 17 ################################################ 18 # parse_re -- Parse a regular expression 19 # and return an array of parsed data 20 ################################################ 21 sub parse_re($) 22 { 23 # The regular expression to use 24 my $quote_re = shift; 25 26 $quote_re =~ s/\\/\\\\/g; 27 28 # The command to get the debug output 29 ...