// mars::stream — text dump of a generic tree, one line per item: // @ [?] [ (alt )] // `?` marks a guessed kind; frames print `{ ... }` with item count and size. // The format matches the reference reader's --dump output line for line so // the two can be diffed (numbers use Python's float repr, strings JSON quoting). #pragma once #include #include #include "node.h" namespace mars::stream { // Python-compatible shortest round-trip repr of a double ("240.0", "1e-05", "3.4028234663852886e+38"). std::string py_float_repr(double v); // JSON string literal for windows-1252 bytes (non-ASCII escaped as \uXXXX, like json.dumps). std::string json_quote_cp1252(const std::string& bytes); std::vector dump_tree(const Node& root, int max_depth = 999); } // namespace mars::stream