<commit_before>#ifndef _C4_YML_PARSE_HPP_
#define _C4_YML_PARSE_HPP_

#ifndef _C4_YML_TREE_HPP_
#include "c4/yml/tree.hpp"
#endif

#ifndef _C4_YML_NODE_HPP_
#include "c4/yml/node.hpp"
#endif

#ifndef _C4_YML_DETAIL_STACK_HPP_
#include "c4/yml/detail/stack.hpp"
#endif

#include <stdarg.h>

namespace c4 {
namespace yml {


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class Parser
{
public:

    Parser(Allocator const& a={});

public:

    //! create a new YAML tree and parse into its root
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    Tree parse(csubstr filename, csubstr src) { Tree t; t.reserve(_estimate_capacity(src)); parse(filename, t.copy_to_arena(src), &t); return t; }
    //! create a new YAML tree and parse into its root
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    Tree parse(csubstr filename,  substr src) { Tree t; t.reserve(_estimate_capacity(src)); parse(filename, src, &t); return t; }


    //! parse with reuse of a YAML tree
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    void parse(csubstr filename,  substr src, Tree *t) { parse(filename, src, t, t->root_id()); }<commit_msg>parser overloads: avoid nested calls<commit_after>#ifndef _C4_YML_PARSE_HPP_
#define _C4_YML_PARSE_HPP_

#ifndef _C4_YML_TREE_HPP_
#include "c4/yml/tree.hpp"
#endif

#ifndef _C4_YML_NODE_HPP_
#include "c4/yml/node.hpp"
#endif

#ifndef _C4_YML_DETAIL_STACK_HPP_
#include "c4/yml/detail/stack.hpp"
#endif

#include <stdarg.h>

namespace c4 {
namespace yml {


//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class Parser
{
public:

    Parser(Allocator const& a={});

public:

    //! create a new YAML tree and parse into its root
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    Tree parse(csubstr filename, csubstr src) { Tree t; t.reserve(_estimate_capacity(src)); parse(filename, t.copy_to_arena(src), &t, t.root_id()); return t; }
    //! create a new YAML tree and parse into its root
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    Tree parse(csubstr filename,  substr src) { Tree t; t.reserve(_estimate_capacity(src)); parse(filename, src, &t, t.root_id()); return t; }


    //! parse with reuse of a YAML tree
    //! @note aliases and anchors are not resolved. You
    //! can resolve by calling Tree::resolve() after parsing.
    void parse(csubstr filename,  substr src, Tree *t) { parse(filename, src, t, t->root_id()); }
{'fraction_non_alphanumeric': 0.2541168873103003, 'fraction_numerical': 0.005812076202776881, 'mean_word_length': 2.052216748768473, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4399807', 'n_tokens_mistral': 949, 'n_tokens_neox': 900, 'n_words': 288}