We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 31e02e2 commit bdd26d3Copy full SHA for bdd26d3
pegged/peg.d
@@ -1927,7 +1927,7 @@ template longest_match(rules...) if (rules.length > 0)
1927
foreach(i; 0..rules.length)
1928
if (failedLength[i] == maxFailedLength && results[i].matches.length > 0)
1929
errString ~= results[i].matches[$-1] ~ names[i][] ~ " or ";
1930
- orErrorString = errString[0..$-4];
+ orErrorString = errString[0..$ >= 4 ? $-4 : $];
1931
1932
longestFail.matches = longestFail.matches.length == 0 ? [orErrorString] :
1933
longestFail.matches[0..$-1] // discarding longestFail error message
0 commit comments