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

specify common action #6

Closed
dgreisen opened this issue Sep 21, 2017 · 4 comments
Closed

specify common action #6

dgreisen opened this issue Sep 21, 2017 · 4 comments
Assignees
Labels
Projects

Comments

@dgreisen
Copy link

dgreisen commented Sep 21, 2017

Feature request.

The @ syntax for specifying common actions in the grammar is great. It would be really nice if I could specify my own common actions for use with the @ syntax.

parser = Parser(g, actions=actions, common_action=common_actions)

If a key conflicts with a default common action (like collect), I'd like to override the default. (common actions should also be specified in documentation).

@igordejanovic
Copy link
Owner

Good idea.

Yeah, the docs needs to be updated before 0.4 release.

igordejanovic added a commit that referenced this issue Sep 22, 2017
- User actions may be given in grammar using `@` syntax. Action must be
  provided using `actions` param during Parser instantiation.
- Parglare common action can be overriden using `actions` param.
- actions for `call_actions` are now given as usual using `actions` param of
  (GLR)Parser class but `build_tree` must be `True` in order to postpone actions
  call.
@igordejanovic
Copy link
Owner

Implemented on develop branch. Will be on master after some more testing.
Until the docs are updated see the tests for this feature. See also the log message for the change.

Please test it from the develop branch and report if it's working for you.

@igordejanovic igordejanovic added this to Docs in v0.5 Sep 23, 2017
@dgreisen
Copy link
Author

It works very well. greatly simplifies my code.

@igordejanovic
Copy link
Owner

Great! I'll close the issue when docs are in place.

@igordejanovic igordejanovic moved this from Docs to Done in v0.5 Oct 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
v0.5
Done
Development

No branches or pull requests

2 participants