From c350c24f6247f8c6f1e5c51de3745232dc7350f0 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 28 Jul 2017 09:51:59 -0700 Subject: [PATCH] Add link nodes to collections and check for their presence. This prevents infinite loops, as Link nodes do not follow regular addInto behavior. --- src/org/nwapw/abacus/lexing/pattern/LinkNode.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/org/nwapw/abacus/lexing/pattern/LinkNode.java b/src/org/nwapw/abacus/lexing/pattern/LinkNode.java index 7c85c0f..63b5335 100644 --- a/src/org/nwapw/abacus/lexing/pattern/LinkNode.java +++ b/src/org/nwapw/abacus/lexing/pattern/LinkNode.java @@ -11,7 +11,10 @@ public class LinkNode extends PatternNode { @Override public void addInto(Collection> into) { - addOutputsInto(into); + if(!into.contains(this)) { + into.add(this); + addOutputsInto(into); + } } }