xo-tokenizer: pretty-printing debug support

This commit is contained in:
Roland Conybeare 2025-07-13 21:19:52 -05:00
commit 55602c83cc
4 changed files with 25 additions and 1 deletions

View file

@ -3,6 +3,7 @@
#pragma once #pragma once
#include "xo/indentlog/scope.hpp" #include "xo/indentlog/scope.hpp"
#include "xo/indentlog/print/ppdetail_atomic.hpp"
#include <ostream> #include <ostream>
#include <cstdint> #include <cstdint>
#include <cassert> #include <cassert>
@ -266,5 +267,14 @@ namespace xo {
return os; return os;
} }
#ifndef ppdetail_atomic
template <typename CharT> \
PPDETAIL_ATOMIC_BODY(printspan_impl<CharT>);
template <typename CharT> \
PPDETAIL_ATOMIC_BODY(xo::scm::span<CharT>);
#endif
} }
} /*namespace xo*/ } /*namespace xo*/

View file

@ -420,6 +420,13 @@ namespace xo {
return os; return os;
} }
} /*Namespace scm*/ } /*Namespace scm*/
#ifndef ppdetail_atomic
namespace print {
PPDETAIL_ATOMIC(xo::scm::token<char>);
}
#endif
} /*namespace xo*/ } /*namespace xo*/
/* end token.hpp */ /* end token.hpp */

View file

@ -10,6 +10,7 @@
#include "span.hpp" #include "span.hpp"
#include "scan_result.hpp" #include "scan_result.hpp"
#include "xo/indentlog/scope.hpp" #include "xo/indentlog/scope.hpp"
#include "xo/indentlog/print/ppdetail_atomic.hpp"
#include <cassert> #include <cassert>
namespace xo { namespace xo {

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include "xo/indentlog/print/tag.hpp" // for STRINGIFY #include "xo/indentlog/print/tag.hpp" // for STRINGIFY
#include "xo/indentlog/print/ppdetail_atomic.hpp"
#include <ostream> #include <ostream>
namespace xo { namespace xo {
@ -159,8 +160,13 @@ namespace xo {
os << tokentype_descr(tk_type); os << tokentype_descr(tk_type);
return os; return os;
} }
} /*namespace scm*/ } /*namespace scm*/
#ifndef ppdetail_atomic
namespace print {
PPDETAIL_ATOMIC(xo::scm::tokentype);
} /*namespace print*/
#endif
} /*namespace xo*/ } /*namespace xo*/
/* end tokentype.hpp */ /* end tokentype.hpp */