From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30245 invoked by alias); 18 Sep 2003 19:16:43 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 30234 invoked from network); 18 Sep 2003 19:16:42 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sources.redhat.com with SMTP; 18 Sep 2003 19:16:42 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 540D7D2DAF; Thu, 18 Sep 2003 12:16:41 -0700 (PDT) Date: Thu, 18 Sep 2003 19:16:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: [RFC] Word break characters are language dependent Message-ID: <20030918191641.GY15984@gnat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2003-09/txt/msg00399.txt.bz2 Hello, I was working on implementing proper completion for Ada in GDB, and ended up reading this part of the code (completer.c:localtion_completer()): else if (strchr (gdb_completer_word_break_characters, *p)) symbol_start = p + 1; Unfortunately, the word-break characters for Ada are not exactly the same as the ones used by default. As a consequence, the current completer does not always find the correct starting location of the symbol name. So I think we should make them language-dependent by adding a new field to the language vector. For instance, we could add a new pointer to a function that would return the string of word-break characters. My proposal is the following: - Add the following field to struct language_defn: char * (*la_word_break_characters) (const char *); - Move static char *gdb_completer_word_break_characters and get_gdb_completer_word_break_characters() to language.[hc] and call them: default_completer_word_break_characters and get_default_completer_word_break_characters() respectively. - Initialize the new field inside all languages to this default function. - Update completer.c to use the language-dependent version of this string, rather than the current hard-coded one. Sounds reasonable? Also, while we are looking at this, would it be worth considering the same for - gdb_completer_command_word_break_characters: I don't think so. Command names are independent of the language. - gdb_completer_file_name_break_characters: I don't think so either. Independent from the filename. - gdb_completer_loc_break_characters: Likewise. - gdb_completer_quote_characters: This is less obvious. Maybe some future language will want to have it's own different quote character. Not obvious, so I would leave it as is too. Thanks, -- Joel