Skip to content

Commit

Permalink
Make kwarg required
Browse files Browse the repository at this point in the history
  • Loading branch information
evhub committed Feb 25, 2024
1 parent 04d906b commit ccfc882
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions coconut/compiler/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -711,52 +711,61 @@ def bind(cls):
cls.classdef_ref,
cls.method("classdef_handle"),
cls.method("class_manage"),
include_in_packrat_context=False,
)
cls.datadef <<= handle_and_manage(
cls.datadef_ref,
cls.method("datadef_handle"),
cls.method("class_manage"),
include_in_packrat_context=False,
)
cls.match_datadef <<= handle_and_manage(
cls.match_datadef_ref,
cls.method("match_datadef_handle"),
cls.method("class_manage"),
include_in_packrat_context=False,
)

# handle parsing_context for function definitions
cls.stmt_lambdef <<= handle_and_manage(
cls.stmt_lambdef_ref,
cls.method("stmt_lambdef_handle"),
cls.method("func_manage"),
include_in_packrat_context=False,
)
cls.decoratable_normal_funcdef_stmt <<= handle_and_manage(
cls.decoratable_normal_funcdef_stmt_ref,
cls.method("decoratable_funcdef_stmt_handle"),
cls.method("func_manage"),
include_in_packrat_context=False,
)
cls.decoratable_async_funcdef_stmt <<= handle_and_manage(
cls.decoratable_async_funcdef_stmt_ref,
cls.method("decoratable_funcdef_stmt_handle", is_async=True),
cls.method("func_manage"),
include_in_packrat_context=False,
)

# handle parsing_context for type aliases
cls.type_alias_stmt <<= handle_and_manage(
cls.type_alias_stmt_ref,
cls.method("type_alias_stmt_handle"),
cls.method("type_alias_stmt_manage"),
include_in_packrat_context=False,
)

# handle parsing_context for where statements
cls.where_stmt <<= handle_and_manage(
cls.where_stmt_ref,
cls.method("where_stmt_handle"),
cls.method("where_stmt_manage"),
include_in_packrat_context=False,
)
cls.implicit_return_where <<= handle_and_manage(
cls.implicit_return_where_ref,
cls.method("where_stmt_handle"),
cls.method("where_stmt_manage"),
include_in_packrat_context=False,
)

# handle parsing_context for expr_setnames
Expand Down
4 changes: 2 additions & 2 deletions coconut/compiler/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,9 +1225,9 @@ def __repr__(self):
return self.wrapped_name


def manage(item, manager, greedy=True, include_in_packrat_context=False):
def manage(item, manager, include_in_packrat_context, greedy=True):
"""Attach a manager to the given parse item."""
return Wrap(item, manager, greedy=greedy, include_in_packrat_context=include_in_packrat_context)
return Wrap(item, manager, include_in_packrat_context=include_in_packrat_context, greedy=greedy)


def handle_and_manage(item, handler, manager, **kwargs):
Expand Down

0 comments on commit ccfc882

Please sign in to comment.