42sh/src/utils/ast/ast_word.h

34 lines
623 B
C
Raw Normal View History

2026-01-24 15:34:10 +01:00
#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.
*/
2026-01-27 19:56:33 +01:00
struct ast *ast_create_word(char *word);
2026-01-24 15:34:10 +01:00
/*
* @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 */