else
output.println(generateTemp(fm, fln.getDst())+"=0;");
} else if (fln.getType().isChar()) {
- output.println(generateTemp(fm, fln.getDst())+"='"+fln.getValue()+"';");
+ String st=FlatLiteralNode.escapeString(fln.getValue().toString());
+ output.println(generateTemp(fm, fln.getDst())+"='"+st+"';");
} else
output.println(generateTemp(fm, fln.getDst())+"="+fln.getValue()+";");
}
}
public FlagExpressionNode parseFlagExpression(ParseNode pn) {
- if (pn.getChild("or")!=null) {
- ParseNodeVector pnv=pn.getChild("or").getChildren();
+ if (isNode(pn,"or")) {
+ ParseNodeVector pnv=pn.getChildren();
ParseNode left=pnv.elementAt(0);
ParseNode right=pnv.elementAt(1);
return new FlagOpNode(parseFlagExpression(left), parseFlagExpression(right), new Operation(Operation.LOGIC_OR));
- } else if (pn.getChild("and")!=null) {
- ParseNodeVector pnv=pn.getChild("and").getChildren();
+ } else if (isNode(pn,"and")) {
+ ParseNodeVector pnv=pn.getChildren();
ParseNode left=pnv.elementAt(0);
ParseNode right=pnv.elementAt(1);
return new FlagOpNode(parseFlagExpression(left), parseFlagExpression(right), new Operation(Operation.LOGIC_AND));
- } else if (pn.getChild("not")!=null) {
- ParseNodeVector pnv=pn.getChild("not").getChildren();
+ } else if (isNode(pn, "not")) {
+ ParseNodeVector pnv=pn.getChildren();
ParseNode left=pnv.elementAt(0);
return new FlagOpNode(parseFlagExpression(left), new Operation(Operation.LOGIC_NOT));
- } else if (pn.getChild("name")!=null) {
- return new FlagNode(pn.getChild("name").getTerminal());
- } else throw new Error();
+ } else if (isNode(pn,"name")) {
+ return new FlagNode(pn.getTerminal());
+ } else {
+ throw new Error();
+ }
}
public Vector parseChecks(ParseNode pn) {
tmp=tmp.getChild("array");
}
String paramname=tmp.getChild("single").getTerminal();
- FlagExpressionNode fen=parseFlagExpression(paramn.getChild("flag"));
+ FlagExpressionNode fen=parseFlagExpression(paramn.getChild("flag").getFirstChild());
td.addParameter(type,paramname,fen);
}
for(int i=0;i<conjunctions.size();i++) {
for(int i2=0;i2<dnf2.conjunctions.size();i2++) {
Vector conjunct=(Vector)conjunctions.get(i);
- Vector conjunct2=(Vector)conjunctions.get(i2);
+ Vector conjunct2=(Vector)dnf2.conjunctions.get(i2);
Vector newconjunct=new Vector();
result.conjunctions.add(newconjunct);
for(int j=0;j<conjunct.size();j++) {
}
return result;
}
+
+ public String toString() {
+ String value="";
+ for(int i=0;i<conjunctions.size();i++) {
+ if (i!=0)
+ value+=" || ";
+ Vector conjunct=(Vector)conjunctions.get(i);
+ for(int j=0;j<conjunct.size();j++) {
+ if (j!=0)
+ value+="&&";
+ value+=conjunct.get(j);
+ }
+ }
+ return value;
+ }
}