eppearl.pl to HTML.

index -|- end

Generated: Tue Feb 2 17:54:31 2010 from eppearl.pl 2005/11/24 5 KB.

#!/perl
my $perlstx = 'C:/Program Files/EditPlus 2/perl.stx'; ### fix location - should maintain separate list???
my $verb3 = 1;
### is this everything ? ;=))
### see sub ispunctuat ($ch) service
@PPunct = ("&", "&&", "&&=", "&=",
   "<", "<<", "<<=", "<&=", "<&",
   "<=", "<==>", ">", ">&", ">>",
   ">>=", ">=",
   "*", "**", "**=", "*=", "*?",
   "@", "@*,", "@_",
   "`", "\\",
   "!", "!=",
   "^", "^=",
   ":", "::", ",", "\$",
   ".", "\"",
   "=", "=>", "==", "=~",
   ">", "#", "-", "->",
   "-*-", "-=", "--", "-|",
   "%", "%=", 
   "+", "+=", "++", "+?",
   "#", "?", "?:", "?...?",
   "'", "\"", ";", "#!",
   "/", "/=", "//", "/.../",
   "~", "~~",
   "_","|", "|=", "|-", "||", "||=",
   "/o"
   );
@PPairs = (
   "<", ">",
   "<%", "%>",
   "{", "}",
   "[", "]",
   "(", ")",
   );
@DolVars = ( "\$1", "\$2", "\$3",
   "\$&", "\$<", "\$>", "\$'", "\$*",
   "\$@", "\$`", "\$\\", "\$!", "\$[",
   "\$]", "\$^", "\$^A", "\$^F",
   "\$^H", "\$^I", "\$^L", "\$^M",
   "\$^O", "\$^P", "\$^T", "\$^W", "\$^X",
   "\$:", "\$,", "\$.", "\$=", "\$-",
   "\$(", "\$)", "\$%", "\$+", "\$?",
   "\$\"", "\$;", "\$/", "\$~",
   "\$_", "\$|"
   );
@PBPunc = (
   "(?!)", "(?!...", "(?:)",
   "(?...)", "(?=)", "(?#)", "(?i)"
   );
@ResWds2 = qw(if until while elsif else unless for 
   foreach continue exit die last goto next 
   redo return local exec sub do dump use 
   require package eval my BEGIN END);
# ==========================================================================
# this is just to load the set of BUILT-IN FUNCTIONS and RESERVED WORDS
# eventually should perhaps be separated from this EditPlus.stx file format
#
# ==========================================================================
sub do_stx_file {
my %stxh = ();
my $icnt = 0;
###### pre-process perl.stx file ######################################
open $STX, "<$perlstx" or die "Can NOT locate $perlstx file...\n";
my @stx = <$STX>; ### slurp file to an array
close($STX);
$i = @stx;
tolog ("List of $i STX file lines...\n");
my $sw = 0; # no switch on
foreach $line (@stx) {
   $icnt++;
   chomp $line;
   my $ll = length($line); # get LENGTH of file line
   my @a;
   my $k;
   my $v;
   $c = substr ($line, 0, 1);
   $msg = '';
   if ($c eq ';') { # comment
      $msg = 'comment only';
   } elsif ($c eq '#') {
      # a line beginning with a HASH char
      if ( ($ll > 3) && ($line =~ /=/) ) { # hash item=value
         $msg = ' hash';
         @a = split('=', $line); # get key/value
         ($k, $v) = @a;
         $k = substr($k, 1);
         ###$stxh{$a[0]} = $a[1];
         if ( exists $stxh{$k} ) {
            if ($stxh{$k} eq $v) {
               $msg .= ' same ';
            } else {
               $msg .= ' new ';
            }
            $stxh{$k} .= '|' . $v;
            ###$v = $stxh{$k};
         } else {
            $stxh{$k} = $v;
         }
         ### $msg .= ' k=' . $a[0] . ' v=' . $a[1] . '-'; 
         ###$msg .= ' k=' . $k . ' v=' . $v . ' - '; 
         $msg .= ' k=';
         $msg .= $k;
         $msg .= ' v=';
         $msg .= $stxh{$k};
         $msg .= ' - '; 
         #KEYWORD=Reserved words
         #KEYWORD=Built-in functions
         if ($k eq 'KEYWORD') {
            if ($v eq 'Reserved words') {
               $sw = 1;
               $msg .= '(ResWds)';
            } elsif ($v eq 'Built-in functions') {
               $sw = 2;
               $msg .= '(BFuncs)';
            } else {
               $sw = 0;
            }
         }
      } else {
         $msg .= ' WARNING: Unprocessed HASH line!';
      }
   }
   ###if ($ll > 1) {
   if ($ll > 0) {
      if ($sw == 1) {
         push(@ResWds, $line);
         if ( exists $HResWds{$line} ) {
            die "Duplicate RESERVE WORD [$line]\n"
         }
         $HResWds{$line} = $line;
         $msg .= " - rw+";
      } elsif ($sw == 2) {
         push(@BFuncs, $line);
         if ( exists $HBFuncs{$line} ) {
            die "Duplicate BUILT-IN FUNCTION [$line]\n"
         }
         $HBFuncs{$line} = $line;
         $msg .= " - bf+";
      } else {
         ###$msg .= " WARNING0 !1|2sw";
      }
   } else {
      $msg .= " empty";
   }
   ###tolog ($line . $msg . "\n") if $verb3;
   tolog ('Line' . $icnt . '=[' . $line . "]($ll) msg=[" . $msg . "]\n") if $verb3 ;
}
$line = 'new';
if ( ! exists $HBFuncs{$line} ) {
   $msg = ' ++Added';
   push(@BFuncs, $line);
   $HBFuncs{$line} = $line;
   tolog ($line . $msg . "\n");
}
$cnt1 = @ResWds;
$cnt2 = @BFuncs;
tolog ("END List of $i STX file lines...rw=$cnt1 bf=$cnt2 \n");
###### end-process perl.stx file ######################################
if ($NewRes) { # switch from perl.stx file - one day!
 my %hash1 = ();
 my %hash2 = ();
 my $k;
 foreach $line (@ResWds) {
   $hash1{$line} = 0;
 }
 foreach $line (@ResWds2) {
   $hash2{$line} = 0;
 }
 foreach  $k (keys %hash1) {
   if (! exists $hash2{$k} ) {
      tolog "Can NOT locate [$k] in hash 2!\n";
   } else {
      $hash1{$k} = 1;
      $hash2{$k} = 1;
   }
 }
 foreach  $k (keys %hash2) {
   if ($hash2{$k} == 0) {
      if (! exists $hash1{$k} ) {
         tolog "Can NOT locate [$k] in hash 1!\n";
      }
   }
 }
 tolog ('@common = qw(');
 foreach  $k (keys %hash1) {
   if ($hash1{$k}) {
      tolog ("$k ");
   }
 }
 tolog (")\n");
} ### if $NewRes # switch from perl.stx file = one day ???
} ### exit STX file load
# ==========================================================================
1;

index -|- top

checked by tidy  Valid HTML 4.01 Transitional