| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | /*************************************** | ||
| 2 | Auteur : Pierre Aubert | ||
| 3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
| 4 | Licence : CeCILL-C | ||
| 5 | ****************************************/ | ||
| 6 | |||
| 7 | #include "HeaderParser.h" | ||
| 8 | |||
| 9 | ///Default constructor of HeaderParser | ||
| 10 |
6/6✓ Branch 0 (2→3) taken 3 times.
✓ Branch 2 (3→4) taken 3 times.
✓ Branch 4 (4→5) taken 3 times.
✓ Branch 6 (7→8) taken 3 times.
✓ Branch 8 (8→9) taken 3 times.
✓ Branch 10 (9→10) taken 3 times.
|
3 | HeaderParser::HeaderParser(){ |
| 11 |
1/1✓ Branch 0 (11→12) taken 3 times.
|
3 | initialisationHeaderParser(); |
| 12 | 3 | } | |
| 13 | |||
| 14 | ///Copy constructor of HeaderParser | ||
| 15 | /** @param other : class to copy | ||
| 16 | */ | ||
| 17 | ✗ | HeaderParser::HeaderParser(const HeaderParser & other){ | |
| 18 | ✗ | copyHeaderParser(other); | |
| 19 | ✗ | } | |
| 20 | |||
| 21 | ///Destructor of HeaderParser | ||
| 22 | 3 | HeaderParser::~HeaderParser(){ | |
| 23 | |||
| 24 | 3 | } | |
| 25 | |||
| 26 | ///Definition of equal operator of HeaderParser | ||
| 27 | /** @param other : class to copy | ||
| 28 | * @return copied class | ||
| 29 | */ | ||
| 30 | ✗ | HeaderParser & HeaderParser::operator = (const HeaderParser & other){ | |
| 31 | ✗ | copyHeaderParser(other); | |
| 32 | ✗ | return *this; | |
| 33 | } | ||
| 34 | |||
| 35 | ///Get the parsed vector of PSource | ||
| 36 | /** @return parsed vector of PSource | ||
| 37 | */ | ||
| 38 | 3 | const PVecSource & HeaderParser::getVecSource() const{ | |
| 39 | 3 | return p_vecSource; | |
| 40 | } | ||
| 41 | |||
| 42 | ///Copy function of HeaderParser | ||
| 43 | /** @param other : class to copy | ||
| 44 | */ | ||
| 45 | ✗ | void HeaderParser::copyHeaderParser(const HeaderParser & other){ | |
| 46 | ✗ | p_vecSource = other.p_vecSource; | |
| 47 | ✗ | } | |
| 48 | |||
| 49 | ///Parse the input file | ||
| 50 | /** @return true on success, false otherwise | ||
| 51 | */ | ||
| 52 | 3 | bool HeaderParser::parseFile(){ | |
| 53 |
1/2✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→4) taken 3 times.
|
3 | if(!p_run) return false; |
| 54 | 3 | p_lastDocString = ""; | |
| 55 | 3 | p_otherCode = ""; | |
| 56 |
3/3✓ Branch 0 (6→7) taken 3 times.
✓ Branch 2 (7→8) taken 3 times.
✓ Branch 4 (8→9) taken 3 times.
|
3 | p_currentSource.setName(p_parser->getFileName().getFileName()); |
| 57 | 3 | p_parser->skipWhiteSpace(); | |
| 58 | //To parse the file we need to read char by char until we get something we know | ||
| 59 |
5/6✓ Branch 0 (45→46) taken 15 times.
✓ Branch 1 (45→48) taken 3 times.
✓ Branch 2 (46→47) taken 15 times.
✗ Branch 3 (46→48) not taken.
✓ Branch 4 (49→13) taken 15 times.
✓ Branch 5 (49→50) taken 3 times.
|
18 | while(!p_parser->isEndOfFile() && p_run){ //If we are not at the end of the file |
| 60 |
1/1✓ Branch 0 (13→14) taken 15 times.
|
15 | PFunction function; |
| 61 |
2/3✓ Branch 0 (14→15) taken 15 times.
✓ Branch 2 (15→16) taken 15 times.
✗ Branch 3 (15→41) not taken.
|
15 | if(parseDocString()){} |
| 62 |
3/6✓ Branch 0 (16→17) taken 15 times.
✓ Branch 2 (17→18) taken 15 times.
✗ Branch 4 (19→20) not taken.
✓ Branch 5 (19→25) taken 15 times.
✗ Branch 6 (20→21) not taken.
✗ Branch 8 (21→22) not taken.
|
15 | else if(p_parser->isMatch("//")){p_parser->getUntilKeyWithoutPatern("\n");} //Skip comment |
| 63 |
6/6✓ Branch 0 (25→26) taken 15 times.
✓ Branch 2 (26→27) taken 15 times.
✓ Branch 4 (28→29) taken 3 times.
✓ Branch 5 (28→34) taken 12 times.
✓ Branch 6 (29→30) taken 3 times.
✓ Branch 8 (30→31) taken 3 times.
|
15 | else if(p_parser->isMatch("/*")){p_parser->getUntilKeyWithoutPatern("*/");} //Skip comment |
| 64 |
3/3✓ Branch 0 (34→35) taken 12 times.
✓ Branch 2 (35→36) taken 3 times.
✓ Branch 3 (35→41) taken 9 times.
|
12 | else if(parseMacro()){} |
| 65 |
2/3✓ Branch 0 (36→37) taken 3 times.
✓ Branch 2 (37→38) taken 3 times.
✗ Branch 3 (37→40) not taken.
|
3 | else if(parseFunction(function)){ |
| 66 |
2/2✓ Branch 0 (38→39) taken 3 times.
✓ Branch 2 (39→41) taken 3 times.
|
3 | p_currentSource.getVecFunction().push_back(function); |
| 67 | }else{ | ||
| 68 | ✗ | incrementCurrentChar(); | |
| 69 | } | ||
| 70 |
1/1✓ Branch 0 (41→42) taken 15 times.
|
15 | p_parser->skipWhiteSpace(); |
| 71 | 15 | } | |
| 72 | 3 | p_vecSource.push_back(p_currentSource); | |
| 73 | 3 | return true; | |
| 74 | } | ||
| 75 | |||
| 76 | ///Initialisation to be done just before loading a file | ||
| 77 | 3 | void HeaderParser::preLoadFile(){ | |
| 78 | //Save the current source | ||
| 79 |
2/2✓ Branch 0 (2→3) taken 3 times.
✓ Branch 2 (3→4) taken 3 times.
|
3 | p_parser->setWhiteSpace(" \t\n"); |
| 80 |
2/2✓ Branch 0 (5→6) taken 3 times.
✓ Branch 2 (6→7) taken 3 times.
|
3 | p_parser->setSeparator(",;{}()"); |
| 81 | 3 | } | |
| 82 | |||
| 83 | ///Initialisation to be done just after loading a file | ||
| 84 | 3 | void HeaderParser::postLoadFile(){ | |
| 85 | |||
| 86 | 3 | } | |
| 87 | |||
| 88 | ///Initialisation function of the class HeaderParser | ||
| 89 | 3 | void HeaderParser::initialisationHeaderParser(){ | |
| 90 | |||
| 91 | 3 | } | |
| 92 | |||
| 93 | ///Increment current char position | ||
| 94 | /** @param[out] textObj : obh to be used to store text | ||
| 95 | */ | ||
| 96 | ✗ | void HeaderParser::incrementCurrentChar(){ | |
| 97 | //If nothing is known I need to save the current char in the other code | ||
| 98 | ✗ | char ch = p_parser->getCurrentCh(); | |
| 99 | ✗ | if(ch == '~'){ch = ' ';} | |
| 100 | ✗ | p_otherCode += ch; | |
| 101 | ✗ | p_parser->getNextChar(); | |
| 102 | ✗ | } | |
| 103 | |||
| 104 | ///Add the other code parsed into the current PSource | ||
| 105 | 3 | void HeaderParser::playOtherCode(){ | |
| 106 |
1/2✗ Branch 0 (3→4) not taken.
✓ Branch 1 (3→11) taken 3 times.
|
3 | if(p_otherCode != ""){ |
| 107 | ✗ | PFunction other; | |
| 108 | ✗ | other.setOtherCode(p_otherCode); | |
| 109 | ✗ | p_currentSource.getVecFunction().push_back(other); | |
| 110 | ✗ | p_otherCode = ""; | |
| 111 | ✗ | } | |
| 112 | 3 | } | |
| 113 | |||
| 114 | ///Parse a macro | ||
| 115 | /** @return true on success, false otherwise | ||
| 116 | */ | ||
| 117 | 12 | bool HeaderParser::parseMacro(){ | |
| 118 |
4/4✓ Branch 0 (2→3) taken 12 times.
✓ Branch 2 (3→4) taken 12 times.
✓ Branch 4 (5→6) taken 3 times.
✓ Branch 5 (5→7) taken 9 times.
|
12 | if(!p_parser->isMatch("#")){return false;} |
| 119 |
5/5✓ Branch 0 (7→8) taken 9 times.
✓ Branch 2 (8→9) taken 9 times.
✓ Branch 4 (9→10) taken 9 times.
✓ Branch 6 (10→11) taken 9 times.
✓ Branch 8 (11→12) taken 9 times.
|
9 | PString macro("#" + p_parser->getUntilKeyWithoutPatern("\n") + "\n"); |
| 120 |
1/1✓ Branch 0 (16→17) taken 9 times.
|
9 | PFunction func; |
| 121 |
1/1✓ Branch 0 (17→18) taken 9 times.
|
9 | func.setOtherCode(macro); |
| 122 |
2/2✓ Branch 0 (18→19) taken 9 times.
✓ Branch 2 (19→20) taken 9 times.
|
9 | p_currentSource.getVecFunction().push_back(func); |
| 123 | 9 | return true; | |
| 124 | 9 | } | |
| 125 | |||
| 126 | ///Parse a doc string | ||
| 127 | /** @return true on success, false otherwise | ||
| 128 | */ | ||
| 129 | 27 | bool HeaderParser::parseDocString(){ | |
| 130 |
3/4✓ Branch 0 (2→3) taken 27 times.
✓ Branch 2 (3→4) taken 27 times.
✓ Branch 4 (5→6) taken 27 times.
✗ Branch 5 (5→7) not taken.
|
27 | if(!p_parser->isMatch("///")){return false;} |
| 131 | ✗ | p_lastDocString = p_parser->getUntilKeyWithoutPatern("\n"); | |
| 132 | |||
| 133 | ✗ | return true; | |
| 134 | } | ||
| 135 | |||
| 136 | ///Parse a PFunction | ||
| 137 | /** @param[out] function : PFunction to be parsed | ||
| 138 | * @return true on success, false otherwise | ||
| 139 | */ | ||
| 140 | 3 | bool HeaderParser::parseFunction(PFunction & function){ | |
| 141 |
1/1✓ Branch 0 (2→3) taken 3 times.
|
3 | p_parser->pushPosition(); |
| 142 |
2/2✓ Branch 0 (3→4) taken 3 times.
✓ Branch 2 (4→5) taken 3 times.
|
3 | PString templateDef(""), returnType(""); |
| 143 |
1/1✓ Branch 0 (5→6) taken 3 times.
|
3 | parseTemplateDef(templateDef); |
| 144 |
1/1✓ Branch 0 (6→7) taken 3 times.
|
3 | parseType(returnType); |
| 145 |
4/4✓ Branch 0 (7→8) taken 3 times.
✓ Branch 2 (8→9) taken 3 times.
✓ Branch 4 (9→10) taken 3 times.
✓ Branch 6 (10→11) taken 3 times.
|
3 | std::cerr << "HeaderParser::parseFunction : returnType = '"<<returnType<<"'" << std::endl; |
| 146 |
1/1✓ Branch 0 (11→12) taken 3 times.
|
3 | PString functionName(p_parser->getNextToken()); |
| 147 |
2/3✓ Branch 0 (12→13) taken 3 times.
✗ Branch 2 (13→14) not taken.
✓ Branch 3 (13→15) taken 3 times.
|
3 | if(functionName == ""){return false;} //This is not a function |
| 148 |
1/1✓ Branch 0 (15→16) taken 3 times.
|
3 | function.setDocString(p_lastDocString); |
| 149 |
1/1✓ Branch 0 (16→17) taken 3 times.
|
3 | p_lastDocString = ""; |
| 150 | //Let's get the arguments of the function | ||
| 151 |
3/4✓ Branch 0 (17→18) taken 3 times.
✓ Branch 2 (18→19) taken 3 times.
✗ Branch 4 (20→21) not taken.
✓ Branch 5 (20→22) taken 3 times.
|
3 | if(!p_parser->isMatch("(")){return false;} //This is not a function |
| 152 |
1/1✓ Branch 0 (22→23) taken 3 times.
|
3 | function.setName(functionName); |
| 153 |
1/1✓ Branch 0 (23→24) taken 3 times.
|
3 | function.setOutputType(returnType); |
| 154 |
10/15✓ Branch 0 (80→81) taken 15 times.
✓ Branch 2 (81→82) taken 15 times.
✗ Branch 3 (81→87) not taken.
✓ Branch 4 (82→83) taken 15 times.
✓ Branch 6 (83→84) taken 15 times.
✓ Branch 8 (84→85) taken 12 times.
✓ Branch 9 (84→87) taken 3 times.
✓ Branch 10 (85→86) taken 12 times.
✗ Branch 11 (85→87) not taken.
✓ Branch 12 (88→89) taken 15 times.
✗ Branch 13 (88→90) not taken.
✓ Branch 14 (90→25) taken 12 times.
✓ Branch 15 (90→91) taken 3 times.
✗ Branch 16 (136→137) not taken.
✗ Branch 17 (136→138) not taken.
|
15 | while(!p_parser->isEndOfFile() && !p_parser->isMatch(")") && p_run){ |
| 155 |
1/1✓ Branch 0 (25→26) taken 12 times.
|
12 | PArgument arg; |
| 156 |
2/3✓ Branch 0 (26→27) taken 12 times.
✓ Branch 2 (27→28) taken 12 times.
✗ Branch 3 (27→73) not taken.
|
12 | if(parseDocString()){} |
| 157 |
3/6✓ Branch 0 (28→29) taken 12 times.
✓ Branch 2 (29→30) taken 12 times.
✗ Branch 4 (31→32) not taken.
✓ Branch 5 (31→37) taken 12 times.
✗ Branch 6 (32→33) not taken.
✗ Branch 8 (33→34) not taken.
|
12 | else if(p_parser->isMatch("//")){p_parser->getUntilKeyWithoutPatern("\n");} //Skip comment |
| 158 |
3/6✓ Branch 0 (37→38) taken 12 times.
✓ Branch 2 (38→39) taken 12 times.
✗ Branch 4 (40→41) not taken.
✓ Branch 5 (40→46) taken 12 times.
✗ Branch 6 (41→42) not taken.
✗ Branch 8 (42→43) not taken.
|
12 | else if(p_parser->isMatch("/*")){p_parser->getUntilKeyWithoutPatern("*/");} //Skip comment |
| 159 |
2/3✓ Branch 0 (46→47) taken 12 times.
✓ Branch 2 (47→48) taken 12 times.
✗ Branch 3 (47→69) not taken.
|
12 | else if(parseArgument(arg)){ |
| 160 |
2/2✓ Branch 0 (48→49) taken 12 times.
✓ Branch 2 (49→50) taken 12 times.
|
12 | function.getVecArgument().push_back(arg); |
| 161 |
11/18✓ Branch 0 (50→51) taken 12 times.
✓ Branch 2 (51→52) taken 12 times.
✓ Branch 4 (52→53) taken 3 times.
✓ Branch 5 (52→57) taken 9 times.
✓ Branch 6 (53→54) taken 3 times.
✓ Branch 8 (54→55) taken 3 times.
✗ Branch 10 (55→56) not taken.
✓ Branch 11 (55→57) taken 3 times.
✓ Branch 12 (58→59) taken 3 times.
✓ Branch 13 (58→60) taken 9 times.
✓ Branch 14 (60→61) taken 12 times.
✗ Branch 15 (60→62) not taken.
✗ Branch 16 (62→63) not taken.
✓ Branch 17 (62→73) taken 12 times.
✗ Branch 18 (125→126) not taken.
✗ Branch 19 (125→127) not taken.
✗ Branch 20 (129→130) not taken.
✗ Branch 21 (129→131) not taken.
|
12 | if(!p_parser->isMatch(",") && !isMatchRewind(")")){ |
| 162 | ✗ | errorAt(); | |
| 163 | ✗ | std::cerr << "HeaderParser::parseFunction : expect ',' or ')' after function definition '"<<functionName<<"'" << std::endl; | |
| 164 | ✗ | return true; | |
| 165 | } | ||
| 166 | }else{ | ||
| 167 | ✗ | errorAt(); | |
| 168 | ✗ | std::cerr << "HeaderParser::parseFunction : cannot parse attribute" << std::endl; | |
| 169 | ✗ | return true; | |
| 170 | } | ||
| 171 |
1/1✓ Branch 0 (73→74) taken 12 times.
|
12 | p_parser->skipWhiteSpace(); |
| 172 | |||
| 173 | 12 | } | |
| 174 |
3/4✓ Branch 0 (91→92) taken 3 times.
✓ Branch 2 (92→93) taken 3 times.
✗ Branch 4 (94→95) not taken.
✓ Branch 5 (94→101) taken 3 times.
|
3 | if(!p_parser->isMatch(";")){ |
| 175 | ✗ | errorAt(); | |
| 176 | ✗ | std::cerr << "HeaderParser::parseFunction : expect ';' after function definition '"<<functionName<<"'" << std::endl; | |
| 177 | ✗ | return true; | |
| 178 | } | ||
| 179 |
1/1✓ Branch 0 (101→102) taken 3 times.
|
3 | playOtherCode(); |
| 180 | 3 | return true; | |
| 181 | |||
| 182 | 3 | } | |
| 183 | |||
| 184 | ///Parse a template definition | ||
| 185 | /** @param[out] templateDef : template definition | ||
| 186 | */ | ||
| 187 | 3 | void HeaderParser::parseTemplateDef(PString & templateDef){ | |
| 188 |
3/4✓ Branch 0 (2→3) taken 3 times.
✓ Branch 2 (3→4) taken 3 times.
✓ Branch 4 (5→6) taken 3 times.
✗ Branch 5 (5→7) not taken.
|
3 | if(!p_parser->isMatchToken("template")){return;} |
| 189 | |||
| 190 | ✗ | if(!p_parser->isMatch("<")){ | |
| 191 | ✗ | errorAt(); | |
| 192 | ✗ | std::cerr << "HeaderParser::parseTemplateDef : expect '<' after 'template' token" << std::endl; | |
| 193 | ✗ | return; | |
| 194 | } | ||
| 195 | ✗ | templateDef += "template<"; | |
| 196 | ✗ | bool isTemplate(true); | |
| 197 | ✗ | while(!p_parser->isEndOfFile() && isTemplate && p_run){ | |
| 198 | ✗ | templateDef += p_parser->getNextToken(); //Some typename | |
| 199 | ✗ | templateDef += " "; | |
| 200 | ✗ | templateDef += p_parser->getNextToken(); //Some T | |
| 201 | ✗ | if(p_parser->isMatch(">")){isTemplate = false;} | |
| 202 | ✗ | else if(!p_parser->isMatch(",")){ | |
| 203 | ✗ | errorAt(); | |
| 204 | ✗ | std::cerr << "HeaderParser::parseTemplateDef : expect '>' or ',' after template definition '"<<templateDef<<"'" << std::endl; | |
| 205 | ✗ | return; | |
| 206 | } | ||
| 207 | } | ||
| 208 | ✗ | templateDef += ">"; | |
| 209 | } | ||
| 210 | |||
| 211 | ///Say if the given string is a pointer or a reference | ||
| 212 | /** @param str : string to be analysed | ||
| 213 | * @return true if the given string is a pointer or a reference, false otherwise | ||
| 214 | */ | ||
| 215 | 21 | bool isPtrRef(const PString & str){ | |
| 216 |
7/11✓ Branch 0 (2→3) taken 21 times.
✓ Branch 2 (3→4) taken 21 times.
✓ Branch 4 (4→5) taken 21 times.
✗ Branch 5 (4→7) not taken.
✓ Branch 6 (5→6) taken 21 times.
✓ Branch 8 (6→7) taken 9 times.
✓ Branch 9 (6→8) taken 12 times.
✓ Branch 10 (10→11) taken 21 times.
✗ Branch 11 (10→12) not taken.
✗ Branch 12 (14→15) not taken.
✗ Branch 13 (14→16) not taken.
|
21 | return str.find("&*") || str == "__restrict__"; |
| 217 | } | ||
| 218 | |||
| 219 | ///Parse a PAttribute | ||
| 220 | /** @param[out] arg : PArgument to be parsed | ||
| 221 | * @return true on success, false otherwise | ||
| 222 | */ | ||
| 223 | 12 | bool HeaderParser::parseArgument(PArgument & arg){ | |
| 224 |
3/4✓ Branch 0 (2→3) taken 12 times.
✓ Branch 2 (3→4) taken 12 times.
✗ Branch 4 (5→6) not taken.
✓ Branch 5 (5→7) taken 12 times.
|
12 | if(p_parser->isMatchRewind(")")){return true;} |
| 225 |
1/1✓ Branch 0 (7→8) taken 12 times.
|
12 | PString type(""); |
| 226 |
1/1✓ Branch 0 (8→9) taken 12 times.
|
12 | parseType(type); |
| 227 | |||
| 228 |
3/3✓ Branch 0 (9→10) taken 12 times.
✓ Branch 2 (10→11) taken 12 times.
✓ Branch 4 (11→12) taken 12 times.
|
12 | PString varName(""), ptrRef(""), tmpPtrRef(""); |
| 229 | |||
| 230 |
2/2✓ Branch 0 (12→13) taken 12 times.
✓ Branch 2 (13→14) taken 12 times.
|
12 | tmpPtrRef = p_parser->getNextToken(); |
| 231 | |||
| 232 |
3/3✓ Branch 0 (15→16) taken 12 times.
✓ Branch 2 (16→17) taken 9 times.
✓ Branch 3 (16→26) taken 3 times.
|
12 | if(isPtrRef(tmpPtrRef)){ |
| 233 | do{ | ||
| 234 |
1/1✓ Branch 0 (18→19) taken 9 times.
|
9 | ptrRef += tmpPtrRef; |
| 235 |
2/2✓ Branch 0 (19→20) taken 9 times.
✓ Branch 2 (20→21) taken 9 times.
|
9 | tmpPtrRef = p_parser->getNextToken(); |
| 236 | // if(tmpPtrRef == "__restrict__"){ptrRef += " ";} | ||
| 237 | |||
| 238 |
2/3✓ Branch 0 (22→23) taken 9 times.
✗ Branch 2 (23→24) not taken.
✓ Branch 3 (23→25) taken 9 times.
|
9 | }while(isPtrRef(tmpPtrRef)); |
| 239 | |||
| 240 |
1/1✓ Branch 0 (25→29) taken 9 times.
|
9 | varName = tmpPtrRef; |
| 241 | }else{ | ||
| 242 |
1/1✓ Branch 0 (26→27) taken 3 times.
|
3 | ptrRef = tmpPtrRef; |
| 243 |
1/1✓ Branch 0 (27→28) taken 3 times.
|
3 | varName = ptrRef; |
| 244 |
1/1✓ Branch 0 (28→29) taken 3 times.
|
3 | ptrRef = ""; |
| 245 | } | ||
| 246 |
8/8✓ Branch 0 (29→30) taken 12 times.
✓ Branch 2 (30→31) taken 12 times.
✓ Branch 4 (31→32) taken 12 times.
✓ Branch 6 (32→33) taken 12 times.
✓ Branch 8 (33→34) taken 12 times.
✓ Branch 10 (34→35) taken 12 times.
✓ Branch 12 (35→36) taken 12 times.
✓ Branch 14 (36→37) taken 12 times.
|
12 | std::cerr << "HeaderParser::parseArgument : type = '"<<type<<", ptrRef = '"<<ptrRef<<"', varName = '"<<varName<<"'" << std::endl; |
| 247 |
1/1✓ Branch 0 (37→38) taken 12 times.
|
12 | PString defaultValue(""); |
| 248 |
3/4✓ Branch 0 (38→39) taken 12 times.
✓ Branch 2 (39→40) taken 12 times.
✗ Branch 4 (41→42) not taken.
✓ Branch 5 (41→60) taken 12 times.
|
12 | if(p_parser->isMatch("=")){ //Some default value |
| 249 | ✗ | defaultValue = p_parser->getNextToken(); | |
| 250 | //If double quote are not token, even default strings are single token | ||
| 251 | ✗ | p_parser->pushPosition(); | |
| 252 | ✗ | PString nexToken(p_parser->getNextToken()); | |
| 253 | ✗ | if(nexToken == "("){ //We call a function/constructor | |
| 254 | ✗ | defaultValue += p_parser->getUntilKeyWithoutPaternRecurse(")", "("); | |
| 255 | }else{ | ||
| 256 | ✗ | p_parser->popPosition(); //It was not a function/constructor call | |
| 257 | } | ||
| 258 | ✗ | } | |
| 259 |
1/1✓ Branch 0 (60→61) taken 12 times.
|
12 | arg.setName(varName); |
| 260 |
1/1✓ Branch 0 (61→62) taken 12 times.
|
12 | arg.setPtrRef(ptrRef); |
| 261 |
1/1✓ Branch 0 (62→63) taken 12 times.
|
12 | arg.setType(type); |
| 262 |
1/1✓ Branch 0 (63→64) taken 12 times.
|
12 | arg.setDefaultValue(defaultValue); |
| 263 | 12 | return true; | |
| 264 | 12 | } | |
| 265 | |||
| 266 | ///Parse a data type | ||
| 267 | /** @param[out] type : type to be parsed | ||
| 268 | */ | ||
| 269 | 15 | void HeaderParser::parseType(PString & type){ | |
| 270 |
1/1✓ Branch 0 (2→3) taken 15 times.
|
15 | type = ""; |
| 271 |
1/1✓ Branch 0 (3→4) taken 15 times.
|
15 | PString token(p_parser->getNextToken()); |
| 272 |
11/11✓ Branch 0 (12→13) taken 27 times.
✓ Branch 2 (13→14) taken 21 times.
✓ Branch 3 (13→18) taken 6 times.
✓ Branch 4 (14→15) taken 21 times.
✓ Branch 6 (15→16) taken 18 times.
✓ Branch 7 (15→18) taken 3 times.
✓ Branch 8 (16→17) taken 18 times.
✓ Branch 10 (17→18) taken 3 times.
✓ Branch 11 (17→19) taken 15 times.
✓ Branch 12 (20→5) taken 12 times.
✓ Branch 13 (20→21) taken 15 times.
|
27 | while(token == "const" || token == "unsigned" || token == "long"){ |
| 273 |
2/2✓ Branch 0 (5→6) taken 12 times.
✓ Branch 2 (6→7) taken 12 times.
|
12 | type += token + " "; |
| 274 |
2/2✓ Branch 0 (8→9) taken 12 times.
✓ Branch 2 (9→10) taken 12 times.
|
12 | token = p_parser->getNextToken(); |
| 275 | } | ||
| 276 |
1/1✓ Branch 0 (21→22) taken 15 times.
|
15 | type += token; |
| 277 | 15 | } | |
| 278 | |||
| 279 | |||
| 280 | |||
| 281 |