Skip to content

Commit cfa8eb7

Browse files
committed
Prevent duplicates.
1 parent 5f9ce20 commit cfa8eb7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pegged/grammar.d

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ string grammar(Memoization withMemo = Memoization.yes)(string definition)
133133
if (!canFind(allLeftRecursiveRules, rule))
134134
allLeftRecursiveRules ~= rule;
135135
foreach (cycle; grammarInfo.leftRecursiveCycles)
136-
stoppers ~= cycle[0];
136+
if (!stoppers.canFind(cycle[0]))
137+
stoppers ~= cycle[0];
137138

138139
// Prints comment showing detected left-recursive cycles.
139140
string printLeftRecursiveCycles()

0 commit comments

Comments
 (0)