lib/XML/Parser/REX.pm

filter: Statementstmt 100% 35 / 35 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 97.4% 38 / 39 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
ShallowParse
1.0
CRAP 1.0
↑ Summary
1 package XML::Parser::REX;
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 our $VERSION = '1.01';
6  
7  
8 # REX/Perl 1.0
9 # Robert D. Cameron "REX: XML Shallow Parsing with Regular Expressions",
10 # Technical Report TR 1998-17, School of Computing Science, Simon Fraser
11 # University, November, 1998.
12 # Copyright (c) 1998, Robert D. Cameron.
13 # The following code may be freely used and distributed provided that
14 # this copyright and citation notice remains intact and that modifications
15 # or additions are clearly identified.
16  
17 1 our $TextSE = "[^<]+";
18 1 our $UntilHyphen = "[^-]*-";
19 1 our $Until2Hyphens = "$UntilHyphen(?:[^-]$UntilHyphen)*-";
20 1 our $CommentCE = "$Until2Hyphens>?";
21 1 our $UntilRSBs = "[^\\]]*](?:[^\\]]+])*]+";
22 1 our $CDATA_CE = "$UntilRSBs(?:[^\\]>]$UntilRSBs)*>";
23 1 our $S = "[ \\n\\t\\r]+";
24 1 our $NameStrt = "[A-Za-z_:]|[^\\x00-\\x7F]";
25 1 our $NameChar = "[A-Za-z0-9_:.-]|[^\\x00-\\x7F]";
26 1 our $Name = "(?:$NameStrt)(?:$NameChar)*";
27 1 our $QuoteSE = "\"[^\"]*\"|'[^']*'";
28 1 our $DT_IdentSE = "$S$Name(?:$S(?:$Name|$QuoteSE))*";
29 1 our $MarkupDeclCE = "(?:[^\\]\"'><]+|$QuoteSE)*>";
30 1 our $S1 = "[\\n\\r\\t ]";
31 1 our $UntilQMs = "[^?]*\\?+";
32 1 our $PI_Tail = "\\?>|$S1$UntilQMs(?:[^>?]$UntilQMs)*>";
33 1 our $DT_ItemSE = "<(?:!(?:--$Until2Hyphens>|[^-]$MarkupDeclCE)|\\?$Name(?:$PI_Tail))|%$Name;|$S";
34 1 our $DocTypeCE = "$DT_IdentSE(?:$S)?(?:\\[(?:$DT_ItemSE)*](?:$S)?)?>?";
35 1 our $DeclCE = "--(?:$CommentCE)?|\\[CDATA\\[(?:$CDATA_CE)?|DOCTYPE(?:$DocTypeCE)?";
36 1 our $PI_CE = "$Name(?:$PI_Tail)?";
37 1 our $EndTagCE = "$Name(?:$S)?>?";
38 1 our $AttValSE = "\"[^<\"]*\"|'[^<']*'";
39 1 our $ElemTagCE = "$Name(?:$S$Name(?:$S)?=(?:$S)?(?:$AttValSE))*(?:$S)?/?>?";
40 1 our $MarkupSPE = "<(?:!(?:$DeclCE)?|\\?(?:$PI_CE)?|/(?:$EndTagCE)?|(?:$ElemTagCE)?)";
41 1 our $XML_SPE = "$TextSE|$MarkupSPE";
42  
43  
44 1 ▶sub ShallowParse {
Subroutine ShallowParse: called CC=1 SCAR=0.0
Pod undocumented
45 1 my($XML_document) = @_;
46 1 return $XML_document =~ /$XML_SPE/g;
47 }
48  
49  
50 1 1;
51  
52  
53 __END__
↑ Summary