home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-10 | 25.5 KB | 1,451 lines |
- /*
- * A n t l r T r a n s l a t i o n H e a d e r
- *
- * Terence Parr, Will Cohen, and Hank Dietz: 1989-1994
- * Purdue University Electrical Engineering
- * With AHPCRC, University of Minnesota
- * ANTLR Version 1.33
- */
- #include <stdio.h>
- #define ANTLR_VERSION 133
-
- #import <Foundation/NSString.h>
-
- #ifndef __Attrib_def__
- #define __Attrib_def__
- typedef id Attrib;
- #endif
-
- #define USER_ZZSYN
- void zzcr_attr(Attrib* attr, int token, char* text);
- #define LL_K 2
- #define zzSET_SIZE 8
- #include "antlr.h"
- #include "tokens.h"
- #include "dlgdef.h"
- #include "mode.h"
- #ifndef PURIFY
- #define PURIFY(r,s)
- #endif
- ANTLR_INFO
-
- #import <Foundation/NSArray.h>
- #import <Foundation/NSAutoreleasePool.h>
- #import <Foundation/NSValue.h>
- #import "Variable.h"
-
- @implementation Variable (Parser)
-
- // Class variables
- NSMutableString* gdbParserErrors;
- static const unsigned char* scannedString;
- static int length, position;
-
- static int nextchar (void)
- {
- if (position < length)
- return scannedString[position++];
- else
- return -1;
- }
-
- + (NSMutableArray*)variablesFromDescription:(NSString*)string
- {
- id pool = [NSAutoreleasePool new];
- id vars;
-
- gdbParserErrors = [NSMutableString new];
-
- scannedString = [string cString];
- length = [string length];
- position = 0;
- ANTLRf(vars = variables(), nextchar);
-
- if([gdbParserErrors length]) {
- NSLog (@"Errors were encountered during parsing of gdb output! Please "
- @"submit this output as bug report:\nString to parse:\n%@\n\nError "
- @"message:\n%@", string, gdbParserErrors);
- [pool release];
- return nil;
- }
-
- [vars retain];
- [pool release];
- [gdbParserErrors autorelease];
- [vars autorelease];
-
- // NSLog (@"variables = %@", vars);
- return vars;
- }
-
- @end
-
- void zzcr_attr(Attrib* attr, int token, char* text)
- {
- switch (token) {
- case STRING:
- case IDENTIFIER:
- case FUNCTION_NAME:
- case CHARACTER:
- case OCTALINT:
- case DECIMALINT:
- case HEXADECIMALINT:
- case FLOATONE:
- case FLOATTWO:
- case FLOATTHREE:
- *attr = [NSString stringWithCString:text];
- break;
- default:
- break;
- }
- }
-
- void zzsyn(char* text, int tok, char* egroup,
- SetWordType* eset, int etok, int k, char*bad_text)
- {
- extern id gdbParserErrors;
-
- [gdbParserErrors appendFormat:
- @"line %d: syntax error at \"%s\"",
- zzline, (tok == zzEOF_TOKEN) ? "EOF" : bad_text];
- if(!etok && !eset) {
- [gdbParserErrors appendString:@"\n"];
- return;
- }
- if (k==1)
- [gdbParserErrors appendString:@" missing"];
- else {
- [gdbParserErrors
- appendFormat:@"; \"%s\" not", bad_text];
- if(zzset_deg(eset) > 1)
- [gdbParserErrors appendString:@" in"];
- }
- if(zzset_deg(eset) > 0)
- [gdbParserErrors appendString:zzedecode(eset)];
- else
- [gdbParserErrors appendFormat:@" %s", zztokens[etok]];
- if(strlen(egroup) > 0)
- [gdbParserErrors appendFormat:@" in %s", egroup];
- [gdbParserErrors appendString:@"\n"];
- }
-
- id
- #ifdef __STDC__
- variables(void)
- #else
- variables()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id var; _retv = [NSMutableArray array];
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==NO_ARGUMENTS) ) {
- zzmatch(NO_ARGUMENTS); zzCONSUME;
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==NO_LOCALS) ) {
- zzmatch(NO_LOCALS); zzCONSUME;
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (LA(1)==NO_SYMBOL_TABLE) ) {
- zzmatch(NO_SYMBOL_TABLE); zzCONSUME;
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- while ( (setwd1[LA(1)]&0x1) ) {
- var = variable();
-
- [_retv addObject:var];
- zzLOOP(zztasp2);
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x2);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- variable(void)
- #else
- variable()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- Attrib name, class_id;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id value; _retv = [[Variable new] autorelease];
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==IDENTIFIER)
- ) {
- zzmatch(IDENTIFIER);
- name = zzaCur;
-
- [_retv setName: name];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==CLASS) ) {
- zzmatch(CLASS);
- class_id = zzaCur;
-
- [_retv setName:@"class"];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(EQUAL); zzCONSUME;
- value = typed_value();
-
- [_retv setValue:value];
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x4);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- typed_value(void)
- #else
- typed_value()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id t; _retv = nil;
- zzmatch(LPARENTHESIS); zzCONSUME;
- t = type();
-
- zzmatch(RPARENTHESIS); zzCONSUME;
- _retv = value( t );
-
- [_retv setType:t];
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x8);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- type(void)
- #else
- type()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- _retv = nil;
- _retv = ptype();
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==DOUBLECOLON) ) {
- zzmatch(DOUBLECOLON); zzCONSUME;
- zzmatch(STAR);
- [[_retv typeName] appendString:@"::* "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x10);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- ptype(void)
- #else
- ptype()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- _retv = nil;
- _retv = typebase();
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd1[LA(1)]&0x20) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- if ( (LA(1)==CONST) ) {
- zzmatch(CONST);
- [[_retv typeName] appendString:@"const "];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==VOLATILE)
- ) {
- zzmatch(VOLATILE);
- [[_retv typeName] appendString:@"volatile "];
- zzCONSUME;
-
- }
- }
- zzEXIT(zztasp3);
- }
- }
- abs_decl( _retv );
- }
- zzEXIT(zztasp2);
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd1, 0x40);
- return _retv;
- }
- }
-
- void
- #ifdef __STDC__
- abs_decl( id type )
- #else
- abs_decl(type)
- id type ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd1[LA(1)]&0x80) ) {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==STAR) ) {
- zzmatch(STAR);
- [[ type typeName] appendString:@"*"];
- [ type setTypeKind:kPointer];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==AMPERSAND) ) {
- zzmatch(AMPERSAND);
- [[ type typeName] appendString:@"&"];
- [ type setTypeKind:kPointer];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd2[LA(1)]&0x1) ) {
- abs_decl( type );
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (setwd2[LA(1)]&0x2)
- ) {
- direct_abs_decl( type );
- }
- else {zzFAIL(1,zzerr3,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x4);
- }
- }
-
- void
- #ifdef __STDC__
- direct_abs_decl( id type )
- #else
- direct_abs_decl(type)
- id type ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (LA(1)==LPARENTHESIS) && (setwd2[LA(2)]&0x8) ) {
- zzmatch(LPARENTHESIS);
- [[ type typeName] appendString:@"("];
- zzCONSUME;
-
- abs_decl( type );
- zzmatch(RPARENTHESIS);
- [[ type typeName] appendString:@")"];
- zzCONSUME;
-
- rest_of_direct_abs_decl( type );
- }
- else {
- if ( (LA(1)==LSQUAREBRACKET) ) {
- array_mod( type );
- rest_of_direct_abs_decl( type );
- }
- else {
- if ( (LA(1)==LPARENTHESIS) && (setwd2[LA(2)]&0x10) ) {
- func_mod( type );
- rest_of_direct_abs_decl( type );
- }
- else {zzFAIL(2,zzerr4,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd2, 0x20);
- }
- }
-
- void
- #ifdef __STDC__
- rest_of_direct_abs_decl( id type )
- #else
- rest_of_direct_abs_decl(type)
- id type ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (setwd2[LA(1)]&0x40) ) {
- direct_abs_decl( type );
- }
- else {
- if ( (setwd2[LA(1)]&0x80)
- ) {
- }
- else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x1);
- }
- }
-
- void
- #ifdef __STDC__
- array_mod( id type )
- #else
- array_mod(type)
- id type ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id num;
- zzmatch(LSQUAREBRACKET);
- [[ type typeName] appendString:@"["];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd3[LA(1)]&0x2) ) {
- num = int_number( type );
-
- [[ type typeName] appendString:[num stringValue]];
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(RSQUAREBRACKET);
- [[ type typeName] appendString:@"]"];
- zzCONSUME;
-
- [ type setTypeKind:kArray];
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x4);
- }
- }
-
- void
- #ifdef __STDC__
- func_mod( id typeObj )
- #else
- func_mod(typeObj)
- id typeObj ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id funcType;
- zzmatch(LPARENTHESIS); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd3[LA(1)]&0x8) ) {
- funcType = type();
-
- [[ typeObj typeName] appendString:[funcType typeName]];
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- while ( (LA(1)==COMMA) ) {
- zzmatch(COMMA); zzCONSUME;
- funcType = type();
-
- [[ typeObj typeName] appendString:[funcType typeName]];
- zzLOOP(zztasp3);
- }
- zzEXIT(zztasp3);
- }
- }
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(RPARENTHESIS); zzCONSUME;
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd3, 0x10);
- }
- }
-
- id
- #ifdef __STDC__
- typebase(void)
- #else
- typebase()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id string = [NSMutableString string];
- id synType;
- _retv = [[Type new] autorelease];
- [_retv setTypeName:string];
- if ( (setwd3[LA(1)]&0x20) ) {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==UNSIGNED)
- ) {
- zzmatch(UNSIGNED);
- [string appendString:@"unsigned "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp2);
- }
- }
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==LONG) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- zzmatch(LONG);
- [string appendString:@"long "];
- [_retv setScalarTypeKind:kLong];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==UNSIGNED) ) {
- zzmatch(UNSIGNED);
- [string appendString:@"unsigned "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp4);
- }
- }
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==INT) ) {
- zzmatch(INT);
- [string appendString:@"int "];
- [_retv setScalarTypeKind:kInt];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==LONG) ) {
- {
- zzBLOCK(zztasp5);
- zzMake0;
- {
- zzmatch(LONG);
- [string appendString:@"long "];
- [_retv setScalarTypeKind:kLong];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp6);
- zzMake0;
- {
- if ( (LA(1)==INT)
- ) {
- zzmatch(INT);
- [string appendString:@"int "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp6);
- }
- }
- zzEXIT(zztasp5);
- }
- }
- }
- }
- zzEXIT(zztasp4);
- }
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (LA(1)==INT) ) {
- zzmatch(INT);
- [string appendString:@"int "];
- [_retv setScalarTypeKind:kInt];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==SHORT) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- zzmatch(SHORT);
- [string appendString:@"short "];
- [_retv setScalarTypeKind:kShort];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==UNSIGNED) ) {
- zzmatch(UNSIGNED);
- [string appendString:@"unsigned "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp4);
- }
- }
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==INT) ) {
- zzmatch(INT);
- [string appendString:@"int "];
- zzCONSUME;
-
- }
- zzEXIT(zztasp4);
- }
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (LA(1)==CHAR)
- ) {
- zzmatch(CHAR);
- [string appendString:@"char "];
- [_retv setScalarTypeKind:kChar];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- zzEXIT(zztasp2);
- }
- }
- [_retv setTypeKind:kScalar];
- }
- else {
- if ( (LA(1)==FLOAT) ) {
- zzmatch(FLOAT);
- [string appendString:@"float "];
- [_retv setTypeKind:kScalar]; [_retv setScalarTypeKind:kFloat];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==DOUBLE) ) {
- zzmatch(DOUBLE);
- [string appendString:@"double "];
- [_retv setTypeKind:kScalar]; [_retv setScalarTypeKind:kDouble];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==STRUCT) ) {
- zzmatch(STRUCT);
- [string appendString:@"struct "];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd3[LA(1)]&0x40) ) {
- synType = identifier();
-
- [string appendString:synType];
- }
- else {
- if ( (LA(1)==LCURLYBRACE)
- ) {
- zzmatch(LCURLYBRACE);
- [string appendString:@"{ "];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- int zzcnt=1;
- zzMake0;
- {
- do {
- synType = type();
-
- [string appendString:[synType typeName]];
- synType = identifier();
-
- [string appendString:synType];
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==LSQUAREBRACKET) ) {
- array_mod( _retv );
- }
- zzEXIT(zztasp4);
- }
- }
- zzmatch(SEMICOLON);
- [string appendString:@"; "];
- zzCONSUME;
-
- zzLOOP(zztasp3);
- } while ( (setwd3[LA(1)]&0x80) );
- zzEXIT(zztasp3);
- }
- }
- zzmatch(RCURLYBRACE);
- [string appendString:@"}"];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- [_retv setTypeKind:kStructure];
- }
- else {
- if ( (LA(1)==CLASS) ) {
- zzmatch(CLASS); zzCONSUME;
- synType = identifier();
-
- [string appendString:@"struct "];
- [string appendString:synType];
- [_retv setTypeKind:kClass];
- }
- else {
- if ( (LA(1)==UNION) ) {
- zzmatch(UNION);
- [string appendString:@"union "];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd4[LA(1)]&0x1)
- ) {
- synType = identifier();
-
- [string appendString:synType];
- }
- else {
- if ( (LA(1)==LCURLYBRACE) ) {
- zzmatch(LCURLYBRACE);
- [string appendString:@"{ "];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp3);
- int zzcnt=1;
- zzMake0;
- {
- do {
- synType = type();
-
- [string appendString:[synType typeName]];
- synType = identifier();
-
- [string appendString:synType];
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- if ( (LA(1)==LSQUAREBRACKET) ) {
- array_mod( _retv );
- }
- zzEXIT(zztasp4);
- }
- }
- zzmatch(SEMICOLON);
- [string appendString:@"; "];
- zzCONSUME;
-
- zzLOOP(zztasp3);
- } while ( (setwd4[LA(1)]&0x2) );
- zzEXIT(zztasp3);
- }
- }
- zzmatch(RCURLYBRACE);
- [string appendString:@"}"];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- [_retv setTypeKind:kUnion];
- }
- else {
- if ( (LA(1)==ENUM) ) {
- zzmatch(ENUM);
- [string appendString:@"enum "];
- zzCONSUME;
-
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd4[LA(1)]&0x4)
- ) {
- synType = identifier();
-
- [string appendString:synType];
- }
- else {
- if ( (LA(1)==LCURLYBRACE) ) {
- zzmatch(LCURLYBRACE);
- [string appendString:@"{ "];
- zzCONSUME;
-
- synType = identifier();
-
- [string appendString:synType];
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- while ( (LA(1)==COMMA) ) {
- zzmatch(COMMA);
- [string appendString:@", "];
- zzCONSUME;
-
- synType = identifier();
-
- [string appendString:synType];
- zzLOOP(zztasp3);
- }
- zzEXIT(zztasp3);
- }
- }
- zzmatch(RCURLYBRACE);
- [string appendString:@"}"];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr10,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- [_retv setTypeKind:kEnum];
- }
- else {
- if ( (setwd4[LA(1)]&0x8) ) {
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==CONST) ) {
- zzmatch(CONST);
- [string appendString:@"const "];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==VOLATILE)
- ) {
- zzmatch(VOLATILE);
- [string appendString:@"volatile "];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr11,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp2);
- }
- }
- synType = typebase();
-
- [string appendString:[synType typeName]];
- [synType setTypeName:string];
- _retv = synType;
- }
- else {
- if ( (LA(1)==VOID) ) {
- zzmatch(VOID);
- [string appendString:@"void "]; [_retv setTypeKind:kVoid];
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr12,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- }
- }
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd4, 0x10);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- value( id type )
- #else
- value(type)
- id type ;
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id num, string, synType; _retv = nil;
- if ( (setwd4[LA(1)]&0x20) ) {
- num = number( type );
-
- _retv = num;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd4[LA(1)]&0x40) ) {
- string = descriptive_value();
-
- [_retv setDescription:string];
- }
- zzEXIT(zztasp2);
- }
- }
- }
- else {
- if ( (setwd4[LA(1)]&0x80) ) {
- synType = identifier();
-
- _retv = [[[ type valueClass] new] autorelease];
- [_retv setStringValue:synType];
- }
- else {
- if ( (LA(1)==LCURLYBRACE)
- ) {
- NSMutableArray* array = [NSMutableArray array];
- _retv = [[[ type valueClass] new] autorelease];
- compound_value( array );
- [_retv setArrayValue:array];
- }
- else {zzFAIL(1,zzerr13,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x1);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- descriptive_value(void)
- #else
- descriptive_value()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- Attrib d1, d2, d3;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- _retv = nil;
- if ( (LA(1)==CHARACTER) ) {
- zzmatch(CHARACTER);
- d1 = zzaCur;
-
- _retv = d1;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==STRING) ) {
- zzmatch(STRING);
- d2 = zzaCur;
-
- _retv = d2;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==FUNCTION_NAME) ) {
- zzmatch(FUNCTION_NAME);
- d3 = zzaCur;
-
- _retv = d3;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr14,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x2);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- number( id type )
- #else
- number(type)
- id type ;
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- Attrib n1, n2, n3, n4;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- _retv = nil;
- if ( (LA(1)==FLOATONE) ) {
- zzmatch(FLOATONE);
- n1 = zzaCur;
-
- _retv = [SimpleValue numberWithString: n1];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==FLOATTWO)
- ) {
- zzmatch(FLOATTWO);
- n2 = zzaCur;
-
- _retv = [SimpleValue numberWithString: n2];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==FLOATTHREE) ) {
- zzmatch(FLOATTHREE);
- n3 = zzaCur;
-
- _retv = [SimpleValue numberWithString: n3];
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==STRING) ) {
- zzmatch(STRING);
- n4 = zzaCur;
-
- _retv = [SimpleValue numberWithString: n4];
- zzCONSUME;
-
- }
- else {
- if ( (setwd5[LA(1)]&0x4) ) {
- _retv = int_number( type );
-
- }
- else {zzFAIL(1,zzerr15,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- }
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x8);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- int_number( id type )
- #else
- int_number(type)
- id type ;
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- Attrib n1, n2, n3;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id numberString; _retv = nil;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (LA(1)==OCTALINT) ) {
- zzmatch(OCTALINT);
- n1 = zzaCur;
-
- numberString = n1;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==DECIMALINT)
- ) {
- zzmatch(DECIMALINT);
- n2 = zzaCur;
-
- numberString = n2;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==HEXADECIMALINT) ) {
- zzmatch(HEXADECIMALINT);
- n3 = zzaCur;
-
- numberString = n3;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr16,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- }
- zzEXIT(zztasp2);
- }
- }
- if ([type typeKind] == kPointer)
- _retv = [PointerValue pointerWithAddress:numberString];
- else
- _retv = [SimpleValue numberWithString:numberString];
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x10);
- return _retv;
- }
- }
-
- void
- #ifdef __STDC__
- compound_value( id components )
- #else
- compound_value(components)
- id components ;
- #endif
- {
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- id val;
- zzmatch(LCURLYBRACE); zzCONSUME;
- {
- zzBLOCK(zztasp2);
- zzMake0;
- {
- if ( (setwd5[LA(1)]&0x20) ) {
- {
- zzBLOCK(zztasp3);
- zzMake0;
- {
- val = variable_or_typed_value();
-
- [ components addObject:val];
- {
- zzBLOCK(zztasp4);
- zzMake0;
- {
- while ( (LA(1)==COMMA) ) {
- zzmatch(COMMA); zzCONSUME;
- val = variable_or_typed_value();
-
- [ components addObject:val];
- zzLOOP(zztasp4);
- }
- zzEXIT(zztasp4);
- }
- }
- zzEXIT(zztasp3);
- }
- }
- }
- else {
- if ( (LA(1)==DOTS) ) {
- zzmatch(DOTS); zzCONSUME;
- }
- }
- zzEXIT(zztasp2);
- }
- }
- zzmatch(RCURLYBRACE); zzCONSUME;
- zzEXIT(zztasp1);
- return;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd5, 0x40);
- }
- }
-
- id
- #ifdef __STDC__
- variable_or_typed_value(void)
- #else
- variable_or_typed_value()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- _retv = nil;
- if ( (setwd5[LA(1)]&0x80)
- ) {
- _retv = variable();
-
- }
- else {
- if ( (LA(1)==LPARENTHESIS) ) {
- _retv = typed_value();
-
- }
- else {zzFAIL(1,zzerr17,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd6, 0x1);
- return _retv;
- }
- }
-
- id
- #ifdef __STDC__
- identifier(void)
- #else
- identifier()
- #endif
- {
- id _retv;
- PURIFY(_retv,sizeof( id ))
- zzRULE;
- Attrib name1, name2;
- zzBLOCK(zztasp1);
- zzMake0;
- {
- if ( (LA(1)==IDENTIFIER) ) {
- zzmatch(IDENTIFIER);
- name1 = zzaCur;
-
- _retv= name1;
- zzCONSUME;
-
- }
- else {
- if ( (LA(1)==CLASS) ) {
- zzmatch(CLASS);
- name2 = zzaCur;
-
- _retv= name2;
- zzCONSUME;
-
- }
- else {zzFAIL(1,zzerr18,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}
- }
- zzEXIT(zztasp1);
- return _retv;
- fail:
- zzEXIT(zztasp1);
- zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText);
- zzresynch(setwd6, 0x2);
- return _retv;
- }
- }
-