libSBML C++ API  5.20.2
FormulaTokenizer_t Struct Reference

Detailed Description

Tracks the state of tokenizing a formula string.

This structure (FormulaTokenizer_t) is part of the simpler mathematical formula translation system designed to help convert between SBML Level 1 and Levels 2 and 3. 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 principal entry points to the translation system are SBML_formulaToString() and SBML_parseFormula().

LibSBML also provides a lower-level interface to the formula parser. This takes the form of the C functions FormulaTokenizer_createFromFormula() and FormulaTokenizer_nextToken(). The structure FormulaTokenizer_t is used to store the current parser state when callers invoke these methods.

An instance of a FormulaTokenizer_t maintains its own internal copy of the formula being tokenized and the current position within the formula string. The field formula holds the former, and the field pos holds the latter. Callers do not need to manipulate these fields themselves; instances of FormulaTokenizer_t are only meant to be passed around between the functions of the formula tokenizer system.

See also
SBML_parseFormula()
SBML_formulaToString()
Note
Callers using SBML Level 3 are encouraged to use the facilities provided by libSBML's newer and more powerful Level 3-oriented formula parser and formatter. The entry points to this second system are SBML_parseL3Formula() and SBML_formulaToL3String(). The Level 1-oriented system (i.e., what is provided by SBML_formulaToString() and SBML_parseFormula()) is provided untouched for backwards compatibility.

Public Attributes

char * formula
 
unsigned int pos
 

Member Data Documentation

◆ formula

char* FormulaTokenizer_t::formula

Field used to store the formula string.

◆ pos

unsigned int FormulaTokenizer_t::pos

Field used to store the current parsing position.