aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dfilter/grammar.lemon
diff options
context:
space:
mode:
authorJoão Valverde <j@v6e.pt>2022-11-19 11:14:57 +0000
committerJoão Valverde <j@v6e.pt>2022-12-01 22:50:09 +0000
commit967a3c3df94d09a09306a23ae248ef611f57087b (patch)
tree7d5da31734eb50d8a87cefd154df81280fc55b3f /epan/dfilter/grammar.lemon
parent5853886d50f2294d4643871878c921a69b8408d5 (diff)
Qt: Check field autocomplete for syntactical validity
Currently the autocompletion engine always suggests a protocol field completion, even in places where it isn't syntactically valid. Fix that by compiling the preamble to the token under the cursor and checking the returned error. If it is DF_ERROR_UNEXPECTED_END that indicates a field or literal value was expected. Otherwise a field replacement is not valid in this position. Fixes #12811.
Diffstat (limited to 'epan/dfilter/grammar.lemon')
-rw-r--r--epan/dfilter/grammar.lemon2
1 files changed, 1 insertions, 1 deletions
diff --git a/epan/dfilter/grammar.lemon b/epan/dfilter/grammar.lemon
index 5b841fa90f..4742520ef5 100644
--- a/epan/dfilter/grammar.lemon
+++ b/epan/dfilter/grammar.lemon
@@ -65,7 +65,7 @@ DIAG_ON_LEMON()
any "error" symbols are shifted, if possible. */
%syntax_error {
if (!TOKEN) {
- dfilter_fail(dfw, DF_ERROR_GENERIC, NULL, "Unexpected end of filter expression.");
+ dfilter_fail(dfw, DF_ERROR_UNEXPECTED_END, NULL, "Unexpected end of filter expression.");
return;
}
FAIL(dfw, TOKEN, "\"%s\" was unexpected in this context.", stnode_token(TOKEN));