1996-05-13 17:32:56 +00:00
|
|
|
/* definition section */
|
|
|
|
|
|
|
|
/* literal block */
|
|
|
|
%{
|
|
|
|
#include <gnustep/base/preface.h>
|
|
|
|
#include <Foundation/NSUtilities.h>
|
|
|
|
#include <Foundation/NSString.h>
|
|
|
|
#include <Foundation/NSData.h>
|
|
|
|
#include <Foundation/NSArray.h>
|
|
|
|
#include <Foundation/NSDictionary.h>
|
|
|
|
%}
|
|
|
|
|
|
|
|
/* token declarations */
|
|
|
|
%token <obj> NSSTRING NSDATA ERROR
|
|
|
|
|
|
|
|
%union {
|
|
|
|
id obj;
|
|
|
|
}
|
|
|
|
|
1998-10-09 08:36:37 +00:00
|
|
|
%type <obj> root object array objlist dictionary keyval_list
|
1996-05-13 17:32:56 +00:00
|
|
|
|
|
|
|
/* rules section */
|
|
|
|
%%
|
|
|
|
root: object
|
|
|
|
{
|
|
|
|
/* want an object, followed by nothing else (<<EOF>>) */
|
|
|
|
return (int)$1;
|
|
|
|
}
|
|
|
|
| error
|
|
|
|
{
|
|
|
|
return (int)nil;
|
|
|
|
}
|
|
|
|
| ERROR
|
|
|
|
{
|
|
|
|
return (int)nil;
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
object: NSSTRING
|
|
|
|
| NSDATA
|
|
|
|
| array
|
|
|
|
| dictionary
|
|
|
|
;
|
|
|
|
|
|
|
|
array: '(' objlist ')'
|
|
|
|
{$$ = $2;}
|
1998-06-24 22:13:15 +00:00
|
|
|
| '(' objlist ',' ')'
|
|
|
|
{$$ = $2;}
|
1996-05-13 17:32:56 +00:00
|
|
|
| '(' ')'
|
1997-09-01 21:59:51 +00:00
|
|
|
{$$ = [NSArray array];}
|
1996-05-13 17:32:56 +00:00
|
|
|
;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
1996-05-13 17:32:56 +00:00
|
|
|
objlist: objlist ',' object
|
|
|
|
{
|
|
|
|
$$ = $1;
|
|
|
|
[$$ addObject:$3];
|
|
|
|
}
|
|
|
|
| object
|
|
|
|
{
|
1998-10-09 08:36:37 +00:00
|
|
|
$$ = [NSMutableArray arrayWithCapacity: 1];
|
1996-05-13 17:32:56 +00:00
|
|
|
[$$ addObject:$1];
|
|
|
|
}
|
|
|
|
;
|
|
|
|
|
|
|
|
dictionary: '{' keyval_list '}'
|
|
|
|
{$$ = $2;}
|
1998-01-19 15:20:15 +00:00
|
|
|
| '{' keyval_list ';' '}'
|
|
|
|
{$$ = $2;}
|
1996-05-13 17:32:56 +00:00
|
|
|
| '{' '}'
|
1997-09-01 21:59:51 +00:00
|
|
|
{$$ = [NSDictionary dictionary];}
|
1996-05-13 17:32:56 +00:00
|
|
|
;
|
1998-10-09 08:36:37 +00:00
|
|
|
keyval_list: keyval_list ';' NSSTRING '=' object
|
1996-05-13 17:32:56 +00:00
|
|
|
{
|
|
|
|
$$ = $1;
|
1998-10-09 08:36:37 +00:00
|
|
|
[$$ setObject:$5 forKey:$3];
|
1996-05-13 17:32:56 +00:00
|
|
|
}
|
1998-10-09 08:36:37 +00:00
|
|
|
| NSSTRING '=' object
|
1997-09-01 21:59:51 +00:00
|
|
|
{
|
1998-10-09 08:36:37 +00:00
|
|
|
$$ = [NSMutableDictionary dictionaryWithCapacity:1];
|
1996-05-13 17:32:56 +00:00
|
|
|
[$$ setObject:$3 forKey:$1];
|
1998-10-09 08:36:37 +00:00
|
|
|
}
|
1996-05-13 17:32:56 +00:00
|
|
|
;
|
|
|
|
%%
|
|
|
|
|
|
|
|
/* C code section */
|
|
|
|
int plerror(char *s)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|