Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static arrays initialization causes parse errors #18

Open
litdarya opened this issue May 24, 2023 · 3 comments
Open

Static arrays initialization causes parse errors #18

litdarya opened this issue May 24, 2023 · 3 comments

Comments

@litdarya
Copy link

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;
}
@satya-das
Copy link
Owner

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.

@litdarya
Copy link
Author

Hello, @satya-das! Looks like I've fixed it, can I create MR?

@satya-das
Copy link
Owner

Hello, @satya-das! Looks like I've fixed it, can I create MR?

Please go ahead. And thanks for taking initiative. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants