return NULL;
}
-/* Skip over the possibly quoted word STR (as defined by the quote
- characters QUOTECHARS and the word break characters BREAKCHARS).
- Returns pointer to the location after the "word". If either
- QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
- completer. */
-
-const char *
-skip_quoted_chars (const char *str, const char *quotechars,
- const char *breakchars)
-{
- char quote_char = '\0';
- const char *scan;
-
- if (quotechars == NULL)
- quotechars = gdb_completer_quote_characters;
-
- if (breakchars == NULL)
- breakchars = current_language->word_break_characters ();
-
- for (scan = str; *scan != '\0'; scan++)
- {
- if (quote_char != '\0')
- {
- /* Ignore everything until the matching close quote char. */
- if (*scan == quote_char)
- {
- /* Found matching close quote. */
- scan++;
- break;
- }
- }
- else if (strchr (quotechars, *scan))
- {
- /* Found start of a quoted string. */
- quote_char = *scan;
- }
- else if (strchr (breakchars, *scan))
- {
- break;
- }
- }
-
- return (scan);
-}
-
-/* Skip over the possibly quoted word STR (as defined by the quote
- characters and word break characters used by the completer).
- Returns pointer to the location after the "word". */
-
-const char *
-skip_quoted (const char *str)
-{
- return skip_quoted_chars (str, NULL, NULL);
-}
-
/* Return a message indicating that the maximum number of completions
has been reached and that there may be more. */
extern void complete_nested_command_line (completion_tracker &tracker,
const char *text);
-extern const char *skip_quoted_chars (const char *, const char *,
- const char *);
-
-extern const char *skip_quoted (const char *);
-
/* Called from command completion function to skip over /FMT
specifications, allowing the rest of the line to be completed. Returns
true if the /FMT is at the end of the current line and there is nothing
static char *uptok (const char *, int);
+static const char *pascal_skip_string (const char *str);
+
using namespace expr;
%}
return uptokstart;
}
+/* Skip over a Pascal string. STR must point to the opening single quote
+ character. This function returns a pointer to the character after the
+ closing single quote character.
+
+ This function does not support embedded, escaped single quotes, which
+ is done by placing two consecutive single quotes into a string.
+ Support for this would be easy to add, but this function is only used
+ from the Python expression parser, and if we did skip over escaped
+ quotes then the rest of the expression parser wouldn't handle them
+ correctly. */
+static const char *
+pascal_skip_string (const char *str)
+{
+ gdb_assert (*str == '\'');
+
+ do
+ ++str;
+ while (*str != '\0' && *str != '\'');
+
+ return str;
+}
+
/* Read one token, getting characters through lexptr. */
static int
c = *pstate->lexptr++;
if (c != '\'')
{
- namelen = skip_quoted (tokstart) - tokstart;
+ namelen = pascal_skip_string (tokstart) - tokstart;
if (namelen > 2)
{
pstate->lexptr = tokstart + namelen;