myshell 2.0.0
Loading...
Searching...
No Matches
msh_token.h File Reference

Token structure and related types. More...

Go to the source code of this file.

Classes

struct  Token
 Structure representing a token. More...
 

Typedefs

using tokens_t = std::vector<Token>
 

Enumerations

enum class  TokenType {
  EMPTY , WORD , COMMAND , AMP ,
  AND , PIPE , PIPE_AMP , OR ,
  OUT , OUT_APPEND , IN , OUT_AMP ,
  IN_AMP , AMP_OUT , AMP_APPEND , SEMICOLON ,
  DQSTRING , SQSTRING , VAR_DECL , SUBOPEN ,
  SUBCLOSE , COM_SUB
}
 

Variables

const std::map< TokenType, int > token_flags
 The internal token flags table.
 
constexpr int UNSUPPORTED = 1 << 0
 Unsupported token. Parser will throw an error if it encounters this.
 
constexpr int GLOB_EXPAND = 1 << 1
 Tells the parser to expand globs in this kind of token.
 
constexpr int VAR_EXPAND = 1 << 2
 Tells the parser to expand variables in this kind of token.
 
constexpr int WORD_LIKE = 1 << 3
 This token is a potential argument/command that will be forwarded to argv.
 
constexpr int NO_WORD_SPLIT = 1 << 4
 This token is not eligible for word splitting.
 
constexpr int COMMAND_SEPARATOR = 1 << 5
 This token separates simple commands. Used for parsing.
 
constexpr int REDIRECT = 1 << 6
 This token is a redirect. Used for parsing.
 
constexpr int ASSIGNMENT_WORD = 1 << 7
 This token is an assignment word. Used for parsing.
 

Detailed Description

Token structure and related types.

Variable Documentation

◆ token_flags

const std::map<TokenType, int> token_flags
extern

The internal token flags table.

Maps token types to their corresponding flags.

See also
TokenType
Note
Wildcard expansion is disabled for double quoted strings by default. To enable it, define ENABLE_DOUBLE_QUOTE_WILDCARD_SUBSTITUTION in CMakeLists.txt.
Glob expansion is not performed for COMMAND tokens by default due to requirement We ignore masks in the program name. However, this behavior is unnatural.