From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26547 invoked by alias); 27 Mar 2012 03:20:16 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 26512 invoked by uid 9079); 27 Mar 2012 03:20:14 -0000 Date: Tue, 27 Mar 2012 03:20:00 -0000 Message-ID: <20120327032013.26497.qmail@sourceware.org> From: kseitz@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] archer-keiths-linespec-rewrite: * linespec.c (is_closing_quote_enclosed): New function. (linespec_lexer_lex_string): Use is_closing_quote_enclosed. (linespec_lexer_lex_one): Likewise. (parse_linespec): Likewise. X-Git-Refname: refs/heads/archer-keiths-linespec-rewrite X-Git-Reftype: branch X-Git-Oldrev: e35c7e8e719cdaf8771b9b03b06be508c35f9949 X-Git-Newrev: 083cb9ba8a4745ea3495b68d3ca7a405e6420139 X-SW-Source: 2012-q1/txt/msg00093.txt.bz2 List-Id: The branch, archer-keiths-linespec-rewrite has been updated via 083cb9ba8a4745ea3495b68d3ca7a405e6420139 (commit) from e35c7e8e719cdaf8771b9b03b06be508c35f9949 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 083cb9ba8a4745ea3495b68d3ca7a405e6420139 Author: Keith Seitz Date: Mon Mar 26 20:19:03 2012 -0700 * linespec.c (is_closing_quote_enclosed): New function. (linespec_lexer_lex_string): Use is_closing_quote_enclosed. (linespec_lexer_lex_one): Likewise. (parse_linespec): Likewise. ----------------------------------------------------------------------- Summary of changes: gdb/linespec.c | 18 +++++++++++++++--- 1 files changed, 15 insertions(+), 3 deletions(-) First 500 lines of diff: diff --git a/gdb/linespec.c b/gdb/linespec.c index 50cf2e0..fa90786 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -442,6 +442,17 @@ copy_token_string (linespec_token token) return str; } +/* Does P represent the end of a quote-enclosed linespec? */ + +static int +is_closing_quote_enclosed (const char *p) +{ + if (strchr (linespec_quote_characters, *p)) + ++p; + p = skip_spaces ((char *) p); + return (*p == '\0' || linespec_lexer_lex_keyword (p)); +} + /* Lex a string from the input in PARSER. */ static linespec_token @@ -556,7 +567,7 @@ linespec_lexer_lex_string (linespec_parser *parser) else if (parser->is_quote_enclosed && strchr (linespec_quote_characters, PARSER_STREAM (parser)[0]) - && PARSER_STREAM (parser)[1] == '\0') + && is_closing_quote_enclosed (PARSER_STREAM (parser))) { LS_TOKEN_STOKEN (token).ptr = start; LS_TOKEN_STOKEN (token).length = PARSER_STREAM (parser) - start; @@ -619,7 +630,8 @@ linespec_lexer_lex_one (linespec_parser *parser) case '\'': case '\"': /* Special case: permit quote-enclosed linespecs. */ - if (parser->is_quote_enclosed && PARSER_STREAM (parser)[1] == '\0') + if (parser->is_quote_enclosed + && is_closing_quote_enclosed (PARSER_STREAM (parser))) { ++(PARSER_STREAM (parser)); parser->lexer.current.type = LSTOKEN_EOI; @@ -1883,7 +1895,7 @@ parse_linespec (linespec_parser *parser, char **argptr) char *end; end = skip_quote_char (*argptr + 1, **argptr); - if (end != NULL && end[1] == '\0') + if (is_closing_quote_enclosed (end)) { /* Here's the special case. Skip ARGPTR past the initial quote. */ hooks/post-receive -- Repository for Project Archer.