Paragraph continuation question (kotlin)

Hello im working on a parser for commonmark in kotlin and ran into something I don’t understand pertaining to lists

Example 272 and 274 are very similar in that they both deal with list items interrupting paragraphs.

One says new lists must start with 1) to interrupt a paragraph (274) and the other has the 3) interrupting the paragraph of the second list item to create a new list.

If i were to remove the right brace from the the 3) it would match as lazy continuation of the paragraph.

Is there any concise way of determining which of the two situations we are in at any given time?

Well, I also feel that the specification should be more explicit about precedence of various rules.

That said, the lazy continuation line is a special thing with very low precedence in comparison to the other possible interpretations. (Otherwise nothing but a blank line could interrupt a paragraph, and that’s clearly not the case.)

In other words, if the currently analyzed line is not indented enough to be still part of the preceding list item, you try to interpret it as a 1st line of a subsequent block (of any type) after the list. Then, as in the example 272, the 3) can start a new block because it does not actually interrupt a paragraph: Instead it interrupts the previous list.

Only finally, if all those other block interpretations fail, and you would see the line as a beginning of a new paragraph after the list, the lazy continuation line rule triggers and you treat it as yet another line of the paragraph at the end of the last list item (or a block quote; a block quote is more or less the same thing as a list in the question of lazy continuation.)

I agree with a lot of what you said in that post
Thanks so much for the recommendation and the follow up post, the precedence ordering and general explanation you provided took a couple hours to get through my brain (thankfully this is just a side project so no worktime lost) but I got all of the lazy continuation tests to pass without having to do a lot of crazy checks within list item itself