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
commit37af727ac31be5890c0ee4e8a0fa3fcd1f559586 (patch)
tree7248d8ac532d22dd38e38a91c35bfda3ceda5370
parentd22cb2891030ec2713a8279771f104cf4bebc3bf (diff)
downloadtxr-37af727ac31be5890c0ee4e8a0fa3fcd1f559586.tar.gz
txr-37af727ac31be5890c0ee4e8a0fa3fcd1f559586.tar.bz2
txr-37af727ac31be5890c0ee4e8a0fa3fcd1f559586.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))