@Override
public ASTNode createFunction(final IParserFactory factory,
final ASTNode lhs, final ASTNode rhs) {
if (rhs instanceof IntegerNode) {
if (lhs instanceof IntegerNode) {
return new FractionNode((IntegerNode) lhs, (IntegerNode) rhs);
}
return factory.createFunction(factory.createSymbol("Times"), lhs,
new FractionNode(IntegerNode.C1, (IntegerNode) rhs));
}
return factory.createFunction(factory.createSymbol("Times"), lhs,
factory.createFunction(factory.createSymbol("Power"), rhs,
factory.createInteger(-1)));
}