kronenthaler / openstep-parser

OpenStep plist parser for python
BSD 2-Clause "Simplified" License
17 stars 17 forks source link

fix parsing dictionaries with no whitespace around `=` #22

Closed baxievski closed 4 years ago

baxievski commented 4 years ago

I've run into a pbxproj's that pbxproj.XcodeProject has trouble loading.

The traceback:

  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/test_pbxproj.py", line 12, in main
    proj = XcodeProject.load(pbx)
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/pbxproj/XcodeProject.py", line 92, in load
    tree = osp.OpenStepDecoder.ParseFromFile(file)
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/openstep_parser/openstep_parser.py", line 40, in ParseFromFile
    return cls.ParseFromString(fp.read())
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/openstep_parser/openstep_parser.py", line 46, in ParseFromString
    return OpenStepDecoder()._parse(str)
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/openstep_parser/openstep_parser.py", line 55, in _parse
    result, index = self._parse_dictionary(str, index)
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/openstep_parser/openstep_parser.py", line 67, in _parse_dictionary
    index = self._parse_dictionary_entry(str, index, obj)
  File "/Users/bojan/Projects/TabTale/github/CL_App_Builder/.venv/lib/python3.8/site-packages/openstep_parser/openstep_parser.py", line 94, in _parse_dictionary_entry
    raise Exception("Expected = after a key. Found {1} @ {0}".format(index, str[index]))
Exception: Expected = after a key. Found ; @ 31

I can't share the actual pbxproj files, but plutil -lint says they are ok.

Here's a fix along with a syntetic test for this case.

kronenthaler commented 4 years ago

Thanks for your contribution. I have fixed the workflow failing in the master, please merge it into your fork and i will get this PR merged right away!

baxievski commented 4 years ago

Great.

Though the workflow is still failing after pulling in the fix...

kronenthaler commented 4 years ago

Great.

Though the workflow is still failing after pulling in the fix...

I think it's because the actions originate on your repo and branch. I will merge it as the tests have passed.