This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH Bug breakpoints/14381] Fix linespec to parse file name that begin with decimal numbers
On Sun, Jul 22, 2012 at 10:11 PM, Keith Seitz <keiths@redhat.com> 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