Skip to content

Commit

Permalink
Update Parser.java, fixes ridencww#28
Browse files Browse the repository at this point in the history
Files ending with line comments should not raise error.group_runaway
  • Loading branch information
codemanyak committed Apr 10, 2024
1 parent a8e848d commit b7e0b5f
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,11 @@ protected ParseMessage parse() {
inputTokens.push(read);

// Handle the case where an unterminated comment block consumes the entire program
if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
// START KGU#1144 2024-04-10: Bugfix #28 With a line comment, we may tolerate EOF
//if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0
&& !(groupStack.size() == 1 && groupStack.peek().group.getEndingMode() == EndingMode.OPEN)) {
// END KGU#1144 2024-04-10
// Runaway group
parseMessage = ParseMessage.GROUP_ERROR;
} else {
Expand All @@ -715,7 +719,11 @@ protected ParseMessage parse() {
} else if (SymbolType.ERROR.equals(read.getType())) {
parseMessage = ParseMessage.LEXICAL_ERROR;
done = true;
} else if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
// START KGU#1144 2024-04-10: Bugfix #28 With a line comment, we may tolerate EOF
//} else if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0) {
} else if (SymbolType.END.equals(read.getType()) && groupStack.size() > 0
&& !(groupStack.size() == 1 && groupStack.peek().group.getEndingMode() == EndingMode.OPEN)) {
// END KGU #1144 2024-04-10
// Runaway group
parseMessage = ParseMessage.GROUP_ERROR;
done = true;
Expand Down

0 comments on commit b7e0b5f

Please sign in to comment.