From 6f3d5f3179e8c12699fb405019a423abc9f92811 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 6 Jan 2015 15:35:40 -0800 Subject: [PATCH] Allow case-insensitive section-matching in c99std/c11std --- modules/c11std.pl | 12 ++++++------ modules/c99std.pl | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/c11std.pl b/modules/c11std.pl index f243f37d..5793cfdd 100755 --- a/modules/c11std.pl +++ b/modules/c11std.pl @@ -21,7 +21,7 @@ my ($section, $paragraph, $section_specified, $paragraph_specified, $match, $lis $section_specified = 0; $paragraph_specified = 0; -if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\.p]*)//i) { +if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\.p]+)//i) { $section = $1; if($section =~ s/p(\d+)//i) { @@ -31,7 +31,7 @@ if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\ $paragraph = 1; } - $section = "$section." if $section =~ m/^[A-Z0-9]+$/; + $section = "$section." if $section =~ m/^[A-Z0-9]+$/i; $section_specified = 1; } @@ -97,7 +97,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { print "Processing section [$this_section]\n" if $debug; - if($section_specified and $this_section !~ m/^$section/) { + if($section_specified and $this_section !~ m/^$section/i) { print "No section match, skipping.\n" if $debug >= 4; next; } @@ -111,9 +111,9 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { last; } - if($section =~ /FOOTNOTE/) { + if($section =~ /FOOTNOTE/i) { $section_text =~ s/^\s{4}//ms; - $section_text =~ s/^\s{4}FOOTNOTE.*//ms; + $section_text =~ s/^\s{4}FOOTNOTE.*//msi; $section_text =~ s/^\d.*//ms; } elsif ($section_text =~ m/(.*?)$/msg) { $section_title = $1 if length $1; @@ -123,7 +123,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { print "$this_section [$section_title]\n" if $debug >= 2; - while($section_text =~ m/^(\d+)\s(.*?)^(?=\d)/msgc or $section_text =~ m/^(\d+)\s(.*)/msg) { + while($section_text =~ m/^(\d+)\s(.*?)^(?=\d)/msgic or $section_text =~ m/^(\d+)\s(.*)/msgi) { my $p = $1 ; my $t = $2; diff --git a/modules/c99std.pl b/modules/c99std.pl index 95f2103b..9919bed3 100755 --- a/modules/c99std.pl +++ b/modules/c99std.pl @@ -21,7 +21,7 @@ my ($section, $paragraph, $section_specified, $paragraph_specified, $match, $lis $section_specified = 0; $paragraph_specified = 0; -if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\.p]*)//i) { +if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\.p]+)//i) { $section = $1; if($section =~ s/p(\d+)//i) { @@ -31,7 +31,7 @@ if($search =~ s/-section\s*([A-Z0-9\.p]+)//i or $search =~ s/\b([A-Z0-9]+\.[0-9\ $paragraph = 1; } - $section = "$section." if $section =~ m/^[A-Z0-9]+$/; + $section = "$section." if $section =~ m/^[A-Z0-9]+$/i; $section_specified = 1; } @@ -96,7 +96,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { print "----------------------------------\n" if $debug >= 2; print "Processing section [$this_section]\n" if $debug; - if($section_specified and $this_section !~ m/^$section/) { + if($section_specified and $this_section !~ m/^$section/i) { print "No section match, skipping.\n" if $debug >= 4; next; } @@ -110,9 +110,9 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { last; } - if($section =~ /FOOTNOTE/) { + if($section =~ /FOOTNOTE/i) { $section_text =~ s/^\s{4}//ms; - $section_text =~ s/^\s{4}FOOTNOTE.*//ms; + $section_text =~ s/^\s{4}FOOTNOTE.*//msi; $section_text =~ s/^\d.*//ms; } elsif ($section_text =~ m/(.*?)$/msg) { $section_title = $1 if length $1; @@ -122,7 +122,7 @@ while($text =~ m/^\s{0,4}([0-9A-Z]+\.[0-9\.]*)/msg) { print "$this_section [$section_title]\n" if $debug >= 2; - while($section_text =~ m/^(\d+)\s(.*?)^(?=\d)/msgc or $section_text =~ m/^(\d+)\s(.*)/msg) { + while($section_text =~ m/^(\d+)\s(.*?)^(?=\d)/msgic or $section_text =~ m/^(\d+)\s(.*)/msgi) { my $p = $1 ; my $t = $2;