Closed fubuloubu closed 2 years ago
Alas, i think this isn't something @dabeaz doesn't agree with. This was discussed in #4 .
I expected this, but it would be nice to at least have the option.
You can always alias rule = _ in a class if you want to use something more verbose
Note, this seems to work without issue:
# NOTE: Dummy function, to get `@_` to stop complaining in Parser
def _(fn, *args):
raise
class Parser(SlyParser):
...
@_("TOKEN")
def rule(p):
...
this is a pretty good solution indeed!
Because the
@_(str)
rule decorator is "special" for this library, my static analysis plugins raise the alarm bells on every invocation because it can't find the name_
, which makes it difficult to see when there actually is a problem.It would be nice to have an "alias" (exported from sly) called something like
@rule(str)
that does the same thing it does now, but makes static analysis tools not raise a bunch of errors.