53 if(!p_run)
return false;
57 p_parser->skipWhiteSpace();
59 while(!p_parser->isEndOfFile() && p_run){
62 else if(p_parser->isMatch(
"//")){p_parser->getUntilKeyWithoutPatern(
"\n");}
63 else if(p_parser->isMatch(
"/*")){p_parser->getUntilKeyWithoutPatern(
"*/");}
70 p_parser->skipWhiteSpace();
79 p_parser->setWhiteSpace(
" \t\n");
80 p_parser->setSeparator(
",;{}()");
98 char ch = p_parser->getCurrentCh();
99 if(ch ==
'~'){ch =
' ';}
101 p_parser->getNextChar();
118 if(!p_parser->isMatch(
"#")){
return false;}
119 PString macro(
"#" + p_parser->getUntilKeyWithoutPatern(
"\n") +
"\n");
130 if(!p_parser->isMatch(
"///")){
return false;}
141 p_parser->pushPosition();
142 PString templateDef(
""), returnType(
"");
145 std::cerr <<
"HeaderParser::parseFunction : returnType = '"<<returnType<<
"'" << std::endl;
146 PString functionName(p_parser->getNextToken());
147 if(functionName ==
""){
return false;}
151 if(!p_parser->isMatch(
"(")){
return false;}
152 function.
setName(functionName);
154 while(!p_parser->isEndOfFile() && !p_parser->isMatch(
")") && p_run){
157 else if(p_parser->isMatch(
"//")){p_parser->getUntilKeyWithoutPatern(
"\n");}
158 else if(p_parser->isMatch(
"/*")){p_parser->getUntilKeyWithoutPatern(
"*/");}
161 if(!p_parser->isMatch(
",") && !isMatchRewind(
")")){
163 std::cerr <<
"HeaderParser::parseFunction : expect ',' or ')' after function definition '"<<functionName<<
"'" << std::endl;
168 std::cerr <<
"HeaderParser::parseFunction : cannot parse attribute" << std::endl;
171 p_parser->skipWhiteSpace();
174 if(!p_parser->isMatch(
";")){
176 std::cerr <<
"HeaderParser::parseFunction : expect ';' after function definition '"<<functionName<<
"'" << std::endl;
188 if(!p_parser->isMatchToken(
"template")){
return;}
190 if(!p_parser->isMatch(
"<")){
192 std::cerr <<
"HeaderParser::parseTemplateDef : expect '<' after 'template' token" << std::endl;
195 templateDef +=
"template<";
196 bool isTemplate(
true);
197 while(!p_parser->isEndOfFile() && isTemplate && p_run){
198 templateDef += p_parser->getNextToken();
200 templateDef += p_parser->getNextToken();
201 if(p_parser->isMatch(
">")){isTemplate =
false;}
202 else if(!p_parser->isMatch(
",")){
204 std::cerr <<
"HeaderParser::parseTemplateDef : expect '>' or ',' after template definition '"<<templateDef<<
"'" << std::endl;
216 return str.find(
"&*") || str ==
"__restrict__";
224 if(p_parser->isMatchRewind(
")")){
return true;}
228 PString varName(
""), ptrRef(
""), tmpPtrRef(
"");
230 tmpPtrRef = p_parser->getNextToken();
235 tmpPtrRef = p_parser->getNextToken();
246 std::cerr <<
"HeaderParser::parseArgument : type = '"<<type<<
", ptrRef = '"<<ptrRef<<
"', varName = '"<<varName<<
"'" << std::endl;
247 PString defaultValue(
"");
248 if(p_parser->isMatch(
"=")){
249 defaultValue = p_parser->getNextToken();
251 p_parser->pushPosition();
252 PString nexToken(p_parser->getNextToken());
254 defaultValue += p_parser->getUntilKeyWithoutPaternRecurse(
")",
"(");
256 p_parser->popPosition();
271 PString token(p_parser->getNextToken());
272 while(token ==
"const" || token ==
"unsigned" || token ==
"long"){
274 token = p_parser->getNextToken();
void setPtrRef(const PString &ptrRef)
Sets the ptrRef of the PArgument.
void setType(const PString &type)
Sets the type of the PArgument.
void setName(const PString &name)
Sets the name of the PArgument.
void setDefaultValue(const PString &defaultValue)
Sets the defaultValue of the PArgument.
void setName(const PString &name)
Sets the name of the PFunction.
void setOutputType(const PString &outputType)
Sets the outputType of the PFunction.
void setDocString(const PString &docString)
Sets the docString of the PFunction.
void setOtherCode(const PString &otherCode)
Sets the otherCode of the PFunction.
const std::vector< PArgument > & getVecArgument() const
Gets the vecArgument of the PFunction.
std::vector< PSource > PVecSource