xo-reader2: + f64 toplevel constant in interactive session
This commit is contained in:
parent
610afe7677
commit
87534edb80
2 changed files with 31 additions and 1 deletions
|
|
@ -173,7 +173,7 @@ main()
|
||||||
// accepting defaults too
|
// accepting defaults too
|
||||||
ReaderConfig rdr_config;
|
ReaderConfig rdr_config;
|
||||||
{
|
{
|
||||||
//rdr_config.reader_debug_flag_ = true;
|
rdr_config.reader_debug_flag_ = true;
|
||||||
//rdr_config.parser_debug_flag_ = true;
|
//rdr_config.parser_debug_flag_ = true;
|
||||||
//rdr_config.tk_debug_flag_ = true;
|
//rdr_config.tk_debug_flag_ = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,18 @@
|
||||||
#include "DExprSeqState.hpp"
|
#include "DExprSeqState.hpp"
|
||||||
#include "DDefineSsm.hpp"
|
#include "DDefineSsm.hpp"
|
||||||
#include "ssm/ISyntaxStateMachine_DExprSeqState.hpp"
|
#include "ssm/ISyntaxStateMachine_DExprSeqState.hpp"
|
||||||
|
#include <xo/reader2/DProgressSsm.hpp>
|
||||||
|
#include <xo/expression2/DConstant.hpp>
|
||||||
|
#include <xo/expression2/detail/IExpression_DConstant.hpp>
|
||||||
|
#include <xo/object2/DFloat.hpp>
|
||||||
|
#include <xo/object2/number/IGCObject_DFloat.hpp>
|
||||||
|
#include <xo/gc/GCObject.hpp>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
|
using xo::scm::DProgressSsm;
|
||||||
|
using xo::scm::DConstant;
|
||||||
|
using xo::scm::DFloat;
|
||||||
|
using xo::mm::AGCObject;
|
||||||
using xo::mm::AAllocator;
|
using xo::mm::AAllocator;
|
||||||
using xo::facet::with_facet;
|
using xo::facet::with_facet;
|
||||||
using xo::reflect::typeseq;
|
using xo::reflect::typeseq;
|
||||||
|
|
@ -182,6 +192,26 @@ namespace xo {
|
||||||
DExprSeqState::on_f64_token(const Token & tk,
|
DExprSeqState::on_f64_token(const Token & tk,
|
||||||
ParserStateMachine * p_psm)
|
ParserStateMachine * p_psm)
|
||||||
{
|
{
|
||||||
|
switch (seqtype_) {
|
||||||
|
case exprseqtype::toplevel_interactive:
|
||||||
|
{
|
||||||
|
auto f64o = DFloat::box<AGCObject>(p_psm->expr_alloc(),
|
||||||
|
tk.f64_value());
|
||||||
|
auto * dconst = DConstant::make(p_psm->expr_alloc(), f64o);
|
||||||
|
auto expr = with_facet<AExpression>::mkobj(dconst);
|
||||||
|
|
||||||
|
DProgressSsm::start(p_psm->parser_alloc(),
|
||||||
|
expr,
|
||||||
|
p_psm);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case exprseqtype::toplevel_batch:
|
||||||
|
break;
|
||||||
|
case exprseqtype::N:
|
||||||
|
assert(false); // unreachable
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
p_psm->illegal_input_on_token("DExprSeqState::on_f64_token",
|
p_psm->illegal_input_on_token("DExprSeqState::on_f64_token",
|
||||||
tk,
|
tk,
|
||||||
this->get_expect_str());
|
this->get_expect_str());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue