STOFFStarMathToMMLConverterInternal::Parser Class Reference

class to parse a StarMath string More...

Public Member Functions

 Parser ()
 constructor More...
 
bool parse (librevenge::RVNGString const &formula, librevenge::RVNGString &res)
 try to parse a StarMath string More...
 

Protected Member Functions

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

Static Protected Member Functions

static std::string getEscapedString (std::string const &str)
 html escape a string More...
 

Protected Attributes

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

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 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().

◆ 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)
inlinestaticprotected

html escape a string

Referenced by convertInMML(), and parse().

◆ ignoreSpaces() [1/2]

void STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces ( size_t &  pos) const
inlineprotected

◆ ignoreSpaces() [2/2]

void STOFFStarMathToMMLConverterInternal::Parser::ignoreSpaces ( size_t &  pos,
std::string &  spaces 
) const
inlineprotected

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().

◆ parenthesisExpr()

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

try to parse a parenthesis expr:

Referenced by functionExpr().

◆ 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(), and positionExpr().

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

◆ 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

◆ 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:

Generated on Sun Mar 24 2019 23:33:17 for libstaroffice by doxygen 1.8.15