CocoaPods / Nanaimo

A native ruby implementation of ASCII plist parsing & serializing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can not parse unqouted attribute strings with -

sundbry opened this issue · comments

Hi,

This parser fails when it hits a hyphen character in an unqouted string. I am using it with Apache Cordova which is generating these unquoted strings in the .pbxproj file. If "-" in a string is not valid for this format, please let me know and I will report the bug over there.

/usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:277:in `raise_parser_error': [!] Dictionary missing ';' after key-value pair for "path", found "-" (Nanaimo::Reader::ParseError)
  #  -------------------------------------------
  #             302D95EF14D2391D003F00A1 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = "<group>"; };
  #             302D95F014D2391D003F00A1 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = "<group>"; };
56>             3047A50F1AB8059700498E2A /* build-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "build-debug.xcconfig"; path = cordova/build-debug.xcconfig; sourceTree = SOURCE_ROOT; };
                                                                                                                                                                                              ^
  #             3047A5101AB8059700498E2A /* build-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "build-release.xcconfig"; path = cordova/build-release.xcconfig; sourceTree = SOURCE_ROOT; };
  #             3047A5111AB8059700498E2A /* build.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = build.xcconfig; path = cordova/build.xcconfig; sourceTree = SOURCE_ROOT; };
  #  -------------------------------------------
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:191:in `parse_dictionary'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:124:in `parse_object'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:185:in `parse_dictionary'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:124:in `parse_object'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:185:in `parse_dictionary'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:124:in `parse_object'
        from /usr/local/lib/ruby/gems/2.3.0/gems/nanaimo-0.2.0/lib/nanaimo/reader.rb:99:in `parse!'
        from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.1/lib/xcodeproj/plist.rb:27:in `read_from_path'
        from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.1/lib/xcodeproj/project.rb:200:in `initialize_from_file'
        from /usr/local/lib/ruby/gems/2.3.0/gems/xcodeproj-1.4.1/lib/xcodeproj/project.rb:102:in `open'

Can Xcode open the project with it unquoted? If so, it's valid and I can release a bug fix this afternoon. Thanks for reporting the issue!

Here is a reference of valid characters in an unquoted string: https://github.com/samdmarshall/pbPlist/blob/develop/pbPlist/StrParse.py#L273

Actually @sundbry can you share the project file so I can look into why the carat in the error message is at the wrong column? Thanks!