Skip to content

Commit 1a790c1

Browse files
Document concat extension function in Parser.kt with details on behavior, reverse order processing, and structure simplification.
1 parent ae3aed5 commit 1a790c1

File tree

1 file changed

+8
-0
lines changed
  • core/common/src/internal/format/parser

1 file changed

+8
-0
lines changed

core/common/src/internal/format/parser/Parser.kt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ internal class ParserStructure<in Output>(
4141
"${operations.joinToString(", ")}(${followedBy.joinToString(";")})"
4242
}
4343

44+
/**
45+
* Concatenates a list of parser structures into a single structure.
46+
*
47+
* Processes parsers in reverse order, batching operations from parsers without alternatives
48+
* and simplifying the resulting structure (merging number spans, handling unconditional modifications).
49+
*
50+
* @return A single parser structure representing the composition of all parsers in the list
51+
*/
4452
internal fun <T> List<ParserStructure<T>>.concat(): ParserStructure<T> {
4553
/**
4654
* Merges pending operations (base operations, number span, and unconditional modifications)

0 commit comments

Comments
 (0)