ParseKit assembler callbacks not called: What am I doing wrong?

不打扰是莪最后的温柔 提交于 2019-12-06 01:05:10

Developer of ParseKit here.

A while back I changed the signature of the Assembler callbacks to accept two arguments:

  1. The Parser which matched the current token.
  2. The Assembly containing the current state of the input parsing.

Previously, there had only been one argument: The Assembly.

I'm not sure the docs are fully updated to reflect this.

So I suspect that if you simply change your Assembler callback method to this, it will work:

- (void)parser:(PKParser *)p didMatchAnything:(PKAssembly *)a {
    NSLog(@"%s %@", __PRETTY_FUNCTION__, a);
}

If not, let me know, and I'll help to further debug.


For background: I made this change because I ran into a situation where my Assembler callback really needed to inspect the Parser which had just made the current match.

It also aligned more closely the strong Cocoa convention of Delegate callbacks which always have the delegator object as their first argument. In hindsight I kinda wish I had renamed the whole concept of Assemblers in ParseKit to Delegates. Since in Cocoa parlance, that's basically what Assemblers are.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!