LibreOffice Module starmath (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
SmParser5 Class Referencefinal

Parses the starmath code and creates the nodes. More...

#include <parse5.hxx>

Inheritance diagram for SmParser5:
[legend]
Collaboration diagram for SmParser5:
[legend]

Public Member Functions

 SmParser5 ()
 
virtual ~SmParser5 ()
 
std::unique_ptr< SmTableNodeParse (const OUString &rBuffer)
 Parse rBuffer to formula tree. More...
 
std::unique_ptr< SmNodeParseExpression (const OUString &rBuffer)
 Parse rBuffer to formula subtree that constitutes an expression. More...
 
const OUString & GetText () const
 
bool IsImportSymbolNames () const
 
void SetImportSymbolNames (bool bVal)
 
bool IsExportSymbolNames () const
 
void SetExportSymbolNames (bool bVal)
 
const SmErrorDescNextError ()
 
const SmErrorDescPrevError ()
 
const SmErrorDescGetError () const
 
const std::set< OUString > & GetUsedSymbols () const
 
- Public Member Functions inherited from AbstractSmParser
virtual ~AbstractSmParser ()
 
virtual std::unique_ptr< SmTableNodeParse (const OUString &rBuffer)=0
 Parse rBuffer to formula tree. More...
 
virtual std::unique_ptr< SmNodeParseExpression (const OUString &rBuffer)=0
 Parse rBuffer to formula subtree that constitutes an expression. More...
 
virtual const OUString & GetText () const =0
 
virtual bool IsImportSymbolNames () const =0
 
virtual void SetImportSymbolNames (bool bVal)=0
 
virtual bool IsExportSymbolNames () const =0
 
virtual void SetExportSymbolNames (bool bVal)=0
 
virtual const SmErrorDescNextError ()=0
 
virtual const SmErrorDescPrevError ()=0
 
virtual const SmErrorDescGetError () const =0
 
virtual const std::set< OUString > & GetUsedSymbols () const =0
 

Private Member Functions

 SmParser5 (const SmParser5 &)=delete
 
SmParser5operator= (const SmParser5 &)=delete
 
void NextToken ()
 
void NextTokenColor (SmTokenType dvipload)
 
void NextTokenFontSize ()
 
sal_Int32 GetTokenIndex () const
 
void Replace (sal_Int32 nPos, sal_Int32 nLen, std::u16string_view aText)
 
bool TokenInGroup (TG nGroup)
 
std::unique_ptr< SmTableNodeDoTable ()
 
std::unique_ptr< SmNodeDoLine ()
 
std::unique_ptr< SmNodeDoExpression (bool bUseExtraSpaces=true)
 
std::unique_ptr< SmNodeDoRelation ()
 
std::unique_ptr< SmNodeDoSum ()
 
std::unique_ptr< SmNodeDoProduct ()
 
std::unique_ptr< SmNodeDoSubSup (TG nActiveGroup, std::unique_ptr< SmNode > xGivenNode)
 
std::unique_ptr< SmNodeDoSubSupEvaluate (std::unique_ptr< SmNode > xGivenNode)
 
std::unique_ptr< SmNodeDoOpSubSup ()
 
std::unique_ptr< SmNodeDoPower ()
 
std::unique_ptr< SmBlankNodeDoBlank ()
 
std::unique_ptr< SmNodeDoTerm (bool bGroupNumberIdent)
 
std::unique_ptr< SmNodeDoEscape ()
 
std::unique_ptr< SmOperNodeDoOperator ()
 
std::unique_ptr< SmNodeDoOper ()
 
std::unique_ptr< SmStructureNodeDoUnOper ()
 
std::unique_ptr< SmNodeDoAlign (bool bUseExtraSpaces=true)
 
std::unique_ptr< SmStructureNodeDoFontAttribute ()
 
std::unique_ptr< SmStructureNodeDoAttribute ()
 
std::unique_ptr< SmStructureNodeDoFont ()
 
std::unique_ptr< SmStructureNodeDoFontSize ()
 
std::unique_ptr< SmStructureNodeDoColor ()
 
std::unique_ptr< SmStructureNodeDoBrace ()
 
std::unique_ptr< SmBracebodyNodeDoBracebody (bool bIsLeftRight)
 
std::unique_ptr< SmNodeDoEvaluate ()
 
std::unique_ptr< SmTextNodeDoFunction ()
 
std::unique_ptr< SmTableNodeDoBinom ()
 
std::unique_ptr< SmBinVerNodeDoFrac ()
 
std::unique_ptr< SmStructureNodeDoStack ()
 
std::unique_ptr< SmStructureNodeDoMatrix ()
 
std::unique_ptr< SmSpecialNodeDoSpecial ()
 
std::unique_ptr< SmGlyphSpecialNodeDoGlyphSpecial ()
 
std::unique_ptr< SmExpressionNodeDoError (SmParseError Error)
 

Private Attributes

OUString m_aBufferString
 
SmToken m_aCurToken
 
ESelection m_aCurESelection
 
std::vector< SmErrorDescm_aErrDescList
 
int m_nCurError
 
sal_Int32 m_nBufferIndex
 
sal_Int32 m_nTokenIndex
 
sal_Int32 m_nRow
 
sal_Int32 m_nColOff
 
bool m_bImportSymNames
 
bool m_bExportSymNames
 
sal_Int32 m_nParseDepth
 
std::set< OUString > m_aUsedSymbols
 
CharClass m_aNumCC
 
const CharClassm_pSysCC
 

Detailed Description

Parses the starmath code and creates the nodes.

Definition at line 29 of file parse5.hxx.

Constructor & Destructor Documentation

◆ SmParser5() [1/2]

SmParser5::SmParser5 ( const SmParser5 )
privatedelete

◆ SmParser5() [2/2]

SmParser5::SmParser5 ( )

Definition at line 2690 of file parse5.cxx.

References LANGUAGE_ENGLISH_US.

◆ ~SmParser5()

SmParser5::~SmParser5 ( )
virtual

Definition at line 2704 of file parse5.cxx.

Member Function Documentation

◆ DoAlign()

std::unique_ptr< SmNode > SmParser5::DoAlign ( bool  bUseExtraSpaces = true)
private

◆ DoAttribute()

std::unique_ptr< SmStructureNode > SmParser5::DoAttribute ( )
private

◆ DoBinom()

std::unique_ptr< SmTableNode > SmParser5::DoBinom ( )
private

Definition at line 2500 of file parse5.cxx.

References DoSum(), m_aCurESelection, m_aCurToken, m_nParseDepth, and NextToken().

Referenced by DoTerm().

◆ DoBlank()

std::unique_ptr< SmBlankNode > SmParser5::DoBlank ( )
private

◆ DoBrace()

std::unique_ptr< SmStructureNode > SmParser5::DoBrace ( )
private

◆ DoBracebody()

std::unique_ptr< SmBracebodyNode > SmParser5::DoBracebody ( bool  bIsLeftRight)
private

◆ DoColor()

std::unique_ptr< SmStructureNode > SmParser5::DoColor ( )
private

◆ DoError()

std::unique_ptr< SmExpressionNode > SmParser5::DoError ( SmParseError  Error)
private

◆ DoEscape()

std::unique_ptr< SmNode > SmParser5::DoEscape ( )
private

◆ DoEvaluate()

std::unique_ptr< SmNode > SmParser5::DoEvaluate ( )
private

◆ DoExpression()

std::unique_ptr< SmNode > SmParser5::DoExpression ( bool  bUseExtraSpaces = true)
private

Definition at line 1231 of file parse5.cxx.

References DoRelation(), m_aCurToken, m_nParseDepth, and SmToken::nLevel.

Referenced by DoAlign(), DoLine(), and ParseExpression().

◆ DoFont()

std::unique_ptr< SmStructureNode > SmParser5::DoFont ( )
private

◆ DoFontAttribute()

std::unique_ptr< SmStructureNode > SmParser5::DoFontAttribute ( )
private

◆ DoFontSize()

std::unique_ptr< SmStructureNode > SmParser5::DoFontSize ( )
private

◆ DoFrac()

std::unique_ptr< SmBinVerNode > SmParser5::DoFrac ( )
private

Definition at line 2515 of file parse5.cxx.

References DoSum(), m_aCurESelection, m_aCurToken, m_nParseDepth, and NextToken().

Referenced by DoTerm().

◆ DoFunction()

std::unique_ptr< SmTextNode > SmParser5::DoFunction ( )
private

◆ DoGlyphSpecial()

std::unique_ptr< SmGlyphSpecialNode > SmParser5::DoGlyphSpecial ( )
private

Definition at line 2655 of file parse5.cxx.

References m_aCurToken, m_nParseDepth, and NextToken().

Referenced by DoProduct(), and DoUnOper().

◆ DoLine()

std::unique_ptr< SmNode > SmParser5::DoLine ( )
private

Definition at line 1200 of file parse5.cxx.

References DoAlign(), DoExpression(), SmToken::eType, m_aCurESelection, m_aCurToken, m_nParseDepth, TEND, and TNEWLINE.

Referenced by DoTable().

◆ DoMatrix()

std::unique_ptr< SmStructureNode > SmParser5::DoMatrix ( )
private

◆ DoOper()

std::unique_ptr< SmNode > SmParser5::DoOper ( )
private

◆ DoOperator()

std::unique_ptr< SmOperNode > SmParser5::DoOperator ( )
private

◆ DoOpSubSup()

std::unique_ptr< SmNode > SmParser5::DoOpSubSup ( )
private

◆ DoPower()

std::unique_ptr< SmNode > SmParser5::DoPower ( )
private

Definition at line 1538 of file parse5.cxx.

References DoSubSup(), DoTerm(), m_aCurToken, m_nParseDepth, SmToken::nGroup, and Power.

Referenced by DoEvaluate(), DoOperator(), DoProduct(), DoTerm(), and DoUnOper().

◆ DoProduct()

std::unique_ptr< SmNode > SmParser5::DoProduct ( )
private

◆ DoRelation()

std::unique_ptr< SmNode > SmParser5::DoRelation ( )
private

Definition at line 1254 of file parse5.cxx.

References DoOpSubSup(), DoSum(), m_aCurESelection, m_aCurToken, m_nParseDepth, Relation, and TokenInGroup().

Referenced by DoExpression(), and DoSubSup().

◆ DoSpecial()

std::unique_ptr< SmSpecialNode > SmParser5::DoSpecial ( )
private

◆ DoStack()

std::unique_ptr< SmStructureNode > SmParser5::DoStack ( )
private

◆ DoSubSup()

std::unique_ptr< SmNode > SmParser5::DoSubSup ( TG  nActiveGroup,
std::unique_ptr< SmNode xGivenNode 
)
private

Of course 'm_aCurToken' is just the first sub-/supscript token. It should be of no further interest. The positions of the sub-/supscripts will be identified by the corresponding subnodes index in the 'aSubNodes' array (enum value from 'SmSubSup').

Definition at line 1384 of file parse5.cxx.

References CSUB, CSUP, DoError(), DoRelation(), DoTerm(), DoubleSubsupscript, eType, SmToken::eType, Limit, LSUB, LSUP, m_aCurESelection, m_aCurToken, m_nParseDepth, NextToken(), SmToken::nGroup, nIndex, Power, RSUB, RSUP, SAL_WARN, SUBSUP_NUM_ENTRIES, TCSUB, TCSUP, TFROM, TLSUB, TLSUP, TokenInGroup(), TRSUB, TRSUP, and TTO.

Referenced by DoOperator(), DoOpSubSup(), and DoPower().

◆ DoSubSupEvaluate()

std::unique_ptr< SmNode > SmParser5::DoSubSupEvaluate ( std::unique_ptr< SmNode xGivenNode)
private

◆ DoSum()

std::unique_ptr< SmNode > SmParser5::DoSum ( )
private

Definition at line 1279 of file parse5.cxx.

References DoOpSubSup(), DoProduct(), m_aCurESelection, m_aCurToken, m_nParseDepth, Sum, and TokenInGroup().

Referenced by DoBinom(), DoFrac(), and DoRelation().

◆ DoTable()

std::unique_ptr< SmTableNode > SmParser5::DoTable ( )
private

Definition at line 1152 of file parse5.cxx.

References DoLine(), SmToken::eType, m_aCurESelection, m_aCurToken, m_nParseDepth, NextToken(), TEND, and TNEWLINE.

Referenced by Parse().

◆ DoTerm()

std::unique_ptr< SmNode > SmParser5::DoTerm ( bool  bGroupNumberIdent)
private

◆ DoUnOper()

std::unique_ptr< SmStructureNode > SmParser5::DoUnOper ( )
private

◆ GetError()

const SmErrorDesc * SmParser5::GetError ( ) const
virtual

Implements AbstractSmParser.

Definition at line 2766 of file parse5.cxx.

References m_aErrDescList.

◆ GetText()

const OUString & SmParser5::GetText ( ) const
inlinevirtual

Implements AbstractSmParser.

Definition at line 107 of file parse5.hxx.

References m_aBufferString.

◆ GetTokenIndex()

sal_Int32 SmParser5::GetTokenIndex ( ) const
inlineprivate

Definition at line 57 of file parse5.hxx.

References m_nTokenIndex.

Referenced by DoSpecial().

◆ GetUsedSymbols()

const std::set< OUString > & SmParser5::GetUsedSymbols ( ) const
inlinevirtual

Implements AbstractSmParser.

Definition at line 117 of file parse5.hxx.

References m_aUsedSymbols.

◆ IsExportSymbolNames()

bool SmParser5::IsExportSymbolNames ( ) const
inlinevirtual

Implements AbstractSmParser.

Definition at line 111 of file parse5.hxx.

References m_bExportSymNames.

Referenced by DoSpecial().

◆ IsImportSymbolNames()

bool SmParser5::IsImportSymbolNames ( ) const
inlinevirtual

Implements AbstractSmParser.

Definition at line 109 of file parse5.hxx.

References m_bImportSymNames.

Referenced by DoSpecial().

◆ NextError()

const SmErrorDesc * SmParser5::NextError ( )
virtual

Implements AbstractSmParser.

Definition at line 2738 of file parse5.cxx.

References m_aErrDescList, and m_nCurError.

◆ NextToken()

void SmParser5::NextToken ( )
private

modifies aRes.EndPos

0 to continue expression

0 to terminate expression

Definition at line 387 of file parse5.cxx.

References SmTokenTableEntry::aIdent, aName, SmToken::aText, Blank, ch, SmTokenTableEntry::cMathChar, SmToken::cMathChar, coContFlags, coNumContFlags, coNumStartFlags, coStartFlags, coUserDefinedCharContFlags, SmTokenTableEntry::eType, SmToken::eType, GetTokenTableEntry(), CharClass::getType(), IsDelimiter(), LBrace, m_aBufferString, m_aCurESelection, m_aCurToken, m_aNumCC, m_nBufferIndex, m_nColOff, m_nRow, m_nTokenIndex, m_pSysCC, MS_AND, MS_ASSIGN, MS_GE, MS_GG, MS_GT, MS_LBRACE, MS_LBRACKET, MS_LE, MS_LEFTARROW, MS_LL, MS_LPARENT, MS_LT, MS_MINUS, MS_MINUSPLUS, MS_MULTIPLY, MS_NEQ, MS_OR, MS_PLACE, MS_PLUS, MS_PLUSMINUS, MS_RBRACE, MS_RBRACKET, MS_RIGHTARROW, MS_RPARENT, MS_SLASH, n, SmTokenTableEntry::nGroup, SmToken::nGroup, SmTokenTableEntry::nLevel, SmToken::nLevel, NONE, CharClass::parseAnyToken(), CharClass::parsePredefinedToken(), Power, Product, RBrace, Relation, SAL_WARN_IF, SmToken::setChar(), Standalone, Sum, TAND, TASSIGN, TBLANK, TCHARACTER, TDIVIDEBY, TDPOUND, TEND, TESCAPE, TGE, TGG, TGT, TIDENT, TLBRACKET, TLE, TLEFTARROW, TLGROUP, TLL, TLPARENT, TLT, TMINUS, TMINUSPLUS, TMULTIPLY, TNEQ, TNUMBER, TOR, TPLACE, TPLUS, TPLUSMINUS, TPOUND, TRBRACKET, TRGROUP, TRIGHTARROW, TRPARENT, TRSUB, TRSUP, TSBLANK, TSPECIAL, TTEXT, u, and UnOper.

Referenced by DoAlign(), DoAttribute(), DoBinom(), DoBlank(), DoBrace(), DoBracebody(), DoColor(), DoError(), DoEscape(), DoEvaluate(), DoFont(), DoFontAttribute(), DoFontSize(), DoFrac(), DoFunction(), DoGlyphSpecial(), DoMatrix(), DoOper(), DoOpSubSup(), DoProduct(), DoSpecial(), DoStack(), DoSubSup(), DoSubSupEvaluate(), DoTable(), DoTerm(), DoUnOper(), Parse(), and ParseExpression().

◆ NextTokenColor()

void SmParser5::NextTokenColor ( SmTokenType  dvipload)
private

◆ NextTokenFontSize()

void SmParser5::NextTokenFontSize ( )
private

◆ operator=()

SmParser5 & SmParser5::operator= ( const SmParser5 )
privatedelete

◆ Parse()

std::unique_ptr< SmTableNode > SmParser5::Parse ( const OUString &  rBuffer)
virtual

◆ ParseExpression()

std::unique_ptr< SmNode > SmParser5::ParseExpression ( const OUString &  rBuffer)
virtual

Parse rBuffer to formula subtree that constitutes an expression.

Implements AbstractSmParser.

Definition at line 2723 of file parse5.cxx.

References convertLineEnd(), DoExpression(), LINEEND_LF, m_aBufferString, m_aErrDescList, m_nBufferIndex, m_nColOff, m_nCurError, m_nRow, m_nTokenIndex, and NextToken().

◆ PrevError()

const SmErrorDesc * SmParser5::PrevError ( )
virtual

Implements AbstractSmParser.

Definition at line 2752 of file parse5.cxx.

References m_aErrDescList, and m_nCurError.

◆ Replace()

void SmParser5::Replace ( sal_Int32  nPos,
sal_Int32  nLen,
std::u16string_view  aText 
)
private

Definition at line 377 of file parse5.cxx.

References m_aBufferString, m_nBufferIndex, m_nTokenIndex, and nPos.

Referenced by DoSpecial().

◆ SetExportSymbolNames()

void SmParser5::SetExportSymbolNames ( bool  bVal)
inlinevirtual

Implements AbstractSmParser.

Definition at line 112 of file parse5.hxx.

References m_bExportSymNames.

◆ SetImportSymbolNames()

void SmParser5::SetImportSymbolNames ( bool  bVal)
inlinevirtual

Implements AbstractSmParser.

Definition at line 110 of file parse5.hxx.

References m_bImportSymNames.

◆ TokenInGroup()

bool SmParser5::TokenInGroup ( TG  nGroup)
inlineprivate

Member Data Documentation

◆ m_aBufferString

OUString SmParser5::m_aBufferString
private

◆ m_aCurESelection

ESelection SmParser5::m_aCurESelection
private

◆ m_aCurToken

SmToken SmParser5::m_aCurToken
private

◆ m_aErrDescList

std::vector<SmErrorDesc> SmParser5::m_aErrDescList
private

Definition at line 34 of file parse5.hxx.

Referenced by DoError(), GetError(), NextError(), Parse(), ParseExpression(), and PrevError().

◆ m_aNumCC

CharClass SmParser5::m_aNumCC
private

Definition at line 46 of file parse5.hxx.

Referenced by NextToken().

◆ m_aUsedSymbols

std::set<OUString> SmParser5::m_aUsedSymbols
private

Definition at line 43 of file parse5.hxx.

Referenced by DoSpecial(), GetUsedSymbols(), and Parse().

◆ m_bExportSymNames

bool SmParser5::m_bExportSymNames
private

Definition at line 39 of file parse5.hxx.

Referenced by IsExportSymbolNames(), and SetExportSymbolNames().

◆ m_bImportSymNames

bool SmParser5::m_bImportSymNames
private

Definition at line 39 of file parse5.hxx.

Referenced by IsImportSymbolNames(), and SetImportSymbolNames().

◆ m_nBufferIndex

sal_Int32 SmParser5::m_nBufferIndex
private

◆ m_nColOff

sal_Int32 SmParser5::m_nColOff
private

Definition at line 38 of file parse5.hxx.

Referenced by NextToken(), NextTokenColor(), NextTokenFontSize(), Parse(), and ParseExpression().

◆ m_nCurError

int SmParser5::m_nCurError
private

Definition at line 35 of file parse5.hxx.

Referenced by NextError(), Parse(), ParseExpression(), and PrevError().

◆ m_nParseDepth

sal_Int32 SmParser5::m_nParseDepth
private

◆ m_nRow

sal_Int32 SmParser5::m_nRow
private

Definition at line 37 of file parse5.hxx.

Referenced by NextToken(), NextTokenColor(), NextTokenFontSize(), Parse(), and ParseExpression().

◆ m_nTokenIndex

sal_Int32 SmParser5::m_nTokenIndex
private

◆ m_pSysCC

const CharClass* SmParser5::m_pSysCC
private

Definition at line 48 of file parse5.hxx.

Referenced by DoTerm(), NextToken(), NextTokenColor(), and NextTokenFontSize().


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