if (isParent) {
return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;
} else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
return "computeData.classData.Sub" + cls.getName() + "." + child.toLowerCase() + "_" + cleanProp + "_last";
} else {
throw new InvalidGrammarException("Cannot access $$ attrib of a non-multi child / self reduction: " + lhs);
}
} else if (prop.contains("$i")) {
//throw new InvalidGrammarException("$i not handled in C++ backend yet");
//System.err.println("$i not handled in C++ backend yet");
if (isParent) {
throw new InvalidGrammarException("Cannot access $i of self attrib: " + lhs);
//return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;
} else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
if (isParseData) {
if (cleanProp.equals("display")) return "loopChild->data.parseData.display";
else return "loopChild->data.parseData.genData.extraParse" + cls.getChildByName(child).getName() + ".fld_" + cleanProp;
}
else return "loopChild->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
} else {
throw new InvalidGrammarException("Cannot access $i attrib of a non-multi child: " + lhs);
//return "parseFloat(getChildByRefName(node,\"" + child + "\").getAttribute(\"" + cleanProp + "\"))";
}
} else if (prop.contains("$-")) {
if (isParent) {
//by definition, cannot be parse data (for now..)
//FIXME check sink is scheduled in same loop
return "computeData.classData.Sub" + cls.getName() + "." + cleanProp;
} else if (Generator.childrenContains(ast.extendedClasses.get(cls).multiChildren.keySet(), child)) {
String init = "computeData.classData.Sub" + cls.getName() + "." + child.toLowerCase() + "_" + cleanProp + "_init";
String step = "(PREV())->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
return "(STEP() == 1 ? (" + init + ") : (" + step + "))";
//return "(PREV())->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
//return " parseFloat((i == 0 ? node.getAttribute(\"" + child.toLowerCase() + "_" + cleanProp + "_init\")" + " : children[i-1].getAttribute(\"" + cleanProp + "\")))";
} else {
throw new InvalidGrammarException("Cannot access $- attrib of a non-multi child: " + lhs);
//by definition, cannot be parse data (for now..)
// System.err.println("check cpp prev child iter name"); //FIXME
// String init = "computeData.classData.Sub" + cls.getName() + "." + cleanProp + "_init";
// String cur = "(loopChild - 1)->data.computeData.classData.Sub" + cls.getChildByName(child) + "." + cleanProp;
// return "(i == 0 ? " + init + " : " + cur + ")";