简体   繁体   English

Objective-C ParseKit错误

[英]Objective-C ParseKit Errors

I'm going through the ParseKit example and trying to modify it to suit my needs and running into this problem. 我正在研究ParseKit示例,并尝试对其进行修改以满足自己的需求,并遇到了这个问题。 As soon as I pass in the grammar file to parserFromGrammar:assembler, I get an error: 一旦将语法文件传递给parserFromGrammar:assembler,就会收到错误消息:

[__NSArrayM objectAtIndex:]: index 0 beyond bounds for empty array

I thought maybe it was because my grammar files had token names with underscores in them. 我以为是因为我的语法文件中的标记名称带有下划线。 Does ParseKit support underscores? ParseKit是否支持下划线? What would the method name be that gets called back? 被调用的方法名称是什么? Aka would the token name "foo_bar" call a method didMatchFoo_bar? 令牌名称“ foo_bar”又将调用方法didMatchFoo_bar吗?

I then took out all the underscored names and it still gives me that error. 然后,我拿出所有带下划线的名称,但仍然给我这个错误。 I'm using the example grammar file from the ParseKit website: 我正在使用ParseKit网站上的示例语法文件:

@start = sentence+;
sentence = adjectives 'beer' '.';
adjectives = cold adjective*;
adjective = cold | freezing;
cold = 'cold';
freezing = 'freezing';

Thanks 谢谢

Developer of ParseKit here. 这里是ParseKit的开发人员。 2 things: 2件事:

  1. To answer your first question, I believe the answer is YES. 为了回答您的第一个问题,我相信答案是肯定的。

  2. I just tried out the grammar and it seems to work for me. 我只是尝试了语法,它似乎对我有用。 However, I am using the latest version of ParseKit from Google Code (not GitHub. GitHub is out of date. sorry.) 但是,我正在使用来自Google Code的最新版本的ParseKit(不是GitHub。GitHub已过时。对不起。)

So checkout ParseKit from Google Code here: 因此,请在此处从Google Code签出ParseKit:

https://parsekit.googlecode.com/svn/trunk https://parsekit.googlecode.com/svn/trunk

And then select the "DebugApp" target and "DebugApp" Executable and run. 然后选择“ DebugApp”目标和“ DebugApp”可执行文件并运行。

In the Xcode project, do a global search for "cold freezing beer". 在Xcode项目中,对“冷啤酒”进行全局搜索。 you'll see I've added your example as the default example run in DebugApp. 您会看到我已将您的示例添加为在DebugApp中运行的默认示例。 Seems to work ok. 似乎工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM