This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]