public ILexLocation findLocation(IrNodeInfo info) { INode vdmNode = getVdmNode(info); if (vdmNode == null) { return null; } return findLocation(vdmNode); }
public String consVdmNodeInfoStr(STypeIR t) { StringBuilder sb = new StringBuilder(); INode vdmNode = AssistantBase.getVdmNode(t); if(vdmNode != null) { sb.append("VDM node: " + vdmNode + "."); ILexLocation loc = findLocation(vdmNode); if(loc != null) { sb.append(" VDM node location: " + loc + "."); } } return sb.toString(); } }
@Override public int compare(VdmNodeInfo first, VdmNodeInfo second) { ILexLocation firstLoc = findLocation(first.getNode()); if (firstLoc == null) { return -1; } ILexLocation secondLoc = findLocation(second.getNode()); if (secondLoc == null) { return 1; } return compareLocations(firstLoc, secondLoc); } });
@Override public int compare(IrNodeInfo first, IrNodeInfo second) { INode vdmNode = getVdmNode(first); ILexLocation firstLoc = vdmNode == null ? null : findLocation(vdmNode); if (firstLoc == null) { return -1; } vdmNode = getVdmNode(second); ILexLocation secondLoc = vdmNode == null ? null : findLocation(vdmNode); if (secondLoc == null) { return 1; } return compareLocations(firstLoc, secondLoc); } });
public String formatVdmSource(PIR irNode) { if (getJavaSettings().printVdmLocations() && irNode != null) { org.overture.ast.node.INode vdmNode = LocationAssistantIR.getVdmNode(irNode); if (vdmNode != null) { ILexLocation loc = info.getLocationAssistant().findLocation(vdmNode); if (loc != null) { return String.format("/* %s %d:%d */\n", loc.getFile().getName(), loc.getStartLine(), loc.getStartPos()); } } } return ""; }
public static void printUnsupportedIrNodes( Set<VdmNodeInfo> unsupportedNodes) { AssistantManager assistantManager = new AssistantManager(); LocationAssistantIR locationAssistant = assistantManager.getLocationAssistant(); List<VdmNodeInfo> nodesSorted = locationAssistant.getVdmNodeInfoLocationSorted(unsupportedNodes); for (VdmNodeInfo vdmNodeInfo : nodesSorted) { MsgPrinter.getPrinter().print(vdmNodeInfo.getNode().toString() + " (" + vdmNodeInfo.getNode().getClass().getSimpleName() + ")"); ILexLocation location = locationAssistant.findLocation(vdmNodeInfo.getNode()); MsgPrinter.getPrinter().print(location != null ? " at [line, pos] = [" + location.getStartLine() + ", " + location.getStartPos() + "] in " + location.getFile().getName() : ""); String reason = vdmNodeInfo.getReason(); if (reason != null) { MsgPrinter.getPrinter().print(". Reason: " + reason); } MsgPrinter.getPrinter().println(""); } }
: nodeInfo.getNode().getClass().getSimpleName()); ILexLocation location = locationAssistant.findLocation(nodeInfo);