Parse Kit を使用していますが、文法に疑問があります。
これは以下の私の文法文字列です:
self.grammar = @" \
@start = sentence+; \
sentence = adjectives subjects will verbs subjects '.'; \
subjects = 'i' | 'you' | 'he' | 'she' | 'it' | 'they' | 'we' | 'who else' | 'Apples QA' | 'Hitler' | 'dance';\
verbs = 'eat' | 'sleep' | 'dance' | 'kill' | 'care'; \
will = 'will'; \
adjectives = 'awesome' | 'red' | 'beautiful' | 'odd' | 'useless' | 'temporary';";
これで、すべての用語のルールを含む文を作成できると思います。
行のように:"sentence = adjectives subjects will verbs subjects '.';"
したがって、ユーザーからの入力文字列は次のようになります。 「awesome you will care Apples QA」
次のように、デリゲート (アセンブラー) メソッドをアセンブラーに追加しました。
- (void)didMatchSentence:(PKAssembly *)a
- (void)didMatchAdjectives:(PKAssembly *)a
- (void)didMatchWill:(PKAssembly *)a
- (void)didMatchSubject:(PKAssembly *)a
- (void)didMatchVerb:(PKAssembly *)a
しかし、パーサーが呼び出したのは、didMatchAdjectives と didMatchWill の 2 つだけでした。
どうして?