[antlr-interest] Objective-C Codegen?
Chris Rudolph
chris_rudolph at apple.com
Wed May 15 22:36:00 PDT 2002
On 5/15/02 10:04 PM, "Hiroyuki Sato" <hiro at kanagawa-u.ac.jp> wrote:
> I'm newbie Objective-C and ANTLR
>
> As far as I know, gsantlr is one of Code Generator for Objective-C.
> http://www.gnustepweb.org/TDocs/gsantlr/
>
> gsantlr still loacking many features.
> for example, Exception Handler.
>
> I modified gnantlr for my study (ObjC and ANTLR)
> and succeed to translate some example programs
> calc, HTML and so on.
>
> But I could not translate many example which using Exception Handler
> So, I also want to know to translate a try/catch/throw into ObjC.
> For example, how to translate following code into Objective-C?
>
> try {
> ...
> ...
> try { // try in catch
> } catch( FooException e ){
> } catch( Exception ex ){
> }
> } catch ( BarExceptionException e ){
> try { // try in catch
> ...
> ...
> } catch (Exception ex ){
> throw ex;
> }
> } catch ( Exception e ){
> throw e;
> }
>
> On 2002.05.16, at 02:08, mzukowski at yci.com wrote:
>
Hi Hiroyuki,
How about:
- (void) blah
{
NS_DURING
{
NS_DURING
{
NSException* ex = [ NSException exceptionWithName:
@"BlahException"
reason: @"just
because"
userInfo: nil ];
[ ex raise ];
}
NS_HANDLER // exception is local variable localException
{
if( [ [ localException name ] isEqualToString: @"BlahException"
] )
{
// ...
}
[ localException raise ];
}
NS_ENDHANDLER
}
NS_HANDLER // exception is local variable localException
{
if( [ [ localException name ] isEqualToString: @"BlahException" ] )
{
// ...
}
}
NS_ENDHANDLER
}
Cheers,
Chris
--
Chris Rudolph, Apple Computer, Inc.
rudy at apple.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list