MySQL 8.4.2
Source Code Documentation
|
Holds the json parse tree being generated by the SHOW PARSE_TREE command. More...
#include <parse_tree_node_base.h>
Classes | |
struct | Parse_tree_comparator |
Public Member Functions | |
Show_parse_tree (Show_parse_tree *parent_tree=nullptr) | |
bool | push_level (const POS &pos, const char *typname) |
Create a json node out of the parse tree node position and type name, and push it onto the json object stack. More... | |
Json_object * | get_current_parent () |
Get the current object under which new json objects are to be added as children. More... | |
std::string | get_parse_tree () |
Generate the json tree text from the json tree, and return it. More... | |
bool | pop_level () |
Pop out the json node pushed by push_level() and make it a child of the inner json object in the stack. More... | |
Private Member Functions | |
bool | make_child (Json_object *obj) |
Make the obj a child of the current parent object in the object stack. More... | |
Json_object * | pop_json_object () |
Pop the current object in the object stack, and return it. More... | |
Private Attributes | |
std::vector< Json_object * > | m_json_obj_stack {} |
Json_object_ptr | m_root_obj = nullptr |
Show_parse_tree * | m_parent_show_parse_tree = nullptr |
const char * | m_reference_pos = nullptr |
Static Private Attributes | |
static constexpr Parse_tree_comparator | m_comparator = {} |
Holds the json parse tree being generated by the SHOW PARSE_TREE command.
The json tree gets built with the help of the two parse tree node walkers namely contextualize() and itemize(). Each contextualize() (or itemize()) creates a new json subtree. In the beginning of contextualize(), push_level() is called, where a new Json object is created and pushed to m_json_obj_stack. This object now becomes a parent json object to which all the subtrees created by the inner contextualize() calls will be added as its children. Each contextualize() will end with a call to pop_level() where the current parent will be popped out and made the child of the now-current parent object in the stack. This way the json tree is built identical to the tree of Parse_tree_node's.
|
inlineexplicit |
|
inline |
Get the current object under which new json objects are to be added as children.
Effectively, this is the outermost object in the object stack.
retval nullptr if the object stack is empty.
std::string Show_parse_tree::get_parse_tree | ( | ) |
Generate the json tree text from the json tree, and return it.
non-empty | success |
empty | error |
|
private |
Make the obj a child of the current parent object in the object stack.
If there is a current parent, assign this object as child of that parent.
obj | Input json object resembling a parse tree node. |
false | success; true: error |
If there is no parent, make this object the root of this parse tree, unless there is a parent parse tree in which case make this object a child of the parent explain tree's leaf parent.
|
private |
Pop the current object in the object stack, and return it.
|
inline |
Pop out the json node pushed by push_level() and make it a child of the inner json object in the stack.
false | success; true: error |
bool Show_parse_tree::push_level | ( | const POS & | pos, |
const char * | typname | ||
) |
Create a json node out of the parse tree node position and type name, and push it onto the json object stack.
Effectively, a new json stack level is created, to which json children would be added.
pos | syntax position of the parse tree node |
typname | type name of the class of the parse tree node |
false | success |
true | error |
|
staticconstexprprivate |
|
private |
|
private |
|
private |
|
private |