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

Function-Style Macro Syntax #27

Open
Hawkbat opened this issue Mar 24, 2019 · 0 comments
Open

Function-Style Macro Syntax #27

Hawkbat opened this issue Mar 24, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@Hawkbat
Copy link
Owner

Hawkbat commented Mar 24, 2019

Allow macros to be called as if they are functions. Arguments are not treated as strings as with normal macro syntax, but instead are evaluated in-place. You should be able to get the same behavior by explicitly including the quote marks to make each argument a string. Using arguments and getting the argument count are the same as with normal macros. In addition, a special keyword return will allow the function to return an expression which evaluates to either a number or string value. If no return value is specified, the function will return the number 0 or an empty string depending on what type of value the calling context expects.

add: MACRO
RETURN \1 + \2
ENDM

result = add("(5 + 1)", 2)
@Hawkbat Hawkbat added the enhancement New feature or request label Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant