xo-reader: streamline: drop redundant admits_xxx() methods
This commit is contained in:
parent
f1f5b44a81
commit
e9e0d5255f
8 changed files with 29 additions and 44 deletions
|
|
@ -88,24 +88,11 @@ namespace xo {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef OBSOLETE
|
||||
bool
|
||||
define_xs::admits_singleassign() const {
|
||||
switch (defxs_type_) {
|
||||
|
||||
/*
|
||||
* def foo = 1 ;
|
||||
* def foo : f64 = 1 ;
|
||||
* ^ ^ ^ ^ ^ ^ ^
|
||||
* | | | | | | (done)
|
||||
* | | | | | def_4:expect_rhs_expression
|
||||
* | | | | def_3
|
||||
* | | | def_2:expect_type
|
||||
* | | def_1
|
||||
* | def_0:expect_symbol
|
||||
* expect_toplevel_expression_sequence
|
||||
*
|
||||
* note that we skip from def_1 -> def_4 if '=' instead of ':'
|
||||
*/
|
||||
case defexprstatetype::def_0:
|
||||
return false;
|
||||
|
||||
|
|
@ -131,6 +118,7 @@ namespace xo {
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OBSOLETE
|
||||
bool
|
||||
|
|
@ -367,10 +355,20 @@ namespace xo {
|
|||
|
||||
constexpr const char * self_name = "exprstate::on_singleassign";
|
||||
|
||||
if (!this->admits_singleassign()) {
|
||||
this->illegal_input_error(self_name, tk);
|
||||
}
|
||||
|
||||
/*
|
||||
* def foo = 1 ;
|
||||
* def foo : f64 = 1 ;
|
||||
* ^ ^ ^ ^ ^ ^ ^
|
||||
* | | | | | | (done)
|
||||
* | | | | | def_4:expect_rhs_expression
|
||||
* | | | | def_3
|
||||
* | | | def_2:expect_type
|
||||
* | | def_1
|
||||
* | def_0:expect_symbol
|
||||
* expect_toplevel_expression_sequence
|
||||
*
|
||||
* note that we skip from def_1 -> def_4 if '=' instead of ':'
|
||||
*/
|
||||
if ((this->defxs_type_ == defexprstatetype::def_1)
|
||||
|| (this->defxs_type_ == defexprstatetype::def_3))
|
||||
{
|
||||
|
|
@ -378,7 +376,7 @@ namespace xo {
|
|||
|
||||
p_stack->push_exprstate(expect_expr_xs::expect_rhs_expression());
|
||||
} else {
|
||||
assert(false);
|
||||
this->illegal_input_error(self_name, tk);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ namespace xo {
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef OBSOLETE
|
||||
bool
|
||||
exprstate::admits_singleassign() const {
|
||||
switch (exs_type_) {
|
||||
|
|
@ -118,6 +119,7 @@ namespace xo {
|
|||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
exprstate::on_def_token(const token_type & tk,
|
||||
|
|
@ -193,14 +195,9 @@ namespace xo {
|
|||
|
||||
constexpr const char * self_name = "exprstate::on_singleassign_token";
|
||||
|
||||
if (!this->admits_singleassign())
|
||||
{
|
||||
throw std::runtime_error(tostr(self_name,
|
||||
": unexpected equals for parsing state",
|
||||
xtag("state", *this)));
|
||||
}
|
||||
|
||||
assert(false);
|
||||
throw std::runtime_error(tostr(self_name,
|
||||
": unexpected equals for parsing state",
|
||||
xtag("state", *this)));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -17,9 +17,6 @@ namespace xo {
|
|||
bool
|
||||
paren_xs::admits_symbol() const { return true; }
|
||||
|
||||
bool
|
||||
paren_xs::admits_singleassign() const { return false; }
|
||||
|
||||
bool
|
||||
paren_xs::admits_rightparen() const {
|
||||
switch (parenxs_type_) {
|
||||
|
|
|
|||
|
|
@ -17,14 +17,6 @@ namespace xo {
|
|||
bool
|
||||
progress_xs::admits_symbol() const { return false; }
|
||||
|
||||
#ifdef OSBOLETE
|
||||
bool
|
||||
progress_xs::admits_semicolon() const { return true; }
|
||||
#endif
|
||||
|
||||
bool
|
||||
progress_xs::admits_singleassign() const { return false; }
|
||||
|
||||
bool
|
||||
progress_xs::admits_f64() const { return false; }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue