xo-reader: wip: + exprseq_xs class
This commit is contained in:
parent
74099cacab
commit
04f79eaf01
4 changed files with 65 additions and 1 deletions
28
include/xo/reader/exprseq_xs.hpp
Normal file
28
include/xo/reader/exprseq_xs.hpp
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
/** @file exprseq_xs.hpp
|
||||
*
|
||||
* Author: Roland Conybeare
|
||||
**/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "exprstate.hpp"
|
||||
//#include <cstdint>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
/** @class exprseq_xs
|
||||
* @brief parsing state-machine for top-level expression sequence
|
||||
*
|
||||
**/
|
||||
class exprseq_xs : public exprstate {
|
||||
public:
|
||||
// ----- token input methods -----
|
||||
|
||||
virtual void on_def_token(const token_type & tk,
|
||||
exprstatestack * p_stack) override;
|
||||
};
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
/** end exprseq_xs.hpp **/
|
||||
|
|
@ -7,7 +7,8 @@ set(SELF_SRCS
|
|||
exprstate.cpp
|
||||
define_xs.cpp
|
||||
progress_xs.cpp
|
||||
paren_xs.cpp)
|
||||
paren_xs.cpp
|
||||
exprseq_xs.cpp)
|
||||
|
||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||
xo_dependency(${SELF_LIB} xo_expression)
|
||||
|
|
|
|||
33
src/reader/exprseq_xs.cpp
Normal file
33
src/reader/exprseq_xs.cpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/* @file exprseq_xs.cpp */
|
||||
|
||||
#include "exprseq_xs.hpp"
|
||||
#include "define_xs.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
void
|
||||
exprseq_xs::on_def_token(const token_type & /*tk*/,
|
||||
exprstatestack * p_stack)
|
||||
{
|
||||
constexpr bool c_debug_flag = true;
|
||||
scope log(XO_DEBUG(c_debug_flag));
|
||||
|
||||
//constexpr const char * c_self_name = "exprseq_xs::on_def_token";
|
||||
|
||||
p_stack->push_exprstate(define_xs::def_0());
|
||||
|
||||
/* todo: replace:
|
||||
* expect_symbol_or_function_signature()
|
||||
*/
|
||||
p_stack->push_exprstate(exprstate::expect_symbol());
|
||||
|
||||
/* keyword 'def' introduces a definition:
|
||||
* def pi : f64 = 3.14159265
|
||||
* def sq(x : f64) -> f64 { (x * x) }
|
||||
*/
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
||||
/* end exprseq_xs.cpp */
|
||||
|
|
@ -41,6 +41,7 @@ namespace xo {
|
|||
return "???";
|
||||
}
|
||||
|
||||
#ifdef OBSOLETE
|
||||
bool
|
||||
exprstate::admits_definition() const {
|
||||
switch (exs_type_) {
|
||||
|
|
@ -69,6 +70,7 @@ namespace xo {
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool
|
||||
exprstate::admits_symbol() const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue