collectLeaves static method
Collects all leaf nodes in the AST that have a sourceRange (flattened) Sorted by sourceRange.start
Implementation
static List<LatexNode> collectLeaves(LatexNode root) {
final leaves = <LatexNode>[];
_collectLeavesImpl(root, leaves);
leaves.sort(
(a, b) =>
(a.sourceRange?.start ?? 0).compareTo(b.sourceRange?.start ?? 0),
);
return leaves;
}