summaryrefslogtreecommitdiff
path: root/starmath/inc/parse.hxx
AgeCommit message (Collapse)Author
2022-03-01Recheck modules s[f-t]* with IWYUGabor Kelemen
See tdf#42949 for motivation Change-Id: I1f520aad1b1c942ad5616d96851016fc366ac58f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130203 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2021-03-01tdf#124176 on starmathdante
Change-Id: I816a12d5f47dd258fb01f14b901328d3e3d68e28 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111690 Tested-by: Jenkins Reviewed-by: Roman Kuznetsov <antilibreoffice@gmail.com>
2021-02-27Introduce the abstractsmparser getter methodsdante
Change-Id: Id8dee76aa7dfa7355f79fab9afb9471b2ec4575c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111686 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-24Starmath now allows multiple parsers second partdante
Uses AbstractSmParser as base for SmParser Renames parse._xx as parse5._xx rename of parse._xx is not recognized, so clang-formated New parse.hxx as a future mean to get the parser. Change-Id: I122c1fda0144a24316948fcc125e60ed1a130bcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111243 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-09no need to use unique_ptr for a simple value classNoel
Change-Id: Id83cd16fe3eb815ad419cc331e65fb731161bd30 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110635 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-09ofz#30663 Direct-leakCaolán McNamara
since... commit 17149f65f03a34e88bb4a10abcd20e6891f5d7ca Date: Sun Feb 7 10:41:46 2021 +0100 Let depthGuard handle everything Change-Id: Icb978724000aec75a84ca6ecfd0fe9e299291db6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110623 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
2021-02-08Simplified addition of color palettesdante
For use of LO based code, won't implement more palettes But will be helpfull for definecolor command Change-Id: Id68b075fb69254a8d5e9c4c0358b3ee3cd99a0c8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110474 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-08Let depthGuard handle everythingdante
Change-Id: I3887273aa0b4e88dd454099052db8ce3811b5d66 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110524 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-06Modifications on starmath smparse error handledante
Made modifications for: - Being able to highlight syntax errors - Displaying error description in visual editor - Easier constructor - Rely on starmathdatabase instead of long switch in code. Change-Id: Ic6c7f920463090176d80668f9b660ccf3e9b5708 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110497 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2021-02-04Fix typo in codeAndrea Gelmini
Here it passed "make build-nocheck" on Linux Change-Id: I1f6ea440e54f87a90abb1b6e9983443764516e06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/110373 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Reviewed-by: Dante DM <dante19031999@gmail.com> Reviewed-by: Andrea Gelmini <andrea.gelmini@gelma.net> Tested-by: Jenkins
2020-12-01tdf#42949 Fix new IWYU warnings in directories s*Gabor Kelemen
Except recently checked sc, sd, svx, sw Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: Ice1b86628e4f22a39f307b9c5fa567b6ab9d5acb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106917 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2020-11-17Starmath has now full support of HTML colors.dante
Some of them have been added to the UI ( from Css3 ). There was not a criteria for color picking so I chose those whose name told me something, those I liked and some to have a more complete palette. It would be nice to be able to ask our users whose colors from https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#Color_Keywords they want in the UI. The color names have been left in alphabetical order. Starmathdatabse has clang format. Change-Id: I6ac1bdbc9e3ed10bff75a99b90bf92d3dcdcabcb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105892 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-10Evaluate command: tdf#109338dante
Adds evaluate command. It's visible from UI as a bracket. Example: evaluate { {1} over {%sigma sqrt{2%pi} }func e^-{{(x-%mu)^2} over {2%sigma^2}} } from { -infinity } to { +infinity } = 0 In order to make the mathml part, several changes had to be mad: - Allow mathml to correctly identify the math token for opperators - Allow mathml to correctly identify the math token for fences - Since improvements where made on token recognision, visitors to string can now be lighter ( removing long long switch ) - Improving the import / export to mathm - LO says it mathml 2, but actually is something between 2 and 3 - Allowing mfenced ( mathml 2.0 ) to stayl 3 adding the missing data ( prefix and postfix ) - Be able to know if we are opening or closing brackets - lrline and lrdline commands hidden on UI. - They are they own open close - If prefix and postfix are missing meaning of the expression may change, however that's the user problem. - The problem resides in the fact that MS_VERTLINE is uses for lline and rline. - The problem resides in the fact that MS_DVERTLINE is uses for ldline and rdline. - Changing frac priority from 0 to 5, if not { frac 1 2 frac 1 2 } fails ( found while testing ) - The mathml testing was made with highter standars than qa tests, however there are no guarantees. - Added xml tokens needed for math - Added starmathdatabase. Will grow in the future. The point is avoiding long lists and swtches inside code. Added it command for hidden or implicit product ( like &it; in mathml ). Oppens path for tdf#66200. Note that about this issue there is only one line on the parser. The mathml implementation will be made later when LO will allow chars with &charname;. Change-Id: If24b40c2420d39498693944f13a02985f997dd23 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105267 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-07Added documentation on starmath.dante
Gives basic description about file content and functionallity. Will allow new programmers to follow the code better. Change-Id: I76a9d61781332e3341130276c1c78ecf82e799a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105290 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-05Added frac command. Sould solve tdf#137234.dante
Change-Id: I78dcd06a30b93c441dd5983711603f184d20c63b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/105255 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-11-03Added hexadecimal number and color support for starmath.Dante DM
Adds hidden command on guy hex number wich allows to use numbers of base 16 and also 0-9-A-Z. Added support for custom RGB colors on hexadecimal on starmath via command color hex colornumber. Improved RGB color handle on starmath. Changed the way the color is handled on starmath. Colors keywords won't give errors. They have been moved to an independent tokens list so starmath will load tokens faster. Changed the way the font size is handeled on starmath. This won't change anything, just related with the structural change. Implemented premature support for rgba colors on math. This change only adds the possibility on the parser, node and node visitors. For now end-user can not access it since in a future there'll be work to do on the renderer to add full support. Added hex entrie on the docking window. Changes made on Color.hxx, will save some nanoseconds on build. If you are interested on allowing rgba and do the job on the renderer (and all the other stuff than there are a lot of .GetRGBColor()), you may find usefull color hex colnum. Since transparency setting is ignored, the hexadecimal color has hidden support for it since did not instore the max value (255 + 255*256 + 255*256*256) and everything is loaded into the sal_uInt32. Change-Id: Iafb38b142fffa329ca468e3d62643154fcdd2bbf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104630 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2020-03-13Revert "loplugin:constfields in starmath"Noel Grandin
This reverts commit e494cc2942899fd92a2273eaed2bf41eb74ea8a9. Change-Id: Ie73ecb4b7299e70dea729c374763f9e2df2aa6f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90421 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2019-01-04tdf#42949 Fix IWYU warnings in starmath/inc/*hxx & starmath/source/*hxxGabor Kelemen
Found with bin/find-unneeded-includes Only removal proposals are dealt with here. Change-Id: If1a597f4c2241dc1ad5687d81199bbc5745e711f Reviewed-on: https://gerrit.libreoffice.org/65624 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
2018-10-08loplugin:constfields in starmathNoel Grandin
Change-Id: I5092401b4138ca15e93b36adf1b059e75d4e8f5a Reviewed-on: https://gerrit.libreoffice.org/61514 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-10-07use more unique_ptr in SmParserNoel Grandin
Change-Id: I132598f5829e02664040dff745011a59c6a19c1d Reviewed-on: https://gerrit.libreoffice.org/61401 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-05-24ofz#8490 stack exhaustionCaolán McNamara
a linear loop builds a recursive structure, if it gets too deep then later processing, e.g. releasing the tree, can exhaust stack Change-Id: I4421b9bae62ac2b6ffe32531d1167a482103bfde Reviewed-on: https://gerrit.libreoffice.org/54762 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2018-02-14starmath: Omit SmParser::GetError()'s argumentTakeshi Abe
as it was always 0. Change-Id: I59570967deb139f258e7aeaab17619f714bc7bb5 Reviewed-on: https://gerrit.libreoffice.org/49640 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-02-08starmath: Make SmParser::DoAttribut() etc. return std::unique_ptrTakeshi Abe
Change-Id: I9693cf15abf202657f5be478bfebd1272dc261dd Reviewed-on: https://gerrit.libreoffice.org/49339 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-02-07starmath: Make SmParser::DoLine() etc. return std::unique_ptrTakeshi Abe
Change-Id: Ia85f66d3490471d7e0c2ce8a1947051be129acf9 Reviewed-on: https://gerrit.libreoffice.org/49276 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-02-06starmath: Make DoAlign() return std::unique_ptrTakeshi Abe
to take advantage of copy elision and simplify client code. Change-Id: I9e08bc2b9743563f483657c7348abca05dd34c85 Reviewed-on: https://gerrit.libreoffice.org/49222 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-01-22starmath: Make SmParser::Parse() return std::unique_ptrTakeshi Abe
Change-Id: I6c8811f71ab40398043cdcfa3334eee4381b4c7e Reviewed-on: https://gerrit.libreoffice.org/48098 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2018-01-17starmath: Make SmParser::ParseExpression() return std::unique_ptrTakeshi Abe
Change-Id: Ib8b65dced2af3ac7dca3fe9dd02e70f02c865f79 Reviewed-on: https://gerrit.libreoffice.org/47974 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
2018-01-11ofz#5244 tighten depth checkCaolán McNamara
Change-Id: Ia841f3419ebe14d8f73d09a6fc089973252725ff Reviewed-on: https://gerrit.libreoffice.org/47770 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-12-06ofz#4539 depth protect mathtype parserCaolán McNamara
Change-Id: I46e12f52d56e7802b676309207904b4d1894d236 Reviewed-on: https://gerrit.libreoffice.org/45928 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
2017-04-05starmath: Kill newly unused m_aNodeStackTakeshi Abe
which now has been replaced naturally with the call stack of SmParser functions. Change-Id: I970a350aae6927c6d13ed4917aa29bce3888a3fe Reviewed-on: https://gerrit.libreoffice.org/36136 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-04-04starmath: Simplify code parsing nospaceTakeshi Abe
This also comes with its unit test. Change-Id: I1478bf48c5522691978e3534c9c8a9c0ddfc1e59 Reviewed-on: https://gerrit.libreoffice.org/35985 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-24starmath: Make SmParser::DoAlign() return SmNodeTakeshi Abe
instead of pushing it to the stack, for later refactoring. Change-Id: I61760fbfe95771dede62f90f82df3e9961efdcd6 Reviewed-on: https://gerrit.libreoffice.org/35609 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-23starmath: Make DoProduct()/DoSum()/DoRelation() return SmNodeTakeshi Abe
to reduce an excessive number of stack operations. Change-Id: Ia4ef08dce76d318c56bf7d112f686e13d1b2660e Reviewed-on: https://gerrit.libreoffice.org/35551 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-22starmath: Make SmParser::DoPower() return SmNodeTakeshi Abe
instead of pushing it to the stack. Change-Id: I7b1640e1b3f835c06726941adfe6d212853f3af6 Reviewed-on: https://gerrit.libreoffice.org/35537 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-22starmath: Make DoOpSubSup() return SmNodeTakeshi Abe
This spares a pair of push and pop of the stack. Change-Id: I046402c2e975a6b5f4148960a9daffa15cc55ff3 Reviewed-on: https://gerrit.libreoffice.org/35532 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-22starmath: Make DoSubSup() return SmNode by taking another nodeTakeshi Abe
as an argument, not from the top of the stack. Because no token belongs to groups TG::Limit and TG::Power at the same time, we can replace TokenInGroup() with direct comparison with each group. Change-Id: I44882ab40f59c4de1c0e2cbbdc354e43de926ab1 Reviewed-on: https://gerrit.libreoffice.org/35500 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-19starmath: Make DoTerm() return the top of the stackTakeshi Abe
without pushing it. Client code do it instead, so no logic changes. Change-Id: I7ea95b4bddc4e1ef7270cfe02d4f8ad3dc1f19d0 Reviewed-on: https://gerrit.libreoffice.org/35400 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-16starmath: Return SmStructureNode from DoAttribut()/DoFontAttribut()Takeshi Abe
This spares a pair of push and pop of the stack. Change-Id: Ic5f1ee0ee158779f2f231dab9f7059ce6618bdcb Reviewed-on: https://gerrit.libreoffice.org/35245 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-15starmath: Separate SmParser::DoError() from Error()Takeshi Abe
for incoming refactoring. Change-Id: I74355dbd1d7a5822cbf67e828ddc31bd76be79f2 Reviewed-on: https://gerrit.libreoffice.org/35171 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-14starmath: Return SmBracebodyNode from DoBracebody()Takeshi Abe
to skip a push to the stack immediately followed by a pop. Change-Id: I97eb48db2521d640acec4d8080cceb56561eb901 Reviewed-on: https://gerrit.libreoffice.org/35129 Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp> Tested-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-10starmath: Return SmGlyphSpecialNode from DoGlyphSpecial()Takeshi Abe
instead of pushing it to the stack. This spares some pops. Change-Id: I9fc987ebf851ff6387e347a2878ff01f482d8f7f Reviewed-on: https://gerrit.libreoffice.org/35029 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-03-08starmath: Return the expression node from DoExpression()Takeshi Abe
instead of pushing it to the stack. This saves extra pops. Change-Id: I2fcf9b86eab9ade45db4351b34bafbcbc42ef056 Reviewed-on: https://gerrit.libreoffice.org/34944 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2017-01-20starmath: Avoid ad hoc LanguageTag and CharClass at tokenizationTakeshi Abe
Instead, keep them as SmParser's members. Change-Id: I8a2aad7ba8baaad9a761f42f62d51fc67cadec07 Reviewed-on: https://gerrit.libreoffice.org/32348 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2016-10-20loplugin:expandablemethodds in sfx2..starmathNoel Grandin
Change-Id: Ia4c411f5a9a68c2f344188ce6b6bc1815c89f993 Reviewed-on: https://gerrit.libreoffice.org/30055 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
2016-10-03starmath: Add comments on indexingTakeshi Abe
Change-Id: Ic87d04f65f8272832c8742f99821876cc28bb514
2016-10-02starmath: Prefix members of SmParserTakeshi Abe
Change-Id: Ib39bf2a9b8c37d9f2ac4ed3db602c3b0a82a506b Reviewed-on: https://gerrit.libreoffice.org/29397 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2016-06-08starmath: The formula tree must be of type SmTableNodeTakeshi Abe
This also omits the last push & pop on m_aNodeStack at the end of parsing. Change-Id: Iefff8fa801ea7cb9015d6cba0d5a972dee675cb7 Reviewed-on: https://gerrit.libreoffice.org/26003 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2016-05-17convert TG constants to scoped enumNoel Grandin
Change-Id: Ide719e8bb0d5aacc8d5da18f385b6373c7e48184 Reviewed-on: https://gerrit.libreoffice.org/24973 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2016-04-22starmath: Drop member variable set but not usedTakeshi Abe
Its usage was gone with 9adcd261054a0e99ae032be5e7428e28a6663975. Change-Id: Ibd322531365c2e0ccad85d553781611dfe96d54e Reviewed-on: https://gerrit.libreoffice.org/24277 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Takeshi Abe <tabe@fixedpoint.jp>
2016-04-14loplugin:passstuffbyref in variousNoel Grandin
Change-Id: I80070c83204e531c2f599f8a56193d6ffe0e5022