9#ifndef MYSHELL_MSH_TOKEN_H
10#define MYSHELL_MSH_TOKEN_H
18using tokens_t = std::vector<Token>;
75 TokenType type = TokenType::EMPTY;
81 explicit Token(TokenType t) : type(t) {
85 Token(TokenType t, std::string value) : type(t), value(std::move(value)) {
89 void set_type(TokenType t) {
94 [[nodiscard]]
bool get_flag(
int flag)
const {
98 [[maybe_unused]]
void set_flag(
int flag) {
102 [[maybe_unused]]
void unset_flag(
int flag) {
constexpr int REDIRECT
This token is a redirect. Used for parsing.
Definition msh_token.h:60
constexpr int COMMAND_SEPARATOR
This token separates simple commands. Used for parsing.
Definition msh_token.h:59
constexpr int GLOB_EXPAND
Tells the parser to expand globs in this kind of token.
Definition msh_token.h:55
constexpr int VAR_EXPAND
Tells the parser to expand variables in this kind of token.
Definition msh_token.h:56
constexpr int NO_WORD_SPLIT
This token is not eligible for word splitting.
Definition msh_token.h:58
constexpr int UNSUPPORTED
Unsupported token. Parser will throw an error if it encounters this.
Definition msh_token.h:54
constexpr int ASSIGNMENT_WORD
This token is an assignment word. Used for parsing.
Definition msh_token.h:61
constexpr int WORD_LIKE
This token is a potential argument/command that will be forwarded to argv.
Definition msh_token.h:57
const std::map< TokenType, int > token_flags
The internal token flags table.
Definition msh_internal.cpp:43
Structure representing a token.
Definition msh_token.h:74