i3
commands_parser.h File Reference
#include <config.h>
#include <yajl/yajl_gen.h>
Include dependency graph for commands_parser.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  CommandResultIR
 Holds an intermediate representation of the result of a call to any command. More...
 
struct  CommandResult
 A struct that contains useful information about the result of a command as a whole (e.g. More...
 

Typedefs

typedef struct CommandResult CommandResult
 

Functions

char * parse_string (const char **walk, bool as_word)
 Parses a string (or word, if as_word is true).
 
CommandResultparse_command (const char *input, yajl_gen gen, ipc_client *client)
 Parses and executes the given command.
 
void command_result_free (CommandResult *result)
 Frees a CommandResult.
 

Typedef Documentation

◆ CommandResult

typedef struct CommandResult CommandResult

Definition at line 38 of file commands_parser.h.

Function Documentation

◆ command_result_free()

void command_result_free ( CommandResult * result)

◆ parse_command()

CommandResult * parse_command ( const char * input,
yajl_gen gen,
ipc_client * client )

Parses and executes the given command.

If a caller-allocated yajl_gen is passed, a json reply will be generated in the format specified by the ipc protocol. Pass NULL if no json reply is required.

Free the returned CommandResult with command_result_free().

Definition at line 253 of file commands_parser.c.

References tokenptr::array, clear_stack(), CommandResultIR::client, cmd_criteria_init(), command_output, current_match, DLOG, ELOG, CommandResult::error_message, token::identifier, CommandResultIR::json_gen, tokenptr::n, token::name, CommandResult::needs_tree_render, CommandResultIR::needs_tree_render, next_state(), CommandResult::parse_error, parse_string(), push_long(), push_string(), sasprintf(), scalloc(), smalloc(), sstrdup(), state, subcommand_output, y, and ystr.

Referenced by IPC_HANDLER(), run_assignments(), and run_binding().

Here is the call graph for this function:

◆ parse_string()

char * parse_string ( const char ** walk,
bool as_word )

Parses a string (or word, if as_word is true).

Extracted out of parse_command so that it can be used in src/workspace.c for interpreting workspace commands.

Definition at line 190 of file commands_parser.c.

References scalloc().

Referenced by extract_workspace_names_from_bindings(), and parse_command().

Here is the call graph for this function: