Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
STOFFStarMathToMMLConverterInternal::Parser Class Reference

class to parse a StarMath string More...

## Public Member Functions
| Parser ()
| constructor
bool | parse (librevenge::RVNGString const &formula, librevenge::RVNGString &res)
| try to parse a StarMath string

## Protected Member Functions
bool | convert (librevenge::RVNGString const &starMath, std::vector< LexerData > &lexList) const
| convert a StarMath string in a list of lexer data.
bool | convertInMML (Node const &node, bool inRow=false)
| try to convert a node in a starMML
bool | convertPositionOverbraceInMML (Node const &node)
| try to convert a position node in a starMML
bool | convertPositionUnderbraceInMML (Node const &node)
| try to convert a position node in a starMML
bool | convertPositionInMML (Node const &node)
| try to convert a position node in a starMML
void | findAndAddAlignment (Node &node, bool &colFound, bool &rowFound)
| try to add the alignment
bool | sendMathVariant ()
| try to send the font style
std::shared_ptr< Node > | expr () const
| try to parse an expr: {newline|sequenceExpr}*
std::shared_ptr< Node > | sequenceExpr (size_t &pos, bool newLineIsBad=false, int stackOrMatrixType=0) const
| try to parse a sequence of expr
std::shared_ptr< Node > | relationExpr (size_t &pos) const
| try to parse an relation expr: additionExpr{[=,==,...]additionExpr}
std::shared_ptr< Node > | additionExpr (size_t &pos) const
| try to parse an addition expr: multiplyExpr{[+,-,in,or,...]multiplyExpr}
std::shared_ptr< Node > | multiplicationExpr (size_t &pos) const
| try to parse an multiplication expr: positionExpr{[*,/,over,...]positionExpr}
std::shared_ptr< Node > | positionExpr (size_t &pos) const
| try to parse a position expr: functionExpr{[^,_,sub,sup]functionExpr} first child is sub, second child is sup
std::shared_ptr< Node > | unaryOperatorExpr (size_t &pos, bool inPosition=false) const
| try to parse a unary operator expr:
std::shared_ptr< Node > | functionExpr (size_t &pos, bool inPosition=false) const
| try to parse a function expr: blockExpr | unaryOpExpr
std::shared_ptr< Node > | parenthesisExpr (size_t &pos) const
| try to parse a parenthesis expr:
std::shared_ptr< Node > | rightParenthesisExpr (size_t &pos, std::shared_ptr< Node > term) const
| look for alone right parenthesis
std::shared_ptr< Node > | leftParenthesisExpr (size_t &pos, std::function< std::shared_ptr< Node >(size_t &)> function) const
| look for alone left parenthesis
std::shared_ptr< Node > | elementExpr (size_t &pos) const
| try to parse a element expr:
void | ignoreSpaces (size_t &pos) const
| ignore the following space
void | ignoreSpaces (size_t &pos, std::string &spaces) const
| ignore the following space

## Static Protected Member Functions
static std::string | getEscapedString (std::string const &str)
| html escape a string

## Protected Attributes
std::vector< LexerData > | m_dataList
| the star math data
std::stringstream | m_output
| the output stream
double | m_fontSize
| the current font size
bool | m_bold
| a flag to know if we are in bold or not
bool | m_italic
| a flag to know if we are in italic or not
std::string | m_fontName
| the font name
std::set< std::string > | m_colorSet
| the set of potential color
std::map< std::string, std::string > | m_fontMap
| the font convert map
std::map< std::string, std::string > | m_greekMap
| the greek convert map
std::map< std::string, std::string > | m_specialPercentMap
| the special percent convert map
std::map< std::string, std::string > | m_otherSpecialMap
| the remaining special key word
std::map< std::string, std::string > | m_parenthesisMap
| the parenthesis left/right map
std::set< std::string > | m_parenthesisRightSet
| the parenthesis right map
std::map< std::string, std::string > | m_parenthesisToStringMap
| the parenthesis unicode map
std::map< std::string, std::string > | m_unaryOperatorMap
| the unary operator
std::set< std::string > | m_function1Set
| the function which have one argument
std::set< std::string > | m_function2Set
| the function which have two argument
std::map< std::string, std::string > | m_integralMap
| the function which have one to three argument (from to optional)
std::map< std::string, std::string > | m_accent1Map
| the accent which have one argument
std::set< std::string > | m_accent1Set
| the accent which have one argument
std::map< std::string, int > | m_positionMap
| position symbol map
std::map< std::string, std::string > | m_multiplicationMap
| multiplication symbol operator
std::map< std::string, std::string > | m_multiplicationStringMap
| multiplication symbol string operator
std::set< std::string > | m_additionSet
| addition symbol operator
std::map< std::string, std::string > | m_additionStringMap
| addition symbol string operator
std::map< std::string, std::string > | m_relationMap
| relation symbol operator
std::map< std::string, std::string > | m_relationStringMap
| relation symbol string operator

## Detailed Description

class to parse a StarMath string

## Constructor & Destructor Documentation

## ◆ Parser()

STOFFStarMathToMMLConverterInternal::Parser::Parser | ( |  | ) |
| inline

constructor

## Member Function Documentation

## ◆ additionExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::additionExpr | ( | size_t & | pos | ) | const
| protected

try to parse an addition expr: multiplyExpr{[+,-,in,or,...]multiplyExpr}

Referenced by relationExpr().

## ◆ convert()

bool STOFFStarMathToMMLConverterInternal::Parser::convert | ( | librevenge::RVNGString const & | starMath,
|  | std::vector< LexerData > & | lexList ) const
| protected

convert a StarMath string in a list of lexer data.

try to merge together the number zone, the placeholder <?>, the "XXX" string zone and some double symbols +-, -+, ##, <=, ...

Referenced by parse().

## ◆ convertInMML()

bool STOFFStarMathToMMLConverterInternal::Parser::convertInMML | ( | Node const & | node,
|  | bool | inRow = false )
| protected

try to convert a node in a starMML

Referenced by convertInMML(), convertPositionInMML(), convertPositionOverbraceInMML(), convertPositionUnderbraceInMML(), and parse().

## ◆ convertPositionInMML()

bool STOFFStarMathToMMLConverterInternal::Parser::convertPositionInMML | ( | Node const & | node | ) |
| protected

try to convert a position node in a starMML

Referenced by convertPositionUnderbraceInMML().

## ◆ convertPositionOverbraceInMML()

bool STOFFStarMathToMMLConverterInternal::Parser::convertPositionOverbraceInMML | ( | Node const & | node | ) |
| protected

try to convert a position node in a starMML

Referenced by convertInMML().

## ◆ convertPositionUnderbraceInMML()

bool STOFFStarMathToMMLConverterInternal::Parser::convertPositionUnderbraceInMML | ( | Node const & | node | ) |
| protected

try to convert a position node in a starMML

Referenced by convertPositionOverbraceInMML().

## ◆ elementExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::elementExpr | ( | size_t & | pos | ) | const
| protected

try to parse a element expr:

Referenced by parenthesisExpr().

## ◆ expr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::expr | ( |  | ) | const
| protected

try to parse an expr: {newline|sequenceExpr}*

Referenced by parse().

## ◆ findAndAddAlignment()

void STOFFStarMathToMMLConverterInternal::Parser::findAndAddAlignment | ( | Node & | node,
|  | bool & | colFound,
|  | bool & | rowFound )
| protected

try to add the alignment

Referenced by convertInMML(), and findAndAddAlignment().

## ◆ functionExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::functionExpr | ( | size_t & | pos,
|  | bool | inPosition = false ) const
| protected

try to parse a function expr: blockExpr | unaryOpExpr

Referenced by unaryOperatorExpr().

## ◆ getEscapedString()

static std::string STOFFStarMathToMMLConverterInternal::Parser::getEscapedString | ( | std::string const & | str | ) |
| inline static protected

html escape a string

Referenced by convertInMML(), and parse().

## ◆ ignoreSpaces() [1/2]

void STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces | ( | size_t & | pos | ) | const
| inline protected

ignore the following space

Referenced by additionExpr(), elementExpr(), expr(), functionExpr(), leftParenthesisExpr(), multiplicationExpr(), parenthesisExpr(), positionExpr(), relationExpr(), rightParenthesisExpr(), sequenceExpr(), and unaryOperatorExpr().

## ◆ ignoreSpaces() [2/2]

void STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces | ( | size_t & | pos,
|  | std::string & | spaces ) const
| inline protected

ignore the following space

## ◆ leftParenthesisExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::leftParenthesisExpr | ( | size_t & | pos,
|  | std::function< std::shared_ptr< Node >(size_t &)> | function ) const
| protected

look for alone left parenthesis

Referenced by multiplicationExpr(), and parenthesisExpr().

## ◆ multiplicationExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::multiplicationExpr | ( | size_t & | pos | ) | const
| protected

try to parse an multiplication expr: positionExpr{[*,/,over,...]positionExpr}

Referenced by additionExpr(), and multiplicationExpr().

## ◆ parenthesisExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::parenthesisExpr | ( | size_t & | pos | ) | const
| protected

try to parse a parenthesis expr:

Referenced by functionExpr(), and parenthesisExpr().

## ◆ parse()

bool STOFFStarMathToMMLConverterInternal::Parser::parse | ( | librevenge::RVNGString const & | formula,
|  | librevenge::RVNGString & | res )

try to parse a StarMath string

Referenced by STOFFStarMathToMMLConverter::convertStarMath().

## ◆ positionExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::positionExpr | ( | size_t & | pos | ) | const
| protected

try to parse a position expr: functionExpr{[^,_,sub,sup]functionExpr} first child is sub, second child is sup

Referenced by multiplicationExpr().

## ◆ relationExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::relationExpr | ( | size_t & | pos | ) | const
| protected

try to parse an relation expr: additionExpr{[=,==,...]additionExpr}

Referenced by functionExpr(), and sequenceExpr().

## ◆ rightParenthesisExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::rightParenthesisExpr | ( | size_t & | pos,
|  | std::shared_ptr< Node > | term ) const
| protected

look for alone right parenthesis

Referenced by multiplicationExpr(), and parenthesisExpr().

## ◆ sendMathVariant()

bool STOFFStarMathToMMLConverterInternal::Parser::sendMathVariant | ( |  | ) |
| protected

try to send the font style

Referenced by convertInMML().

## ◆ sequenceExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::sequenceExpr | ( | size_t & | pos,
|  | bool | newLineIsBad = false,
|  | int | stackOrMatrixType = 0 ) const
| protected

try to parse a sequence of expr

Referenced by expr(), functionExpr(), and parenthesisExpr().

## ◆ unaryOperatorExpr()

std::shared_ptr< Node > STOFFStarMathToMMLConverterInternal::Parser::unaryOperatorExpr | ( | size_t & | pos,
|  | bool | inPosition = false ) const
| protected

try to parse a unary operator expr:

Referenced by functionExpr(), positionExpr(), and unaryOperatorExpr().

## Member Data Documentation

## ◆ m_accent1Map

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_accent1Map
| protected

the accent which have one argument

Referenced by convertInMML(), functionExpr(), and Parser().

## ◆ m_accent1Set

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_accent1Set
| protected

the accent which have one argument

Referenced by functionExpr(), and Parser().

## ◆ m_additionSet

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_additionSet
| protected

addition symbol operator

Referenced by additionExpr(), and Parser().

## ◆ m_additionStringMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_additionStringMap
| protected

addition symbol string operator

Referenced by additionExpr(), convertInMML(), and Parser().

## ◆ m_bold

bool STOFFStarMathToMMLConverterInternal::Parser::m_bold
| protected

a flag to know if we are in bold or not

Referenced by convertInMML(), and sendMathVariant().

## ◆ m_colorSet

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_colorSet
| protected

the set of potential color

Referenced by convertInMML(), and Parser().

## ◆ m_dataList

std::vector<LexerData> STOFFStarMathToMMLConverterInternal::Parser::m_dataList
| protected

the star math data

Referenced by additionExpr(), elementExpr(), expr(), functionExpr(), ignoreSpaces(), ignoreSpaces(), leftParenthesisExpr(), multiplicationExpr(), parenthesisExpr(), parse(), positionExpr(), relationExpr(), rightParenthesisExpr(), sequenceExpr(), and unaryOperatorExpr().

## ◆ m_fontMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_fontMap
| protected

the font convert map

Referenced by convertInMML(), and Parser().

## ◆ m_fontName

std::string STOFFStarMathToMMLConverterInternal::Parser::m_fontName
| protected

the font name

Referenced by convertInMML(), and sendMathVariant().

## ◆ m_fontSize

double STOFFStarMathToMMLConverterInternal::Parser::m_fontSize
| protected

the current font size

Referenced by convertInMML().

## ◆ m_function1Set

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_function1Set
| protected

the function which have one argument

Referenced by convertInMML(), functionExpr(), and Parser().

## ◆ m_function2Set

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_function2Set
| protected

the function which have two argument

Referenced by convertInMML(), functionExpr(), and Parser().

## ◆ m_greekMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_greekMap
| protected

the greek convert map

Referenced by convert(), convertInMML(), elementExpr(), and Parser().

## ◆ m_integralMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_integralMap
| protected

the function which have one to three argument (from to optional)

Referenced by convertInMML(), functionExpr(), and Parser().

## ◆ m_italic

bool STOFFStarMathToMMLConverterInternal::Parser::m_italic
| protected

a flag to know if we are in italic or not

Referenced by convertInMML(), and sendMathVariant().

## ◆ m_multiplicationMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_multiplicationMap
| protected

multiplication symbol operator

Referenced by convertInMML(), multiplicationExpr(), and Parser().

## ◆ m_multiplicationStringMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_multiplicationStringMap
| protected

multiplication symbol string operator

Referenced by convertInMML(), multiplicationExpr(), and Parser().

## ◆ m_otherSpecialMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_otherSpecialMap
| protected

the remaining special key word

Referenced by convertInMML(), elementExpr(), and Parser().

## ◆ m_output

std::stringstream STOFFStarMathToMMLConverterInternal::Parser::m_output
| protected

the output stream

Referenced by convertInMML(), convertPositionInMML(), convertPositionOverbraceInMML(), convertPositionUnderbraceInMML(), findAndAddAlignment(), parse(), and sendMathVariant().

## ◆ m_parenthesisMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisMap
| protected

the parenthesis left/right map

Referenced by convert(), leftParenthesisExpr(), parenthesisExpr(), and Parser().

## ◆ m_parenthesisRightSet

std::set<std::string> STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisRightSet
| protected

the parenthesis right map

Referenced by convert(), leftParenthesisExpr(), Parser(), and rightParenthesisExpr().

## ◆ m_parenthesisToStringMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_parenthesisToStringMap
| protected

the parenthesis unicode map

Referenced by convertInMML(), and Parser().

## ◆ m_positionMap

std::map<std::string, int> STOFFStarMathToMMLConverterInternal::Parser::m_positionMap
| protected

position symbol map

Referenced by Parser(), and positionExpr().

## ◆ m_relationMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_relationMap
| protected

relation symbol operator

Referenced by convertInMML(), Parser(), and relationExpr().

## ◆ m_relationStringMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_relationStringMap
| protected

relation symbol string operator

Referenced by convertInMML(), Parser(), and relationExpr().

## ◆ m_specialPercentMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_specialPercentMap
| protected

the special percent convert map

Referenced by convert(), convertInMML(), elementExpr(), and Parser().

## ◆ m_unaryOperatorMap

std::map<std::string, std::string> STOFFStarMathToMMLConverterInternal::Parser::m_unaryOperatorMap
| protected

the unary operator

Referenced by convertInMML(), Parser(), and unaryOperatorExpr().

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

- STOFFStarMathToMMLConverter.cxx