cppparser
cppparser copied to clipboard
Static arrays initialization causes parse errors
There are some cases with initializing static arrays in sequences which the parser fails to process.
Example 1:
int main()
{
int variable, array_one[100], array_two[500];
return 0;
}
produces:
./cppparsertest -p failed_testcases/many_arrays.cpp
Error: Unexpected '[', while in context=ctxGeneral(1), found at line#2
int variable, array_one[100], array_two[
Example 2:
int main()
{
int variable = 0, array[100];
return 0;
}
produces:
./cppparsertest -p failed_testcases/one_array.cpp
Error: Unexpected '[', while in context=ctxGeneral(1), found at line#2
int variable=0, array[
At the same time it parses these examples:
int main()
{
int variable_one = 0, variable_two = 1;
return 0;
}
int main()
{
int array_one[500], array_two[500];
return 0;
}
Thanks for reporting. I see the problem and can be fixed. I will tackle it soon after completion of the major refactoring I am doing as of now.
Hello, @satya-das! Looks like I've fixed it, can I create MR?
Hello, @satya-das! Looks like I've fixed it, can I create MR?
Please go ahead. And thanks for taking initiative. :)
The issue is fixed with 07e43111