| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "ConfigParser.h" | ||
| 8 | |||
| 9 | ///Default constructor of ConfigParser | ||
| 10 |
3/3✓ Branch 0 (2→3) taken 2 times.
✓ Branch 2 (3→4) taken 2 times.
✓ Branch 4 (4→5) taken 2 times.
|
2 | ConfigParser::ConfigParser(){ |
| 11 | 2 | initialisationConfigParser(); | |
| 12 | 2 | } | |
| 13 | |||
| 14 | ///Destructor of ConfigParser | ||
| 15 | 2 | ConfigParser::~ConfigParser(){ | |
| 16 | |||
| 17 | 2 | } | |
| 18 | |||
| 19 | ///Get the last doc string | ||
| 20 | /** @return last doc string | ||
| 21 | */ | ||
| 22 | 2 | const std::string & ConfigParser::getDocString() const{ | |
| 23 | 2 | return p_lastDocString; | |
| 24 | } | ||
| 25 | |||
| 26 | ///Parse the input file | ||
| 27 | /** @return true on success, false otherwise | ||
| 28 | */ | ||
| 29 | 5 | bool ConfigParser::parseFile(){ | |
| 30 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 5 times.
|
5 | if(!p_run) return false; |
| 31 | |||
| 32 | 5 | p_parser->skipWhiteSpace(); | |
| 33 | //To parse the file we need to read char by char until we get something we know | ||
| 34 |
2/2✓ Branch 0 (6→7) taken 3 times.
✓ Branch 1 (6→19) taken 2 times.
|
5 | if(parseDocString()){} |
| 35 |
6/6✓ Branch 0 (7→8) taken 3 times.
✓ Branch 2 (8→9) taken 3 times.
✓ Branch 4 (10→11) taken 2 times.
✓ Branch 5 (10→16) taken 1 times.
✓ Branch 6 (11→12) taken 2 times.
✓ Branch 8 (12→13) taken 2 times.
|
3 | else if(isMatch("//")){p_parser->getUntilKeyWithoutPatern("\n");} //Skip comment |
| 36 | else{ | ||
| 37 | 1 | unexpectedToken(); | |
| 38 | 1 | pointAtRow(); | |
| 39 | 1 | return false; | |
| 40 | } | ||
| 41 | 4 | p_parser->skipWhiteSpace(); | |
| 42 | 4 | return true; | |
| 43 | } | ||
| 44 | |||
| 45 | ///Initialisation to be done just before loading a file | ||
| 46 | 3 | void ConfigParser::preLoadFile(){ | |
| 47 | //Save the current source | ||
| 48 |
2/2✓ Branch 0 (3→4) taken 3 times.
✓ Branch 2 (4→5) taken 3 times.
|
3 | getCurrentParser()->setWhiteSpace(" \t\n"); |
| 49 |
2/2✓ Branch 0 (7→8) taken 3 times.
✓ Branch 2 (8→9) taken 3 times.
|
3 | getCurrentParser()->setSeparator(",;{}[]()"); |
| 50 | 3 | p_lastDocString = ""; | |
| 51 | 3 | } | |
| 52 | |||
| 53 | ///Initialisation to be done just after loading a file | ||
| 54 | 2 | void ConfigParser::postLoadFile(){ | |
| 55 | |||
| 56 | 2 | } | |
| 57 | |||
| 58 | ///Initialisation function of the class ConfigParser | ||
| 59 | 2 | void ConfigParser::initialisationConfigParser(){ | |
| 60 | |||
| 61 | 2 | } | |
| 62 | |||
| 63 | ///Parse a doc string | ||
| 64 | /** @return true on success, false otherwise | ||
| 65 | */ | ||
| 66 | 5 | bool ConfigParser::parseDocString(){ | |
| 67 |
4/4✓ Branch 0 (2→3) taken 5 times.
✓ Branch 2 (3→4) taken 5 times.
✓ Branch 4 (5→6) taken 3 times.
✓ Branch 5 (5→7) taken 2 times.
|
5 | if(!isMatch("///")){return false;} |
| 68 |
2/2✓ Branch 0 (7→8) taken 2 times.
✓ Branch 2 (8→9) taken 2 times.
|
2 | p_lastDocString = p_parser->getUntilKeyWithoutPatern("\n"); |
| 69 | |||
| 70 | 2 | return true; | |
| 71 | } | ||
| 72 | |||
| 73 | |||
| 74 | |||
| 75 | |||
| 76 |