|
libSBML C++ API
5.18.0
|
Tokenizes an SBML formula string. More...
Classes | |
| struct | FormulaTokenizer_t |
| used to track the state of tokenizing a string. More... | |
| struct | Token_t |
| Structure used to store a token returned by FormulaTokenizer_nextToken(). More... | |
Enumerations | |
| enum | TokenType_t { TT_PLUS = '+', TT_MINUS = '-', TT_TIMES = '*', TT_DIVIDE = '/', TT_POWER = '^', TT_LPAREN = '(', TT_RPAREN = ')', TT_COMMA = ',', TT_END = '\0', TT_NAME = 256, TT_INTEGER, TT_REAL, TT_REAL_E, TT_UNKNOWN } |
| Enumeration of possible token types. More... | |
Functions | |
| FormulaTokenizer_t * | FormulaTokenizer_createFromFormula (const char *formula) |
Creates a new FormulaTokenizer_t object for the given formula string and returns a pointer to the object. More... | |
| void | FormulaTokenizer_free (FormulaTokenizer_t *ft) |
Frees the given FormulaTokenizer_t object ft. More... | |
| Token_t * | FormulaTokenizer_nextToken (FormulaTokenizer_t *ft) |
| Returns the next token in the formula string. More... | |
Tokenizes an SBML formula string.
| enum TokenType_t |
Enumeration of possible token types.
"TT" is short for "TokenType".
| FormulaTokenizer_t* FormulaTokenizer_createFromFormula | ( | const char * | formula | ) |
Creates a new FormulaTokenizer_t object for the given formula string and returns a pointer to the object.
SBML Level 1 uses a simple text-string representation of mathematical formulas, rather than the MathML-based representation used in SBML Levels 2 and 3. LibSBML implements a parser and converter to translate formulas between this text-string representation and MathML. The first entry point is the function FormulaTokenizer_createFromFormula(), which returns a FormulaTokenizer_t structure. The structure tracks the current position in the string to be tokenized, and can be handed to other functions such as FormulaTokenizer_nextToken(). Tokens are returned as Token_t structures.
| formula | the text string that contains the mathematical formula to be tokenized. |
| void FormulaTokenizer_free | ( | FormulaTokenizer_t * | ft | ) |
Frees the given FormulaTokenizer_t object ft.
| Token_t* FormulaTokenizer_nextToken | ( | FormulaTokenizer_t * | ft | ) |
Returns the next token in the formula string.
SBML Level 1 uses a simple text-string representation of mathematical formulas, rather than the MathML-based representation used in SBML Levels 2 and 3. LibSBML implements a parser and converter to translate formulas between this text-string representation and MathML. The first entry point is the function FormulaTokenizer_createFromFormula(), which returns a FormulaTokenizer_t structure. The structure tracks the current position in the string to be tokenized, and can be handed to other functions such as FormulaTokenizer_nextToken(). Tokens are returned as Token_t structures.
An instance of a FormulaTokenizer_t maintains its own internal copy of the formula being tokenized and the current position within the formula string. Callers do not need to manipulate the fields of a FormulaTokenizer_t structure themselves; instances of FormulaTokenizer_t are only meant to be passed around between the functions of the formula tokenizer system, such as FormulaTokenizer_createFromFormula() and FormulaTokenizer_getName().
| ft | the object tracking the current tokenization state. |
TT_END. Please consult the documentation for the structure Token_t for more information about the possible data values it can hold.