itod / pegkit

'Parsing Expression Grammar' toolkit for Cocoa/Objective-C
MIT License
392 stars 37 forks source link

Turn off emitting some didMatchXXX callbacks #51

Open yepher opened 8 years ago

yepher commented 8 years ago

Feature Request

I hope you don't mind my creating issues as I find myself wishing I could do something in PegKit. PegKit is awesome and if I did not like it I would not create issues ;) One feature I especially love is the generation of call backs for the grammar.

I really try to keep my code warnings down to zero. But one annoying thing is ParseGenApp generates callbacks for parts of grammar that will never need a callback. I can put in a bunch of empty methods to resolve those errors but that seems a bit inefficient both from a coding stand point an execution standpoint.

I think it would be nice to have some sort of syntax in the grammar definition language that tells ParseGenApp to not emit that callback.

One great upside of doing this in grammar it become very easy to see which callbacks the developer has forgotten to implement.

I see there are quite a few pull request that are not merged so I am not sure if it is worth the time to do some of this and create a pull request for it.

yepher commented 8 years ago

I looks like warning occur rather the method is available in the delegate or not. On solution is to put this at the top of the grammar definition:

@m {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"
}

It will turn off undeclared warning in the emitted file.