changeset 21967:17457503ba95

gendoc.pl: Minor changes for readability and speed. * gendoc.pl: Don't bother to capture reference in regexp which is never used. use \Q,\E pairs to turn off specialness of regexp characters temporarily to make patterns easier to read.
author Rik <rik@octave.org>
date Tue, 21 Jun 2016 16:38:59 -0700
parents 112b20240c87
children 973db845cb43
files libinterp/gendoc.pl
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/gendoc.pl	Tue Jun 21 16:07:51 2016 -0400
+++ b/libinterp/gendoc.pl	Tue Jun 21 16:38:59 2016 -0700
@@ -20,8 +20,7 @@
 
 unless (@ARGV > 1) { die "Usage: $0 SRCDIR src-file1 ..." }
 
-$srcdir = $ARGV[0];
-shift;
+$srcdir = shift (@ARGV);
 
 print <<__END_OF_MSG__;
 ### DO NOT EDIT!
@@ -49,13 +48,13 @@
 
   LINE: while (<SRC_FH>)
   {
-    if (/^\s*DEF(CONSTFUN|UN|UN_DLD|UNX|UNX_DLD)\s*\(/)
+    if (/^\s*DEF(?:CONSTFUN|UN|UN_DLD|UNX|UNX_DLD)\s*\(/)
     {
       ($func) = /\("?(\w+)"?,/;
       unless ($func) { die "Unable to parse $src_fname at line $.\n" }
       push (@func_list, $func);
 
-      if (<SRC_FH> =~ /\s*doc:\s+\/\*\s+-\*- texinfo -\*-\s*$/)
+      if (<SRC_FH> =~ m#\s*doc:\s+\Q/*\E\s+\Q-*- texinfo -*-\E\s*$#)
       {
         $str = "-*- texinfo -*-\n";
         $reading_docstring = 1;
@@ -70,7 +69,7 @@
     {
       if (/^.*\s+\*\/\s*\)\s*$/)
       {
-        s/\s+\*\/\s*\)\s*$//;
+        s#\s+\*/\s*\)\s*$##;
         push (@docstr, $str . $_);
         $reading_docstring = 0;
       }