cx.addElement not adding elements, depending on order of addition of the elements.

Well, I am trying to recreate the emphesis parser to parse incompletely, as in if there is a starting delimiter, and no ending delimiter it would still parse the whole section(paragraph): Older topic I created on this matter, which goes into depth on what I was trying to achieve.

The way I am achieving this is by recreating the current emphasis parsing system to fit my needs, the current parser first incorrectly parses the delimiters, which then gets correctly parsed inside of resolveMarkers at the end of the parser cycle.

I have a similar system, where I recreate this whole parsing system inside of the extension architecture of the lezer markdown parser, and modify this system to fit my needs. At the end I am left with a list of elements which I need to then add the to parser using cx.addElement. And trying to add these elements caused the problem.

This doesn’t seem to be a problem in the current default parser as resolveMarkers replaces the element list after everything is parsed, rather than adding these elements at post as I am trying to(I can’t find exactly where this happens, but resolveMarkers is required for parsing to correctly work, and it is referenced inside of parseInline which itself is is referenced inside of finishLeaf, where I am guessing this really happens):