• Alexander Barkov's avatar
    Moving a few static functions in sql_lex.cc to new methods in Lex_input_stream · 1d30a23f
    Alexander Barkov authored
    Reasoning:
    - Shorter and clearer code
    - Better encapsulation
      (a fair number of Lex_input_stream methods and members were
       moved to the private section)
    
    New methods:
    
      int lex_token(union YYSTYPE *yylval, THD *thd);
      bool consume_comment(int remaining_recursions_permitted);
      int lex_one_token(union YYSTYPE *yylval, THD *thd);
      int find_keyword(Lex_ident_cli_st *str, uint len, bool function);
      LEX_CSTRING get_token(uint skip, uint length);
    
    Additional changes:
    
    - Removing Lex_input_stream::yylval.
      In the original code it was just an alias
      for the "yylval" passed to lex_one_token().
      This coding style is bug prone and is hard to follow.
      In the new reduction "yylval" (or its components) is passed to
      the affected methods as a parameter.
    - Moving the code in sql_lex.h up and down between "private" and "public"
      sections (sorry if this made the diff somewhat harder to read)
    1d30a23f
sql_lex.cc 231 KB