Skip to content

Commit

Permalink
spring-projectsgh-277: parse commented line like an empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
polo7 committed Jun 8, 2024
1 parent 3ee49e8 commit 33757f3
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ public Input readInput() {
if (line == null) {
return null;
} else {
ParsedLine parsedLine = parser.parse(sb.toString(), sb.toString().length());
// gh-277: if it's a commented line then skip as it is equal to NO_INPUT
ParsedLine parsedLine;
if (isCommentedLine(line)) {
parsedLine = parser.parse("", -1, Parser.ParseContext.COMPLETE);
} else {
parsedLine = parser.parse(sb.toString(), sb.toString().length());
}
return new ParsedLineInput(parsedLine);
}
}
Expand All @@ -75,4 +81,8 @@ public Input readInput() {
public void close() throws IOException {
reader.close();
}

private boolean isCommentedLine(String line) {
return line.matches("\\s*//.*");
}
}

0 comments on commit 33757f3

Please sign in to comment.