+2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
+
+ * ada-lang.c (ada_get_gdb_completer_word_break_characters): Delete.
+ (ada_language_data): Delete la_word_break_characters initializer.
+ (ada_language::word_break_characters): New member function.
+ * c-lang.c (c_language_data): Delete la_word_break_characters
+ initializer.
+ (cplus_language_data): Likewise.
+ (asm_language_data): Likewise.
+ (minimal_language_data): Likewise.
+ * completer.c: Update global comment.
+ (advance_to_expression_complete_word_point): Update call to
+ word_break_characters.
+ (complete_files_symbols): Likewise.
+ (complete_line_internal_1): Likewise.
+ (default_completer_handle_brkchars): Likewise.
+ (skip_quoted_chars): Likewise.
+ * d-lang.c (d_language_data): Delete la_word_break_characters
+ initializer.
+ * f-lang.c (f_word_break_characters): Delete.
+ (f_language_data): Delete la_word_break_characters initializer.
+ (f_language::word_break_characters): New member function.
+ * go-lang.c (go_language_data): Delete la_word_break_characters
+ initializer.
+ * language.c (unknown_language_data): Likewise.
+ (auto_language_data): Likewise.
+ * language.h (default_word_break_characters): Move declaration to
+ earlier in the file.
+ (language_data): Delete la_word_break_characters field.
+ (language_defn::word_break_characters): New member function.
+ * m2-lang.c (m2_language_data): Delete la_word_break_characters
+ initializer.
+ * objc-lang.c (objc_language_data): Likewise.
+ * opencl-lang.c (opencl_language_data): Likewise.
+ * p-lang.c (pascal_language_data): Likewise.
+ * rust-lang.c (rust_language_data): Likewise.
+
2020-06-17 Andrew Burgess <andrew.burgess@embecosm.com>
* ada-lang.c (ada_get_symbol_name_matcher): Update header comment.
return string_printf ("<%s>", str);
}
-static const char *
-ada_get_gdb_completer_word_break_characters (void)
-{
- return ada_completer_word_break_characters;
-}
-
/* la_watch_location_expression for Ada. */
static gdb::unique_xmalloc_ptr<char>
ada_op_print_tab, /* expression operators for printing */
0, /* c-style arrays */
1, /* String lower bound */
- ada_get_gdb_completer_word_break_characters,
ada_collect_symbol_completion_matches,
ada_watch_location_expression,
&ada_varobj_ops,
ada_print_type (type, varstring, stream, show, level, flags);
}
+ /* See language.h. */
+
+ const char *word_break_characters (void) const override
+ {
+ return ada_completer_word_break_characters;
+ }
+
protected:
/* See language.h. */
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&c_varobj_ops,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&cplus_varobj_ops,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
but it does affect how much stuff M-? lists.
(2) If one of the matches contains a word break character, readline
will quote it. That's why we switch between
- current_language->la_word_break_characters() and
+ current_language->word_break_characters () and
gdb_completer_command_word_break_characters. I'm not sure when
we need this behavior (perhaps for funky characters in C++
symbols?). */
advance_to_expression_complete_word_point (completion_tracker &tracker,
const char *text)
{
- const char *brk_chars = current_language->la_word_break_characters ();
+ const char *brk_chars = current_language->word_break_characters ();
return advance_to_completion_word (tracker, brk_chars, text);
}
colon = p;
symbol_start = p + 1;
}
- else if (strchr (current_language->la_word_break_characters(), *p))
+ else if (strchr (current_language->word_break_characters (), *p))
symbol_start = p + 1;
}
strings, which leaves out the '-' and '.' character used in some
commands. */
set_rl_completer_word_break_characters
- (current_language->la_word_break_characters());
+ (current_language->word_break_characters ());
/* Decide whether to complete on a list of gdb commands or on
symbols. */
const char *text, const char *word)
{
set_rl_completer_word_break_characters
- (current_language->la_word_break_characters ());
+ (current_language->word_break_characters ());
}
/* See definition in completer.h. */
quotechars = gdb_completer_quote_characters;
if (breakchars == NULL)
- breakchars = current_language->la_word_break_characters();
+ breakchars = current_language->word_break_characters ();
for (scan = str; *scan != '\0'; scan++)
{
d_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
nr_f_primitive_types
};
-/* Remove the modules separator :: from the default break list. */
-
-static const char *
-f_word_break_characters (void)
-{
- static char *retval;
-
- if (!retval)
- {
- char *s;
-
- retval = xstrdup (default_word_break_characters ());
- s = strchr (retval, ':');
- if (s)
- {
- char *last_char = &s[strlen (s) - 1];
-
- *s = *last_char;
- *last_char = 0;
- }
- }
- return retval;
-}
-
/* Consider the modules separator :: as a valid symbol name character
class. */
f_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
1, /* String lower bound */
- f_word_break_characters,
f_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
f_print_type (type, varstring, stream, show, level, flags);
}
+ /* See language.h. This just returns default set of word break
+ characters but with the modules separator `::' removed. */
+
+ const char *word_break_characters (void) const override
+ {
+ static char *retval;
+
+ if (!retval)
+ {
+ char *s;
+
+ retval = xstrdup (language_defn::word_break_characters ());
+ s = strchr (retval, ':');
+ if (s)
+ {
+ char *last_char = &s[strlen (s) - 1];
+
+ *s = *last_char;
+ *last_char = 0;
+ }
+ }
+ return retval;
+ }
+
protected:
/* See language.h. */
go_op_print_tab, /* Expression operators for printing. */
1, /* C-style arrays. */
0, /* String lower bound. */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
unk_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
bool destructible = true;
};
+/* Splitting strings into words. */
+extern const char *default_word_break_characters (void);
+
/* Structure tying together assorted information about a language.
As we move over from the old structure based languages to a class
/* Index to use for extracting the first element of a string. */
char string_lower_bound;
- /* The list of characters forming word boundaries. */
- const char *(*la_word_break_characters) (void);
-
/* Add to the completion tracker all symbols which are possible
completions for TEXT. WORD is the entire command on which the
completion is being made. If CODE is TYPE_CODE_UNDEF, then all
return nullptr;
}
+ /* The list of characters forming word boundaries. */
+ virtual const char *word_break_characters (void) const
+ {
+ return default_word_break_characters ();
+ }
+
/* List of all known languages. */
static const struct language_defn *languages[nr_languages];
extern char *language_demangle (const struct language_defn *current_language,
const char *mangled, int options);
-/* Splitting strings into words. */
-extern const char *default_word_break_characters (void);
-
/* Return information about whether TYPE should be passed
(and returned) by reference at the language level. */
struct language_pass_by_ref_info language_pass_by_reference (struct type *type);
m2_op_print_tab, /* expression operators for printing */
0, /* arrays are first-class (not c-style) */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
objc_op_print_tab, /* Expression operators for printing */
1, /* C-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
pascal_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
c_watch_location_expression,
&default_varobj_ops,
c_op_print_tab, /* expression operators for printing */
1, /* c-style arrays */
0, /* String lower bound */
- default_word_break_characters,
default_collect_symbol_completion_matches,
rust_watch_location_expression,
&default_varobj_ops,