improved parser
This commit is contained in:
@@ -1373,6 +1373,23 @@ set<ParallelRegion*> getAllRegionsByLine(const vector<ParallelRegion*>& regions,
|
|||||||
return regFound;
|
return regFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool checkFormat(const string& toCheck, const string& given)
|
||||||
|
{
|
||||||
|
if (given == "" || given == "*")
|
||||||
|
{
|
||||||
|
if (toCheck == "for" || toCheck == "f90" || toCheck == "fdv" ||
|
||||||
|
toCheck == "ftn" || toCheck == "f95" || toCheck == "f03" ||
|
||||||
|
toCheck == "f")
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (toCheck == given)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int argc, bool& isInline)
|
pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int argc, bool& isInline)
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201703L
|
#if __cplusplus >= 201703L
|
||||||
@@ -1390,30 +1407,27 @@ pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int a
|
|||||||
|
|
||||||
string ext = OnlyExt(arg.c_str());
|
string ext = OnlyExt(arg.c_str());
|
||||||
convertToLower(ext);
|
convertToLower(ext);
|
||||||
if (ext.find("for") != string::npos ||
|
if (arg.find("*") != string::npos || checkFormat(ext, ""))
|
||||||
ext.find("f90") != string::npos ||
|
|
||||||
ext.find("fdv") != string::npos ||
|
|
||||||
ext.find("ftn") != string::npos ||
|
|
||||||
ext.find("f95") != string::npos ||
|
|
||||||
ext.find("f03") != string::npos ||
|
|
||||||
ext.find("f") != string::npos)
|
|
||||||
{
|
{
|
||||||
if (arg.find("*") == string::npos)
|
if (arg.find("*") == string::npos)
|
||||||
|
{
|
||||||
|
if (checkFormat(ext, ""))
|
||||||
files.insert(arg);
|
files.insert(arg);
|
||||||
|
else
|
||||||
|
printf("skip file %s\n", arg.c_str());
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if __cplusplus >= 201703L
|
#if __cplusplus >= 201703L
|
||||||
fs::path ext = fs::path(arg).filename().extension();
|
|
||||||
auto str_ext = ext.string();
|
|
||||||
convertToLower(str_ext);
|
|
||||||
|
|
||||||
for (auto& file : filesInDir)
|
for (auto& file : filesInDir)
|
||||||
{
|
{
|
||||||
auto cmp_ext = file.extension().string();
|
auto cmp_ext = file.extension().string();
|
||||||
convertToLower(cmp_ext);
|
convertToLower(cmp_ext);
|
||||||
|
|
||||||
if (cmp_ext == str_ext)
|
if (checkFormat(cmp_ext, arg))
|
||||||
files.insert(file.filename().string());
|
files.insert(file.filename().string());
|
||||||
|
else
|
||||||
|
printf(" skip file %s\n", arg.c_str());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1422,8 +1436,10 @@ pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int a
|
|||||||
{
|
{
|
||||||
if (arg == "-inl")
|
if (arg == "-inl")
|
||||||
isInline = true;
|
isInline = true;
|
||||||
else
|
else if (arg.find("-") != string::npos)
|
||||||
options.push_back(arg);
|
options.push_back(arg);
|
||||||
|
else
|
||||||
|
printf(" skip option %s\n", arg.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1441,6 +1457,11 @@ pair<vector<string>, vector<string>> splitCommandLineForParse(char** argv, int a
|
|||||||
printf(" skip not existing file '%s'\n", elem.c_str());
|
printf(" skip not existing file '%s'\n", elem.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf(" options: ");
|
||||||
|
for (auto& opt : options)
|
||||||
|
printf("%s ", opt.c_str());
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
return make_pair(options, filesV);
|
return make_pair(options, filesV);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user