From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20464 invoked by alias); 22 Jul 2012 14:48:08 -0000 Received: (qmail 20456 invoked by uid 22791); 22 Jul 2012 14:48:07 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-gh0-f169.google.com (HELO mail-gh0-f169.google.com) (209.85.160.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 22 Jul 2012 14:47:53 +0000 Received: by ghrr18 with SMTP id r18so5788539ghr.0 for ; Sun, 22 Jul 2012 07:47:53 -0700 (PDT) Received: by 10.50.88.167 with SMTP id bh7mr8481921igb.69.1342968472963; Sun, 22 Jul 2012 07:47:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.146.205 with HTTP; Sun, 22 Jul 2012 07:47:11 -0700 (PDT) In-Reply-To: <500C0A1F.8040106@redhat.com> References: <500C0A1F.8040106@redhat.com> From: Hui Zhu Date: Sun, 22 Jul 2012 14:48:00 -0000 Message-ID: Subject: Re: [PATCH Bug breakpoints/14381] Fix linespec to parse file name that begin with decimal numbers To: Keith Seitz Cc: gdb-patches ml Content-Type: text/plain; charset=ISO-8859-1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00428.txt.bz2 On Sun, Jul 22, 2012 at 10:11 PM, Keith Seitz wrote: > On 07/21/2012 11:30 PM, Hui Zhu wrote: >> >> @@ -390,6 +392,12 @@ linespec_lexer_lex_number (linespec_pars >> ++(PARSER_STREAM (parser)); >> } >> >> + if (*PARSER_STREAM (parser) != '\0' && !isspace(*PARSER_STREAM >> (parser))) >> + { >> + PARSER_STREAM (parser) = LS_TOKEN_STOKEN (token).ptr; >> + return linespec_lexer_lex_string (parser); >> + } >> + >> return token; >> } >> > > This obfuscates the meaning of linespec_lexer_lex_number. A better place to > deal with this is in linespec_lexer_lex_one directly where the decision to > call linespec_lexer_lex_number is made. > > That can either be done by inspecting the input stream directly in *_lex_one > or by having *_lex_number error (add a new error token type) and then having > linespec_lexer_lex_one fallback to string lexing. > > Keith The string begin with a number is not a error, why handle it as a error? I think that will really make this part obfuscates. What I thought is change the function name to linespec_lexer_lex_number_string to make it clear. Thanks, Hui