diff --git a/README.md b/README.md index aa1466230..bf8854c48 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Parsley is a fast and modern parser combinator library for Scala based loosely o Parsley is distributed on Maven Central, and can be added to your project via: ```scala -libraryDependencies += "com.github.j-mie6" %% "parsley" % "4.1.3" +libraryDependencies += "com.github.j-mie6" %% "parsley" % "4.1.5" ``` Documentation can be found [**here**](https://javadoc.io/doc/com.github.j-mie6/parsley_2.13/latest/index.html) diff --git a/parsley/shared/src/main/scala/parsley/internal/deepembedding/backend/SequenceEmbedding.scala b/parsley/shared/src/main/scala/parsley/internal/deepembedding/backend/SequenceEmbedding.scala index 20692da88..affb5ef17 100644 --- a/parsley/shared/src/main/scala/parsley/internal/deepembedding/backend/SequenceEmbedding.scala +++ b/parsley/shared/src/main/scala/parsley/internal/deepembedding/backend/SequenceEmbedding.scala @@ -180,7 +180,10 @@ private [deepembedding] final class Seq[A](private [backend] var before: DoublyL this } } - case r <** (p: Seq[_]) => mergeFromRight(p, chooseInto(r)) + case r <** (p: Seq[_]) => + assume(after.size == 1 && (after.head eq p), "after can only contain just p, which is going to get flattened, so it can be dropped") + after.clear() + mergeFromRight(p, chooseInto(r)) // shift pure to the right by swapping before and after (before is empty linked list!) case (_: Pure[_]) <** _ => assume(before.isEmpty, "empty can reuse before instead of allocating a new list because before is empty")