Version 6.1.4.1, tag libreoffice-6.1.4.1
[LibreOffice.git] / starmath / inc / token.hxx
blob7bf4da95f31f330d792f38e7518df21ffa898bd0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_TOKEN_HXX
20 #define INCLUDED_STARMATH_INC_TOKEN_HXX
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <tools/solar.h>
25 #include <o3tl/typed_flags_set.hxx>
27 // TokenGroups
28 enum class TG {
29 NONE = 0x000000,
30 Oper = 0x000001,
31 Relation = 0x000002,
32 Sum = 0x000004,
33 Product = 0x000008,
34 UnOper = 0x000010,
35 Power = 0x000020,
36 Attribute = 0x000040,
37 Align = 0x000080,
38 Function = 0x000100,
39 Blank = 0x000200,
40 LBrace = 0x000400,
41 RBrace = 0x000800,
42 Color = 0x001000,
43 Font = 0x002000,
44 Standalone = 0x004000,
45 Limit = 0x010000,
46 FontAttr = 0x020000
48 namespace o3tl {
49 template<> struct typed_flags<TG> : is_typed_flags<TG, 0x037fff> {};
52 enum SmTokenType
54 /* 0*/ TEND, TLGROUP, TRGROUP, TLPARENT, TRPARENT,
55 /* 5*/ TLBRACKET, TRBRACKET, TPLUS, TMINUS, TMULTIPLY,
56 /* 10*/ TDIVIDEBY, TASSIGN, TPOUND, TSPECIAL, TSLASH,
57 /* 15*/ TBACKSLASH, TBLANK, TSBLANK, TRSUB, TRSUP,
58 /* 20*/ TCSUB, TCSUP, TLSUB, TLSUP, TGT,
59 /* 25*/ TLT, TAND, TOR, TINTERSECT, TUNION,
60 /* 30*/ TNEWLINE, TBINOM, TFROM, TTO, TINT,
61 /* 35*/ TSUM, TOPER, TABS, TSQRT, TFACT,
62 /* 40*/ TNROOT, TOVER, TTIMES, TGE, TLE,
63 /* 45*/ TGG, TLL, TDOTSAXIS, TDOTSLOW, TDOTSVERT,
64 /* 50*/ TDOTSDIAG, TDOTSUP, TDOTSDOWN, TACUTE, TBAR,
65 /* 55*/ TBREVE, TCHECK, TCIRCLE, TDOT, TDDOT,
66 /* 60*/ TDDDOT, TGRAVE, THAT, TTILDE, TVEC,
67 /* 65*/ TUNDERLINE, TOVERLINE, TOVERSTRIKE, TITALIC, TNITALIC,
68 /* 70*/ TBOLD, TNBOLD, TPHANTOM, TFONT, TSIZE,
69 /* 75*/ TCOLOR, TALIGNL, TALIGNC, TALIGNR, TLEFT,
70 /* 80*/ TRIGHT, TLANGLE, TLBRACE, TLLINE, TLDLINE,
71 /* 85*/ TLCEIL, TLFLOOR, TNONE, TMLINE, TRANGLE,
72 /* 90*/ TRBRACE, TRLINE, TRDLINE, TRCEIL, TRFLOOR,
73 /* 95*/ TSIN, TCOS, TTAN, TCOT, TFUNC,
74 /*100*/ TSTACK, TMATRIX, TMATFORM, TDPOUND, TPLACE,
75 /*105*/ TTEXT, TNUMBER, TCHARACTER, TIDENT, TNEQ,
76 /*110*/ TEQUIV, TDEF, TPROP, TSIM, TSIMEQ,
77 /*115*/ TAPPROX, TPARALLEL, TORTHO, TIN, TNOTIN,
78 /*120*/ TSUBSET, TSUBSETEQ, TSUPSET, TSUPSETEQ, TPLUSMINUS,
79 /*125*/ TMINUSPLUS, TOPLUS, TOMINUS, TDIV, TOTIMES,
80 /*130*/ TODIVIDE, TTRANSL, TTRANSR, TIINT, TIIINT,
81 /*135*/ TLINT, TLLINT, TLLLINT, TPROD, TCOPROD,
82 /*140*/ TFORALL, TEXISTS, TNOTEXISTS, TLIM, TNABLA,
83 /*145*/ TTOWARD, TSINH, TCOSH, TTANH, TCOTH,
84 /*150*/ TASIN, TACOS, TATAN, TLN, TLOG,
85 /*155*/ TUOPER, TBOPER, TBLACK, TWHITE, TRED,
86 /*160*/ TGREEN, TBLUE, TCYAN, TMAGENTA, TYELLOW,
87 /*165*/ TFIXED, TSANS, TSERIF, TPOINT, TASINH,
88 /*170*/ TACOSH, TATANH, TACOTH, TACOT, TEXP,
89 /*175*/ TCDOT, TODOT, TLESLANT, TGESLANT, TNSUBSET,
90 /*180*/ TNSUPSET, TNSUBSETEQ, TNSUPSETEQ, TPARTIAL, TNEG,
91 /*185*/ TNI, TBACKEPSILON, TALEPH, TIM, TRE,
92 /*190*/ TWP, TEMPTYSET, TINFINITY, TESCAPE, TLIMSUP,
93 /*195*/ TLIMINF, TNDIVIDES, TDRARROW, TDLARROW, TDLRARROW,
94 /*200*/ TUNDERBRACE, TOVERBRACE, TCIRC, TTOP, THBAR,
95 /*205*/ TLAMBDABAR, TLEFTARROW, TRIGHTARROW, TUPARROW, TDOWNARROW,
96 /*210*/ TDIVIDES, TNDIBVIDES, TSETN, TSETZ, TSETQ,
97 /*215*/ TSETR, TSETC, TWIDEVEC, TWIDETILDE, TWIDEHAT,
98 /*220*/ TWIDESLASH, TWIDEBACKSLASH, TLDBRACKET, TRDBRACKET, TNOSPACE,
99 /*225*/ TUNKNOWN, TPRECEDES, TSUCCEEDS, TPRECEDESEQUAL, TSUCCEEDSEQUAL,
100 /*230*/ TPRECEDESEQUIV, TSUCCEEDSEQUIV, TNOTPRECEDES, TNOTSUCCEEDS, TSILVER,
101 /*235*/ TGRAY, TMAROON, TPURPLE, TLIME, TOLIVE,
102 /*240*/ TNAVY, TTEAL, TAQUA, TFUCHSIA, TINTD
105 struct SmToken
108 OUString aText; // token text
109 SmTokenType eType; // token info
110 sal_Unicode cMathChar;
112 // parse-help info
113 TG nGroup;
114 sal_uInt16 nLevel;
116 // token position
117 sal_Int32 nRow; // 1-based
118 sal_Int32 nCol; // 1-based
120 SmToken();
121 SmToken(SmTokenType eTokenType,
122 sal_Unicode cMath,
123 const sal_Char* pText,
124 TG nTokenGroup = TG::NONE,
125 sal_uInt16 nTokenLevel = 0);
128 struct SmTokenTableEntry
130 const sal_Char* pIdent;
131 SmTokenType eType;
132 sal_Unicode cMathChar;
133 TG nGroup;
134 sal_uInt16 nLevel;
137 #endif
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */