]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/DEVEL/mathml_editor/src/TPushParser.cc
* changed handling of ' (\primes) with a few patches in the stylesheets
[helm.git] / helm / DEVEL / mathml_editor / src / TPushParser.cc
index ad439908c66a036dd5d0767901ace9c8ba39b477..4c36b026581ed3f93b133dd013e4dbdb310234ed 100644 (file)
@@ -36,12 +36,21 @@ TPushParser::reset()
   if (factory) factory->documentModified(doc);
 }
 
-std::string
-TPushParser::PRIME() const
+TNode
+TPushParser::PRIME()
 {
   const TDictionary::Entry entry = dictionary.find("prime");
-  if (entry.cls == TDictionary::OPERATOR) return entry.value;
-  else return "?";
+  if (entry.cls == TDictionary::OPERATOR)
+    {
+      TNode op = doc.createO(entry.value, nextId++);
+      op["name"] = "prime";
+      return op;
+    }
+  else
+    {
+      TNode op = doc.createO("?", nextId++);
+      return op;
+    }
 }
 
 bool
@@ -433,7 +442,7 @@ bool
 TPushParser::isPrimes(const TNode& node) const
 {
   assert(node);
-  return node.isG() && node.last() && node.last().is("o") && node.last()["val"] == PRIME();
+  return node.isG() && node.last() && node.last().is("o") && node.last()["name"] == "prime";
 }
 
 bool
@@ -445,14 +454,14 @@ TPushParser::do_apostrophe()
        {
          if (prev.isSp() && prev[1] && isPrimes(prev[1]))
            {
-             prev[1].append(doc.createO(PRIME(), nextId++));
+             prev[1].append(PRIME());
              return true;
            }
          else if (prev.isSb() && prev[0] &&
                   prev[0].isSp() && prev[0][1] &&
                   isPrimes(prev[0][1]))
            {
-             prev[0][1].append(doc.createO(PRIME(), nextId++));
+             prev[0][1].append(PRIME());
              return true;
            }
          else
@@ -462,7 +471,7 @@ TPushParser::do_apostrophe()
              prev.replace(elem);
              elem.append(prev);
              elem.append(g);
-             g.append(doc.createO(PRIME(), nextId++));
+             g.append(PRIME());
              return true;
            }
        }