xo-reader2: + IPrintable+DExprSeqState
This commit is contained in:
parent
6e7524a730
commit
a836c72a72
7 changed files with 155 additions and 0 deletions
|
|
@ -44,6 +44,18 @@ xo_add_genfacetimpl(
|
|||
OUTPUT_CPP_DIR src/reader2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-reader2-facetimpl-printable-exprseqstate
|
||||
FACET_PKG xo_printable2
|
||||
FACET Printable
|
||||
REPR ExprSeqState
|
||||
INPUT idl/IPrintable_DExprSeqState.json5
|
||||
OUTPUT_HPP_DIR include/xo/reader2
|
||||
OUTPUT_IMPL_SUBDIR ssm
|
||||
OUTPUT_CPP_DIR src/reader2
|
||||
)
|
||||
|
||||
# note: manual target; generated code committed to git
|
||||
xo_add_genfacetimpl(
|
||||
TARGET xo-reader2-facetimpl-syntaxstatemachine-definessm
|
||||
|
|
|
|||
13
idl/IPrintable_DExprSeqState.json5
Normal file
13
idl/IPrintable_DExprSeqState.json5
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
mode: "implementation",
|
||||
includes: [ "<xo/printable2/Printable.hpp>",
|
||||
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
|
||||
local_types: [],
|
||||
namespace1: "xo",
|
||||
namespace2: "scm",
|
||||
facet_idl: "idl/Printable.json5",
|
||||
brief: "provide APrintable interface for DExprSeqState",
|
||||
using_doxygen: true,
|
||||
repr: "DExprSeqState",
|
||||
doc: [ "implement APrintable for DExprSeqState" ],
|
||||
}
|
||||
|
|
@ -25,6 +25,13 @@ namespace xo {
|
|||
N
|
||||
};
|
||||
|
||||
const char * exprseqtype_descr(exprseqtype x);
|
||||
|
||||
inline std::ostream & operator<<(std::ostream & os, exprseqtype x) {
|
||||
os << exprseqtype_descr(x);
|
||||
return os;
|
||||
}
|
||||
|
||||
/** @class DExprSeqState
|
||||
* @brief state machine for parsing a sequence of expression
|
||||
*
|
||||
|
|
@ -33,6 +40,7 @@ namespace xo {
|
|||
class DExprSeqState {
|
||||
public:
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using ppindentinfo = xo::print::ppindentinfo;
|
||||
|
||||
public:
|
||||
explicit DExprSeqState(exprseqtype ty);
|
||||
|
|
@ -78,6 +86,13 @@ namespace xo {
|
|||
void on_parsed_symbol(std::string_view sym, ParserStateMachine * p_psm);
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-exprseq-printable-facet printable facet methods **/
|
||||
///@{
|
||||
|
||||
/** pretty-printing driver; combine layout+printing **/
|
||||
bool pretty(const ppindentinfo & ppii) const;
|
||||
|
||||
///@}
|
||||
|
||||
private:
|
||||
/** sequence type. accept rvalue expressions when
|
||||
|
|
|
|||
62
include/xo/reader2/ssm/IPrintable_DExprSeqState.hpp
Normal file
62
include/xo/reader2/ssm/IPrintable_DExprSeqState.hpp
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
/** @file IPrintable_DExprSeqState.hpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DExprSeqState.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_repr.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DExprSeqState.json5]
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Printable.hpp"
|
||||
#include <xo/printable2/Printable.hpp>
|
||||
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||
#include "DExprSeqState.hpp"
|
||||
|
||||
namespace xo { namespace scm { class IPrintable_DExprSeqState; } }
|
||||
|
||||
namespace xo {
|
||||
namespace facet {
|
||||
template <>
|
||||
struct FacetImplementation<xo::print::APrintable,
|
||||
xo::scm::DExprSeqState>
|
||||
{
|
||||
using ImplType = xo::print::IPrintable_Xfer
|
||||
<xo::scm::DExprSeqState,
|
||||
xo::scm::IPrintable_DExprSeqState>;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class IPrintable_DExprSeqState
|
||||
**/
|
||||
class IPrintable_DExprSeqState {
|
||||
public:
|
||||
/** @defgroup scm-printable-dexprseqstate-type-traits **/
|
||||
///@{
|
||||
using ppindentinfo = xo::print::APrintable::ppindentinfo;
|
||||
using Copaque = xo::print::APrintable::Copaque;
|
||||
using Opaque = xo::print::APrintable::Opaque;
|
||||
///@}
|
||||
/** @defgroup scm-printable-dexprseqstate-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** Pretty-printing support for this object.
|
||||
See [xo-indentlog/xo/indentlog/pretty.hpp] **/
|
||||
static bool pretty(const DExprSeqState & self, const ppindentinfo & ppii);
|
||||
|
||||
// non-const methods
|
||||
///@}
|
||||
};
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end */
|
||||
|
|
@ -13,6 +13,7 @@ set(SELF_SRCS
|
|||
|
||||
DExprSeqState.cpp
|
||||
ISyntaxStateMachine_DExprSeqState.cpp
|
||||
IPrintable_DExprSeqState.cpp
|
||||
|
||||
DDefineSsm.cpp
|
||||
ISyntaxStateMachine_DDefineSsm.cpp
|
||||
|
|
|
|||
|
|
@ -13,6 +13,21 @@ namespace xo {
|
|||
using xo::reflect::typeseq;
|
||||
|
||||
namespace scm {
|
||||
const char *
|
||||
exprseqtype_descr(exprseqtype x)
|
||||
{
|
||||
switch (x) {
|
||||
case exprseqtype::toplevel_interactive:
|
||||
return "toplevel-interactive";
|
||||
case exprseqtype::toplevel_batch:
|
||||
return "toplevel-batch";
|
||||
case exprseqtype::N:
|
||||
break;
|
||||
}
|
||||
|
||||
return "exprseqtype?";
|
||||
}
|
||||
|
||||
DExprSeqState::DExprSeqState(exprseqtype ty) : seqtype_{ty}
|
||||
{}
|
||||
|
||||
|
|
@ -153,6 +168,15 @@ namespace xo {
|
|||
sym,
|
||||
this->get_expect_str());
|
||||
}
|
||||
|
||||
bool
|
||||
DExprSeqState::pretty(const ppindentinfo & ppii) const
|
||||
{
|
||||
return ppii.pps()->pretty_struct
|
||||
(ppii,
|
||||
"DExprSeqState",
|
||||
refrtag("seqtype", seqtype_));
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
28
src/reader2/IPrintable_DExprSeqState.cpp
Normal file
28
src/reader2/IPrintable_DExprSeqState.cpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file IPrintable_DExprSeqState.cpp
|
||||
*
|
||||
* Generated automagically from ingredients:
|
||||
* 1. code generator:
|
||||
* [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet]
|
||||
* arguments:
|
||||
* --input [idl/IPrintable_DExprSeqState.json5]
|
||||
* 2. jinja2 template for abstract facet .hpp file:
|
||||
* [iface_facet_any.hpp.j2]
|
||||
* 3. idl for facet methods
|
||||
* [idl/IPrintable_DExprSeqState.json5]
|
||||
**/
|
||||
|
||||
#include "ssm/IPrintable_DExprSeqState.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IPrintable_DExprSeqState::pretty(const DExprSeqState & self, const ppindentinfo & ppii) -> bool
|
||||
{
|
||||
return self.pretty(ppii);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end IPrintable_DExprSeqState.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue