Commit 53ccc27b authored by Peter's avatar Peter
Browse files

$display placed to correct position in MarcoListing now

parent dfa62f13
Loading
Loading
Loading
Loading
Loading
+6 −1
Changes for src/main/java/hk/quantr/verilogcompiler/macro/MacroListing.java: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -35,8 +35,13 @@ public class MacroListing {
//		if (type == Type.MACRO) {
//			return lineNo + "\t" + secondLineNo + "\t" + type + "(" + uuid + ")" + "\t" + line;
//		} else {
		return originalLineNo + "    " + lineNo + "    " + type + "    " + line.trim() + " >> " + children.isEmpty();
		return "(" + parseNo + ") " + originalLineNo + "    " + lineNo + "    " + type + "    " + line.trim() + " >> " + children.isEmpty();
//		}
	}

	public boolean isEmptyIgnoreProfiling() {
		long count = children.stream().filter(c -> c.type != Type.PROFILING).count();
		return count == 0;
	}

}
+22 −13
Changes for src/main/java/hk/quantr/verilogcompiler/macro/ParseStructure.java: 22 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -100,9 +100,15 @@ public class ParseStructure {
	}

	public MacroListing getByLastLineNo(int lineNo, int parseNo) {
		List<MacroListing> temp = fatternMacroListing().stream().filter(c -> c.type != Type.PROFILING && c.children.isEmpty()).collect(Collectors.toList());
//		for (MacroListing t : fatternMacroListing()) {
//			System.out.println("- " + t);
//		}
		List<MacroListing> temp = fatternMacroListing().stream().filter(c -> c.type != Type.PROFILING && c.isEmptyIgnoreProfiling()).collect(Collectors.toList());
//		for (MacroListing t : temp) {
//			System.out.println("+ " + t);
//		}
		int bingoX = -1;
		if (lineNo == 83) {
		if (lineNo == 748) {
			System.out.println("");
		}
		for (int x = temp.size() - 1; x >= 0; x--) {
@@ -117,17 +123,20 @@ public class ParseStructure {
		if (bingoX == -1) {
			System.err.println("bingoX is -1");
		}
		int delta = lineNo - temp.get(bingoX).lineNo;
//		int tempDelta = bingoX;
//		MacroListing deltaMacroListing = temp.get(tempDelta);
//		while (delta > 0) {
//			if (deltaMacroListing.children.stream().filter(c -> c.type != Type.PROFILING).count() == 0) {
//				delta--;
//			}
//			tempDelta++;
//			deltaMacroListing = temp.get(tempDelta);
//		}
		return temp.get(bingoX + delta);
		int delta = lineNo - temp.get(bingoX).lineNo - 1;
		int tempDelta = bingoX;
		MacroListing deltaMacroListing = temp.get(tempDelta);
		int lastLineNo = deltaMacroListing.lineNo;
		while (delta > 0) {
			if (deltaMacroListing.children.stream().filter(c -> c.type != Type.PROFILING).count() == 0 && lastLineNo != deltaMacroListing.lineNo) {
				delta--;
			}
			tempDelta++;
			lastLineNo = deltaMacroListing.lineNo;
			deltaMacroListing = temp.get(tempDelta);
		}
//		return temp.get(bingoX + delta);
		return deltaMacroListing;
	}

}