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

LLL: macro with zero args #2375

Merged
merged 5 commits into from
Jun 13, 2017
Merged

LLL: macro with zero args #2375

merged 5 commits into from
Jun 13, 2017

Conversation

pirapira
Copy link
Member

On develop, LLL macros with zero arguments were not definable because () was not a valid list.

However, #2350 found a usage for that: (panic).

This PR modifies the parser so that LLL macros with zero arguments can be defined.

@axic
Copy link
Member

axic commented Jun 12, 2017

I think this is a good short term fix, though we should aim at removing the "literal definitions" and just keep macros.

Copy link
Member

@axic axic left a comment

Choose a reason for hiding this comment

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

Use different names in the test cases please, because this could conflict with the current builtin instruction as well as when the macro is added to the standard list.

Perhaps go with headlesschicken :)

@pirapira pirapira force-pushed the macro_with_zero_args branch from 3633dfb to f958bf1 Compare June 12, 2017 13:10
@pirapira
Copy link
Member Author

I chose something more neutral.

@@ -174,6 +174,12 @@ BOOST_AUTO_TEST_CASE(list)
BOOST_CHECK(!successParse("()"));
}

BOOST_AUTO_TEST_CASE(macro_with_zero_args)
{
char const* text = "(def 'panic () (asm INVALID))";
Copy link
Member

Choose a reason for hiding this comment

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

Can you change it here too for clarity? (You are right, change is not needed here.)

Copy link
Member Author

Choose a reason for hiding this comment

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

No, that was me being headless chicken.

@pirapira pirapira force-pushed the macro_with_zero_args branch from f958bf1 to a039134 Compare June 12, 2017 13:16
@@ -174,6 +174,12 @@ BOOST_AUTO_TEST_CASE(list)
BOOST_CHECK(!successParse("()"));
Copy link
Member

Choose a reason for hiding this comment

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

Tests fail on this one.

char const* sourceCode = R"(
(returnlll
(seq
(def 'zeroarg () (asm INVALID))
Copy link
Member

Choose a reason for hiding this comment

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

I think we should have a better test here. Such as:

(def 'zeroarg () { (mstore 0 0x1234) (return 0 32) })

@pirapira
Copy link
Member Author

@axic ready to merge?

@axic axic merged commit 0c8c209 into develop Jun 13, 2017
@axic axic deleted the macro_with_zero_args branch June 13, 2017 13:44
@axic axic removed the in progress label Jun 13, 2017
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.

2 participants