MySQL 9.1.0
Source Code Documentation
|
Lexical scanner for hint comments. More...
#include <sql_lex_hints.h>
Public Member Functions | |
Hint_scanner (THD *thd, size_t lineno_arg, const char *buf, size_t len, sql_digest_state *digest_state_arg) | |
Constructor. More... | |
size_t | get_lineno () const |
const char * | get_ptr () const |
sql_digest_state * | get_digest () |
void | syntax_warning (const char *msg) const |
Push a warning message into MySQL error stack with line and position information. More... | |
int | get_next_token () |
Public Attributes | |
const char * | raw_yytext |
Current token (yytext) origin in the input_buf. More... | |
const char * | yytext |
Current token pointer (may be converted allocated string outside input_buf. More... | |
size_t | yyleng |
Length of the current token (see yytext) More... | |
bool | has_hints |
True if a hint comment is not empty (has any hints). More... | |
Protected Member Functions | |
int | scan () |
template<hint_lex_char_classes Quote> | |
int | scan_quoted () |
int | scan_ident () |
int | scan_multiplier_or_ident () |
int | scan_query_block_name () |
int | scan_ident_or_keyword () |
int | scan_number_or_multiplier_or_ident () |
int | scan_fraction_digits () |
bool | eof () const |
char | peek_byte () const |
hint_lex_char_classes | peek_class () const |
hint_lex_char_classes | peek_class2 () const |
void | skip_newline () |
uchar | get_byte () |
void | skip_byte () |
void | skip_byte (char byte) |
Skips the next byte. More... | |
void | skip_byte (const char *str) |
Skips the next byte. More... | |
bool | skip_mb () |
void | adjust_token () |
void | start_token () |
template<hint_lex_char_classes Separator> | |
void | compact (LEX_STRING *to, const char *from, size_t len, size_t doubles) |
void | add_hint_token_digest () |
Add hint tokens to main lexer's digest calculation buffer. More... | |
Private Member Functions | |
void | add_digest (uint token) |
Helper function to check digest buffer for overflow before adding tokens. More... | |
Private Attributes | |
THD * | thd |
const CHARSET_INFO * | cs |
const bool | is_ansi_quotes |
size_t | lineno |
const hint_lex_char_classes * | char_classes |
const char * | input_buf |
const char * | input_buf_end |
const char * | ptr |
int | prev_token |
sql_digest_state * | digest_state |
Digest buffer interface to append tokens. More... | |
Lexical scanner for hint comments.
When the main lexical scanner recognizes the "/*+" delimiter, it calls the hint parser (my_hint_parser_parse) to consume the rest of hint tokens including the */ delimiter. The hint parser uses Hint_scanner as its own lexer to scan hint-specific tokens.
Hint_scanner::Hint_scanner | ( | THD * | thd_arg, |
size_t | lineno_arg, | ||
const char * | buf, | ||
size_t | len, | ||
sql_digest_state * | digest_state_arg | ||
) |
Constructor.
thd_arg | The thread handler. |
lineno_arg | The starting line number of a hint string in a query. |
buf | The rest of a query buffer with hints at the start. |
len | The length of the buf. |
digest_state_arg | The digest buffer to output scanned token data. |
|
inlineprivate |
Helper function to check digest buffer for overflow before adding tokens.
token | A token number to add. |
|
protected |
Add hint tokens to main lexer's digest calculation buffer.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
protected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
Skips the next byte.
In the debug mode, abort if it's not found in byte
.
byte | A byte to compare with the byte we skip. Unused in non-debug builds. |
|
inlineprotected |
Skips the next byte.
In the debug mode, abort if it's not found in str
.
str | A string of characters to compare with the next byte. Unused in non-debug builds. |
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
void Hint_scanner::syntax_warning | ( | const char * | msg | ) | const |
Push a warning message into MySQL error stack with line and position information.
This function provides semantic action implementers with a way to push the famous "You have a syntax error near..." error message into the error stack, which is normally produced only if a parse error is discovered internally by the Bison generated parser.
|
private |
|
private |
|
private |
Digest buffer interface to append tokens.
bool Hint_scanner::has_hints |
True if a hint comment is not empty (has any hints).
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
const char* Hint_scanner::raw_yytext |
Current token (yytext) origin in the input_buf.
|
private |
size_t Hint_scanner::yyleng |
Length of the current token (see yytext)
const char* Hint_scanner::yytext |
Current token pointer (may be converted allocated string outside input_buf.