Re: [PATCH Bug breakpoints/14381] Fix linespec to parse file name that begin with decimal numbers

Keith Seitz
2012-07-22T14:12:06Z

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