add: str=result[1]; AMremoveBrackets(node); node=AMcreateMmlNode(_2e.tag,node); node.appendChild(result[0]); newFrag.appendChild(node); _2e=AMgetSymbol(str); }else{ if(node!=undefined){ newFrag.appendChild(node); } } }while((_2e.ttype!=RIGHTBRACKET&&(_2e.ttype!=LEFTRIGHT||_2d)||AMnestingDepth==0)&&_2e!=null&&_2e.output!=""); if(_2e.ttype==RIGHTBRACKET||_2e.ttype==LEFTRIGHT){ var len=newFrag.childNodes.length; if(len>0&&newFrag.childNodes[len-1].nodeName=="mrow"&&len>1&&newFrag.childNodes[len-2].nodeName=="mo"&&newFrag.childNodes[len-2].firstChild.nodeValue==","){ var _30=newFrag.childNodes[len-1].lastChild.firstChild.nodeValue; if(_30==")"||_30=="]"){ var _31=newFrag.childNodes[len-1].firstChild.firstChild.nodeValue; if(_31=="("&&_30==")"&&_2e.output!="}"||_31=="["&&_30=="]"){ var pos=[]; var _33=true; var m=newFrag.childNodes.length; for(i=0;_33&&i<m;i=i+2){ pos[i]=[]; node=newFrag.childNodes[i]; if(_33){ _33=node.nodeName=="mrow"&&(i==m-1||node.nextSibling.nodeName=="mo"&&node.nextSibling.firstChild.nodeValue==",")&&node.firstChild.firstChild.nodeValue==_31&&node.lastChild.firstChild.nodeValue==_30; } if(_33){ for(var j=0;j<node.childNodes.length;j++){ if(node.childNodes[j].firstChild.nodeValue==","){ pos[i][pos[i].length]=j; } } } if(_33&&i>1){ _33=pos[i].length==pos[i-2].length; } } if(_33){ var row,frag,n,k,table=document.createDocumentFragment(); for(i=0;i<m;i=i+2){ row=document.createDocumentFragment(); frag=document.createDocumentFragment(); node=newFrag.firstChild; n=node.childNodes.length; k=0; node.removeChild(node.firstChild); for(j=1;j<n-1;j++){ if(typeof pos[i][k]!="undefined"&&j==pos[i][k]){ node.removeChild(node.firstChild); row.appendChild(AMcreateMmlNode("mtd",frag)); k++; }else{ frag.appendChild(node.firstChild); } } row.appendChild(AMcreateMmlNode("mtd",frag)); if(newFrag.childNodes.length>2){ newFrag.removeChild(newFrag.firstChild); newFrag.removeChild(newFrag.firstChild); } table.appendChild(AMcreateMmlNode("mtr",row)); } node=AMcreateMmlNode("mtable",table); if(typeof _2e.invisible=="boolean"&&_2e.invisible){ node.setAttribute("columnalign","left"); } newFrag.replaceChild(node,newFrag.firstChild); } } } } str=AMremoveCharsAndBlanks(str,_2e.input.length); if(typeof _2e.invisible!="boolean"||!_2e.invisible){ node=AMcreateMmlNode("mo",document.createTextNode(_2e.output)); newFrag.appendChild(node); } } return [newFrag,str]; } 
context: function AMparseExpr(str,rightbracket) {  var symbol, node, result, i, nodeList = [],  newFrag = document.createDocumentFragment();  do {    str = AMremoveCharsAndBlanks(str,0);    result = AMparseIexpr(str);    node = result[0];    str = result[1];    symbol = AMgetSymbol(str);    if (symbol.ttype == INFIX && symbol.input == "/") {      str = AMremoveCharsAndBlanks(str,symbol.input.length);      result = AMparseIexpr(str);      if (result[0] == null) // show box in place of missing argument        result[0] = AMcreateMmlNode("mo",document.createTextNode("\u25A1"));      else AMremoveBrackets(result[0]);      str = result[1];      AMremoveBrackets(node);      node = AMcreateMmlNode(symbol.tag,node);      node.appendChild(result[0]);      newFrag.appendChild(node);      symbol = AMgetSymbol(str);    }     else if (node!=undefined) newFrag.appendChild(node);  } while ((symbol.ttype != RIGHTBRACKET &&            (symbol.ttype != LEFTRIGHT || rightbracket)           || AMnestingDepth == 0) && symbol!=null && symbol.output!="");  if (symbol.ttype == RIGHTBRACKET || symbol.ttype == LEFTRIGHT) {//    if (AMnestingDepth > 0) AMnestingDepth--;    var len = newFrag.childNodes.length;    if (len>0 && newFrag.childNodes[len-1].nodeName == "mrow" && len>1 &&      newFrag.childNodes[len-2].nodeName == "mo" &&      newFrag.childNodes[len-2].firstChild.nodeValue == ",") { //matrix      var right = newFrag.childNodes[len-1].lastChild.firstChild.nodeValue;      if (right==")" || right=="]") {        var left = newFrag.childNodes[len-1].firstChild.firstChild.nodeValue;        if (left=="(" && right==")" && symbol.output != "}" ||             left=="[" && right=="]") {        var pos = []; // positions of commas        var matrix = true;        var m = newFrag.childNodes.length;        for (i=0; matrix && i<m; i=i+2) {          pos[i] = [];          node = newFrag.childNodes[i];          if (matrix) matrix = node.nodeName=="mrow" &&             (i==m-1 || node.nextSibling.nodeName=="mo" &&             node.nextSibling.firstChild.nodeValue==",")&&            node.firstChild.firstChild.nodeValue==left &&            node.lastChild.firstChild.nodeValue==right;          if (matrix)             for (var j=0; j<node.childNodes.length; j++)              if (node.childNodes[j].firstChild.nodeValue==",")                pos[i][pos[i].length]=j;          if (matrix && i>1) matrix = pos[i].length == pos[i-2].length;        }        if (matrix) {          var row, frag, n, k, table = document.createDocumentFragment();          for (i=0; i<m; i=i+2) {            row = document.createDocumentFragment();            frag = document.createDocumentFragment();            node = newFrag.firstChild; // <mrow>(-,-,...,-,-)</mrow>            n = node.childNodes.length;            k = 0;            node.removeChild(node.firstChild); //remove (            for (j=1; j<n-1; j++) {              if (typeof pos[i][k] != "undefined" && j==pos[i][k]){                node.removeChild(node.firstChild); //remove ,                row.appendChild(AMcreateMmlNode("mtd",frag));                k++;              } else frag.appendChild(node.firstChild);            }            row.appendChild(AMcreateMmlNode("mtd",frag));            if (newFrag.childNodes.length>2) {              newFrag.removeChild(newFrag.firstChild); //remove <mrow>)</mrow>              newFrag.removeChild(newFrag.firstChild); //remove <mo>,</mo>            }            table.appendChild(AMcreateMmlNode("mtr",row));          }          node = AMcreateMmlNode("mtable",table);          if (typeof symbol.invisible == "boolean" && symbol.invisible) node.setAttribute("columnalign","left");          newFrag.replaceChild(node,newFrag.firstChild);        }       }      }    }    str = AMremoveCharsAndBlanks(str,symbol.input.length);    if (typeof symbol.invisible != "boolean" || !symbol.invisible) {      node = AMcreateMmlNode("mo",document.createTextNode(symbol.output));      newFrag.appendChild(node);    }  }  return [newFrag,str];}
meta: 6015	/local1/tlutelli/issta_data/temp/all_js/javascript/2007_temp/2007/6015/d8776708e0e10dfa0ab6ee1d0fa9e512d8d16348/ASCIIMathML.js/clean/packages/acs-templating/www/resources/xinha-nightly/plugins/Equation/ASCIIMathML.js