Skip to content

Function-Style Macro Syntax #27

@Hawkbat

Description

@Hawkbat

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions