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

Parsing::define(OPCODE, OPERATOR) #38

Closed
2 tasks done
xparq opened this issue Sep 8, 2023 · 0 comments
Closed
2 tasks done

Parsing::define(OPCODE, OPERATOR) #38

xparq opened this issue Sep 8, 2023 · 0 comments

Comments

@xparq
Copy link
Owner

xparq commented Sep 8, 2023

Well, but its only benefit compared to

CONST_OPERATORS[opcode] = [](Parser& p, size_t pos, const Rule& rule, OUT size_t& len) -> bool { ... } 

seems to be that it can check if it's been set already.
And perhaps that the [CONST_]OPERATORS map can be hidden, can also be considered an advantage, but it's a stretch...

OTOH:

  • If really checking for existence (instead of overriding), errors would need to be handled by callers...

  • Also, custom OPCODEs would probably still need to be defined symbolically -- somewhere... --, to be practical for actually defining grammar rules. :-/

  • Use it in init(), and also in test/extending!

  • But, again, there should be two sets: one for const, another for non-const, right? What does C++ do nowadays with Function types differing in c-v only?
    ! Hehh, congratulations!... :) It doesn't accept a param. with a c-v mismatch, yet it refuses to dispatch on it, so: "ambiguous call" to define, if trying to overload it based on the c-v diff... The good old begin/end cbegin/cend crap, still...

    • Leaving it commented out for now.
@xparq xparq changed the title Parser::define(OPCODE, OPERATOR) Parsing::define(OPCODE, OPERATOR) Sep 8, 2023
@xparq xparq closed this as completed in f0aa161 Sep 8, 2023
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

No branches or pull requests

1 participant