xo-reader: simplify: adopt exprseq_xs + drop .admits_definition()

This commit is contained in:
Roland Conybeare 2024-08-09 19:43:00 -04:00
commit 424a4cd0f1
11 changed files with 39 additions and 3 deletions

View file

@ -42,7 +42,9 @@ namespace xo {
defexprstatetype defxs_type() const { return defxs_type_; }
#ifdef OBSOLETE
virtual bool admits_definition() const override;
#endif
virtual bool admits_symbol() const override;
virtual bool admits_colon() const override;
virtual bool admits_semicolon() const override;

View file

@ -15,6 +15,11 @@ namespace xo {
*
**/
class exprseq_xs : public exprstate {
public:
exprseq_xs();
static std::unique_ptr<exprseq_xs> expect_toplevel_expression_sequence();
public:
// ----- token input methods -----

View file

@ -70,9 +70,11 @@ namespace xo {
{}
virtual ~exprstate() = default;
#ifdef RELOCATED
static std::unique_ptr<exprstate> expect_toplevel_expression_sequence() {
return std::make_unique<exprstate>(exprstate(exprstatetype::expect_toplevel_expression_sequence));
}
#endif
static std::unique_ptr<exprstate> expect_rhs_expression() {
return std::make_unique<exprstate>(exprstate(exprstatetype::expect_rhs_expression));
}
@ -85,10 +87,12 @@ namespace xo {
exprstatetype exs_type() const { return exs_type_; }
#ifdef OBSOLETE
/** true iff this parsing state admits a 'def' keyword
* as next token
**/
virtual bool admits_definition() const;
#endif
/** true iff this parsing state admits a symbol as next token **/
virtual bool admits_symbol() const;
/** true iff this parsing state admits a colon as next token **/

View file

@ -31,7 +31,9 @@ namespace xo {
static std::unique_ptr<paren_xs> lparen_0();
#ifdef OBSOLETE
virtual bool admits_definition() const override;
#endif
virtual bool admits_symbol() const override;
virtual bool admits_colon() const override;
virtual bool admits_semicolon() const override;

View file

@ -22,7 +22,9 @@ namespace xo {
static std::unique_ptr<progress_xs> make(rp<Expression> valex);
#ifdef OBSOLETE
virtual bool admits_definition() const override;
#endif
virtual bool admits_symbol() const override;
virtual bool admits_colon() const override;
virtual bool admits_semicolon() const override;