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

Manually throw error for incomplete expression #319

Merged
merged 4 commits into from
Aug 9, 2021

Conversation

melonedo
Copy link
Contributor

Fix #311

Copy link
Member

@Gnimuc Gnimuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fix #311, we should add support for this macro pattern instead of skipping it.

src/generator/macro.jl Outdated Show resolved Hide resolved
Co-authored-by: Yupei Qi <qiyupei@gmail.com>
@melonedo
Copy link
Contributor Author

Can we support this kind of macro? void * is tricky even in C...
But at least we must ensure the generated code is valid Julia code, so I forced the generator to ignore this macro.

@Gnimuc
Copy link
Member

Gnimuc commented Jul 25, 2021

No need to be generic. In this specific case, we can check: if the parsed expr is incomplete and the last char in str is *, then we remove this * from str and parse again until all of the tailing * are recursively removed; now the only thing left should be a valid Julia type, if not, we just give up and skip.

@Gnimuc
Copy link
Member

Gnimuc commented Aug 9, 2021

@melonedo, is this ready to merge?

@melonedo
Copy link
Contributor Author

melonedo commented Aug 9, 2021

I think yes. I do not see any regression locally.

@Gnimuc Gnimuc merged commit 0ad040b into JuliaInterop:master Aug 9, 2021
@Gnimuc
Copy link
Member

Gnimuc commented Aug 9, 2021

Thanks!

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

Successfully merging this pull request may close these issues.

"$" expression outside quote around...
2 participants