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

gdradon: KeyError: Token('RULE', 'property_body_def') with Property Body #292

Closed
plink-plonk-will opened this issue Mar 19, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@plink-plonk-will
Copy link
Contributor

When running gdradon cc on a GDScript with a Property definition in it, the gd2py convertor throws an exception:

Traceback (most recent call last):
  File "Python/3.9/bin/gd2py", line 8, in <module>
    sys.exit(main())
  File "Python/3.9/lib/python/site-packages/gdtoolkit/gd2py/__main__.py", line 34, in main
    print(convert_code(handle.read()))
  File "Python/3.9/lib/python/site-packages/gdtoolkit/gd2py/__init__.py", line 24, in convert_code
    converted_lines = _convert_block(parse_tree.children, context)
  File "Python/3.9/lib/python/site-packages/gdtoolkit/gd2py/__init__.py", line 31, in _convert_block
    converted_lines += _convert_statement(statement, context)
  File "Python/3.9/lib/python/site-packages/gdtoolkit/gd2py/__init__.py", line 115, in _convert_statement
    return handlers[statement.data](statement, context)
KeyError: Token('RULE', 'property_body_def')

I am happy to open a PR with this if preferred, but I patched this locally by passing it in the statement conversion in gdtoolkit/gd2py/__init__.py _convert_statement, eg:

        ...
        "enum_stmt": _pass,  # TODO: implement
        "classname_stmt": _pass,
        "property_body_def": _pass, # This was added here
        "classname_extends_stmt": _pass,
        "signal_stmt": _pass, 
        ...
@Scony Scony added the bug Something isn't working label Mar 19, 2024
@Scony
Copy link
Owner

Scony commented Mar 19, 2024

Yeah, the gd2py is probably quite outdated. If you'd like to open PR I'd be happy to accept that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants