[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] bistromathic: check completion
From: |
Akim Demaille |
Subject: |
[PATCH 1/6] bistromathic: check completion |
Date: |
Tue, 3 Mar 2020 18:35:21 +0100 |
* examples/c/bistromathic/bistromathic.test: here.
* examples/c/bistromathic/parse.y (expected_tokens): Fix a memory
leak.
---
examples/c/bistromathic/bistromathic.test | 15 +++++++++++++++
examples/c/bistromathic/parse.y | 4 +++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/examples/c/bistromathic/bistromathic.test
b/examples/c/bistromathic/bistromathic.test
index f42fb29d..ad614283 100755
--- a/examples/c/bistromathic/bistromathic.test
+++ b/examples/c/bistromathic/bistromathic.test
@@ -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'
diff --git a/examples/c/bistromathic/parse.y b/examples/c/bistromathic/parse.y
index 4591b64f..971f9b56 100644
--- a/examples/c/bistromathic/parse.y
+++ b/examples/c/bistromathic/parse.y
@@ -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
--
2.25.1
- [PATCH 0/6] Address some limitations in the bistro example, Akim Demaille, 2020/03/03
- [PATCH 1/6] bistromathic: check completion,
Akim Demaille <=
- [PATCH 2/6] bistromathic: don't require spaces after operators for completion, Akim Demaille, 2020/03/03
- [PATCH 3/6] bistromathic: properly compute the lcp, as expected by readline, Akim Demaille, 2020/03/03
- [PATCH 4/6] style: formatting changes, Akim Demaille, 2020/03/03
- [PATCH 6/6] yacc.c: push: undefine the pstate macros for the epilogue, Akim Demaille, 2020/03/03
- [PATCH 5/6] yacc.c: push: initialize the pstate variables in pstate_new, Akim Demaille, 2020/03/03