Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/Developer' into DDH-13425-error-…
Browse files Browse the repository at this point in the history
…when-running-on-Linux-
  • Loading branch information
Lars Egeberg Hansen committed Sep 20, 2024
2 parents be92de1 + 652c061 commit 8c95ab0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public String interpretNextLine() {
}

// Current line might change from when it was originally read
return reader.getCurrentLine().getUnNumberedString();
return reader.getCurrentLine().getOriginalString();
}

public void closeReader() {
Expand Down Expand Up @@ -606,7 +606,7 @@ public void removeSectionOrParagraphLines(){
public void addSectionOrParagraphLine(){
if(Interpreter.shouldLineBeStubbed(reader.getCurrentLine(), reader.getState()))
sectionOrParagraph.addLine(StringHelper.stubLine(reader.getCurrentLine().getUnNumberedString(), stubTag));
else sectionOrParagraph.addLine(reader.getCurrentLine().getUnNumberedString());
else sectionOrParagraph.addLine(reader.getCurrentLine().getOriginalString());
}

public void addSectionOrParagraphLine(String line){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,6 @@ public class CobolGenerator {



static List<String> generateSectionLines(String identifier, List<String> commentLines, List<String> bodyLines){
List<String> lines = new ArrayList<>();
lines.add(String.format(SECTION_HEADER_FORMAT, identifier));
if (commentLines != null)
lines.addAll(commentLines);
if (bodyLines != null) {
lines.addAll(bodyLines);
// Check if the last line in bodyLines ends with a period
if (!bodyLines.get(bodyLines.size() - 1).endsWith(".")) {
lines.add(ENDING_PERIOD);
}
} else {
// If bodyLines is null, add ENDING_PERIOD
lines.add(ENDING_PERIOD);
}
return lines;
}

static List<String> generateParagraphLines(String identifier, List<String> commentLines, List<String> bodyLines){
List<String> lines = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ private String tryInsertEndEvaluateAtMockedCompomentEnd(String sourceLine) throw
}
}
return sourceLine;

}


/**
* Writes the given line to the output file. If a multiline statement has been read, this will
* be written instead (this statement will include the line). Comments out lines and statements
Expand Down Expand Up @@ -248,6 +250,10 @@ private void writeWhenOtherSectionOrParagraph(String sourceLine) throws IOExcep
private void echoingSourceLineToOutput(String sourceLine){
try{
if(interpreter.isInsideSectionOrParagraphMockBody()){
// Avoid giving mocked section ending period line numbers, as they would be duplicates
if (sourceLine.length() > 6 && sourceLine.substring(6).trim().equals(".")) {
sourceLine = " " + sourceLine.substring(6);
}
interpreter.addSectionOrParagraphLine();
}
sourceLine = tryInsertEndEvaluateAtMockedCompomentEnd(sourceLine);
Expand Down

0 comments on commit 8c95ab0

Please sign in to comment.