[hmath-commits] org.hartmath.tex2mml/src/org/hartmath/tex2mml IRowMMLConverter.java,NONE,1.1 IRowCSS
Status: Pre-Alpha
Brought to you by:
jsurfer
|
From: Klaus H. <js...@us...> - 2004-03-19 20:29:14
|
Update of /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23782/src/org/hartmath/tex2mml Modified Files: TeXParser.java Text.java Identifier.java Node.java Scanner.java Row.java TeX2MathMLFactory.java Operator.java Number.java Added Files: IRowMMLConverter.java IRowCSSConverter.java Removed Files: IRowConverter.java Log Message: misc changes Index: Operator.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Operator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Operator.java 12 Mar 2004 20:47:10 -0000 1.2 --- Operator.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 50,54 **** } ! public void convert2CSS(TeX2MathMLFactory f,StringBuffer buf) { buf.append(fOperator.toString()); } --- 50,54 ---- } ! public void convert2CSS(StringBuffer buf,boolean noTags) { buf.append(fOperator.toString()); } Index: Text.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Text.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Text.java 12 Mar 2004 20:47:10 -0000 1.2 --- Text.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 20,24 **** } ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { buf.append(fOutput); } --- 20,24 ---- } ! public void convert2CSS(StringBuffer buf, boolean noTags) { buf.append(fOutput); } --- NEW FILE: IRowCSSConverter.java --- package org.hartmath.tex2mml; public interface IRowCSSConverter { public boolean convert(StringBuffer buffer, Row row); } --- NEW FILE: IRowMMLConverter.java --- package org.hartmath.tex2mml; public interface IRowMMLConverter { public boolean convert(StringBuffer buffer, Row row, TeX2MathMLFactory f); } --- IRowConverter.java DELETED --- Index: Identifier.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Identifier.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Identifier.java 12 Mar 2004 20:47:10 -0000 1.2 --- Identifier.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 20,24 **** } ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { buf.append(fOutput); } --- 20,24 ---- } ! public void convert2CSS(StringBuffer buf, boolean noTags) { buf.append(fOutput); } Index: Node.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Node.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Node.java 12 Mar 2004 20:47:10 -0000 1.2 --- Node.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 37,44 **** } ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { buf.append(fOutput); } /* * (non-Javadoc) --- 37,47 ---- } ! public void convert2CSS(StringBuffer buf, boolean noTags) { buf.append(fOutput); } + public void convert2CSS(StringBuffer buf) { + convert2CSS(buf, false); + } /* * (non-Javadoc) Index: Scanner.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Scanner.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Scanner.java 12 Mar 2004 20:47:10 -0000 1.2 --- Scanner.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 14,17 **** --- 14,18 ---- protected String fOperatorString; + protected String fBackslashSymbol; // row counter for syntax errors: *************** *** 52,55 **** --- 53,63 ---- final static public int TT_OPERATOR = 55; + final static public int TT_DOUBLE_BACKSLASH = 56; + final static public int TT_AMPERSAND = 57; + + final static public int TT_BEGIN = 60; + final static public int TT_END = 61; + final static public int TT_LEFT = 62; + final static public int TT_RIGHT = 63; final static public int TT_ARGUMENTS_OPEN = 126; *************** *** 161,223 **** return; } - // if (ch == '/') { - // if (str.length() > chIndx) { - // if (str.charAt(chIndx) == '/') { - // chIndx++; - // // read comment until end of line: - // while ((str.length() > chIndx) && (str.charAt(chIndx) != '\n')) { - // chIndx++; - // } - // if (str.length() > chIndx) { - // chIndx++; - // } - // continue; - // } - // } - // } - switch (fChar) { case '(' : token = TT_PRECEDENCE_OPEN; - break; case ')' : token = TT_PRECEDENCE_CLOSE; - break; case '{' : token = TT_LIST_OPEN; - break; case '}' : token = TT_LIST_CLOSE; - break; case '[' : token = TT_ARGUMENTS_OPEN; - if (fSourceString.length() > fCurrentPosition) { - if (fSourceString.charAt(fCurrentPosition) == '[') { - fCurrentPosition++; - token = TT_PARTOPEN; - break; - } - } break; case ']' : token = TT_ARGUMENTS_CLOSE; - // if (partCloseExpected) { - // if (str.length() > chIndx) { - // if (str.charAt(chIndx) == ']') { - // chIndx++; - // token = TT_PARTCLOSE; - // break; - // } - // } - // } break; case ',' : ! token = TT_COMMA; ! break; case '!' : --- 169,195 ---- return; } switch (fChar) { case '(' : token = TT_PRECEDENCE_OPEN; break; case ')' : token = TT_PRECEDENCE_CLOSE; break; case '{' : token = TT_LIST_OPEN; break; case '}' : token = TT_LIST_CLOSE; break; case '[' : token = TT_ARGUMENTS_OPEN; break; case ']' : token = TT_ARGUMENTS_CLOSE; break; case ',' : ! token = TT_OPERATOR; ! fOperatorString = ","; break; case '!' : *************** *** 228,257 **** token = TT_OPERATOR; fOperatorString = "_"; - // token = TT_BLANK; - break; case '.' : ! token = TT_DOT; ! if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition) >= '0' && fSourceString.charAt(fCurrentPosition) <= '9') { ! // don't increment chIndx (see getNumberString()) ! // chIndx++; ! token = TT_DIGIT; // floating-point number ! break; ! } ! } ! break; case '"' : ! token = TT_STRING; ! break; case '%' : ! token = TT_PERCENT; ! break; case ';' : ! token = TT_SEMICOLON; ! break; case '\\' : --- 200,219 ---- token = TT_OPERATOR; fOperatorString = "_"; break; case '.' : ! token = TT_OPERATOR; ! fOperatorString = "."; break; case '"' : ! token = TT_OPERATOR; ! fOperatorString = "\""; break; case '%' : ! token = TT_OPERATOR; ! fOperatorString = "%"; break; case ';' : ! token = TT_OPERATOR; ! fOperatorString = ";"; break; case '\\' : *************** *** 260,264 **** if ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z')) { fCurrentPosition++; ! token = TT_BACKSLASH_SYMBOL; return; } --- 222,231 ---- if ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z')) { fCurrentPosition++; ! getBackslashSymbol(); ! return; ! } ! if (fChar == '\\') { ! fCurrentPosition++; ! token = TT_DOUBLE_BACKSLASH; return; } *************** *** 268,320 **** token = TT_OPERATOR; fOperatorString = "^"; - // - // if (fSourceString.length() > fCurrentPosition) { - // fChar = fSourceString.charAt(fCurrentPosition); - // - // if (fChar == '=') { - // fCurrentPosition++; - // token = TT_UPSET; - // - // break; - // } - // if (fChar == ':') { - // fCurrentPosition++; - // - // if (fSourceString.length() > fCurrentPosition) { - // fChar = fSourceString.charAt(fCurrentPosition); - // - // if (fChar == '=') { - // fCurrentPosition++; - // token = TT_UPSETDELAYED; - // - // break; - // } - // } - // } - // } - break; case '/' : token = TT_OPERATOR; fOperatorString = "/"; - // if (fSourceString.length() > fCurrentPosition) { - // if (fSourceString.charAt(fCurrentPosition) == '.') { - // fCurrentPosition++; - // token = TT_REPLACEALL; - // - // break; - // } - // if (fSourceString.charAt(fCurrentPosition) == '=') { - // fCurrentPosition++; - // token = TT_DIVIDEBY; - // - // break; - // } - // } - break; case '*' : token = TT_OPERATOR; - fOperatorString = "*"; if (fSourceString.length() > fCurrentPosition) { if (fSourceString.charAt(fCurrentPosition) == '*') { --- 235,245 ---- *************** *** 323,435 **** break; } - // if (fSourceString.charAt(fCurrentPosition) == '=') { - // fCurrentPosition++; - // token = TT_TIMESBY; - // - // break; - // } } ! break; case '+' : token = TT_OPERATOR; fOperatorString = "+"; - // if (fSourceString.length() > fCurrentPosition) { - // if (fSourceString.charAt(fCurrentPosition) == '+') { - // fCurrentPosition++; - // token = TT_INCREMENT; - // - // break; - // } - // if (fSourceString.charAt(fCurrentPosition) == '=') { - // fCurrentPosition++; - // token = TT_ADDTO; - // - // break; - // } - // } break; case '-' : token = TT_OPERATOR; fOperatorString = "-"; - // if (fSourceString.length() > fCurrentPosition) { - // if (fSourceString.charAt(fCurrentPosition) == '>') { - // fCurrentPosition++; - // token = TT_RULE; - // - // break; - // } - // if (fSourceString.charAt(fCurrentPosition) == '-') { - // fCurrentPosition++; - // token = TT_DECREMENT; - // - // break; - // } - // if (fSourceString.charAt(fCurrentPosition) == '=') { - // fCurrentPosition++; - // token = TT_SUBTRACTFROM; - // - // break; - // } - // } - break; case '=' : token = TT_OPERATOR; fOperatorString = "="; - // if (fSourceString.length() > fCurrentPosition) { - // fChar = fSourceString.charAt(fCurrentPosition); - // - // if (fChar == '=') { - // fCurrentPosition++; - // token = TT_EQUAL; - // - // break; - // } - // } - break; case '>' : token = TT_OPERATOR; ! fOperatorString = ">"; ! // token = TT_GREATER; ! // ! // if (fSourceString.length() > fCurrentPosition) { ! // if (fSourceString.charAt(fCurrentPosition) == '=') { ! // fCurrentPosition++; ! // token = TT_GREATEREQUAL; ! // ! // break; ! // } ! // } break; case '<' : token = TT_OPERATOR; - fOperatorString = "<"; - // token = TT_LESS; - // - // if (fSourceString.length() > fCurrentPosition) { - // if (fSourceString.charAt(fCurrentPosition) == '=') { - // fCurrentPosition++; - // token = TT_LESSEQUAL; - // - // break; - // } - // } - - break; - case '&' : - token = TT_PUREFUNCTION; if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition) == '&') { fCurrentPosition++; ! token = TT_AND; ! break; } } ! break; case '|' : --- 248,293 ---- break; } } ! fOperatorString = "*"; break; case '+' : token = TT_OPERATOR; fOperatorString = "+"; break; case '-' : token = TT_OPERATOR; fOperatorString = "-"; break; case '=' : token = TT_OPERATOR; fOperatorString = "="; break; case '>' : token = TT_OPERATOR; ! if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition) == '=') { ! fCurrentPosition++; ! fOperatorString = "geq"; ! break; ! } ! } + fOperatorString = ">"; break; case '<' : token = TT_OPERATOR; if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition) == '=') { fCurrentPosition++; ! fOperatorString = "leq"; break; } } ! fOperatorString = "<"; ! break; ! case '&' : ! token = TT_AMPERSAND; ! fOperatorString = "&"; break; case '|' : *************** *** 439,478 **** case ':' : ! if (fSourceString.length() > fCurrentPosition) { ! if (fSourceString.charAt(fCurrentPosition) == '=') { ! fCurrentPosition++; ! token = TT_SETDELAYED; ! ! break; ! } ! if (fSourceString.charAt(fCurrentPosition) == '>') { ! fCurrentPosition++; ! token = TT_RULEDELAYED; ! ! break; ! } ! } ! break; - case '#' : - token = TT_SLOT; - if (fSourceString.length() > fCurrentPosition) { - if (fSourceString.charAt(fCurrentPosition) == '#') { - fCurrentPosition++; - token = TT_SLOTSEQUENCE; - - break; - } - } - break; default : token = TT_CHARACTER; } - // if (token == TT_EOF) { - // throwSyntaxError("token not found"); - // } - return; } --- 297,309 ---- case ':' : ! token = TT_OPERATOR; ! fOperatorString = ":"; break; default : token = TT_CHARACTER; + fOperatorString = String.valueOf(fChar); } return; } *************** *** 484,504 **** } - // protected void throwSyntaxError(String error) { - // - // if (fSourceString.length() < fCurrentPosition) { - // fCurrentPosition--; - // } - // // read until end-of-line - // int eol = fCurrentPosition; - // while (fSourceString.length() > eol) { - // fChar = fSourceString.charAt(eol++); - // if (fChar == '\n') { - // eol--; - // break; - // } - // } - // throw new SyntaxError(rowCount, fCurrentPosition - columnCount, fSourceString.substring(columnCount, eol), error); - // } - public String getIdentifier() { int startPosition = fCurrentPosition - 1; --- 315,318 ---- *************** *** 507,513 **** // special identifiers beginning with "$$" are JSP/servlet specific variables !!! // see org.hmath.servlet.HMTag ! if (fChar == '$') { ! getChar(); ! } while ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z') || (fChar >= '0' && fChar <= '9')) { getChar(); --- 321,327 ---- // special identifiers beginning with "$$" are JSP/servlet specific variables !!! // see org.hmath.servlet.HMTag ! //if (fChar == '$') { ! // getChar(); ! //} while ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z') || (fChar >= '0' && fChar <= '9')) { getChar(); *************** *** 525,535 **** public String getBackslashSymbol() { int startPosition = fCurrentPosition - 1; - getChar(); // special identifiers beginning with "$$" are JSP/servlet specific variables !!! // see org.hmath.servlet.HMTag ! if (fChar == '$') { ! getChar(); ! } while ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z') || (fChar >= '0' && fChar <= '9')) { getChar(); --- 339,348 ---- public String getBackslashSymbol() { int startPosition = fCurrentPosition - 1; getChar(); // special identifiers beginning with "$$" are JSP/servlet specific variables !!! // see org.hmath.servlet.HMTag ! // if (fChar == '$') { ! // getChar(); ! // } while ((fChar >= 'a' && fChar <= 'z') || (fChar >= 'A' && fChar <= 'Z') || (fChar >= '0' && fChar <= '9')) { getChar(); *************** *** 538,546 **** int endPosition = fCurrentPosition--; int length = (--endPosition) - startPosition; ! if (length == 1) { ! return optimizedCurrentTokenSource1(startPosition, endPosition); ! } ! ! return fSourceString.substring(startPosition, endPosition); } --- 351,402 ---- int endPosition = fCurrentPosition--; int length = (--endPosition) - startPosition; ! // if (length == 1) { ! // return optimizedCurrentTokenSource1(startPosition, endPosition); ! // } ! // set default token: ! token = TT_BACKSLASH_SYMBOL; ! fBackslashSymbol = fSourceString.substring(startPosition, endPosition); ! if (fBackslashSymbol.length()>=3 && fBackslashSymbol.length()<=5) { ! int index = startPosition; ! switch(fBackslashSymbol.length()){ ! case 3: // \end ! if (fSourceString.charAt(index)=='e' && ! fSourceString.charAt(++index)=='n' && ! fSourceString.charAt(++index)=='d') { ! token = TT_END; ! return fBackslashSymbol; ! } ! break; ! case 4: // \left ! if (fSourceString.charAt(index)=='l' && ! fSourceString.charAt(++index)=='e' && ! fSourceString.charAt(++index)=='f' && ! fSourceString.charAt(++index)=='t') { ! token = TT_LEFT; ! return fBackslashSymbol; ! } ! break; ! case 5: // \begin \right ! if (fSourceString.charAt(index)=='b' && ! fSourceString.charAt(++index)=='e' && ! fSourceString.charAt(++index)=='g' && ! fSourceString.charAt(++index)=='i' && ! fSourceString.charAt(++index)=='n') { ! token = TT_BEGIN; ! return fBackslashSymbol; ! } ! index = startPosition; ! if (fSourceString.charAt(index)=='r' && ! fSourceString.charAt(++index)=='i' && ! fSourceString.charAt(++index)=='g' && ! fSourceString.charAt(++index)=='h' && ! fSourceString.charAt(++index)=='t') { ! token = TT_RIGHT; ! return fBackslashSymbol; ! } ! break; ! } ! } ! return fBackslashSymbol; } *************** *** 618,663 **** } getChar(); - // if (firstCh == '0') { - // switch (ch) { - // case 'b' : - // numFormat = 2; - // startPosition = chIndx; - // getChar(); - // break; - // case 'B' : - // numFormat = 2; - // startPosition = chIndx; - // getChar(); - // break; - // case 'o' : - // numFormat = 8; - // startPosition = chIndx; - // getChar(); - // break; - // case 'O' : - // numFormat = 8; - // startPosition = chIndx; - // getChar(); - // break; - // case 'x' : - // numFormat = 16; - // startPosition = chIndx; - // getChar(); - // break; - // case 'X' : - // numFormat = 16; - // startPosition = chIndx; - // getChar(); - // break; - // } - // } - - // if (numFormat == 16) { - // while ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) { - // getChar(); - // } - // } else { - // while ((ch >= '0' && ch <= '9') || (ch == '.') || (ch == 'E') || (ch == 'e')) { while ((fChar >= '0' && fChar <= '9') || (fChar == '.')) { // if ((ch == '.') || (ch == 'E') || (ch == 'e')) { --- 474,478 ---- *************** *** 687,737 **** } - /** - * Method Declaration. - * - */ - // public StringBuffer getStringBuffer() { - // StringBuffer ident = new StringBuffer(); - // - // getChar(); - // - // if ((fChar == '\n') || (token == TT_EOF)) { - // throwSyntaxError("string -" + ident.toString() + "- contains no character."); - // } - // - // while (fChar != '"') { - // if ((fChar == '\\')) { - // getChar(); - // - // switch (fChar) { - // - // case '\\' : - // ident.append(fChar); - // - // break; - // case 'n' : - // ident.append("\n"); - // - // break; - // case 't' : - // ident.append("\t"); - // - // break; - // default : - // throwSyntaxError("string - unknown character after back-slash."); - // } - // - // getChar(); - // } else { - // if ((fChar != '"') && ((fChar == '\n') || (token == TT_EOF))) { - // throwSyntaxError("string -" + ident.toString() + "- not closed."); - // } - // - // ident.append(fChar); - // getChar(); - // } - // } - // - // return ident; - // } } --- 502,504 ---- Index: TeXParser.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeXParser.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TeXParser.java 12 Mar 2004 20:47:10 -0000 1.3 --- TeXParser.java 19 Mar 2004 20:19:03 -0000 1.4 *************** *** 178,186 **** getNextToken(); return MML_FACTORY.getIdentifier(str); case TT_BACKSLASH_SYMBOL : ! str = getBackslashSymbol(); getNextToken(); temp = createOperationNode(str, stack); return temp; } return null; --- 178,218 ---- getNextToken(); return MML_FACTORY.getIdentifier(str); + case TT_AMPERSAND : + case TT_CHARACTER : + str = fOperatorString; + getNextToken(); + return MML_FACTORY.getText(str); case TT_BACKSLASH_SYMBOL : ! str = fBackslashSymbol; getNextToken(); temp = createOperationNode(str, stack); return temp; + case TT_BEGIN : + getNextToken(); + return getBegin(); + case TT_LEFT : + getNextToken(); + if (token == TT_LIST_OPEN) { + getNextToken(); + return new Operator("{"); + } else if (token == TT_PRECEDENCE_OPEN) { + getNextToken(); + return new Operator("("); + } else if (token == TT_ARGUMENTS_OPEN) { + getNextToken(); + return new Operator("["); + } + case TT_RIGHT : + getNextToken(); + if (token == TT_LIST_CLOSE) { + getNextToken(); + return new Operator("}"); + } else if (token == TT_PRECEDENCE_CLOSE) { + getNextToken(); + return new Operator(")"); + } else if (token == TT_ARGUMENTS_CLOSE) { + getNextToken(); + return new Operator("]"); + } } return null; *************** *** 231,234 **** } } ! } \ No newline at end of file --- 263,358 ---- } } ! ! private Node getBegin() { ! if (token==TT_LIST_OPEN) { ! getNextToken(); ! } ! String str; ! if (token==TT_IDENTIFIER) { ! str = getIdentifier(); ! getNextToken(); ! if (! str.equals("array")) { ! if (token==TT_LIST_CLOSE) { ! getNextToken(); ! } ! return null; ! } ! } ! if (token==TT_LIST_CLOSE) { ! getNextToken(); ! } ! if (token==TT_LIST_OPEN) { ! getNextToken(); ! } ! int numColumns = 0; ! if (token==TT_IDENTIFIER) { ! str = getIdentifier(); ! numColumns = str.length(); ! getNextToken(); ! } ! if (token==TT_LIST_CLOSE) { ! getNextToken(); ! } ! return createArray(numColumns); ! } ! ! private void getEnd() { ! if (token==TT_LIST_OPEN) { ! getNextToken(); ! } ! if (token==TT_IDENTIFIER) { ! String str = getIdentifier(); ! getNextToken(); ! } ! if (token==TT_LIST_CLOSE) { ! getNextToken(); ! } ! } ! ! public Node createArray(int numColumns) { ! Row rowList; ! if (numColumns==1) { ! rowList = MML_FACTORY.getRow("vector"); ! } else { ! rowList = MML_FACTORY.getRow("matrix"); ! } ! Row list = null; ! Node node1 = null; ! Node node2 = null; ! ! Row colList; ! if (numColumns==1) { ! colList = MML_FACTORY.getRow("vectorrow"); ! } else { ! colList = MML_FACTORY.getRow("matrixrow"); ! } ! while (token != TT_END && token != TT_EOF) { ! if (token!=TT_DOUBLE_BACKSLASH&&token!=TT_AMPERSAND) { ! node1 = createNextNode(null); ! if (node1 != null) { ! colList.add(node1); ! } ! } ! if (token==TT_AMPERSAND) { ! getNextToken(); ! } ! if (token==TT_DOUBLE_BACKSLASH) { ! rowList.add(colList); ! if (numColumns==1) { ! colList = MML_FACTORY.getRow("vectorrow"); ! } else { ! colList = MML_FACTORY.getRow("matrixrow"); ! } ! getNextToken(); ! } ! } ! if (token == TT_END) { ! if (colList.size()!=0) { ! rowList.add(colList); ! } ! getNextToken(); ! getEnd(); ! } ! return rowList; ! } } \ No newline at end of file Index: Number.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Number.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Number.java 12 Mar 2004 20:47:10 -0000 1.2 --- Number.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 20,24 **** } ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) { buf.append(fOutput); --- 20,24 ---- } ! public void convert2CSS(StringBuffer buf, boolean noTags) { buf.append(fOutput); Index: Row.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/Row.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Row.java 12 Mar 2004 20:47:10 -0000 1.2 --- Row.java 19 Mar 2004 20:19:03 -0000 1.3 *************** *** 13,17 **** final public static String CSS_CONVERTER_PACKAGE_NAME = "org.hartmath.tex2css.reflection.convert."; final public static HashMap CSS_CONVERTER = new HashMap(199); ! ArrayList fList; int fType; --- 13,17 ---- final public static String CSS_CONVERTER_PACKAGE_NAME = "org.hartmath.tex2css.reflection.convert."; final public static HashMap CSS_CONVERTER = new HashMap(199); ! ArrayList fList; int fType; *************** *** 36,43 **** } ! public static IRowConverter getMMLConverter(String symbol) { Object temp; if ((temp = MML_CONVERTER.get(symbol)) != null) { ! return (IRowConverter) temp; } if (symbol.length() == 0 || MML_CONVERTER.containsKey(symbol)) { --- 36,43 ---- } ! public static IRowMMLConverter getMMLConverter(String symbol) { Object temp; if ((temp = MML_CONVERTER.get(symbol)) != null) { ! return (IRowMMLConverter) temp; } if (symbol.length() == 0 || MML_CONVERTER.containsKey(symbol)) { *************** *** 62,68 **** } ! IRowConverter module; try { ! module = (IRowConverter) clazz.newInstance(); MML_CONVERTER.put(symbol, module); return module; --- 62,68 ---- } ! IRowMMLConverter module; try { ! module = (IRowMMLConverter) clazz.newInstance(); MML_CONVERTER.put(symbol, module); return module; *************** *** 75,79 **** public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { ! IRowConverter converter = getMMLConverter(fTeXSymbol); if (converter != null && converter.convert(buf, this, f)) { --- 75,79 ---- public void convert2MML(TeX2MathMLFactory f, StringBuffer buf) { ! IRowMMLConverter converter = getMMLConverter(fTeXSymbol); if (converter != null && converter.convert(buf, this, f)) { *************** *** 88,95 **** } ! public static IRowConverter getCSSConverter(String symbol) { Object temp; if ((temp = CSS_CONVERTER.get(symbol)) != null) { ! return (IRowConverter) temp; } if (symbol.length() == 0 || CSS_CONVERTER.containsKey(symbol)) { --- 88,95 ---- } ! public static IRowCSSConverter getCSSConverter(String symbol) { Object temp; if ((temp = CSS_CONVERTER.get(symbol)) != null) { ! return (IRowCSSConverter) temp; } if (symbol.length() == 0 || CSS_CONVERTER.containsKey(symbol)) { *************** *** 114,120 **** } ! IRowConverter module; try { ! module = (IRowConverter) clazz.newInstance(); CSS_CONVERTER.put(symbol, module); return module; --- 114,120 ---- } ! IRowCSSConverter module; try { ! module = (IRowCSSConverter) clazz.newInstance(); CSS_CONVERTER.put(symbol, module); return module; *************** *** 125,141 **** } ! public void convert2CSS(TeX2MathMLFactory f, StringBuffer buf) ! { ! IRowConverter converter = getCSSConverter(fTeXSymbol); ! if (converter != null && converter.convert(buf, this, f)) { return; } ! ! buf.append("<m>"); for (int i = 0; i < fList.size(); i++) { ! ((Node) fList.get(i)).convert2CSS(f, buf); } - buf.append("</m>"); } /** --- 125,143 ---- } ! public void convert2CSS(StringBuffer buf, boolean noTags) { ! IRowCSSConverter converter = getCSSConverter(fTeXSymbol); ! if (converter != null && converter.convert(buf, this)) { return; } ! if (! noTags) { ! buf.append("<m>"); ! } for (int i = 0; i < fList.size(); i++) { ! ((Node) fList.get(i)).convert2CSS(buf, false); ! } ! if (! noTags) { ! buf.append("</m>"); } } /** Index: TeX2MathMLFactory.java =================================================================== RCS file: /cvsroot/hmath/org.hartmath.tex2mml/src/org/hartmath/tex2mml/TeX2MathMLFactory.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TeX2MathMLFactory.java 12 Mar 2004 20:47:10 -0000 1.4 --- TeX2MathMLFactory.java 19 Mar 2004 20:19:03 -0000 1.5 *************** *** 17,21 **** public final static String UNDEROVER = "underover"; ! public final static boolean USE_IDENTIFIERS = true; --- 17,23 ---- public final static String UNDEROVER = "underover"; ! public final static String CSS_OPEN = "css_open"; ! public final static String CSS_CLOSE = "css_close"; ! public final static boolean USE_IDENTIFIERS = true; *************** *** 71,75 **** public void convert2CSS(Node node, StringBuffer buf) { ! node.convert2CSS(this, buf); } --- 73,77 ---- public void convert2CSS(Node node, StringBuffer buf) { ! node.convert2CSS(buf, false); } *************** *** 100,105 **** public void tag(StringBuffer buf, String tag, String data) { tagStart(buf, tag); ! // entity(buf, data); ! buf.append(tag); tagEnd(buf, tag); } --- 102,107 ---- public void tag(StringBuffer buf, String tag, String data) { tagStart(buf, tag); ! //entity(buf, data); ! buf.append(data); tagEnd(buf, tag); } *************** *** 196,201 **** //miscellaneous symbols - CONSTANT_SYMBOLS.put("int", new Operator(toEntity('\u222B'), CONSTANT)); - CONSTANT_SYMBOLS.put("oint", new Operator(toEntity('\u222E'), CONSTANT)); CONSTANT_SYMBOLS.put("partial", new Operator(toEntity('\u2202'), CONSTANT)); CONSTANT_SYMBOLS.put("nabla", new Operator(toEntity('\u2207'), CONSTANT)); --- 198,201 ---- *************** *** 291,304 **** ! Map underover = new HashMap(); ! underover.put(UNDEROVER, "true"); ! ! CONSTANT_SYMBOLS.put("sum", new Operator(toEntity('\u2211'), "sum", CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("prod", new Operator(toEntity('\u220F'), "ProD", CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("lim", new Operator("lim", "LiM",CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("bigwedge", new Operator(toEntity('\u22C0'), CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("bigvee", new Operator(toEntity('\u22C1'), CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("bigcap", new Operator(toEntity('\u22C2'), CONSTANT, underover)); ! CONSTANT_SYMBOLS.put("bigcup", new Operator(toEntity('\u22C3'), CONSTANT, underover)); CONSTANT_SYMBOLS.put("+", new Operator("+", CONSTANT)); --- 291,344 ---- ! Map underoverAttr = new HashMap(); ! underoverAttr.put(UNDEROVER, "true"); ! ! Map intAttr = new HashMap(); ! intAttr.put(UNDEROVER, "true"); ! intAttr.put(CSS_OPEN, "<InT>"); ! intAttr.put(CSS_CLOSE, "</InT>"); ! Map ointAttr = new HashMap(); ! ointAttr.put(UNDEROVER, "true"); ! ointAttr.put(CSS_OPEN, "<InT contour=\"+\">"); ! ointAttr.put(CSS_CLOSE, "</InT>"); ! Map sumAttr = new HashMap(); ! sumAttr.put(UNDEROVER, "true"); ! sumAttr.put(CSS_OPEN, "<SuM>"); ! sumAttr.put(CSS_CLOSE, "</SuM>"); ! Map prodAttr = new HashMap(); ! prodAttr.put(UNDEROVER, "true"); ! prodAttr.put(CSS_OPEN, "<ProD>"); ! prodAttr.put(CSS_CLOSE, "</ProD>"); ! Map bigoplusAttr = new HashMap(); ! bigoplusAttr.put(UNDEROVER, "true"); ! bigoplusAttr.put(CSS_OPEN, "<Sum direct= \"+\">"); ! bigoplusAttr.put(CSS_CLOSE, "</Sum>"); ! Map bigotimesAttr = new HashMap(); ! bigotimesAttr.put(UNDEROVER, "true"); ! bigotimesAttr.put(CSS_OPEN, "<Prod direct=\"+\">"); ! bigotimesAttr.put(CSS_CLOSE, "</Prod>"); ! Map limAttr = new HashMap(); ! limAttr.put(UNDEROVER, "true"); ! Map bigcapAttr = new HashMap(); ! bigcapAttr.put(UNDEROVER, "true"); ! bigcapAttr.put(CSS_OPEN, "<CaP>"); ! bigcapAttr.put(CSS_CLOSE, "</CaP>"); ! Map bigcupAttr = new HashMap(); ! bigcupAttr.put(UNDEROVER, "true"); ! bigcupAttr.put(CSS_OPEN, "<CuP>"); ! bigcupAttr.put(CSS_CLOSE, "</CuP>"); ! ! CONSTANT_SYMBOLS.put("int", new Operator(toEntity('\u222B'), CONSTANT, intAttr)); ! CONSTANT_SYMBOLS.put("oint", new Operator(toEntity('\u222E'), CONSTANT, ointAttr)); ! ! CONSTANT_SYMBOLS.put("sum", new Operator(toEntity('\u2211'), CONSTANT, sumAttr)); ! CONSTANT_SYMBOLS.put("prod", new Operator(toEntity('\u220F'), CONSTANT, prodAttr)); ! CONSTANT_SYMBOLS.put("bigoplus", new Operator(toEntity('\u2295'), CONSTANT, bigoplusAttr)); ! CONSTANT_SYMBOLS.put("bigotimes", new Operator(toEntity('\u2297'), CONSTANT, bigotimesAttr)); ! CONSTANT_SYMBOLS.put("lim", new Operator("lim", CONSTANT, limAttr)); ! CONSTANT_SYMBOLS.put("bigwedge", new Operator(toEntity('\u22C0'), CONSTANT, underoverAttr)); ! CONSTANT_SYMBOLS.put("bigvee", new Operator(toEntity('\u22C1'), CONSTANT, underoverAttr)); ! CONSTANT_SYMBOLS.put("bigcap", new Operator(toEntity('\u22C2'), CONSTANT, bigcapAttr)); ! CONSTANT_SYMBOLS.put("bigcup", new Operator(toEntity('\u22C3'), CONSTANT, bigcupAttr)); CONSTANT_SYMBOLS.put("+", new Operator("+", CONSTANT)); |