BareGit
#ifndef MACRODOWN_BLOCK_PARSER_H
#define MACRODOWN_BLOCK_PARSER_H

#include <string>
#include <vector>
#include <memory>
#include "block.h"

namespace macrodown
{

class BlockParser
{
public:
    // Main entry point: parses the entire document into a Block tree
    static std::unique_ptr<Block> parse(const std::string& input);

private:
    struct BlockStackItem
    {
        Block* block;
        // Parsing state specific to this block type could go here
    };

    std::unique_ptr<Block> root;
    std::vector<BlockStackItem> open_blocks;

    BlockParser();
    void process_line(const std::string& line);
    void close_unmatched_blocks(size_t last_matched_index);
    void add_text_to_current(const std::string& text);
    
    // Checkers
    bool is_container(BlockType type);
    bool matches(Block* block, const std::string& line, size_t& offset);
};

} // namespace macrodown

#endif // MACRODOWN_BLOCK_PARSER_H