/** * Returns a simple tree view of the ASTNode internal, including mainly * node type and hierarchy. * * @param n * @param tree * @param indent * @return a simple tree view of the ASTNode internal */ public static String astNodeToTree(ASTNode n, String tree, String indent) { //tree = tree + indent + n.getType() + " " + // (n.isInteger() ? n.getInteger() : "") + (n.isReal() ? n.getReal() : "") + '\n'; tree = tree + indent + n.toSimpleString() + " unit:" + n.deriveUnit() + '\n'; for (ASTNode child : n.getChildren()) { tree = astNodeToTree(child, tree, indent + " "); } return tree; }
ud = expandedMath.deriveUnit(); } catch (Throwable exc) {
ud = node.getChild(0).deriveUnit(); } catch (Exception e) { UnitDefinition def = child.deriveUnit();