1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: parse.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
35 #include <vcl/svapp.hxx>
37 #ifndef _STACK_HXX //autogen
38 #include <tools/stack.hxx>
48 #define TGOPER 0x00000001
49 #define TGRELATION 0x00000002
50 #define TGSUM 0x00000004
51 #define TGPRODUCT 0x00000008
52 #define TGUNOPER 0x00000010
53 #define TGPOWER 0x00000020
54 #define TGATTRIBUT 0x00000040
55 #define TGALIGN 0x00000080
56 #define TGFUNCTION 0x00000100
57 #define TGBLANK 0x00000200
58 #define TGLBRACES 0x00000400
59 #define TGRBRACES 0x00000800
60 #define TGCOLOR 0x00001000
61 #define TGFONT 0x00002000
62 #define TGSTANDALONE 0x00004000
63 #define TGDISCARDED 0x00008000
64 #define TGLIMIT 0x00010000
65 #define TGFONTATTR 0x00020000
70 TEND
, TLGROUP
, TRGROUP
, TLPARENT
, TRPARENT
,
71 TLBRACKET
, TRBRACKET
, TPLUS
, TMINUS
, TMULTIPLY
,
72 TDIVIDEBY
, TASSIGN
, TPOUND
, TSPECIAL
, TSLASH
,
73 TBACKSLASH
, TBLANK
, TSBLANK
, TRSUB
, TRSUP
,
74 TCSUB
, TCSUP
, TLSUB
, TLSUP
, TGT
,
75 TLT
, TAND
, TOR
, TINTERSECT
, TUNION
,
76 TNEWLINE
, TBINOM
, TFROM
, TTO
, TINT
,
77 TSUM
, TOPER
, TABS
, TSQRT
, TFACT
,
78 TNROOT
, TOVER
, TTIMES
, TGE
, TLE
,
79 TGG
, TLL
, TDOTSAXIS
, TDOTSLOW
, TDOTSVERT
,
80 TDOTSDIAG
, TDOTSUP
, TDOTSDOWN
, TACUTE
, TBAR
,
81 TBREVE
, TCHECK
, TCIRCLE
, TDOT
, TDDOT
,
82 TDDDOT
, TGRAVE
, THAT
, TTILDE
, TVEC
,
83 TUNDERLINE
, TOVERLINE
, TOVERSTRIKE
, TITALIC
, TNITALIC
,
84 TBOLD
, TNBOLD
, TPHANTOM
, TFONT
, TSIZE
,
85 TCOLOR
, TALIGNL
, TALIGNC
, TALIGNR
, TLEFT
,
86 TRIGHT
, TLANGLE
, TLBRACE
, TLLINE
, TLDLINE
,
87 TLCEIL
, TLFLOOR
, TNONE
, TMLINE
, TRANGLE
,
88 TRBRACE
, TRLINE
, TRDLINE
, TRCEIL
, TRFLOOR
,
89 TSIN
, TCOS
, TTAN
, TCOT
, TFUNC
,
90 TSTACK
, TMATRIX
, TMATFORM
, TDPOUND
, TPLACE
,
91 TTEXT
, TNUMBER
, TCHARACTER
, TIDENT
, TNEQ
,
92 TEQUIV
, TDEF
, TPROP
, TSIM
, TSIMEQ
,
93 TAPPROX
, TPARALLEL
, TORTHO
, TIN
, TNOTIN
,
94 TSUBSET
, TSUBSETEQ
, TSUPSET
, TSUPSETEQ
, TPLUSMINUS
,
95 TMINUSPLUS
, TOPLUS
, TOMINUS
, TDIV
, TOTIMES
,
96 TODIVIDE
, TTRANSL
, TTRANSR
, TIINT
, TIIINT
,
97 TLINT
, TLLINT
, TLLLINT
, TPROD
, TCOPROD
,
98 TFORALL
, TEXISTS
, TLIM
, TNABLA
, TTOWARD
,
99 TSINH
, TCOSH
, TTANH
, TCOTH
, TASIN
,
100 TACOS
, TATAN
, TLN
, TLOG
, TUOPER
,
101 TBOPER
, TBLACK
, TWHITE
, TRED
, TGREEN
,
102 TBLUE
, TCYAN
, TMAGENTA
, TYELLOW
, TFIXED
,
103 TSANS
, TSERIF
, TPOINT
, TASINH
, TACOSH
,
104 TATANH
, TACOTH
, TACOT
, TEXP
, TCDOT
,
105 TODOT
, TLESLANT
, TGESLANT
, TNSUBSET
, TNSUPSET
,
106 TNSUBSETEQ
, TNSUPSETEQ
, TPARTIAL
, TNEG
, TNI
,
107 TBACKEPSILON
, TALEPH
, TIM
, TRE
, TWP
,
108 TEMPTYSET
, TINFINITY
, TESCAPE
, TLIMSUP
, TLIMINF
,
109 TNDIVIDES
, TDRARROW
, TDLARROW
, TDLRARROW
, TUNDERBRACE
,
110 TOVERBRACE
, TCIRC
, TTOP
, THBAR
, TLAMBDABAR
,
111 TLEFTARROW
, TRIGHTARROW
, TUPARROW
, TDOWNARROW
, TDIVIDES
,
112 TNDIBVIDES
, TSETN
, TSETZ
, TSETQ
, TSETR
,
113 TSETC
, TWIDEVEC
, TWIDETILDE
, TWIDEHAT
, TWIDESLASH
,
114 TWIDEBACKSLASH
, TLDBRACKET
, TRDBRACKET
,
125 sal_Unicode cMathChar
;
139 PE_NONE
, PE_UNEXPECTED_END_OF_INPUT
,
140 PE_UNEXPECTED_CHAR
, PE_UNEXPECTED_TOKEN
,
141 PE_FUNC_EXPECTED
, PE_UNOPER_EXPECTED
,
142 PE_BINOPER_EXPECTED
, PE_SYMBOL_EXPECTED
,
143 PE_IDENTIFIER_EXPECTED
, PE_POUND_EXPECTED
,
144 PE_COLOR_EXPECTED
, PE_LGROUP_EXPECTED
,
145 PE_RGROUP_EXPECTED
, PE_LBRACE_EXPECTED
,
146 PE_RBRACE_EXPECTED
, PE_PARENT_MISMATCH
,
147 PE_RIGHT_EXPECTED
, PE_FONT_EXPECTED
,
148 PE_SIZE_EXPECTED
, PE_DOUBLE_ALIGN
,
149 PE_DOUBLE_SUBSUPSCRIPT
160 DECLARE_STACK(SmNodeStack
, SmNode
*)
161 DECLARE_LIST(SmErrDescList
, SmErrorDesc
*)
163 /**************************************************************************/
165 // defines possible conversions of the formula text from the format of
166 // one release to the one of another.
180 SmNodeStack NodeStack
;
181 SmErrDescList ErrDescList
;
184 xub_StrLen BufferIndex
,
188 SmConvert eConversion
;
189 BOOL bImportSymNames
,
192 // declare copy-constructor and assignment-operator private
193 SmParser(const SmParser
&);
194 SmParser
& operator = (const SmParser
&);
198 #if OSL_DEBUG_LEVEL > 1
199 BOOL
IsDelimiter( const String
&rTxt
, xub_StrLen nPos
);
203 xub_StrLen
GetTokenIndex() const { return nTokenIndex
; }
204 void Insert(const String
&rText
, USHORT nPos
);
205 void Replace( USHORT nPos
, USHORT nLen
, const String
&rText
);
207 inline BOOL
TokenInGroup(ULONG nGroup
);
216 void SubSup(ULONG nActiveGroup
);
232 void Bracebody(BOOL bIsLeftRight
);
234 /*N*/ void Binom(); // matrixfett.smf
235 /*N*/ void Stack(); // matrixfett.smf
241 LanguageType
GetLanguage() const { return nLang
; }
242 void SetLanguage( LanguageType nNewLang
) { nLang
= nNewLang
; }
244 void Error(SmParseError Error
);
249 SmNode
*Parse(const String
&rBuffer
);
251 const String
& GetText() const { return BufferString
; };
253 SmConvert
GetConversion() const { return eConversion
; }
254 void SetConversion(SmConvert eConv
) { eConversion
= eConv
; }
256 BOOL
IsImportSymbolNames() const { return bImportSymNames
; }
257 void SetImportSymbolNames(BOOL bVal
) { bImportSymNames
= bVal
; }
258 BOOL
IsExportSymbolNames() const { return bExportSymNames
; }
259 void SetExportSymbolNames(BOOL bVal
) { bExportSymNames
= bVal
; }
261 USHORT
AddError(SmParseError Type
, SmNode
*pNode
);
266 inline BOOL
SmParser::TokenInGroup(ULONG nGroup
)
268 return (CurToken
.nGroup
& nGroup
) ? TRUE
: FALSE
;
272 } //namespace binfilter