BashSpark
Loading...
Searching...
No Matches
shell_keyword.h File Reference

Defines enum bs::shell_keyword. More...

#include <type_traits>
Include dependency graph for shell_keyword.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  bs
 BashSpark main namespace.
 

Enumerations

enum class  bs::shell_keyword {
  bs::SK_NONE = 0x0 , bs::SK_FUNCTION = 1 << 0 , bs::SK_IF = 1 << 1 , bs::SK_THEN = 1 << 2 ,
  bs::SK_ELSE = 1 << 3 , bs::SK_ELIF = 1 << 4 , bs::SK_FI = 1 << 5 , bs::SK_FOR = 1 << 6 ,
  bs::SK_IN = 1 << 7 , bs::SK_WHILE = 1 << 8 , bs::SK_UNTIL = 1 << 9 , bs::SK_DO = 1 << 10 ,
  bs::SK_DONE = 1 << 11 , bs::SK_CONTINUE = 1 << 12 , bs::SK_BREAK = 1 << 13 , bs::SK_IF_DELIMITER = SK_ELSE | SK_ELIF | SK_FI
}
 Enumeration of shell keywords for scripting. More...
 
enum class  bs::parse_mode {
  bs::PM_NORMAL = 0x0 , bs::PM_BACKQUOTE = 1 << 0 , bs::PM_LOOP = 1 << 1 , PM_FUNCTION_NAME = 1 << 2 ,
  bs::PM_BACKQUOTE_LOOP = PM_BACKQUOTE & PM_LOOP
}
 Enumeration for different parsing modes. More...
 

Functions

constexpr bool bs::has (const parse_mode nItem, const parse_mode nSet)
 Checks if the bitwise and of two parse_mode is 0.
 
constexpr bool bs::has (const shell_keyword nItem, const shell_keyword nSet)
 Checks if the bitwise and of two shell_keyword is 0.
 
constexpr bs::shell_keyword operator| (const bs::shell_keyword nLeft, const bs::shell_keyword nRight)
 Bitwise OR operator for shell_keyword.
 
constexpr bs::shell_keyword operator& (const bs::shell_keyword nLeft, const bs::shell_keyword nRight)
 Bitwise AND operator for shell_keyword.
 
constexpr bs::shell_keyword operator^ (const bs::shell_keyword nLeft, const bs::shell_keyword nRight)
 Bitwise XOR operator for shell_keyword.
 
bs::shell_keywordoperator|= (bs::shell_keyword &nLeft, const bs::shell_keyword nRight)
 Bitwise OR assignment operator for shell_keyword.
 
bs::shell_keywordoperator&= (bs::shell_keyword &nLeft, const bs::shell_keyword nRight)
 Bitwise AND assignment operator for shell_keyword.
 
bs::shell_keywordoperator^= (bs::shell_keyword &nLeft, const bs::shell_keyword nRight)
 Bitwise XOR assignment operator for shell_keyword.
 
constexpr bs::parse_mode operator| (const bs::parse_mode nLeft, const bs::parse_mode nRight)
 Bitwise OR operator for parse_mode.
 
constexpr bs::parse_mode operator& (const bs::parse_mode nLeft, const bs::parse_mode nRight)
 Bitwise AND operator for parse_mode.
 
constexpr bs::parse_mode operator^ (const bs::parse_mode nLeft, const bs::parse_mode nRight)
 Bitwise XOR operator for parse_mode.
 
bs::parse_modeoperator|= (bs::parse_mode &nLeft, const bs::parse_mode nRight)
 Bitwise OR assignment operator for parse_mode.
 
bs::parse_modeoperator&= (bs::parse_mode &nLeft, const bs::parse_mode nRight)
 Bitwise AND assignment operator for parse_mode.
 
bs::parse_modeoperator^= (bs::parse_mode &nLeft, const bs::parse_mode nRight)
 Bitwise XOR assignment operator for parse_mode.
 

Detailed Description

Defines enum bs::shell_keyword.

This file contains the definition of the bs::shell_keyword enum, which provides helper methods for class shell.

Date
Created on 2/11/25
Author
Dante Doménech Martínez

This file is part of BashSpark. Copyright (C) 2025 Dante Doménech Martínez

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Function Documentation

◆ operator&() [1/2]

constexpr bs::parse_mode operator& ( const bs::parse_mode  nLeft,
const bs::parse_mode  nRight 
)
constexpr

Bitwise AND operator for parse_mode.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise AND as a parse_mode.

◆ operator&() [2/2]

constexpr bs::shell_keyword operator& ( const bs::shell_keyword  nLeft,
const bs::shell_keyword  nRight 
)
constexpr

Bitwise AND operator for shell_keyword.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise AND as a shell_keyword.

◆ operator&=() [1/2]

bs::parse_mode & operator&= ( bs::parse_mode nLeft,
const bs::parse_mode  nRight 
)
inline

Bitwise AND assignment operator for parse_mode.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.

◆ operator&=() [2/2]

bs::shell_keyword & operator&= ( bs::shell_keyword nLeft,
const bs::shell_keyword  nRight 
)
inline

Bitwise AND assignment operator for shell_keyword.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.

◆ operator^() [1/2]

constexpr bs::parse_mode operator^ ( const bs::parse_mode  nLeft,
const bs::parse_mode  nRight 
)
constexpr

Bitwise XOR operator for parse_mode.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise XOR as a parse_mode.

◆ operator^() [2/2]

constexpr bs::shell_keyword operator^ ( const bs::shell_keyword  nLeft,
const bs::shell_keyword  nRight 
)
constexpr

Bitwise XOR operator for shell_keyword.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise XOR as a shell_keyword.

◆ operator^=() [1/2]

bs::parse_mode & operator^= ( bs::parse_mode nLeft,
const bs::parse_mode  nRight 
)
inline

Bitwise XOR assignment operator for parse_mode.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.

◆ operator^=() [2/2]

bs::shell_keyword & operator^= ( bs::shell_keyword nLeft,
const bs::shell_keyword  nRight 
)
inline

Bitwise XOR assignment operator for shell_keyword.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.

◆ operator|() [1/2]

constexpr bs::parse_mode operator| ( const bs::parse_mode  nLeft,
const bs::parse_mode  nRight 
)
constexpr

Bitwise OR operator for parse_mode.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise OR as a parse_mode.

◆ operator|() [2/2]

constexpr bs::shell_keyword operator| ( const bs::shell_keyword  nLeft,
const bs::shell_keyword  nRight 
)
constexpr

Bitwise OR operator for shell_keyword.

Parameters
nLeftThe left operand.
nRightThe right operand.
Returns
The result of the bitwise OR as a shell_keyword.

◆ operator|=() [1/2]

bs::parse_mode & operator|= ( bs::parse_mode nLeft,
const bs::parse_mode  nRight 
)
inline

Bitwise OR assignment operator for parse_mode.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.

◆ operator|=() [2/2]

bs::shell_keyword & operator|= ( bs::shell_keyword nLeft,
const bs::shell_keyword  nRight 
)
inline

Bitwise OR assignment operator for shell_keyword.

Parameters
nLeftThe left operand, which will be modified.
nRightThe right operand.
Returns
A reference to the modified left operand.