LCOV - code coverage report
Current view: top level - src/parse - ASTPrinter.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 4 100.0 %
Date: 2025-03-25 01:19:55 Functions: 3 4 75.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : #include <mutable/parse/AST.hpp>
       2                 :            : 
       3                 :            : 
       4                 :            : namespace m {
       5                 :            : 
       6                 :            : namespace ast {
       7                 :            : 
       8                 :            : /** Pretty-prints the AST in SQL. */
       9                 :            : struct M_EXPORT ASTPrinter : ConstASTVisitor
      10                 :            : {
      11                 :            :     public:
      12                 :            :     std::ostream &out; ///< the output stream to write to
      13                 :            :     private:
      14                 :            :     unsigned indent_; ///< the current level of indentation
      15                 :       6296 :     bool is_nested_ = false; ///< whether the statement is nested; determines whether a final ';' must be printed
      16                 :       6296 :     bool expand_nested_queries_ = true; ///< determines whether nested queries are printed
      17                 :            : 
      18                 :            :     public:
      19                 :      12592 :     ASTPrinter(std::ostream &out, unsigned indent = 0) : out(out), indent_(indent) { (void)(this->indent_); }
      20                 :            : 
      21                 :            :     bool expand_nested_queries() { return expand_nested_queries_; }
      22                 :       6084 :     void expand_nested_queries(bool expand) { expand_nested_queries_ = expand; }
      23                 :            : 
      24                 :            :     using ConstASTVisitor::operator();
      25                 :            : #define DECLARE(CLASS) void operator()(Const<CLASS>&) override;
      26                 :            :     M_AST_LIST(DECLARE)
      27                 :            : #undef DECLARE
      28                 :            : };
      29                 :            : 
      30                 :            : }
      31                 :            : 
      32                 :            : }

Generated by: LCOV version 1.16