[system] / trunk / webwork / system / courseScripts / AlgParser.pm Repository: Repository Listing bbplugincoursesdistsnplrochestersystemwww

# Diff of /trunk/webwork/system/courseScripts/AlgParser.pm

Revision 26 Revision 27
47$numberplain = '(?:\d+(?:\.\d*)?|\.\d+)'; 47$numberplain = '(?:\d+(?:\.\d*)?|\.\d+)';
48$numberE = '(?:' .$numberplain . 'E[-+]?\d+)'; 48$numberE = '(?:' .$numberplain . 'E[-+]?\d+)';
49$number = '(?:' .$numberE . '|' . $numberplain . ')'; 49$number = '(?:' . $numberE . '|' .$numberplain . ')';
50$trigfname = '(?:cosh|sinh|tanh|cot|(?:a(?:rc)?)?cos|(?:a(?:rc)?)?sin|' . 50$trigfname = '(?:cosh|sinh|tanh|cot|(?:a(?:rc)?)?cos|(?:a(?:rc)?)?sin|' .
51 '(?:a(?:rc)?)?tan|sech?)'; 51 '(?:a(?:rc)?)?tan|sech?)';
52$otherfunc = '(?:exp|abs|logten|log|ln|sqrt|sgn|step|fact)'; 52$otherfunc = '(?:exp|abs|logten|log|ln|sqrt|sgn|step)';
53$funcname = '(?:' .$otherfunc . '|' . $trigfname . ')'; 53$funcname = '(?:' . $otherfunc . '|' .$trigfname . ')';
54 54
55$tokenregexp = "(?:($binoper3)|($binoper2)|($binoper1)|($openparen)|" . 55$tokenregexp = "(?:($binoper3)|($binoper2)|($binoper1)|($openparen)|" .
56 "($closeparen)|($funcname)|($specialvalue)|($varname)|" . 56 "($closeparen)|($funcname)|($specialvalue)|($varname)|" .
57 "($numberE)|($number))"; 57 "($numberE)|($number))";
566 /func1/ && do { 566 /func1/ && do {
567 my($p1,$p2); 567 my($p1,$p2);
568 if($args[0] eq "sqrt"){($p1,$p2)=qw{ \left{ \right} };} 568 if($args[0] eq "sqrt"){($p1,$p2)=qw{ \left{ \right} };}
569 else {($p1,$p2)=qw{ \left( \right) };} 569 else {($p1,$p2)=qw{ \left( \right) };}
570 570
571 $specialfunc = '(?:abs|logten|asin|acos|atan|sech|sgn|step|fact)'; 571$specialfunc = '(?:abs|logten|asin|acos|atan|sech|sgn)';
572 572
573 573
574 if ($args[0] =~ /$specialfunc/) { 574 if ($args[0] =~ /$specialfunc/) {
575 return ('\mbox{' . $args[0] .'}'.$p1 . $args[1]->tolatex() .$p2); 575 return ('\mbox{' . $args[0] .'}'.$p1 . $args[1]->tolatex() .$p2);
576 } 576 }

Legend:
 Removed from v.26 changed lines Added in v.27