1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_STARMATH_INC_PARSE_HXX
20 #define INCLUDED_STARMATH_INC_PARSE_HXX
22 #include <vcl/svapp.hxx>
33 OUString m_aBufferString
;
35 SmNodeStack m_aNodeStack
;
36 SmErrDescList m_aErrDescList
;
39 sal_Int32 m_nBufferIndex
,
46 // map of used symbols (used to reduce file size by exporting only actually used symbols)
47 std::set
< OUString
> m_aUsedSymbols
;
49 //! locale where '.' is decimal separator!
50 ::com::sun::star::lang::Locale m_aDotLoc
;
52 SmParser(const SmParser
&) SAL_DELETED_FUNCTION
;
53 SmParser
& operator=(const SmParser
&) SAL_DELETED_FUNCTION
;
55 #if OSL_DEBUG_LEVEL > 1
56 bool IsDelimiter( const OUString
&rTxt
, sal_Int32 nPos
);
59 sal_Int32
GetTokenIndex() const { return m_nTokenIndex
; }
60 void Replace( sal_Int32 nPos
, sal_Int32 nLen
, const OUString
&rText
);
62 inline bool TokenInGroup( sal_uLong nGroup
);
71 void SubSup(sal_uLong nActiveGroup
);
75 void Term(bool bGroupNumberIdent
);
87 void Bracebody(bool bIsLeftRight
);
96 LanguageType
GetLanguage() const { return m_nLang
; }
97 void SetLanguage( LanguageType nNewLang
) { m_nLang
= nNewLang
; }
99 void Error(SmParseError Error
);
101 void ClearUsedSymbols() { m_aUsedSymbols
.clear(); }
102 void AddToUsedSymbols( const OUString
&rSymbolName
) { m_aUsedSymbols
.insert( rSymbolName
); }
107 /** Parse rBuffer to formula tree */
108 SmNode
*Parse(const OUString
&rBuffer
);
109 /** Parse rBuffer to formula subtree that constitutes an expression */
110 SmNode
*ParseExpression(const OUString
&rBuffer
);
112 const OUString
& GetText() const { return m_aBufferString
; };
114 bool IsImportSymbolNames() const { return bImportSymNames
; }
115 void SetImportSymbolNames(bool bVal
) { bImportSymNames
= bVal
; }
116 bool IsExportSymbolNames() const { return m_bExportSymNames
; }
117 void SetExportSymbolNames(bool bVal
) { m_bExportSymNames
= bVal
; }
119 size_t AddError(SmParseError Type
, SmNode
*pNode
);
120 const SmErrorDesc
* NextError();
121 const SmErrorDesc
* PrevError();
122 const SmErrorDesc
* GetError(size_t i
);
123 static const SmTokenTableEntry
* GetTokenTableEntry( const OUString
&rName
);
124 bool IsUsedSymbol( const OUString
&rSymbolName
) const { return m_aUsedSymbols
.find( rSymbolName
) != m_aUsedSymbols
.end(); }
125 std::set
< OUString
> GetUsedSymbols() const { return m_aUsedSymbols
; }
129 inline bool SmParser::TokenInGroup( sal_uLong nGroup
)
131 return (m_aCurToken
.nGroup
& nGroup
) != 0;
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */