[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm

www lon-capa-cvs@mail.lon-capa.org
Fri, 28 Jul 2006 15:22:28 -0000


www		Fri Jul 28 11:22:28 2006 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
  Log:
  Trying to cover more implicit multiplication cases
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.114 loncom/homework/default_homework.lcpm:1.115
--- loncom/homework/default_homework.lcpm:1.114	Thu Jul 27 18:56:37 2006
+++ loncom/homework/default_homework.lcpm	Fri Jul 28 11:22:28 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.114 2006/07/27 22:56:37 albertel Exp $
+# $Id: default_homework.lcpm,v 1.115 2006/07/28 15:22:28 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -208,12 +208,16 @@
 # Fill in multiplication signs
 # a b -> a*b;3 b -> 3*b;3 4 -> 3*4
     $expression=~s/(\w)\s+(\w)/$1\*$2/gs;
-# 3a -> 3*a; 3( -> 3*(; 3A -> 3*a
-    $expression=~s/(\d)([a-zA-Z\(])/$1\*$2/gs;
+# )( -> )*(; ) ( -> )*(
+    $expression=~s/\)\s*\(/\)\*\(/gs;
+# 3a -> 3*a; 3( -> 3*(; 3 ( -> 3*(; 3A -> 3*A
+    $expression=~s/(\d)\s*([a-zA-Z\(])/$1\*$2/gs;
+# a ( -> a*(
+    $expression=~s/(\w)\s+\(/$1\*\(/gs;
 # a3 -> a*3;
     $expression=~s/([a-zA-Z])(\d)/$1\*$2/gs;
-# )a -> )*a; )3 -> )*3
-    $expression=~s/\)(\w)/\)\*$1/gs;
+# )a -> )*a; )3 -> )*3; ) 3 -> )*3
+    $expression=~s/\)\s*(\w)/\)\*$1/gs;
 # 3&8 -> 3e8; 3&-4 -> 3e-4
     $expression=~s/(\d+)\&\(([\+\-]*\d+)\)/$1e$2/gs;
     return $expression;