completer.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  1. /* Header for GDB line completion.
  2. Copyright (C) 2000-2022 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 3 of the License, or
  6. (at your option) any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program. If not, see <http://www.gnu.org/licenses/>. */
  13. #if !defined (COMPLETER_H)
  14. #define COMPLETER_H 1
  15. #include "gdbsupport/gdb-hashtab.h"
  16. #include "gdbsupport/gdb_vecs.h"
  17. #include "command.h"
  18. /* Types of functions in struct match_list_displayer. */
  19. struct match_list_displayer;
  20. typedef void mld_crlf_ftype (const struct match_list_displayer *);
  21. typedef void mld_putch_ftype (const struct match_list_displayer *, int);
  22. typedef void mld_puts_ftype (const struct match_list_displayer *,
  23. const char *);
  24. typedef void mld_flush_ftype (const struct match_list_displayer *);
  25. typedef void mld_erase_entire_line_ftype (const struct match_list_displayer *);
  26. typedef void mld_beep_ftype (const struct match_list_displayer *);
  27. typedef int mld_read_key_ftype (const struct match_list_displayer *);
  28. /* Interface between CLI/TUI and gdb_match_list_displayer. */
  29. struct match_list_displayer
  30. {
  31. /* The screen dimensions to work with when displaying matches. */
  32. int height, width;
  33. /* Print cr,lf. */
  34. mld_crlf_ftype *crlf;
  35. /* Not "putc" to avoid issues where it is a stdio macro. Sigh. */
  36. mld_putch_ftype *putch;
  37. /* Print a string. */
  38. mld_puts_ftype *puts;
  39. /* Flush all accumulated output. */
  40. mld_flush_ftype *flush;
  41. /* Erase the currently line on the terminal (but don't discard any text the
  42. user has entered, readline may shortly re-print it). */
  43. mld_erase_entire_line_ftype *erase_entire_line;
  44. /* Ring the bell. */
  45. mld_beep_ftype *beep;
  46. /* Read one key. */
  47. mld_read_key_ftype *read_key;
  48. };
  49. /* A list of completion candidates. Each element is a malloc string,
  50. because ownership of the strings is transferred to readline, which
  51. calls free on each element. */
  52. typedef std::vector<gdb::unique_xmalloc_ptr<char>> completion_list;
  53. /* The result of a successful completion match. When doing symbol
  54. comparison, we use the symbol search name for the symbol name match
  55. check, but the matched name that is shown to the user may be
  56. different. For example, Ada uses encoded names for lookup, but
  57. then wants to decode the symbol name to show to the user, and also
  58. in some cases wrap the matched name in "<sym>" (meaning we can't
  59. always use the symbol's print name). */
  60. class completion_match
  61. {
  62. public:
  63. /* Get the completion match result. See m_match/m_storage's
  64. descriptions. */
  65. const char *match ()
  66. { return m_match; }
  67. /* Set the completion match result. See m_match/m_storage's
  68. descriptions. */
  69. void set_match (const char *match)
  70. { m_match = match; }
  71. /* Get temporary storage for generating a match result, dynamically.
  72. The built string is only good until the next clear() call. I.e.,
  73. good until the next symbol comparison. */
  74. std::string &storage ()
  75. { return m_storage; }
  76. /* Prepare for another completion matching sequence. */
  77. void clear ()
  78. {
  79. m_match = NULL;
  80. m_storage.clear ();
  81. }
  82. private:
  83. /* The completion match result. This can either be a pointer into
  84. M_STORAGE string, or it can be a pointer into the some other
  85. string that outlives the completion matching sequence (usually, a
  86. pointer to a symbol's name). */
  87. const char *m_match;
  88. /* Storage a symbol comparison routine can use for generating a
  89. match result, dynamically. The built string is only good until
  90. the next clear() call. I.e., good until the next symbol
  91. comparison. */
  92. std::string m_storage;
  93. };
  94. /* The result of a successful completion match, but for least common
  95. denominator (LCD) computation. Some completers provide matches
  96. that don't start with the completion "word". E.g., completing on
  97. "b push_ba" on a C++ program usually completes to
  98. std::vector<...>::push_back, std::string::push_back etc. In such
  99. case, the symbol comparison routine will set the LCD match to point
  100. into the "push_back" substring within the symbol's name string.
  101. Also, in some cases, the symbol comparison routine will want to
  102. ignore parts of the symbol name for LCD purposes, such as for
  103. example symbols with abi tags in C++. In such cases, the symbol
  104. comparison routine will set MARK_IGNORED_RANGE to mark the ignored
  105. substrings of the matched string. The resulting LCD string with
  106. the ignored parts stripped out is computed at the end of a
  107. completion match sequence iff we had a positive match. */
  108. class completion_match_for_lcd
  109. {
  110. public:
  111. /* Get the resulting LCD, after a successful match. */
  112. const char *match ()
  113. { return m_match; }
  114. /* Set the match for LCD. See m_match's description. */
  115. void set_match (const char *match)
  116. { m_match = match; }
  117. /* Mark the range between [BEGIN, END) as ignored. */
  118. void mark_ignored_range (const char *begin, const char *end)
  119. { m_ignored_ranges.emplace_back (begin, end); }
  120. /* Get the resulting LCD, after a successful match. If there are
  121. ignored ranges, then this builds a new string with the ignored
  122. parts removed (and stores it internally). As such, the result of
  123. this call is only good for the current completion match
  124. sequence. */
  125. const char *finish ()
  126. {
  127. if (m_ignored_ranges.empty ())
  128. return m_match;
  129. else
  130. {
  131. m_finished_storage.clear ();
  132. const char *prev = m_match;
  133. for (const auto &range : m_ignored_ranges)
  134. {
  135. m_finished_storage.append (prev, range.first);
  136. prev = range.second;
  137. }
  138. m_finished_storage.append (prev);
  139. return m_finished_storage.c_str ();
  140. }
  141. }
  142. /* Prepare for another completion matching sequence. */
  143. void clear ()
  144. {
  145. m_match = NULL;
  146. m_ignored_ranges.clear ();
  147. }
  148. private:
  149. /* The completion match result for LCD. This is usually either a
  150. pointer into to a substring within a symbol's name, or to the
  151. storage of the pairing completion_match object. */
  152. const char *m_match;
  153. /* The ignored substring ranges within M_MATCH. E.g., if we were
  154. looking for completion matches for C++ functions starting with
  155. "functio"
  156. and successfully match:
  157. "function[abi:cxx11](int)"
  158. the ignored ranges vector will contain an entry that delimits the
  159. "[abi:cxx11]" substring, such that calling finish() results in:
  160. "function(int)"
  161. */
  162. std::vector<std::pair<const char *, const char *>> m_ignored_ranges;
  163. /* Storage used by the finish() method, if it has to compute a new
  164. string. */
  165. std::string m_finished_storage;
  166. };
  167. /* Convenience aggregate holding info returned by the symbol name
  168. matching routines (see symbol_name_matcher_ftype). */
  169. struct completion_match_result
  170. {
  171. /* The completion match candidate. */
  172. completion_match match;
  173. /* The completion match, for LCD computation purposes. */
  174. completion_match_for_lcd match_for_lcd;
  175. /* Convenience that sets both MATCH and MATCH_FOR_LCD. M_FOR_LCD is
  176. optional. If not specified, defaults to M. */
  177. void set_match (const char *m, const char *m_for_lcd = NULL)
  178. {
  179. match.set_match (m);
  180. if (m_for_lcd == NULL)
  181. match_for_lcd.set_match (m);
  182. else
  183. match_for_lcd.set_match (m_for_lcd);
  184. }
  185. };
  186. /* The final result of a completion that is handed over to either
  187. readline or the "completion" command (which pretends to be
  188. readline). Mainly a wrapper for a readline-style match list array,
  189. though other bits of info are included too. */
  190. struct completion_result
  191. {
  192. /* Create an empty result. */
  193. completion_result ();
  194. /* Create a result. */
  195. completion_result (char **match_list, size_t number_matches,
  196. bool completion_suppress_append);
  197. /* Destroy a result. */
  198. ~completion_result ();
  199. DISABLE_COPY_AND_ASSIGN (completion_result);
  200. /* Move a result. */
  201. completion_result (completion_result &&rhs) noexcept;
  202. /* Release ownership of the match list array. */
  203. char **release_match_list ();
  204. /* Sort the match list. */
  205. void sort_match_list ();
  206. private:
  207. /* Destroy the match list array and its contents. */
  208. void reset_match_list ();
  209. public:
  210. /* (There's no point in making these fields private, since the whole
  211. point of this wrapper is to build data in the layout expected by
  212. readline. Making them private would require adding getters for
  213. the "complete" command, which would expose the same
  214. implementation details anyway.) */
  215. /* The match list array, in the format that readline expects.
  216. match_list[0] contains the common prefix. The real match list
  217. starts at index 1. The list is NULL terminated. If there's only
  218. one match, then match_list[1] is NULL. If there are no matches,
  219. then this is NULL. */
  220. char **match_list;
  221. /* The number of matched completions in MATCH_LIST. Does not
  222. include the NULL terminator or the common prefix. */
  223. size_t number_matches;
  224. /* Whether readline should suppress appending a whitespace, when
  225. there's only one possible completion. */
  226. bool completion_suppress_append;
  227. };
  228. /* Object used by completers to build a completion match list to hand
  229. over to readline. It tracks:
  230. - How many unique completions have been generated, to terminate
  231. completion list generation early if the list has grown to a size
  232. so large as to be useless. This helps avoid GDB seeming to lock
  233. up in the event the user requests to complete on something vague
  234. that necessitates the time consuming expansion of many symbol
  235. tables.
  236. - The completer's idea of least common denominator (aka the common
  237. prefix) between all completion matches to hand over to readline.
  238. Some completers provide matches that don't start with the
  239. completion "word". E.g., completing on "b push_ba" on a C++
  240. program usually completes to std::vector<...>::push_back,
  241. std::string::push_back etc. If all matches happen to start with
  242. "std::", then readline would figure out that the lowest common
  243. denominator is "std::", and thus would do a partial completion
  244. with that. I.e., it would replace "push_ba" in the input buffer
  245. with "std::", losing the original "push_ba", which is obviously
  246. undesirable. To avoid that, such completers pass the substring
  247. of the match that matters for common denominator computation as
  248. MATCH_FOR_LCD argument to add_completion. The end result is
  249. passed to readline in gdb_rl_attempted_completion_function.
  250. - The custom word point to hand over to readline, for completers
  251. that parse the input string in order to dynamically adjust
  252. themselves depending on exactly what they're completing. E.g.,
  253. the linespec completer needs to bypass readline's too-simple word
  254. breaking algorithm.
  255. */
  256. class completion_tracker
  257. {
  258. public:
  259. completion_tracker ();
  260. ~completion_tracker ();
  261. DISABLE_COPY_AND_ASSIGN (completion_tracker);
  262. /* Add the completion NAME to the list of generated completions if
  263. it is not there already. If too many completions were already
  264. found, this throws an error. */
  265. void add_completion (gdb::unique_xmalloc_ptr<char> name,
  266. completion_match_for_lcd *match_for_lcd = NULL,
  267. const char *text = NULL, const char *word = NULL);
  268. /* Add all completions matches in LIST. Elements are moved out of
  269. LIST. */
  270. void add_completions (completion_list &&list);
  271. /* Remove completion matching NAME from the completion list, does nothing
  272. if NAME is not already in the completion list. */
  273. void remove_completion (const char *name);
  274. /* Set the quote char to be appended after a unique completion is
  275. added to the input line. Set to '\0' to clear. See
  276. m_quote_char's description. */
  277. void set_quote_char (int quote_char)
  278. { m_quote_char = quote_char; }
  279. /* The quote char to be appended after a unique completion is added
  280. to the input line. Returns '\0' if no quote char has been set.
  281. See m_quote_char's description. */
  282. int quote_char () { return m_quote_char; }
  283. /* Tell the tracker that the current completer wants to provide a
  284. custom word point instead of a list of a break chars, in the
  285. handle_brkchars phase. Such completers must also compute their
  286. completions then. */
  287. void set_use_custom_word_point (bool enable)
  288. { m_use_custom_word_point = enable; }
  289. /* Whether the current completer computes a custom word point. */
  290. bool use_custom_word_point () const
  291. { return m_use_custom_word_point; }
  292. /* The custom word point. */
  293. int custom_word_point () const
  294. { return m_custom_word_point; }
  295. /* Set the custom word point to POINT. */
  296. void set_custom_word_point (int point)
  297. { m_custom_word_point = point; }
  298. /* Advance the custom word point by LEN. */
  299. void advance_custom_word_point_by (int len);
  300. /* Whether to tell readline to skip appending a whitespace after the
  301. completion. See m_suppress_append_ws. */
  302. bool suppress_append_ws () const
  303. { return m_suppress_append_ws; }
  304. /* Set whether to tell readline to skip appending a whitespace after
  305. the completion. See m_suppress_append_ws. */
  306. void set_suppress_append_ws (bool suppress)
  307. { m_suppress_append_ws = suppress; }
  308. /* Return true if we only have one completion, and it matches
  309. exactly the completion word. I.e., completing results in what we
  310. already have. */
  311. bool completes_to_completion_word (const char *word);
  312. /* Get a reference to the shared (between all the multiple symbol
  313. name comparison calls) completion_match_result object, ready for
  314. another symbol name match sequence. */
  315. completion_match_result &reset_completion_match_result ()
  316. {
  317. completion_match_result &res = m_completion_match_result;
  318. /* Clear any previous match. */
  319. res.match.clear ();
  320. res.match_for_lcd.clear ();
  321. return m_completion_match_result;
  322. }
  323. /* True if we have any completion match recorded. */
  324. bool have_completions () const
  325. { return htab_elements (m_entries_hash.get ()) > 0; }
  326. /* Discard the current completion match list and the current
  327. LCD. */
  328. void discard_completions ();
  329. /* Build a completion_result containing the list of completion
  330. matches to hand over to readline. The parameters are as in
  331. rl_attempted_completion_function. */
  332. completion_result build_completion_result (const char *text,
  333. int start, int end);
  334. private:
  335. /* The type that we place into the m_entries_hash hash table. */
  336. class completion_hash_entry;
  337. /* Add the completion NAME to the list of generated completions if
  338. it is not there already. If false is returned, too many
  339. completions were found. */
  340. bool maybe_add_completion (gdb::unique_xmalloc_ptr<char> name,
  341. completion_match_for_lcd *match_for_lcd,
  342. const char *text, const char *word);
  343. /* Ensure that the lowest common denominator held in the member variable
  344. M_LOWEST_COMMON_DENOMINATOR is valid. This method must be called if
  345. there is any chance that new completions have been added to the
  346. tracker before the lowest common denominator is read. */
  347. void recompute_lowest_common_denominator ();
  348. /* Callback used from recompute_lowest_common_denominator, called for
  349. every entry in m_entries_hash. */
  350. void recompute_lcd_visitor (completion_hash_entry *entry);
  351. /* Completion match outputs returned by the symbol name matching
  352. routines (see symbol_name_matcher_ftype). These results are only
  353. valid for a single match call. This is here in order to be able
  354. to conveniently share the same storage among all the calls to the
  355. symbol name matching routines. */
  356. completion_match_result m_completion_match_result;
  357. /* The completion matches found so far, in a hash table, for
  358. duplicate elimination as entries are added. Otherwise the user
  359. is left scratching his/her head: readline and complete_command
  360. will remove duplicates, and if removal of duplicates there brings
  361. the total under max_completions the user may think gdb quit
  362. searching too early. */
  363. htab_up m_entries_hash;
  364. /* If non-zero, then this is the quote char that needs to be
  365. appended after completion (iff we have a unique completion). We
  366. don't rely on readline appending the quote char as delimiter as
  367. then readline wouldn't append the ' ' after the completion.
  368. I.e., we want this:
  369. before tab: "b 'function("
  370. after tab: "b 'function()' "
  371. */
  372. int m_quote_char = '\0';
  373. /* If true, the completer has its own idea of "word" point, and
  374. doesn't want to rely on readline computing it based on brkchars.
  375. Set in the handle_brkchars phase. */
  376. bool m_use_custom_word_point = false;
  377. /* The completer's idea of where the "word" we were looking at is
  378. relative to RL_LINE_BUFFER. This is advanced in the
  379. handle_brkchars phase as the completer discovers potential
  380. completable words. */
  381. int m_custom_word_point = 0;
  382. /* If true, tell readline to skip appending a whitespace after the
  383. completion. Automatically set if we have a unique completion
  384. that already has a space at the end. A completer may also
  385. explicitly set this. E.g., the linespec completer sets this when
  386. the completion ends with the ":" separator between filename and
  387. function name. */
  388. bool m_suppress_append_ws = false;
  389. /* Our idea of lowest common denominator to hand over to readline.
  390. See intro. */
  391. char *m_lowest_common_denominator = NULL;
  392. /* If true, the LCD is unique. I.e., all completions had the same
  393. MATCH_FOR_LCD substring, even if the completions were different.
  394. For example, if "break function<tab>" found "a::function()" and
  395. "b::function()", the LCD will be "function()" in both cases and
  396. so we want to tell readline to complete the line with
  397. "function()", instead of showing all the possible
  398. completions. */
  399. bool m_lowest_common_denominator_unique = false;
  400. /* True if the value in M_LOWEST_COMMON_DENOMINATOR is correct. This is
  401. set to true each time RECOMPUTE_LOWEST_COMMON_DENOMINATOR is called,
  402. and reset to false whenever a new completion is added. */
  403. bool m_lowest_common_denominator_valid = false;
  404. /* To avoid calls to xrealloc in RECOMPUTE_LOWEST_COMMON_DENOMINATOR, we
  405. track the maximum possible size of the lowest common denominator,
  406. which we know as each completion is added. */
  407. size_t m_lowest_common_denominator_max_length = 0;
  408. };
  409. /* Return a string to hand off to readline as a completion match
  410. candidate, potentially composed of parts of MATCH_NAME and of
  411. TEXT/WORD. For a description of TEXT/WORD see completer_ftype. */
  412. extern gdb::unique_xmalloc_ptr<char>
  413. make_completion_match_str (const char *match_name,
  414. const char *text, const char *word);
  415. /* Like above, but takes ownership of MATCH_NAME (i.e., can
  416. reuse/return it). */
  417. extern gdb::unique_xmalloc_ptr<char>
  418. make_completion_match_str (gdb::unique_xmalloc_ptr<char> &&match_name,
  419. const char *text, const char *word);
  420. extern void gdb_display_match_list (char **matches, int len, int max,
  421. const struct match_list_displayer *);
  422. extern const char *get_max_completions_reached_message (void);
  423. extern void complete_line (completion_tracker &tracker,
  424. const char *text,
  425. const char *line_buffer,
  426. int point);
  427. /* Complete LINE and return completion results. For completion purposes,
  428. cursor position is assumed to be at the end of LINE. WORD is set to
  429. the end of word to complete. QUOTE_CHAR is set to the opening quote
  430. character if we found an unclosed quoted substring, '\0' otherwise. */
  431. extern completion_result
  432. complete (const char *line, char const **word, int *quote_char);
  433. /* Find the bounds of the word in TEXT for completion purposes, and
  434. return a pointer to the end of the word. Calls the completion
  435. machinery for a handle_brkchars phase (using TRACKER) to figure out
  436. the right work break characters for the command in TEXT.
  437. QUOTE_CHAR, if non-null, is set to the opening quote character if
  438. we found an unclosed quoted substring, '\0' otherwise. */
  439. extern const char *completion_find_completion_word (completion_tracker &tracker,
  440. const char *text,
  441. int *quote_char);
  442. /* Assuming TEXT is an expression in the current language, find the
  443. completion word point for TEXT, emulating the algorithm readline
  444. uses to find the word point, using the current language's word
  445. break characters. */
  446. const char *advance_to_expression_complete_word_point
  447. (completion_tracker &tracker, const char *text);
  448. /* Assuming TEXT is an filename, find the completion word point for
  449. TEXT, emulating the algorithm readline uses to find the word
  450. point. */
  451. extern const char *advance_to_filename_complete_word_point
  452. (completion_tracker &tracker, const char *text);
  453. extern char **gdb_rl_attempted_completion_function (const char *text,
  454. int start, int end);
  455. extern void noop_completer (struct cmd_list_element *,
  456. completion_tracker &tracker,
  457. const char *, const char *);
  458. extern void filename_completer (struct cmd_list_element *,
  459. completion_tracker &tracker,
  460. const char *, const char *);
  461. extern void expression_completer (struct cmd_list_element *,
  462. completion_tracker &tracker,
  463. const char *, const char *);
  464. extern void location_completer (struct cmd_list_element *,
  465. completion_tracker &tracker,
  466. const char *, const char *);
  467. extern void symbol_completer (struct cmd_list_element *,
  468. completion_tracker &tracker,
  469. const char *, const char *);
  470. extern void command_completer (struct cmd_list_element *,
  471. completion_tracker &tracker,
  472. const char *, const char *);
  473. extern void signal_completer (struct cmd_list_element *,
  474. completion_tracker &tracker,
  475. const char *, const char *);
  476. extern void reg_or_group_completer (struct cmd_list_element *,
  477. completion_tracker &tracker,
  478. const char *, const char *);
  479. extern void reggroup_completer (struct cmd_list_element *,
  480. completion_tracker &tracker,
  481. const char *, const char *);
  482. extern const char *get_gdb_completer_quote_characters (void);
  483. extern char *gdb_completion_word_break_characters (void);
  484. /* Set the word break characters array to BREAK_CHARS. This function
  485. is useful as const-correct alternative to direct assignment to
  486. rl_completer_word_break_characters, which is "char *",
  487. not "const char *". */
  488. extern void set_rl_completer_word_break_characters (const char *break_chars);
  489. /* Get the matching completer_handle_brkchars_ftype function for FN.
  490. FN is one of the core completer functions above (filename,
  491. location, symbol, etc.). This function is useful for cases when
  492. the completer doesn't know the type of the completion until some
  493. calculation is done (e.g., for Python functions). */
  494. extern completer_handle_brkchars_ftype *
  495. completer_handle_brkchars_func_for_completer (completer_ftype *fn);
  496. /* Exported to linespec.c */
  497. /* Return a list of all source files whose names begin with matching
  498. TEXT. */
  499. extern completion_list complete_source_filenames (const char *text);
  500. /* Complete on expressions. Often this means completing on symbol
  501. names, but some language parsers also have support for completing
  502. field names. */
  503. extern void complete_expression (completion_tracker &tracker,
  504. const char *text, const char *word);
  505. /* Called by custom word point completers that want to recurse into
  506. the completion machinery to complete a command. Used to complete
  507. COMMAND in "thread apply all COMMAND", for example. Note that
  508. unlike command_completer, this fully recurses into the proper
  509. completer for COMMAND, so that e.g.,
  510. (gdb) thread apply all print -[TAB]
  511. does the right thing and show the print options. */
  512. extern void complete_nested_command_line (completion_tracker &tracker,
  513. const char *text);
  514. extern const char *skip_quoted_chars (const char *, const char *,
  515. const char *);
  516. extern const char *skip_quoted (const char *);
  517. /* Maximum number of candidates to consider before the completer
  518. bails by throwing MAX_COMPLETIONS_REACHED_ERROR. Negative values
  519. disable limiting. */
  520. extern int max_completions;
  521. #endif /* defined (COMPLETER_H) */