Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for side-effect actions (pull request)#56

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jwcraftsman wants to merge10 commits intoigordejanovic:master
base:master
Choose a base branch
Loading
fromjwcraftsman:side-effects

Conversation

@jwcraftsman
Copy link
Contributor

This pull request was spawned as a result of the discussion in#51.

This branch divides grammar actions into two groups, based on whether their purpose is to 1) construct a parse result (e.g. AST tree nodes) or 2) manipulate external state for use by recognizers or dynamic filters. If the purpose is manipulate external state, then the action is a side-effect action, otherwise it is a standard action.

A new keyword argument "side_actions" was added to the Parser constructor. Support for a _side_actions.py file was also added to grammar.py.

The option added in#45 was removed, as it is no longer necessary, since side_actions are processed regardless of whether build_tree is true or false.

… method.- Added _resolve_side_effects() method to Grammar class, which  mimics _resolve_actions().- Modified constructor and _init_grammar() to pass along  side_effects argument to _resolve_side_effects().- Added call to side_effect action in _call_shift_action and  _call_reduce_action Parser methods.  Refactored some code out  of _call_reduce_action to reduce code duplication between  actions and side_effects.- No support for <grammar>_side_effects.py yet.
@coveralls
Copy link

Coverage Status

Coverage decreased (-2.7%) to 82.937% when pulling136430f on codecraftingtools:side-effects intoc6e4d8a on igordejanovic:master.

@coveralls
Copy link

coveralls commentedAug 1, 2018
edited
Loading

Coverage Status

Coverage decreased (-0.4%) to 85.526% when pulling3228904 on codecraftingtools:side-effects into39927c4 on igordejanovic:master.

@jwcraftsman
Copy link
ContributorAuthor

How does this implementation look? It seems to be working for me. Please let me know if this in on the right track. Thanks.

@igordejanovic
Copy link
Owner

I haven't had a change for a deeper look into it. I'll get to that probably after finishing current rework around error reporting. The thing that I don't like with the current side-effect implementation is that a lot of code is copy-pasted from plain actions. I would like to integrate/generalize that so it would be easier to maintain. I could provide more info when get back to it in the next week or two probably.

@jwcraftsman
Copy link
ContributorAuthor

Yes, I agree that the duplicated code should be minimized. Thanks.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@jwcraftsman@coveralls@igordejanovic

[8]ページ先頭

©2009-2025 Movatter.jp