[LON-CAPA-cvs] cvs: modules /TexConvert/algebra AlgParser.pm algebra2tex.pl

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 24 Feb 2005 08:24:40 -0000


albertel		Thu Feb 24 03:24:40 2005 EDT

  Modified files:              
    /modules/TexConvert/algebra	AlgParser.pm algebra2tex.pl 
  Log:
  - break up the large regexp
  
  
Index: modules/TexConvert/algebra/AlgParser.pm
diff -u modules/TexConvert/algebra/AlgParser.pm:1.2 modules/TexConvert/algebra/AlgParser.pm:1.3
--- modules/TexConvert/algebra/AlgParser.pm:1.2	Thu Feb 24 01:21:10 2005
+++ modules/TexConvert/algebra/AlgParser.pm	Thu Feb 24 03:24:40 2005
@@ -43,7 +43,10 @@
 my $openparen = '[{(\\[]';
 my $closeparen = '[})\\]]';
 my $varname = '[A-Za-z](?:_[0-9]+)?';
-my $specialvalue = '(?:e|pi|da|db|dc|de|df|dg|dh|di|dj|dk|dl|dm|dn|do|dp|dq|dr|ds|dt|du|dv|dw|dx|dy|dz|infty|alpha|bita|gamma|zita|thita|iota|kappa|lambda|mu|nu|xi|rho|sigma|tau|phi|chi|psi|omega|zepslon|zdelta|xeta|zupslon|zeroplace)';
+my $greek='alpha|bita|gamma|zita|thita|iota|kappa|lambda|mu|nu|xi|rho|sigma|tau|phi|chi|psi|omega|zepslon|zdelta|xeta|zupslon';
+my $delete='zeroplace';
+my $escape='infty';
+my $specialvalue = '(?:e|pi|da|db|dc|de|df|dg|dh|di|dj|dk|dl|dm|dn|do|dp|dq|dr|ds|dt|du|dv|dw|dx|dy|dz|'.$escape.'|'.$greek.'|'.$delete.')';
 my $numberplain = '(?:\d+(?:\.\d*)?|\.\d+)';
 my $numberE = '(?:' . $numberplain . 'E[-+]?\d+)';
 my $number = '(?:' . $numberE . '|' . $numberplain . ')';
Index: modules/TexConvert/algebra/algebra2tex.pl
diff -u modules/TexConvert/algebra/algebra2tex.pl:1.1 modules/TexConvert/algebra/algebra2tex.pl:1.2
--- modules/TexConvert/algebra/algebra2tex.pl:1.1	Wed Feb 23 20:21:51 2005
+++ modules/TexConvert/algebra/algebra2tex.pl	Thu Feb 24 03:24:40 2005
@@ -6,7 +6,8 @@
 my $parser = new AlgParserWithImplicitExpand;
 my $ret;
 
-$ret = $parser -> parse($ARGV[0]);
+foreach $str (@ARGV) {
+$ret = $parser -> parse($str);
 if ( ref($ret) ) {
     $parser -> tostring();
     $parser -> normalize();
@@ -14,4 +15,6 @@
 } else {
     print $parser->{htmlerror};
 }
+print "\n";
+}