|
BashSpark
|
BashSpark main namespace. More...
Classes | |
| class | basic_ifakestream |
| A class for input stream behavior with a character type. More... | |
| class | basic_iinullstream |
| A null input stream that provides no input. More... | |
| class | basic_nullbuffer |
| A null stream buffer that ignores all input and output. More... | |
| class | basic_ofakestream |
| A class for output stream behavior with a character type. More... | |
| class | basic_onullstream |
| A null output stream that discards all output. More... | |
| class | command |
| Abstract base class for all shell commands. More... | |
| class | command_echo |
| Built-in command that prints all arguments to stdout. More... | |
| class | command_eval |
| Built-in command that evaluates its arguments as a shell command. More... | |
| class | command_fcall |
| Calls a function. More... | |
| class | command_getenv |
| Retrieves the value of an environment variable. More... | |
| class | command_getvar |
| Retrieves the value of an local variable. More... | |
| class | command_math |
| Prints on stdout the result of a mathematical operation. More... | |
| class | command_seq |
| Prints a sequence on stdout. Supports negative numbers and decreasing sequences. More... | |
| class | command_setenv |
| Sets the value of an environment variable. More... | |
| class | command_setvar |
| Sets the value of a local variable. More... | |
| class | command_test |
| Performs a test. Returns through status code. More... | |
| struct | math_error |
| Exception representing a math-related error during expression evaluation. More... | |
| struct | math_parser |
Structure to help class command_math parse it's parameters. More... | |
| class | shell |
| A simplified shell environment inspired by Bash. More... | |
| class | shell_arg |
| Represents a command line argument list for shell commands. More... | |
| class | shell_env |
| Represents an environment for shell commands. More... | |
| struct | shell_hash |
| Custom hash functor for strings using the 64-bit FNV-1a algorithm. More... | |
| struct | shell_hash_view |
| Custom hash functor for strings using the 64-bit FNV-1a algorithm. More... | |
| class | shell_node |
| Base class for all parser nodes. More... | |
| class | shell_node_and |
| Logical AND operator node (executes right only if left succeeded). More... | |
| class | shell_node_arg |
| Extract positional argument from the session (e.g. $1, $2). More... | |
| class | shell_node_background |
| Evaluates a subcommand in background semantics (implementation-specific). More... | |
| class | shell_node_break |
Represents a break statement inside a loop. More... | |
| class | shell_node_command |
| Wraps a command expression and executes it as a command. More... | |
| class | shell_node_command_block |
| A sequence of evaluable nodes executed in order (a block). More... | |
| class | shell_node_command_block_subshell |
| Command block executed in a subshell (may isolate environment changes). More... | |
| class | shell_node_command_expression |
| Represents a command expression composed of expandable children. More... | |
| class | shell_node_continue |
Represents a continue statement inside a loop. More... | |
| class | shell_node_dollar_arg |
| Extract an argument referenced with a leading $ (e.g. $@, $* or $1). More... | |
| class | shell_node_dollar_arg_dhop |
| Dollar-argument with "double-hop" semantics (implementation-specific). More... | |
| class | shell_node_dollar_command |
| Command-substitution node used in $() or backticks when appearing inside other contexts. More... | |
| class | shell_node_dollar_special |
| Special dollar items such as $?, $#, $$, etc. (implementation-specific). More... | |
| class | shell_node_dollar_variable |
| Dollar-prefixed variable node (may have different semantics). More... | |
| class | shell_node_dollar_variable_dhop |
| Dollar-variable with double-hop lookup semantics. More... | |
| class | shell_node_evaluable |
| Base interface for nodes that can be evaluated (executed). More... | |
| class | shell_node_expandable |
| Base interface for nodes that expand to tokens (strings). More... | |
| class | shell_node_for |
| Iterative 'for' loop node that iterates over an expandable sequence. More... | |
| class | shell_node_function |
| Create function and adds to the shell session. More... | |
| class | shell_node_if |
| Conditional execution node (if-then-else). More... | |
| class | shell_node_invalid_argument |
| Exception thrown when a node is constructed with invalid args. More... | |
| class | shell_node_null_command |
| Represents a no-op command node (useful as placeholder). More... | |
| class | shell_node_operator |
| Base class for binary operator nodes (pipe, and, or) with priority handling. More... | |
| class | shell_node_or |
| Logical OR operator node (executes right only if left failed). More... | |
| class | shell_node_pipe |
| Pipe operator node (connects stdout of left to stdin of right). More... | |
| class | shell_node_session_extractor |
| Base for nodes that extract values from the session (args/vars/etc.). More... | |
| class | shell_node_str |
| Base for string-like nodes composed of expandable fragments. More... | |
| class | shell_node_str_back |
| Command-substitution string node (backticks or $(...)). More... | |
| class | shell_node_str_double |
| Double-quoted string node. More... | |
| class | shell_node_str_simple |
| Simple (unquoted) string node. More... | |
| class | shell_node_test |
| Node that evaluates an expandable expression as a test/condition. More... | |
| class | shell_node_unicode |
| A single Unicode codepoint node. More... | |
| class | shell_node_until |
| 'Until' loop node that executes the iterative block until the condition succeeds. More... | |
| class | shell_node_variable |
| Extract a named shell variable from the session environment. More... | |
| class | shell_node_visitor |
| Generic visitor for shell AST nodes. More... | |
| class | shell_node_visitor_json |
| Visitor that converts shell nodes into JSON. More... | |
| class | shell_node_while |
| While-loop node executing the iterative block while the condition succeeds. More... | |
| class | shell_node_word |
| A plain word token node. More... | |
| class | shell_parser |
| Parses tokens into an evaluable shell AST. More... | |
| class | shell_parser_exception |
| Exception class for handling shell-specific errors. More... | |
| class | shell_session |
| Represents an execution environment for a shell instance. More... | |
| struct | shell_token |
| Represents a token generated during command parsing. More... | |
| class | shell_tokenizer |
| class | shell_var |
| Represents a variable map for shell commands. More... | |
| class | shell_vtable |
| Represents an environment for shell commands. More... | |
| struct | test_error |
| Exception representing a test-related error during expression evaluation. More... | |
| struct | test_parser |
Structure to help class command_test parse it's parameters. More... | |
| class | token_holder |
| A class that manages a collection of shell tokens for processing. More... | |
Typedefs | |
| using | ifakestream = basic_ifakestream< char > |
| Alias for basic_ifakestream with char. | |
| using | wifakestream = basic_ifakestream< wchar_t > |
| Alias for basic_ifakestream with wchar_t. | |
| using | u8ifakestream = basic_ifakestream< char8_t > |
| Alias for basic_ifakestream with char8_t. | |
| using | u16ifakestream = basic_ifakestream< char16_t > |
| Alias for basic_ifakestream with char16_t. | |
| using | u32ifakestream = basic_ifakestream< char32_t > |
| Alias for basic_ifakestream with char32_t. | |
| using | ofakestream = basic_ofakestream< char > |
| Alias for basic_ofakestream with char. | |
| using | wofakestream = basic_ofakestream< wchar_t > |
| Alias for basic_ofakestream with wchar_t. | |
| using | u8ofakestream = basic_ofakestream< char8_t > |
| Alias for basic_ofakestream with char8_t. | |
| using | u16ofakestream = basic_ofakestream< char16_t > |
| Alias for basic_ofakestream with char16_t. | |
| using | u32ofakestream = basic_ofakestream< char32_t > |
| Alias for basic_ofakestream with char32_t. | |
| using | onullstream = basic_onullstream< char, std::char_traits< char > > |
| Type alias for a null output stream using char type. | |
| using | u8onullstream = basic_onullstream< char8_t, std::char_traits< char8_t > > |
| Type alias for a null output stream using char8_t type. | |
| using | u16onullstream = basic_onullstream< char16_t, std::char_traits< char16_t > > |
| Type alias for a null output stream using char16_t type. | |
| using | u32onullstream = basic_onullstream< char32_t, std::char_traits< char32_t > > |
| Type alias for a null output stream using char32_t type. | |
| using | inullstream = basic_iinullstream< char, std::char_traits< char > > |
| Type alias for a null input stream using char type. | |
| using | u8inullstream = basic_iinullstream< char8_t, std::char_traits< char8_t > > |
| Type alias for a null input stream using char8_t type. | |
| using | u16inullstream = basic_iinullstream< char16_t, std::char_traits< char16_t > > |
| Type alias for a null input stream using char16_t type. | |
| using | u32inullstream = basic_iinullstream< char32_t, std::char_traits< char32_t > > |
| Type alias for a null input stream using char32_t type. | |
| using | safe_int = boost::safe_numerics::safe< std::int64_t > |
| Sugar syntax: typedef of boost::safe_numerics::safe<std::int64_t> | |
| using | visit_type = shell_node_visitor_json::visit_type |
Typedef of shell_node_visitor_json::visit_type (sugar syntax) | |
| using | evaluable_ptr = shell_parser::evaluable_ptr |
| Unique pointer to evaluable node (sugar syntax). | |
| using | expandable_ptr = shell_parser::expandable_ptr |
| Unique pointer to expandable node (sugar syntax). | |
Functions | |
| constexpr bool | has (const parse_mode nItem, const parse_mode nSet) |
Checks if the bitwise and of two parse_mode is 0. | |
| constexpr bool | has (const shell_keyword nItem, const shell_keyword nSet) |
Checks if the bitwise and of two shell_keyword is 0. | |
| constexpr shell_status | make_user_code (const unsigned int nCode) |
| Generates status codes for user use from user codes. | |
| constexpr bool | is_syntax_error (const shell_status nStatus) |
| constexpr std::uint64_t | hash (const char *const pString, const std::size_t nLength) |
| Hashes a string. | |
| constexpr std::uint64_t | hash (const std::string_view sString) |
| Hashes a string. | |
| std::uint64_t | hash (const std::string &sString) |
| Hashes a string. | |
| constexpr std::uint64_t | hash (const char *const pString) |
| Hashes a string. | |
| constexpr bool | is_arg (const std::string_view &sArg) |
| Check whether a std::string represents a valid unsigned integer argument. | |
| bool | is_arg (const std::string &sArg) |
| Check whether a std::string represents a valid unsigned integer argument. | |
| constexpr bool | is_var (const std::string_view &sVar) |
| Internal helper: check whether the given string_view is a valid variable name. | |
| bool | is_var (const std::string &sVar) |
| Internal helper: check whether the given string_view is a valid variable name. | |
| constexpr bool | is_number (const std::string_view &sArg) |
| Checks if the provided string is a valid representation of a number. | |
| constexpr char32_t | combine_surrogates (const char16_t high, const char16_t low) |
| Combines high and low UTF-16 surrogates into a UTF-32 code point. | |
| std::string | to_hex_string (const char32_t cChar, const std::size_t nLength) |
| Converts a UTF-32 character to a hexadecimal string representation. | |
| void | write_char32_t (ofakestream &oStream, const char32_t cChar) |
| Writes a UTF-32 character to an output stream in UTF-8 encoding. | |
| std::string | write_char32_t (const char32_t cChar) |
| Converts a UTF-32 character to a UTF-8 encoded string. | |
| bool | parse_utf (ifakestream &oIstream, const std::size_t nCount, char32_t &cResult) |
| Parses a UTF-n encoded character from an input stream. | |
| std::vector< std::string > | split_string (const std::string_view &oString) |
| Splits a string into a vector. | |
| void | split_string (std::vector< std::string > &vStrings, const std::string_view &oString) |
| Splits a string into a vector. | |
| void | insert_vector (std::vector< std::string > &vDestiny, std::vector< std::string > vOrigin) |
| Moves appends the contents of the origin vector into the destination vector. | |
| void | concat_vector (ofakestream &oOstream, const std::vector< std::string > &vOrigin) |
| Writes the contents of a vector<string> on an output stream. | |
| std::int64_t | get_pid () |
| Gets the PID process of the shell On non recognized platforms returns 0. | |
| shell_keyword | get_keyword_id (const std::string_view &oString) |
| Identifies shell special keywords. | |
| shell_keyword | get_keyword_id (const std::string &oString) |
| Identifies shell special keywords. | |
Variables | |
| constexpr std::size_t | SHELL_MAX_DEPTH = 16 |
| Maximum depth allowed for shell. | |
| constexpr std::uint64_t | FNV_OFFSET_BASIS = 2166136261 |
| FVN-1 offset basis. | |
| constexpr std::uint64_t | FNVPrime = 16777619 |
| FVN-1 prime number. | |
BashSpark main namespace.
| using bs::onullstream = typedef basic_onullstream<char, std::char_traits<char> > |
|
strong |
Enumeration of all supported mathematical operators.
|
strong |
Enumeration for different parsing modes.
This enum defines various modes for the parsing process, allowing for specific behaviors depending on the mode set.
| Enumerator | |
|---|---|
| PM_NORMAL | Normal parsing mode. |
| PM_BACKQUOTE | Backquote parsing mode. |
| PM_LOOP | Loop parsing mode. |
| PM_BACKQUOTE_LOOP | Combined mode for handling both backquote and looping. |
|
strong |
Enumeration of shell keywords for scripting.
|
strong |
Types of nodes recognized by the shell parser.
Values include language constructs (IF/FOR/WHILE), tokens (WORD, ARG), expansion tokens ($VAR, command substitution) and executable nodes (COMMAND, COMMAND_BLOCK, etc.).
|
strong |
Shell status codes.
bs::shell_status::SHELL_CMD_ERROR results in undefined behaviour.
|
strong |
Enumeration of types of tokens that can be parsed from shell commands.
This enum categorizes various components of shell commands to facilitate tokenization and parsing.
|
strong |
An enumeration representing various comparison and logical operators.
This enum class defines a set of operators that can be used in expressions to perform comparisons, checks, or logical operations.
|
constexpr |
Combines high and low UTF-16 surrogates into a UTF-32 code point.
| high | The high surrogate (in the range 0xD800 to 0xDBFF). |
| low | The low surrogate (in the range 0xDC00 to 0xDFFF). |
|
inline |
Writes the contents of a vector<string> on an output stream.
| oOstream | Output stream to write |
| vOrigin | Vector to write |
|
inline |
Identifies shell special keywords.
| oString | Keyword to identify |
|
inline |
Identifies shell special keywords.
| oString | Keyword to identify |
|
inline |
Gets the PID process of the shell On non recognized platforms returns 0.
|
constexpr |
Checks if the bitwise and of two parse_mode is 0.
| nItem | Left parse mode |
| nSet | Right parse mode |
|
constexpr |
Checks if the bitwise and of two shell_keyword is 0.
| nItem | Left keyword |
| nSet | Right keyword |
|
constexpr |
Hashes a string.
See hash function implementation details for implementation details.
| pString | String to hash (C null terminated) |
|
constexpr |
Hashes a string.
This function is the base implementation of all other hashing variant funtions. Currently hashes with FNV-1a.
| pString | String to hash (C null terminated) |
| nLength | Length of text to hash |
|
inline |
Hashes a string.
See hash function implementation details for implementation details.
| sString | String to hash |
|
constexpr |
Hashes a string.
See hash function implementation details for implementation details.
| sString | String to hash |
|
inline |
Moves appends the contents of the origin vector into the destination vector.
| vDestiny | Destination vector |
| vOrigin | Origin vector |
|
inline |
Check whether a std::string represents a valid unsigned integer argument.
A valid argument:
| sArg | String to validate. |
|
constexpr |
Check whether a std::string represents a valid unsigned integer argument.
A valid argument:
| sArg | String to validate. |
|
constexpr |
Checks if the provided string is a valid representation of a number.
This function verifies whether the input string can be interpreted as a numerical value. It checks that the string is not empty, does not exceed a length of 18 digits (limited by std::int64_t range), and contains only digits. It also allows for an optional leading '+' or '-' sign.
| sArg | A string view representing the input string to be checked. |
|
constexpr |
Check whether a status code represents a syntax error
| nStatus | Status code to check |
|
inline |
Internal helper: check whether the given string_view is a valid variable name.
A valid variable name:
_ or a letter a–z, A–Z_a–z, A–Z0–9| sVar | String to validate. |
|
constexpr |
Internal helper: check whether the given string_view is a valid variable name.
A valid variable name:
_ or a letter a–z, A–Z_a–z, A–Z0–9| sVar | String to validate. |
|
constexpr |
Generates status codes for user use from user codes.
| nCode | User code |
|
inline |
Parses a UTF-n encoded character from an input stream.
| oIstream | The input stream to read from. |
| nCount | The number of hex digits to read (1 for UTF-8, 2 for UTF-16, 4 for UTF-32). |
| cResult | Parse UTF-32 character. |
This function reads the specified number of characters, checks for valid hex format, and handles surrogate pairs as needed.
| bash_utf_error | If the input is invalid or not properly encoded. |
|
inline |
Splits a string into a vector.
| oString | String to split |
|
inline |
Splits a string into a vector.
| vStrings | Vector of strings where to split |
| oString | String to split |
|
inline |
Converts a UTF-32 character to a hexadecimal string representation.
| cChar | The UTF-32 character to convert. |
| nLength | The number of hex digits to include (1 for byte, 2 for UTF-16, 4 for UTF-32). |
|
inline |
Converts a UTF-32 character to a UTF-8 encoded string.
| cChar | The UTF-32 character to convert. |
|
inline |
Writes a UTF-32 character to an output stream in UTF-8 encoding.
| oStream | The output stream to write to. |
| cChar | The UTF-32 character to encode and write. |
This function encodes the character based on its value, handling the appropriate byte sequence for UTF-8.
|
constexpr |
Maximum depth allowed for shell.
Surpassing this depth will result in controlled errors.