bistromathic: check completion

* examples/c/bistromathic/bistromathic.test: here.
* examples/c/bistromathic/parse.y (expected_tokens): Fix a memory
leak.
This commit is contained in:
Akim Demaille
2020-03-01 15:30:28 +01:00
parent 99bedadf23
commit feb1011c8b
2 changed files with 18 additions and 1 deletions

View File

@@ -79,3 +79,18 @@ cat >input <<EOF
EOF
run 0 '> 1 / 0
> err: 1.1-5: error: division by zero'
## ------------ ##
## Completion. ##
## ------------ ##
sed -e 's/\\t/ /g' >input <<EOF
( 1 + \t\t
EOF
run 0 '> ( 1 +
( cos ln
- double precision number sin
atan exp sqrt
> ( 1 +
> err: 1.7: syntax error: expected - or ( or double precision number or function or variable before end of file'

View File

@@ -356,7 +356,9 @@ expected_tokens (const char *input,
// Then query for the accepted tokens at this point.
yyparse_context_t yyctx
= {ps->yyssp, YYEMPTY, &lloc, ps->yyesa, &ps->yyes, &ps->yyes_capacity};
return yyexpected_tokens (&yyctx, tokens, ntokens);
int res = yyexpected_tokens (&yyctx, tokens, ntokens);
yypstate_delete (ps);
return res;
}
/* Attempt to complete on the contents of TEXT. START and END bound the