开发者

ParseKit object cannot be nil error

I am trying to use ParseKit in a project. I think to have correctly defined a grammar and each time I try to use that grammar with a test string I obtain a log inside the console and a crash:

p: (n开发者_如何转开发ull) * -[__NSArrayM insertObject:atIndex:]: object cannot be nil

What's does it means? What I am doing wrong?


Developer of ParseKit here. I was able to find the problem with your grammar you sent me (off site).

The problem is in this line:

optionalWhere = empty | 'WHERE' comparisons;

Here you have an 'empty' which should be Empty.

All built-in ParseKit parsers are capital case like: Empty.

If you fix that, you're good.

To find/fix problems like this in the future: do a global search in the ParseKit project for: "doTestGrammar".

In that method, replace the existing grammar with your grammar. Then run the "DebugApp" target in Debug mode with breakpoints on. This will lead you to the crash. From there, back up in the stack trace to the last parser callback that was called, and print the PKAssembly sent to that parser callback method as an arg. The console output of printing the PKAssembly will point you to the line in your grammar that has a bug. In this case it was:

[] /empty/ /|/ /'WHERE'/ /comparisons^

Hope that helps you debug future issues.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜