diff --git a/xo-expression2/include/xo/expression2/Constant.hpp b/xo-expression2/include/xo/expression2/Constant.hpp new file mode 100644 index 00000000..29e6694f --- /dev/null +++ b/xo-expression2/include/xo/expression2/Constant.hpp @@ -0,0 +1,13 @@ +/** @file Constant.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include "DConstant.hpp" +#include "detail/IExpression_DConstant.hpp" +#include "detail/IGCObject_DConstant.hpp" +#include "detail/IPrintable_DConstant.hpp" + +/* end Constant.hpp */ diff --git a/xo-facet/include/xo/facet/OObject.hpp b/xo-facet/include/xo/facet/OObject.hpp index e4ed5b06..e6eb0f6d 100644 --- a/xo-facet/include/xo/facet/OObject.hpp +++ b/xo-facet/include/xo/facet/OObject.hpp @@ -253,6 +253,15 @@ namespace xo { //iface_ = *std::launder(&iface_); } + /** use this to access non-facet methods, + * _when representation is known at compile time_. + * + * Deliberately disable this for variants + **/ + DRepr * operator->() + requires (!std::is_same_v) + { return data_; } + #ifdef NOPE DRepr & operator*() { return *data_; } #endif diff --git a/xo-object2/include/xo/object2/DInteger.hpp b/xo-object2/include/xo/object2/DInteger.hpp index c56a4be1..b03693be 100644 --- a/xo-object2/include/xo/object2/DInteger.hpp +++ b/xo-object2/include/xo/object2/DInteger.hpp @@ -28,7 +28,7 @@ namespace xo { /** allocate boxed value @p x using memory from @p mm **/ static DInteger * _box(obj mm, long x); - double value() const noexcept { return value_; } + long value() const noexcept { return value_; } bool pretty(const ppindentinfo & ppii) const; diff --git a/xo-object2/include/xo/object2/Integer.hpp b/xo-object2/include/xo/object2/Integer.hpp new file mode 100644 index 00000000..7279f97d --- /dev/null +++ b/xo-object2/include/xo/object2/Integer.hpp @@ -0,0 +1,12 @@ +/** @file Integer.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include "DInteger.hpp" +#include "number/IGCObject_DInteger.hpp" +#include "number/IPrintable_DInteger.hpp" + +/* end Integer.hpp */ diff --git a/xo-reader2/utest/SchematikaParser.test.cpp b/xo-reader2/utest/SchematikaParser.test.cpp index 29697389..0761ce39 100644 --- a/xo-reader2/utest/SchematikaParser.test.cpp +++ b/xo-reader2/utest/SchematikaParser.test.cpp @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include #include @@ -18,11 +20,15 @@ namespace xo { using xo::scm::syntaxstatetype; // using xo::scm::DDefineSsm; using xo::scm::DExpectExprSsm; + using xo::scm::AExpression; + using xo::scm::DConstant; // using xo::scm::defexprstatetype; //using xo::scm::ParserResult; //using xo::scm::parser_result_type; using xo::scm::Token; using xo::scm::DString; + using xo::scm::DInteger; + using xo::mm::AGCObject; using xo::mm::ArenaConfig; using xo::mm::AAllocator; using xo::mm::DArena; @@ -244,6 +250,17 @@ namespace xo { REQUIRE(!result.is_error()); REQUIRE(result.is_expression()); REQUIRE(result.result_expr()); + + auto expr = obj::from(result.result_expr()); + REQUIRE(expr); + + REQUIRE(expr->value()); + + auto value_i64 = obj::from(expr->value()); + + REQUIRE(value_i64); + + REQUIRE(value_i64->value() == 1011); } //REQUIRE(result.is_error());