33 lines
623 B
C
33 lines
623 B
C
#ifndef AST_WORD_H
|
|
#define AST_WORD_H
|
|
|
|
#include "ast_base.h"
|
|
|
|
struct ast_word
|
|
{
|
|
enum ast_type type;
|
|
char *word;
|
|
};
|
|
|
|
/**
|
|
* Checks if the given AST node is a command.
|
|
*/
|
|
bool ast_is_word(struct ast *node);
|
|
|
|
/**
|
|
* Retrieves the command data from the given AST node.
|
|
* Assumes that the node is of type AST_CMD.
|
|
*/
|
|
struct ast_word *ast_get_word(struct ast *node);
|
|
|
|
/**
|
|
* Creates a new AST node representing a command.
|
|
*/
|
|
struct ast *ast_create_word(char *word);
|
|
|
|
/*
|
|
* @brief: frees the given ast_command and sets the pointer to NULL.
|
|
*/
|
|
void ast_free_word(struct ast_word *ast_node);
|
|
|
|
#endif /* ! AST_WORD_H */
|