BEEP-8 Helper Lib 1.0.0
Loading...
Searching...
No Matches
tokenizer.h File Reference

Header file for the tokenizer module. More...

#include <cstr.h>
#include <vector>
#include <map>

Go to the source code of this file.

Classes

struct  Macro
 Structure representing a macro with a key-value pair. More...
 
class  MacroDict
 A dictionary for storing and retrieving macros. More...
 
class  CFormula
 Class representing a formula with a left-hand side (LHS) and a right-hand side (RHS). More...
 
class  CTokenizer
 A tokenizer class for handling comma-separated equations. More...
 

Detailed Description

Header file for the tokenizer module.

This file contains the declarations for the tokenizer class and supporting structures used to parse and handle comma-separated equations.

The tokenizer module allows for defining and retrieving key-value pairs from a string of equations. Each equation is in the format of "key=value" and multiple equations can be separated by commas. Additionally, macros can be used to replace placeholders in the equations.

Example usage:

CTokenizer tokenizer("xx = +123 ; yy = -3 ; zz = -987 ; str = test_string");
const char* fn = "CTestTokenizer";
_ASSERT(tokenizer.GetNumber("xx") == 123, fn);
_ASSERT(tokenizer.GetNumber("yy") == -3, fn);
_ASSERT(tokenizer.GetNumber("zz") == -987, fn);
_ASSERT(tokenizer.GetNumber("str") == 0, fn);
_ASSERT(tokenizer.GetString("xx") == "+123", fn);
_ASSERT(tokenizer.GetString("yy") == "-3", fn);
_ASSERT(tokenizer.GetString("zz") == "-987", fn);
_ASSERT(tokenizer.GetString("str") == "test_string", fn);
A tokenizer class for handling comma-separated equations.
Definition tokenizer.h:104
Author
Your Name
Date
2024