Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWWDillingham WesleyDillingham <wwdillingham@sugarlabs.org>2009-07-07 01:15:27 (GMT)
committer WWDillingham WesleyDillingham <wwdillingham@sugarlabs.org>2009-07-07 01:15:27 (GMT)
commit5af3c40f281f9d85ee45ebc787962b10ef7c93db (patch)
treebeb33c57d9b6bb27b9891bf4fff7491993360639
parent37006d9d0070ecb0cdaef0e1146058a537cd726a (diff)
updated regular expression in compound section
-rw-r--r--order_of_operations_parser.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/order_of_operations_parser.php b/order_of_operations_parser.php
index 9382497..7b59d8f 100644
--- a/order_of_operations_parser.php
+++ b/order_of_operations_parser.php
@@ -184,7 +184,7 @@ for (i=0;i<=$numRecords;i++)
//**********************************************COMPOUND EQUATIONS*********************************
// can simply not use regexp but replace with a literal reg expression
- if(preg_match("+", $equation) && (preg_match("-", $equation) || preg_match("\/", $equation) || preg_match("*", $equation)))
+ if(preg_match("/\+/", $equation) && (preg_match("/[0-9]\-[0-9]/", $equation) || preg_match("/\//", $equation) || preg_match("/\*/", $equation)))
{
$compound[tok[0]]++; //NOTE compound_incorrect is implicit
@@ -193,7 +193,7 @@ for (i=0;i<=$numRecords;i++)
$compound_correct[tok[0]]++;
}
}
- elseif( (preg_match("-", $equation)) && (preg_match("+", $equation) || preg_match("\/", $equation) || preg_match("*", $equation)))
+ elseif( (preg_match("/[0-9]\-[0-9]/", $equation)) && (preg_match("/\+/", $equation) || preg_match("/\//", $equation) || preg_match("/\*/", $equation)))
{
$compound[tok[0]]++;
if ($tok[3] = "1") //if correct
@@ -202,7 +202,7 @@ for (i=0;i<=$numRecords;i++)
}
}
- elseif(preg_match($"\/", $equation) && (preg_match("+", $equation) || preg_match("-", $equation) || preg_match("*", $equation)))
+ elseif(preg_match($"/\//", $equation) && (preg_match("/\+/", $equation) || preg_match("/[0-9]\-[0-9]/", $equation) || preg_match("/\*/", $equation)))
{
$compound[tok[0]]++;
if ($tok[3] = "1") //if correct
@@ -210,7 +210,7 @@ for (i=0;i<=$numRecords;i++)
$compound_correct[tok[0]]++;
}
}
- elseif( (preg_match($"*", $equation)) && (preg_match("+", $equation) || preg_match("-", $equation) || preg_match("\/", $equation)))
+ elseif( (preg_match($"/\*/", $equation)) && (preg_match("/\+/", $equation) || preg_match("/[0-9]\-[0-9]/", $equation) || preg_match("/\//", $equation)))
{
$compound[tok[0]]++;
if ($tok[3] = "1") //if correct
@@ -224,7 +224,7 @@ for (i=0;i<=$numRecords;i++)
$non_compound[tok[0]++;
if ($tok[3] = "1") //if correct
{
- $compound_correct[tok[0]]++;
+ $non_compound_correct[tok[0]]++;
}
}