Wildmeshing Toolkit
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
wmtk::components::image_simulation::expression_parser::Parser Class Reference

Public Member Functions

 Parser (const std::string &input, const std::map< std::string, int64_t > &tag_name_to_id)
 Constructs a new Parser object.
 
ExpressionPtr parse ()
 Parses the input string into a boolean expression tree.
 
ExpressionPtr parseOr ()
 Parses a logical OR expression.
 
ExpressionPtr parseAnd ()
 Parses a logical AND expression.
 
ExpressionPtr parseUnary ()
 Parses a unary expression (e.g., logical NOT).
 
ExpressionPtr parsePrimary ()
 Parses a primary expression (variables, parenthesized expressions).
 
std::string parseIdentifier ()
 Parses an identifier from the input string.
 
bool match (char c)
 Checks if the current character matches a given character, advancing the internal pointer if it does.
 
void skipWhitespace ()
 Skips whitespaces in the input string.
 

Private Attributes

std::string m_input
 
size_t m_pos = 0
 
std::map< std::string, int64_t > m_tag_name_to_id
 

Constructor & Destructor Documentation

◆ Parser()

wmtk::components::image_simulation::expression_parser::Parser::Parser ( const std::string &  input,
const std::map< std::string, int64_t > &  tag_name_to_id 
)
inlineexplicit

Constructs a new Parser object.

Parameters
inputThe input string containing the expression to parse.
tag_name_to_idA map from tag names to their respective IDs.

Member Function Documentation

◆ match()

bool wmtk::components::image_simulation::expression_parser::Parser::match ( char  c)

Checks if the current character matches a given character, advancing the internal pointer if it does.

Parameters
cThe character to match.
Returns
true If the current character matches c.
false Otherwise.

◆ parse()

ExpressionPtr wmtk::components::image_simulation::expression_parser::Parser::parse ( )

Parses the input string into a boolean expression tree.

Returns
ExpressionPtr The root of the parsed expression tree.

◆ parseAnd()

ExpressionPtr wmtk::components::image_simulation::expression_parser::Parser::parseAnd ( )

Parses a logical AND expression.

Returns
ExpressionPtr The parsed AND expression, or lower precedence expression.

◆ parseIdentifier()

std::string wmtk::components::image_simulation::expression_parser::Parser::parseIdentifier ( )

Parses an identifier from the input string.

Returns
std::string The parsed identifier.

◆ parseOr()

ExpressionPtr wmtk::components::image_simulation::expression_parser::Parser::parseOr ( )

Parses a logical OR expression.

Returns
ExpressionPtr The parsed OR expression, or lower precedence expression.

◆ parsePrimary()

ExpressionPtr wmtk::components::image_simulation::expression_parser::Parser::parsePrimary ( )

Parses a primary expression (variables, parenthesized expressions).

Returns
ExpressionPtr The parsed primary expression.

◆ parseUnary()

ExpressionPtr wmtk::components::image_simulation::expression_parser::Parser::parseUnary ( )

Parses a unary expression (e.g., logical NOT).

Returns
ExpressionPtr The parsed unary expression, or lower precedence expression.

The documentation for this class was generated from the following files: