remove leftover junk
parent
d2b53b174e
commit
6d6a115d0c
|
@ -475,7 +475,7 @@ void gen_state::gen_block() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::pair<std::size_t, std::string_view> gen_state::gen_block(
|
std::pair<std::size_t, std::string_view> gen_state::gen_block(
|
||||||
std::string_view v, std::size_t line, int ret_type, int term
|
std::string_view v, std::size_t line, int ltype, int term
|
||||||
) {
|
) {
|
||||||
auto csz = code.size();
|
auto csz = code.size();
|
||||||
code.push_back(BC_INST_BLOCK);
|
code.push_back(BC_INST_BLOCK);
|
||||||
|
@ -495,13 +495,13 @@ std::pair<std::size_t, std::string_view> gen_state::gen_block(
|
||||||
ret_line = ps.current_line;
|
ret_line = ps.current_line;
|
||||||
}
|
}
|
||||||
if (code.size() > (csz + 2)) {
|
if (code.size() > (csz + 2)) {
|
||||||
code.push_back(BC_INST_EXIT | ret_type);
|
code.push_back(BC_INST_EXIT | ret_code(ltype));
|
||||||
/* encode the block size in BC_INST_BLOCK */
|
/* encode the block size in BC_INST_BLOCK */
|
||||||
code[csz] |= (std::uint32_t(code.size() - csz - 1) << 8);
|
code[csz] |= (std::uint32_t(code.size() - csz - 1) << 8);
|
||||||
} else {
|
} else {
|
||||||
/* empty code */
|
/* empty code */
|
||||||
code.resize(csz);
|
code.resize(csz);
|
||||||
code.push_back(BC_INST_EMPTY | ret_type);
|
code.push_back(BC_INST_EMPTY | ret_code(ltype));
|
||||||
}
|
}
|
||||||
return std::make_pair(ret_line, v);
|
return std::make_pair(ret_line, v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,7 +99,7 @@ struct gen_state {
|
||||||
void gen_block();
|
void gen_block();
|
||||||
std::pair<std::size_t, std::string_view> gen_block(
|
std::pair<std::size_t, std::string_view> gen_block(
|
||||||
std::string_view v, std::size_t line,
|
std::string_view v, std::size_t line,
|
||||||
int ret_type = BC_RET_NULL, int term = '\0'
|
int ltype = VAL_NULL, int term = '\0'
|
||||||
);
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -396,13 +396,6 @@ std::string_view parser_state::get_word() {
|
||||||
return std::string_view{beg, std::size_t(source - beg)};
|
return std::string_view{beg, std::size_t(source - beg)};
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int ret_code(int type, int def = 0) {
|
|
||||||
if (type >= VAL_ANY) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
return type << BC_INST_RET;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool compilearg(
|
static bool compilearg(
|
||||||
parser_state &gs, int wordtype, charbuf *word = nullptr
|
parser_state &gs, int wordtype, charbuf *word = nullptr
|
||||||
);
|
);
|
||||||
|
@ -710,7 +703,7 @@ static void compileblockmain(parser_state &gs, int wordtype) {
|
||||||
case VAL_COND: {
|
case VAL_COND: {
|
||||||
auto ret = gs.gs.gen_block(std::string_view{
|
auto ret = gs.gs.gen_block(std::string_view{
|
||||||
start, gs.send
|
start, gs.send
|
||||||
}, curline, BC_RET_NULL, ']');
|
}, curline, VAL_NULL, ']');
|
||||||
gs.source = ret.second.data();
|
gs.source = ret.second.data();
|
||||||
gs.send = ret.second.data() + ret.second.size();
|
gs.send = ret.second.data() + ret.second.size();
|
||||||
gs.current_line = ret.first;
|
gs.current_line = ret.first;
|
||||||
|
|
Loading…
Reference in New Issue