summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-05-25 07:59:27 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-05-25 07:59:27 -0700
commitd4825b785b76e817d0926e81c273979bb1e1061c (patch)
tree7248d8ac532d22dd38e38a91c35bfda3ceda5370
parent85f7b2c689906eb3e3d29802bed6cf3758fad410 (diff)
downloadtxr-d4825b785b76e817d0926e81c273979bb1e1061c.tar.gz
txr-d4825b785b76e817d0926e81c273979bb1e1061c.tar.bz2
txr-d4825b785b76e817d0926e81c273979bb1e1061c.zip
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 [.
-rw-r--r--parser.c18
1 files 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))