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

Support args for ParserProtocol.setNextRule #36

Open
introom opened this issue Aug 5, 2013 · 2 comments
Open

Support args for ParserProtocol.setNextRule #36

introom opened this issue Aug 5, 2013 · 2 comments

Comments

@introom
Copy link
Contributor

introom commented Aug 5, 2013

Currently, we can only do setNextRule("ruleName"). But sometimes, the nextRule may in the form of :
ruleName :arg1 :arg2 = expr

As the argument is set by the caller, so, the currentRule needn't be in the form of term based Action(arg). It should directly be the data.
To accomplish this, I used the codeName to tell this apart. (I don't know if it's a good way to go or not.) When the codeName is None, it means the arg is already the pure data, which needn't be self._eval again.
A sample link:
https://github.com/introom/parsley/blob/master/ometa/interp.py#L154

To support rule invocation with argument, of course some other parts should be modified too.
I will discuss it later when this issue gets its attention.

@washort @habnabit

@introom
Copy link
Contributor Author

introom commented Aug 5, 2013

I currently make the currentRule support two form:

  1. "ruleName" #rule without args
  2. ("ruleName", (args, args)) rule with args.
    See
    https://github.com/twisted/parsley-protocols/blob/smtp/parseproto/util/tube.py#L30

@habnabit
Copy link
Contributor

habnabit commented Aug 5, 2013

Your code is a little behind; setNextRule was removed. You could check if receiver.currentRule is a tuple, though.

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

2 participants