xo-reader2: revert c++23 feature, to keep osx clang build
This commit is contained in:
parent
f08403bfe3
commit
315c066734
14 changed files with 57 additions and 63 deletions
|
|
@ -2,10 +2,7 @@
|
|||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
|
||||
# relying on
|
||||
# this auto&&
|
||||
#
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
#set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
project(xo_reader2 VERSION 1.0)
|
||||
enable_language(CXX)
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ namespace xo {
|
|||
/** @defgroup scm-definessm-access-methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DDefineSsm"; }
|
||||
static const char * ssm_classname() { return "DDefineSsm"; }
|
||||
|
||||
/** identify this nested state machine **/
|
||||
defexprstatetype defstate() const noexcept { return defstate_; }
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace xo {
|
|||
/** @defgroup scm-expectexpr-access-methods access methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectExprSsm"; }
|
||||
static const char * ssm_classname() { return "DExpectExprSsm"; }
|
||||
bool allow_defs() const noexcept { return allow_defs_; }
|
||||
bool cxl_on_rightbrace() const noexcept { return cxl_on_rightbrace_; }
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ namespace xo {
|
|||
/** @defgroup scm-expectformalargssm-methods general methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectFormalArgSsm"; }
|
||||
static const char * ssm_classname() { return "DExpectFormalArgSsm"; }
|
||||
|
||||
/** update state on incoming colon token @p tk;
|
||||
* with overall parser state in @p p_psm
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ namespace xo {
|
|||
/** @defgroup scm-expectformalarglistssm-methods general methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectFormalArglistSsm"; }
|
||||
static const char * ssm_classname() { return "DExpectFormalArglistSsm"; }
|
||||
|
||||
/** update state on incoming token @p tk, with overall parser state in @p p_psm **/
|
||||
void on_leftparen_token(const Token & tk,
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ namespace xo {
|
|||
static void on_symbol_token(const Token & tk,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectSymbolSsm"; }
|
||||
static const char * ssm_classname() { return "DExpectSymbolSsm"; }
|
||||
|
||||
/** @defgroup scm-expectsymbol-ssm-facet syntaxstatemachine facet methods **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace xo {
|
|||
|
||||
static void start(ParserStateMachine * p_psm);
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DExpectTypeSsm"; }
|
||||
static const char * ssm_classname() { return "DExpectTypeSsm"; }
|
||||
|
||||
/** @defgroup scm-expecttype-ssm-facet syntaxstatemachine facet methods **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace xo {
|
|||
ParserStateMachine * p_psm);
|
||||
|
||||
public:
|
||||
const char * ssm_classname() const noexcept { return "DExprSeqState"; }
|
||||
static const char * ssm_classname() { return "DExprSeqState"; }
|
||||
|
||||
/** @defgroup scm-exprseq-ssm-facet syntaxstatemachine facet methods **/
|
||||
///@{
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace xo {
|
|||
/** @class DIfElseSsm
|
||||
* @brief syntax state machine for parsing a conditional expression
|
||||
**/
|
||||
class DIfElseSsm : public DSyntaxStateMachine<DIfElseExpr> {
|
||||
class DIfElseSsm : public DSyntaxStateMachine<DIfElseSsm> {
|
||||
public:
|
||||
using Super = DSyntaxStateMachine<DIfElseExpr>;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
|
|
@ -89,7 +89,9 @@ namespace xo {
|
|||
obj<AAllocator> expr_mm,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DIfElseSsm"; }
|
||||
static const char * ssm_classname() { return "DIfElseSsm"; }
|
||||
|
||||
DSyntaxStateMachine<DIfElseSsm> * super() { return this; }
|
||||
|
||||
///@}
|
||||
/** @defgroup scm-ifelsessm-expression-methods general methods **/
|
||||
|
|
@ -142,27 +144,6 @@ namespace xo {
|
|||
void on_semicolon_token(const Token & tk,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
#ifdef OBSOLETE
|
||||
/** update state for this syntax after parsing a symbol @p sym,
|
||||
* with overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_symbol(std::string_view sym,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state for this syntax after parsing a type description @p td;
|
||||
* overall parser state in @p p_psm
|
||||
**/
|
||||
void on_parsed_typedescr(TypeDescr td,
|
||||
ParserStateMachine * p_psm);
|
||||
|
||||
/** update state to consume formal param (name,value)
|
||||
* from nested ssm
|
||||
**/
|
||||
void on_parsed_formal(const DUniqueString * param_name,
|
||||
TypeDescr param_type,
|
||||
ParserStateMachine * p_psm);
|
||||
#endif
|
||||
|
||||
/** update state for this syntax after parsing an expression @p expr,
|
||||
* overall parser state in @p p_psm.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ namespace xo {
|
|||
/** @defgroup scm-lambdassm-methods **/
|
||||
///@{
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DLambdaSsm"; }
|
||||
static const char * ssm_classname() { return "DLambdaSsm"; }
|
||||
|
||||
static void start(ParserStateMachine * p_psm);
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ namespace xo {
|
|||
parserstatemachine * p_psm) const;
|
||||
#endif
|
||||
|
||||
const char * ssm_classname() const noexcept { return "DProgressSsm"; }
|
||||
static const char * ssm_classname() { return "DProgressSsm"; }
|
||||
|
||||
std::string_view get_expect_str() const noexcept;
|
||||
|
||||
|
|
|
|||
|
|
@ -33,43 +33,51 @@ namespace xo {
|
|||
|
||||
/** Default implementation for required SyntaxStateMachine facet method
|
||||
**/
|
||||
void on_token(this auto&& self,
|
||||
const Token & tk,
|
||||
void on_token(const Token & tk,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_input_on_token(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = reinterpret_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_input_on_token(Derived::ssm_classname(),
|
||||
tk,
|
||||
self.get_expect_str());
|
||||
}
|
||||
|
||||
void on_parsed_symbol(this auto&& self,
|
||||
std::string_view sym,
|
||||
void on_parsed_symbol(std::string_view sym,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_input_on_symbol(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = reinterpret_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_input_on_symbol(Derived::ssm_classname(),
|
||||
sym,
|
||||
self.get_expect_str());
|
||||
}
|
||||
|
||||
/** Default implementation for required SyntaxStateMachine facet method
|
||||
**/
|
||||
void on_parsed_typedescr(this auto&& self,
|
||||
TypeDescr td,
|
||||
void on_parsed_typedescr(TypeDescr td,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_input_on_typedescr(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = reinterpret_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_input_on_typedescr(Derived::ssm_classname(),
|
||||
td,
|
||||
self.get_expect_str());
|
||||
}
|
||||
|
||||
/** Default implementation for required SyntaxStateMachine facet method
|
||||
**/
|
||||
void on_parsed_formal(this auto&& self,
|
||||
const DUniqueString * param_name,
|
||||
void on_parsed_formal(const DUniqueString * param_name,
|
||||
TypeDescr param_type,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_formal(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = reinterpret_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_parsed_formal(Derived::ssm_classname(),
|
||||
param_name,
|
||||
param_type,
|
||||
self.get_expect_str());
|
||||
|
|
@ -79,22 +87,26 @@ namespace xo {
|
|||
*
|
||||
* arglist is DArray of obj<AGCObejct,DVariable>
|
||||
**/
|
||||
void on_parsed_formal_arglist(this auto&& self,
|
||||
DArray * arglist,
|
||||
void on_parsed_formal_arglist(DArray * arglist,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_formal_arglist(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = static_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_parsed_formal_arglist(Derived::ssm_classname(),
|
||||
arglist,
|
||||
self.get_expect_str());
|
||||
}
|
||||
|
||||
/** Default implementation for required SyntaxStateMachine facet method
|
||||
**/
|
||||
void on_parsed_expression(this auto&& self,
|
||||
obj<AExpression> expr,
|
||||
void on_parsed_expression(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
p_psm->illegal_parsed_expression(self.ssm_classname(),
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = static_cast<Derived&>(*this);
|
||||
|
||||
p_psm->illegal_parsed_expression(Derived::ssm_classname(),
|
||||
expr,
|
||||
self.get_expect_str());
|
||||
|
||||
|
|
@ -102,15 +114,17 @@ namespace xo {
|
|||
|
||||
/** Default implementation for required SyntaxStateMachine facet method
|
||||
**/
|
||||
void on_parsed_expression_with_semicolon(this auto&& self,
|
||||
obj<AExpression> expr,
|
||||
void on_parsed_expression_with_semicolon(obj<AExpression> expr,
|
||||
ParserStateMachine * p_psm)
|
||||
{
|
||||
// starting with c++23 can use "this auto&& self" instead
|
||||
Derived & self = static_cast<Derived&>(*this);
|
||||
|
||||
// We don't need a separate entry point,
|
||||
// since the semicolon isn't relevant to problem with syntax
|
||||
//
|
||||
|
||||
p_psm->illegal_parsed_expression(self.ssm_classname(),
|
||||
p_psm->illegal_parsed_expression(Derived::ssm_classname(),
|
||||
expr,
|
||||
self.get_expect_str());
|
||||
|
||||
|
|
|
|||
|
|
@ -261,10 +261,12 @@ namespace xo {
|
|||
**/
|
||||
DLocalSymtab * local_symtab_ = nullptr;
|
||||
|
||||
#ifdef NOT_YET
|
||||
/** global symbol table.
|
||||
* Toplevel definitions go here.
|
||||
**/
|
||||
DGlobalSymtab * global_symtab_ = nullptr;
|
||||
#endif
|
||||
|
||||
/** current output from parser **/
|
||||
ParserResult result_;
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ namespace xo {
|
|||
break;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -207,7 +207,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -225,7 +225,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -243,7 +243,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
|
|
@ -313,7 +313,7 @@ namespace xo {
|
|||
return;
|
||||
}
|
||||
|
||||
Super::on_token(tk, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_token(tk, p_psm);
|
||||
}
|
||||
|
||||
#ifdef NOT_YET
|
||||
|
|
@ -402,7 +402,7 @@ namespace xo {
|
|||
break;
|
||||
}
|
||||
|
||||
Super::on_parsed_expression(expr, p_psm);
|
||||
DSyntaxStateMachine<DIfElseSsm>::on_parsed_expression(expr, p_psm);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue