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

feat: visitor with dataclass objects and tests #35

Merged
merged 6 commits into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Example:
>>> grammar = create_daide_grammar(level=130)
>>> message = 'PRP (AND (SLO (ENG)) (SLO (GER)) (SLO (RUS)) (AND (SLO (ENG)) (SLO (GER)) (SLO (RUS))))'
>>> parse_tree = grammar.parse(message)
>>> output = daide_visitor.visit(parse_tree)
>>> output = daide_visitor.visit(parse_tree) # object composed of dataclass objects in keywords.py
>>> print(output)
('PRP', ('AND', [('SLO', 'ENG'), ('SLO', 'GER'), ('SLO', 'RUS'), ('AND', [('SLO', 'ENG'), ('SLO', 'GER'), ('SLO', 'RUS')])]))
PRP ( AND ( SLO ( ENG ) ) ( SLO ( GER ) ) ( SLO ( RUS ) ) ( AND ( SLO ( ENG ) ) ( SLO ( GER ) ) ( SLO ( RUS ) ) ) )
```

If the DAIDE token is not in the grammar or if the message is malformed, the parser will just thrown an exception. We're currently working on returning a list of unrecognized tokens instead of just erroring out.
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ addopts =
--cov=daidepp
--cov-report html
timeout = 10
filterwarnings =
mjspeck marked this conversation as resolved.
Show resolved Hide resolved
ignore::DeprecationWarning

[pylint.MESSAGES CONTROL]
extension-pkg-whitelist =
Expand Down
Loading