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

Make macros syntax error instead of silently failing. Thanks @marcioA… #68

Merged
merged 2 commits into from
Apr 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/macros.yay
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

$(macro) {
declare {
$! // syntax error if no match
$(repeat(either(
chain(
optional(buffer('static') as static),
Expand Down Expand Up @@ -112,7 +113,7 @@ $(macro) {

$(macro) {
compile {
function $(llvmidentifier() as name) ($(optional(ls(
function $(llvmidentifier() as name) $! ($(optional(ls(
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be breaking function calls with no arguments

compile {
     foo($x);
}

works

compile {
     foo();
}

gives me a fatal error/throws a runtime exception in the docker image.

Copy link
Owner Author

Choose a reason for hiding this comment

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

That line shouldn't trigger that error, since there is no function keyword... It would trigger the other instance though...

Fixed, with test added.

Copy link
Collaborator

Choose a reason for hiding this comment

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

you're right, I commented on the wrong line

T_VARIABLE as param,
token(',')
)) as params)) {
Expand All @@ -134,6 +135,7 @@ $(macro) {

$(macro :unsafe :recursive) {
$(optional(buffer('unsigned')) as unsigned) compile {
$!
$(repeat(either(
chain(T_VARIABLE as result, token('='), either(
chain(T_VARIABLE as nullcheck_var, token(T_IS_EQUAL), buffer('null')) as nullcheck,
Expand Down