Directory: | ./ |
---|---|
File: | tmp_project/PhoenixTex2Html/src/PLatexObj/platexobj_parse.cpp |
Date: | 2025-03-24 18:12:43 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 12 | 14 | 85.7% |
Branches: | 11 | 20 | 55.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | #include "platexobj_parse.h" | ||
8 | |||
9 | ///Parse a str and convert it into a PLatexObj | ||
10 | /** @param[out] obj : PLatexObj of parsed string | ||
11 | * @param latexStr : string to be parsed | ||
12 | * @return true on success, false otherwise | ||
13 | */ | ||
14 | 590 | bool platexobj_parseStr(PLatexObj & obj, const PString & latexStr){ | |
15 |
2/2✓ Branch 1 taken 590 times.
✓ Branch 4 taken 590 times.
|
590 | PConfigParser parser; |
16 |
3/3✓ Branch 1 taken 590 times.
✓ Branch 4 taken 590 times.
✓ Branch 7 taken 590 times.
|
590 | parser.setFileContent(latexStr + "\n"); |
17 |
2/3✓ Branch 1 taken 590 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 590 times.
|
590 | if(!parser.fullParsing()){ |
18 | ✗ | std::cerr << "platexobj_parseStr : cannot parse string '"<<latexStr<<"'" << std::endl; | |
19 | ✗ | return false; | |
20 | } | ||
21 |
2/2✓ Branch 1 taken 590 times.
✓ Branch 4 taken 590 times.
|
590 | obj = parser.getSource(); |
22 |
1/1✓ Branch 1 taken 590 times.
|
590 | obj.setType(PLatexType::NONE); |
23 | 590 | return true; | |
24 | 590 | } | |
25 | |||
26 | ///Parse a str and convert it into a PLatexObj | ||
27 | /** @param latexStr : string to be parsed | ||
28 | * @return PLatexObj of parsed string | ||
29 | */ | ||
30 | 3 | PLatexObj platexobj_parseStr(const PString & latexStr){ | |
31 | 3 | PLatexObj obj; | |
32 |
1/1✓ Branch 1 taken 3 times.
|
3 | platexobj_parseStr(obj, latexStr); |
33 | 3 | return obj; | |
34 | } | ||
35 | |||
36 |