xo-reader: refactor: + expect_symbol_xs [wip]

This commit is contained in:
Roland Conybeare 2024-08-10 16:20:51 -05:00
commit be412cb5ae
6 changed files with 56 additions and 8 deletions

View file

@ -0,0 +1,27 @@
/* file expect_symbol_xs.hpp
*
* author: Roland Conybeare, Aug 2024
*/
#pragma once
#include "exprstate.hpp"
namespace xo {
namespace scm {
/** @class expect_symbol_xs
* @brief state machine to expect + capture a symbol
*
* For example, lhs in a define-expression
**/
class expect_symbol_xs : public exprstate {
public:
expect_symbol_xs();
static std::unique_ptr<expect_symbol_xs> expect_symbol_expression();
};
} /*namespace scm*/
} /*namespace xo*/
/* end expect_symbol_xs.hpp */

View file

@ -70,9 +70,11 @@ namespace xo {
{}
virtual ~exprstate() = default;
#ifdef RELOCATED
static std::unique_ptr<exprstate> expect_symbol() {
return std::make_unique<exprstate>(exprstate(exprstatetype::expect_symbol));
}
#endif
static std::unique_ptr<exprstate> expect_type() {
return std::make_unique<exprstate>(exprstate(exprstatetype::expect_type));
}