|
BashSpark
|
Generic visitor for shell AST nodes. More...
#include <shell_node_visitor.h>
Public Types | |
| using | visit_type = visit_t |
| Type of data resulting of visit. | |
Public Member Functions | |
| virtual visit_t | visit_node (shell_session &oSession, const shell_node *pRawNode) |
| Dispatch a node to the correct visit function. | |
Protected Member Functions | |
Visit functions for each concrete shell node type. | |
Implement these in derived classes. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_word *pNode)=0 |
| Visit a word node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_unicode *pNode)=0 |
| Visit a Unicode node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_str_simple *pNode)=0 |
| Visit a simple quoted string node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_str_double *pNode)=0 |
| Visit a double-quoted string node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_str_back *pNode)=0 |
| Visit a backtick command string node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_null_command *pNode)=0 |
| Visit a null command node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_command *pNode)=0 |
| Visit a command node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_command_expression *pNode)=0 |
| Visit a command expression node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_command_block *pNode)=0 |
| Visit a command block node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_command_block_subshell *pNode)=0 |
| Visit a subshell command block node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_arg *pNode)=0 |
| Visit an argument node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_variable *pNode)=0 |
| Visit a variable node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_arg *pNode)=0 |
Visit a $N argument reference node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_variable *pNode)=0 |
Visit a $var variable reference node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_arg_dhop *pNode)=0 |
Visit a ${N} argument reference node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_variable_dhop *pNode)=0 |
Visit a ${var} variable reference node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_command *pNode)=0 |
Visit a command substitution node ($(...)). | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_dollar_special *pNode)=0 |
Visit a special variable node ($?, $#, etc.). | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_background *pNode)=0 |
| Visit a background operator node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_pipe *pNode)=0 |
| Visit a pipe operator node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_or *pNode)=0 |
| Visit a logical OR operator node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_and *pNode)=0 |
| Visit a logical AND operator node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_test *pNode)=0 |
| Visit a test command node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_if *pNode)=0 |
| Visit an if-statement node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_break *pNode)=0 |
| Visit a break statement node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_continue *pNode)=0 |
| Visit a continue statement node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_for *pNode)=0 |
| Visit a for-loop node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_while *pNode)=0 |
| Visit a while-loop node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_until *pNode)=0 |
| Visit an until-loop node. | |
| virtual visit_t | visit (shell_session &oSession, const shell_node_function *pNode)=0 |
| Visit a function node. | |
Generic visitor for shell AST nodes.
This class implements a type–safe visitor pattern over all shell_node subclasses. Users must implement all visit() overloads corresponding to the node types they wish to handle.
| visit_t | The return type of all visit functions. Must be default-constructible. |
|
protectedpure virtual |
Visit a logical AND operator node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit an argument node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a background operator node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a break statement node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a command node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a command block node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a subshell command block node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a command expression node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a continue statement node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a $N argument reference node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a ${N} argument reference node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a command substitution node ($(...)).
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a special variable node ($?, $#, etc.).
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a $var variable reference node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a ${var} variable reference node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a for-loop node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a function node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit an if-statement node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a null command node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a logical OR operator node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a pipe operator node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a backtick command string node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a double-quoted string node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a simple quoted string node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a test command node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a Unicode node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit an until-loop node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a variable node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a while-loop node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
protectedpure virtual |
Visit a word node.
| oSession | The current shell session. |
| pNode | The node to visit. |
|
virtual |
Dispatch a node to the correct visit function.
Performs a type switch on the node's shell_node_type and forwards it to the corresponding visit() overload. If visit_t is void, no value is returned.
| oSession | Execution session. |
| pRawNode | Pointer to the node being visited. |
visit_t if the node type is unhandled. Reimplemented in bs::shell_node_visitor_json.