xo-reader: + formal arglist error reporting
This commit is contained in:
parent
c6f6ee17d2
commit
5ed8999ccf
2 changed files with 21 additions and 1 deletions
|
|
@ -16,7 +16,7 @@ namespace xo {
|
||||||
* ^ ^ ^ ^ ^
|
* ^ ^ ^ ^ ^
|
||||||
* | | | | |
|
* | | | | |
|
||||||
* | | | | argl_1b
|
* | | | | argl_1b
|
||||||
* | argl_1a | argla
|
* | argl_1a | argl_1a
|
||||||
* argl_0 argl_1b
|
* argl_0 argl_1b
|
||||||
*
|
*
|
||||||
* argl_0 --on_leftparen_token()--> argl_1a
|
* argl_0 --on_leftparen_token()--> argl_1a
|
||||||
|
|
@ -55,6 +55,8 @@ namespace xo {
|
||||||
|
|
||||||
static void start(parserstatemachine * p_psm);
|
static void start(parserstatemachine * p_psm);
|
||||||
|
|
||||||
|
virtual const char * get_expect_str() const override;
|
||||||
|
|
||||||
virtual void on_leftparen_token(const token_type & tk,
|
virtual void on_leftparen_token(const token_type & tk,
|
||||||
parserstatemachine * p_psm) override;
|
parserstatemachine * p_psm) override;
|
||||||
virtual void on_formal(const rp<Variable> & formal,
|
virtual void on_formal(const rp<Variable> & formal,
|
||||||
|
|
|
||||||
|
|
@ -43,6 +43,24 @@ namespace xo {
|
||||||
p_psm->push_exprstate(expect_formal_arglist_xs::make());
|
p_psm->push_exprstate(expect_formal_arglist_xs::make());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
expect_formal_arglist_xs::get_expect_str() const {
|
||||||
|
switch (farglxs_type_) {
|
||||||
|
case formalarglstatetype::invalid:
|
||||||
|
case formalarglstatetype::n_formalarglstatetype:
|
||||||
|
assert(false); // impossible
|
||||||
|
break;
|
||||||
|
case formalarglstatetype::argl_0:
|
||||||
|
return "leftparen";
|
||||||
|
case formalarglstatetype::argl_1a:
|
||||||
|
return "formal-name";
|
||||||
|
case formalarglstatetype::argl_1b:
|
||||||
|
return "comma|rightparen";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "?expect";
|
||||||
|
}
|
||||||
|
|
||||||
expect_formal_arglist_xs::expect_formal_arglist_xs()
|
expect_formal_arglist_xs::expect_formal_arglist_xs()
|
||||||
: exprstate(exprstatetype::expect_formal_arglist),
|
: exprstate(exprstatetype::expect_formal_arglist),
|
||||||
farglxs_type_{formalarglstatetype::argl_0}
|
farglxs_type_{formalarglstatetype::argl_0}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue