Fix the bug of mapping ast node types.

This commit is contained in:
Kui LIU
2017-08-05 20:43:15 +02:00
parent 21d55e82da
commit 5b8ca570cd
@@ -83,11 +83,16 @@ public class HierarchicalRegrouper {
int index = actStrFrag.lastIndexOf(" ") + 1; int index = actStrFrag.lastIndexOf(" ") + 1;
String nodeType = actStrFrag.substring(index); String nodeType = actStrFrag.substring(index);
if (!"".equals(nodeType)) { if (!"".equals(nodeType)) {
try { if (Character.isDigit(nodeType.charAt(0)) || nodeType.startsWith("-")) {
String type = ASTNodeMap.map.get(Integer.parseInt(nodeType)); try {
nodeType = type; int typeInt = Integer.parseInt(nodeType);
} catch (NumberFormatException e) { if (ASTNodeMap.map.containsKey(typeInt)) {
// nodeType = actStrFrag.substring(index); String type = ASTNodeMap.map.get(Integer.parseInt(nodeType));
nodeType = type;
}
} catch (NumberFormatException e) {
nodeType = actStrFrag.substring(index);
}
} }
} }
actStrFrag = actStrFrag.substring(0, index) + nodeType + "@@"; actStrFrag = actStrFrag.substring(0, index) + nodeType + "@@";