From d4da1b2c1b7b85968da608dde03e054cc0b1f7ca Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 22 Feb 2022 13:12:02 -0700 Subject: Add context-sensitive field name completion to Ada parser This updates the Ada expression parser to implement context-sensitive field name completion. This is PR ada/28727. This is somewhat complicated due to some choices in the Ada lexer -- it chooses to represent a sequence of "."-separated identifiers as a single token, so the parser must partially recreate the completer's logic to find the completion word boundaries. Despite the minor warts in this patch, though, it is a decent improvement. It's possible that the DWARF reader rewrite will help fix the package completion problem pointed out in this patch as well. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28727 --- gdb/expop.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'gdb/expop.h') diff --git a/gdb/expop.h b/gdb/expop.h index c159d96..a17311f 100644 --- a/gdb/expop.h +++ b/gdb/expop.h @@ -1005,10 +1005,18 @@ public: /* Try to complete this operation in the context of EXP. TRACKER is the completion tracker to update. Return true if completion was possible, false otherwise. */ - bool complete (struct expression *exp, completion_tracker &tracker); + virtual bool complete (struct expression *exp, completion_tracker &tracker) + { + return complete (exp, tracker, ""); + } protected: + /* Do the work of the public 'complete' method. PREFIX is prepended + to each result. */ + bool complete (struct expression *exp, completion_tracker &tracker, + const char *prefix); + using tuple_holding_operation::tuple_holding_operation; }; -- cgit v1.1