Skip to content

Commit

Permalink
fix expected string length bug
Browse files Browse the repository at this point in the history
  • Loading branch information
skoppe committed Feb 5, 2020
1 parent 9add4b5 commit c6d1a03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pegged/peg.d
Original file line number Diff line number Diff line change
Expand Up @@ -1656,15 +1656,15 @@ template or(rules...) if (rules.length > 0)
failedLength[i] = temp.end;
if (temp.end >= longestFail.end)
{
if (temp.end == longestFail.end)
errorStringChars += (temp.matches.length > 0 ? temp.matches[$-1].length : 0) + errName.length + 4;
else
errorStringChars = (temp.matches.length > 0 ? temp.matches[$-1].length : 0) + errName.length + 4;
maxFailedLength = temp.end;
longestFail = temp;
names[i] = errName;
results[i] = temp;
if (temp.end == longestFail.end)
errorStringChars += (temp.matches.length > 0 ? temp.matches[$-1].length : 0) + errName.length + 4;
else
errorStringChars = (temp.matches.length > 0 ? temp.matches[$-1].length : 0) + errName.length + 4;
}
// Else, this error parsed less input than another one: we discard it.
}
Expand Down

0 comments on commit c6d1a03

Please sign in to comment.