Skip to content

Semantic action should use operator() instead of operator[] #63

@saki7

Description

@saki7

It is very common to use lambds in semantic actions. Currently, the syntax requires the user to add extra parenthesis around the lambda because the token [[ is ambiguously recognized as the starting character for [[attribute.

constexpr auto p = some_rule[([](auto&& ctx) { do_something(); })];

This is very, very awkward and cumbersome. We should simply use operator() and deprecate operator[].

As a consequence, this fix will going to make directives the only components which use operator[]. So it might actually make the code more readable because people can recognize that the entity is a directive as soon as they see the symbol [ in their parser definitions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions