From 37af727ac31be5890c0ee4e8a0fa3fcd1f559586 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 25 May 2021 07:59:27 -0700 Subject: listener: complete on structs and FFI typedefs. * parser.c (find_matching_syms): Apply DeMorgan's on the symbol binding tests, to use sum of positive tests instead of product of negations. Check for struct and ffi type bindings in the default case. The default and '[' cases are rearranged so that the '[' case omits these, so as not to complete on a struct or FFI typedef after a [. --- parser.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/parser.c b/parser.c index b791d7d8..c6a291fa 100644 --- a/parser.c +++ b/parser.c @@ -63,6 +63,7 @@ #include "arith.h" #include "buf.h" #include "vm.h" +#include "ffi.h" #include "txr.h" #if HAVE_TERMIOS #include "linenoise/linenoise.h" @@ -954,17 +955,20 @@ static void find_matching_syms(lino_completions_t *cpl, switch (kind) { case '(': - if (!fboundp(sym) && !mboundp(sym) && !special_operator_p(sym)) - continue; - break; + if (fboundp(sym) || mboundp(sym) || special_operator_p(sym)) + break; + continue; case 'M': case 'S': break; - case '[': default: - if (!fboundp(sym) && !boundp(sym)) - continue; - break; + if (find_struct_type(sym) || ffi_type_p(sym)) + break; + /* fallthrough */ + case '[': + if (fboundp(sym) || boundp(sym)) + break; + continue; } if (equal(name, prefix)) -- cgit v1.2.3