thibaultmarin / hpp2plantuml

Convert C++ header files to PlantUML
MIT License
223 stars 35 forks source link

KeyError: 'values' #3

Closed PanderMusubi closed 6 years ago

PanderMusubi commented 6 years ago

I ran hpp2plantuml for a project and errors arose for three header files, the output was:

[1485] WARN unresolved _reference
Traceback (most recent call last):
  File "/usr/local/bin/hpp2plantuml", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 1112, in main
    CreatePlantUMLFile(args.input_files, args.output_file)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 1080, in CreatePlantUMLFile
    diag.create_from_file_list(list(set(expand_file_list(file_list_c))))
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 768, in create_from_file_list
    flag_build_lists=True, flag_reset=True)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 747, in _build_helper
    self.parse_objects(single_input, build_from_single)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 860, in parse_objects
    self._objects.append(container_handler(obj))
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 32, in <lambda>
    ['enums', lambda objs: objs, lambda obj: Enum(obj)]
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 487, in __init__
    self.parse_members(header_enum)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 497, in parse_members
    for value in header_enum['values']:
KeyError: 'values'

The script I use to run it is https://github.com/nuspell/nuspell/blob/e18c81732a39ab5735659338333253c1969b0642/checks/hpp2plantuml.sh

or hpp2plantuml -i "src/nuspell/*.hxx" -o nuspell.puml for project https://github.com/nuspell/nuspell

thibaultmarin commented 6 years ago

Thanks for the report. Your test is a challenging one.

The latest commit (8e5ebf88) allows me to run hpp2plantuml -i "src/nuspell/*.hxx" -o nuspell.puml without errors.

I have tentatively added support for namespaces and fixed a coupled of bugs revealed by your example:

The output for your code is not great, but it shouldn't fail anymore. Please try it out and let me know if it fixes your issue.

Thanks

Pander writes:

I ran hpp2plantuml for a project and errors arose for three header files, the output was:

[1485] WARN unresolved _reference
Traceback (most recent call last):
  File "/usr/local/bin/hpp2plantuml", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 1112, in main
    CreatePlantUMLFile(args.input_files, args.output_file)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 1080, in CreatePlantUMLFile
    diag.create_from_file_list(list(set(expand_file_list(file_list_c))))
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 768, in create_from_file_list
    flag_build_lists=True, flag_reset=True)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 747, in _build_helper
    self.parse_objects(single_input, build_from_single)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 860, in parse_objects
    self._objects.append(container_handler(obj))
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 32, in <lambda>
    ['enums', lambda objs: objs, lambda obj: Enum(obj)]
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 487, in __init__
    self.parse_members(header_enum)
  File "/usr/local/lib/python3.6/dist-packages/hpp2plantuml/hpp2plantuml.py", line 497, in parse_members
    for value in header_enum['values']:
KeyError: 'values'

The script I use to run it is https://github.com/nuspell/nuspell/blob/e18c81732a39ab5735659338333253c1969b0642/checks/hpp2plantuml.sh

or hpp2plantuml -i "src/nuspell/*.hxx" -o nuspell.puml for project https://github.com/nuspell/nuspell

PanderMusubi commented 6 years ago

Could you let me know when there is a new version on PyPI? Thanks

thibaultmarin commented 6 years ago

v0.4 should now be on PyPI.

Pander writes:

Could you let me know when there is a new version on PyPI? Thanks

— You are receiving this because you commented. Reply to this email directly, [1]view it on GitHub, or [2]mute the thread.*

References:

[1] https://github.com/thibaultmarin/hpp2plantuml/issues/3#issuecomment-416140249 [2] https://github.com/notifications/unsubscribe-auth/AIcC7Uzjb5S9--lWwq4qGnTvfzItWKu-ks5uU5_9gaJpZM4WMdEB

PanderMusubi commented 6 years ago

Thanks. Only errors/warnings for nuspell at the moment are:

[ 505] Warning: can not parse inheriting class const Affixes * >
[1485] WARN unresolved _reference
thibaultmarin commented 6 years ago

I believe these are CppHeaderParser warnings. I think this can now be closed.

PanderMusubi commented 5 years ago

See also (and vote for) https://bitbucket.org/senex/cppheaderparser/issues/43/resolve-_iterator-and-_reference-when and https://bitbucket.org/senex/cppheaderparser/issues/44/improve-parsing-of-inheriting-classes