|
static void | PutSymbol (const std::string &identifier, const std::string ®ex) |
| Adds a terminal symbol with its associated regex to the symbol table.
|
|
static void | PutSymbol (const std::string &identifier) |
| Adds a non-terminal symbol to the symbol table.
|
|
static bool | In (const std::string &s) |
| Checks if a symbol exists in the symbol table.
|
|
static bool | IsTerminal (const std::string &s) |
| Checks if a symbol is a terminal.
|
|
static std::string | GetValue (const std::string &terminal) |
| Retrieves the regex pattern for a terminal symbol.
|
|
static void | Debug () |
| Prints all symbols and their properties in the symbol table.
|
|
static void | SetEol (const std::string &eol) |
| Sets the end-of-line symbol.
|
|
|
static std::string | EOL_ {"$"} |
| End-of-line symbol used in parsing, initialized as "$".
|
|
static std::string | EPSILON_ {"EPSILON"} |
| Epsilon symbol, representing empty transitions, initialized as "EPSILON".
|
|
static std::unordered_map< std::string, std::pair< symbol_type, std::string > > | st_ {{EOL_, {TERMINAL, EOL_}}, {EPSILON_, {TERMINAL, EPSILON_}}} |
| Main symbol table, mapping identifiers to a pair of symbol type and its regex.
|
|
static std::unordered_map< std::string, unsigned long > | token_types_ |
| Token types, mapping each symbol to a unique integer ID.
|
|
static std::unordered_map< unsigned long, std::string > | token_types_r_ |
| Reverse mapping from integer token IDs back to symbols.
|
|
static std::vector< unsigned long > | order_ {1} |
| Tracks insertion order of token types.
|
|
static unsigned long | i_ {2} |
| Current index for assigning new token IDs, starting from 2.
|
|
◆ Debug()
void symbol_table::Debug |
( |
| ) |
|
|
static |
Prints all symbols and their properties in the symbol table.
Outputs the symbol table for debugging purposes.
◆ GetValue()
std::string symbol_table::GetValue |
( |
const std::string & | terminal | ) |
|
|
static |
Retrieves the regex pattern for a terminal symbol.
- Parameters
-
terminal | Terminal symbol identifier. |
- Returns
- Regex pattern associated with the terminal symbol.
◆ In()
bool symbol_table::In |
( |
const std::string & | s | ) |
|
|
static |
Checks if a symbol exists in the symbol table.
- Parameters
-
s | Symbol identifier to search. |
- Returns
- true if the symbol is present, otherwise false.
◆ IsTerminal()
bool symbol_table::IsTerminal |
( |
const std::string & | s | ) |
|
|
static |
Checks if a symbol is a terminal.
- Parameters
-
s | Symbol identifier to check. |
- Returns
- true if the symbol is terminal, otherwise false.
◆ PutSymbol() [1/2]
void symbol_table::PutSymbol |
( |
const std::string & | identifier | ) |
|
|
static |
Adds a non-terminal symbol to the symbol table.
- Parameters
-
identifier | Name of the non-terminal symbol. |
◆ PutSymbol() [2/2]
void symbol_table::PutSymbol |
( |
const std::string & | identifier, |
|
|
const std::string & | regex ) |
|
static |
Adds a terminal symbol with its associated regex to the symbol table.
Updates the token type mappings and tracks insertion order.
- Parameters
-
identifier | Name of the terminal symbol. |
regex | Regular expression representing the terminal symbol. |
◆ SetEol()
void symbol_table::SetEol |
( |
const std::string & | eol | ) |
|
|
static |
Sets the end-of-line symbol.
- Parameters
-
eol | String to use as the new end-of-line symbol. |
◆ token_types_
std::unordered_map<std::string, unsigned long> symbol_table::token_types_ |
|
inlinestatic |
Initial value:{
static std::string EOL_
End-of-line symbol used in parsing, initialized as "$".
Definition symbol_table.hpp:11
Token types, mapping each symbol to a unique integer ID.
◆ token_types_r_
std::unordered_map<unsigned long, std::string> symbol_table::token_types_r_ |
|
inlinestatic |
Initial value:
Reverse mapping from integer token IDs back to symbols.
The documentation for this struct was generated from the following files: