import { UndEndIterator } from '../util/iterator';
export const walk0 = (node) => {
    const stack = [node];
    return () => {
        const node = stack.pop();
        if (!node)
            return;
        if (typeof node === 'string')
            return node;
        for (let i = node.length - 1; i >= 2; i--)
            stack.push(node[i]);
        return node;
    };
};
export const walk = (node) => new UndEndIterator(walk0(node));
//# sourceMappingURL=walk.js.map