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-01 18:59:20 (GMT)
committer WWDillingham WesleyDillingham <wwdillingham@sugarlabs.org>2009-07-01 18:59:20 (GMT)
commit5e2cb199896d04c3634f6449c13190be11653c7b (patch)
treed02e0135b74bad932d5bf7cd7fb5b0d2595f031e
parente22b74cec4a393fce7945cb31fa3327c0e1a7047 (diff)
accounting for compound[] and compound_correct[]
-rw-r--r--order_of_operations_parser.php35
1 files changed, 27 insertions, 8 deletions
diff --git a/order_of_operations_parser.php b/order_of_operations_parser.php
index d2d5e54..519b695 100644
--- a/order_of_operations_parser.php
+++ b/order_of_operations_parser.php
@@ -180,28 +180,47 @@ for (i=0;i<=$numRecords;i++)
// 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)))
+ {
+
+ $compound[tok[0]]++; //NOTE compound_incorrect is implicit
+ if ($tok[3] = "1") //if correct
{
-
- if ($tok[3] = "1") //is it also correct? put it in a different associative array with the same key
- {
- $compound_correct[tok[0]]++;
- }
+ $compound_correct[tok[0]]++;
}
+ }
elseif( (preg_match("-", $equation)) && (preg_match("+", $equation) || preg_match("\/", $equation) || preg_match("*", $equation)))
+ {
+ $compound[tok[0]]++;
+ if ($tok[3] = "1") //if correct
{
-
+ $compound_correct[tok[0]]++;
}
+
+ }
elseif(preg_match($"\/", $equation) && (preg_match("+", $equation) || preg_match("-", $equation) || preg_match("*", $equation)))
+ {
+ $compound[tok[0]]++;
+ if ($tok[3] = "1") //if correct
{
-
+ $compound_correct[tok[0]]++;
}
+ }
elseif( (preg_match($"*", $equation)) && (preg_match("+", $equation) || preg_match("-", $equation) || preg_match("\/", $equation)))
+ {
+ $compound[tok[0]]++;
+ if ($tok[3] = "1") //if correct
{
-
+ $compound_correct[tok[0]]++;
}
+
+ }
else
{
$non_compound[tok[0]++;
+ if ($tok[3] = "1") //if correct
+ {
+ $compound_correct[tok[0]]++;
+ }
}