version 1.13, 1999/12/09 00:32:36 |
version 1.16, 2000/01/20 18:14:32 |
|
|
/** |
/** |
* $OpenXM: OpenXM/src/OpenMath/OM2OXM.java,v 1.12 1999/11/18 15:13:01 tam Exp $ |
* $OpenXM: OpenXM/src/OpenMath/OM2OXM.java,v 1.15 2000/01/20 13:58:48 tam Exp $ |
* |
* |
* $B$3$N%/%i%9$G$O0J2<$N(B BNF $B$GI=$5$l$k9=J82r@O$r<BAu$7$F$$$k(B |
* $B$3$N%/%i%9$G$O0J2<$N(B BNF $B$GI=$5$l$k9=J82r@O$r<BAu$7$F$$$k(B |
* expr -> stag [expr | immediate]* etag |
* expr -> stag [expr | immediate]* etag |
Line 39 final class OM2OXM implements Runnable{ |
|
Line 39 final class OM2OXM implements Runnable{ |
|
private int token = TT_NULL; |
private int token = TT_NULL; |
private boolean lexPushbackFlag = false; |
private boolean lexPushbackFlag = false; |
private OpenXM asir; // for debug |
private OpenXM asir; // for debug |
private boolean debug = true; |
protected boolean debug = false; // for debug message |
|
|
// Token Type for lexical analyzer |
// Token Type for lexical analyzer |
final static int TT_NULL = 0; |
final static int TT_NULL = 0; |
Line 88 final class OM2OXM implements Runnable{ |
|
Line 88 final class OM2OXM implements Runnable{ |
|
case CMO.CMO_STRING: |
case CMO.CMO_STRING: |
return "<OMSTR>"+ ((CMO_STRING)cmo).getString() +"</OMSTR>"; |
return "<OMSTR>"+ ((CMO_STRING)cmo).getString() +"</OMSTR>"; |
|
|
// case CMO.CMO_LIST: |
case CMO.CMO_LIST: |
|
ret += "<OMA><OMS name=\"list\" cd=\"basic\"/>"; |
|
{ |
|
CMO ob[] = ((CMO_LIST)cmo).getElements(); |
|
|
|
for(int i=0;i<ob.length;i++){ |
|
ret += CMO2OM_sub(ob[i]); |
|
} |
|
} |
|
ret += "</OMA>"; |
|
return ret; |
|
|
case CMO.CMO_MONOMIAL32: |
case CMO.CMO_MONOMIAL32: |
ret += "<OMA><OMS name=\"Monom\" cd=\"poly\"/>"; |
ret += "<OMA><OMS name=\"Monom\" cd=\"poly\"/>"; |
ret += CMO2OM_sub(((CMO_MONOMIAL32)cmo).getCoefficient()); |
ret += CMO2OM_sub(((CMO_MONOMIAL32)cmo).getCoefficient()); |
Line 149 final class OM2OXM implements Runnable{ |
|
Line 159 final class OM2OXM implements Runnable{ |
|
case CMO.CMO_TREE: |
case CMO.CMO_TREE: |
ret += "<OMA><OMS name=\""+ ((CMO_TREE)cmo).getName() +"\" cd=\""+ |
ret += "<OMA><OMS name=\""+ ((CMO_TREE)cmo).getName() +"\" cd=\""+ |
((CMO_TREE)cmo).getCDName() +"\"/>"; |
((CMO_TREE)cmo).getCDName() +"\"/>"; |
for(int i=0;i<((CMO_TREE)cmo).getLeaves().getElement().length;i++){ |
for(int i=0;i<((CMO_TREE)cmo).getLeaves().getElements().length;i++){ |
ret += CMO2OM_sub(((CMO_TREE)cmo).getLeaves().getElement()[i]); |
ret += CMO2OM_sub(((CMO_TREE)cmo).getLeaves().getElements()[i]); |
} |
} |
ret += "</OMA>"; |
ret += "</OMA>"; |
return ret; |
return ret; |
Line 172 final class OM2OXM implements Runnable{ |
|
Line 182 final class OM2OXM implements Runnable{ |
|
} |
} |
|
|
poly = (CMO_POLYNOMIAL_IN_ONE_VARIABLE)cmo; |
poly = (CMO_POLYNOMIAL_IN_ONE_VARIABLE)cmo; |
variable = CMO2OM_sub(variables.getElement()[poly.getVariable()]); |
variable = CMO2OM_sub(variables.getElements()[poly.getVariable()]); |
|
|
for(int i=0;i<poly.getDegrees().length;i++){ |
for(int i=0;i<poly.getDegrees().length;i++){ |
String mono; |
String mono; |
Line 353 final class OM2OXM implements Runnable{ |
|
Line 363 final class OM2OXM implements Runnable{ |
|
if(name.equals("DMP")){ |
if(name.equals("DMP")){ |
ret = parse_symb_DMP(); |
ret = parse_symb_DMP(); |
debug("poly: "+ret); |
debug("poly: "+ret); |
|
}else if(name.equals("list")){ |
|
ret = parse_objects(); |
}else{ |
}else{ |
ret = new CMO_TREE(name,"Basic",parse_objects()); |
ret = new CMO_TREE(name,"Basic",parse_objects()); |
} |
} |
Line 771 final class OM2OXM implements Runnable{ |
|
Line 783 final class OM2OXM implements Runnable{ |
|
asir.send(obj); |
asir.send(obj); |
asir.sendSM(new SM(SM.SM_popCMO)); |
asir.sendSM(new SM(SM.SM_popCMO)); |
}catch(NumberFormatException e){ |
}catch(NumberFormatException e){ |
|
System.err.println(e.getMessage()); |
|
}catch(MathcapViolation e){ |
System.err.println(e.getMessage()); |
System.err.println(e.getMessage()); |
} |
} |
} |
} |