
/*  A Bison parser, made from parser.y
 by  GNU Bison version 1.25
  */

#define YYBISON 1  /* Identify Bison output.  */

#define	TOK_ANY	258
#define	TOK_ATTRIBUTE	259
#define	TOK_BOOLEAN	260
#define	TOK_CASE	261
#define	TOK_CHAR	262
#define	TOK_CONST	263
#define	TOK_CONTEXT	264
#define	TOK_DEFAULT	265
#define	TOK_DOUBLE	266
#define	TOK_ENUM	267
#define	TOK_EXCEPTION	268
#define	TOK_FALSE	269
#define	TOK_FIXED	270
#define	TOK_FLOAT	271
#define	TOK_IN	272
#define	TOK_INOUT	273
#define	TOK_INTERFACE	274
#define	TOK_LONG	275
#define	TOK_MODULE	276
#define	TOK_NATIVE	277
#define	TOK_NOSCRIPT	278
#define	TOK_OBJECT	279
#define	TOK_OCTET	280
#define	TOK_ONEWAY	281
#define	TOK_OP_SCOPE	282
#define	TOK_OP_SHL	283
#define	TOK_OP_SHR	284
#define	TOK_OUT	285
#define	TOK_RAISES	286
#define	TOK_READONLY	287
#define	TOK_SEQUENCE	288
#define	TOK_SHORT	289
#define	TOK_STRING	290
#define	TOK_STRUCT	291
#define	TOK_SWITCH	292
#define	TOK_TRUE	293
#define	TOK_TYPECODE	294
#define	TOK_TYPEDEF	295
#define	TOK_UNION	296
#define	TOK_UNSIGNED	297
#define	TOK_VARARGS	298
#define	TOK_VOID	299
#define	TOK_WCHAR	300
#define	TOK_WSTRING	301
#define	TOK_FLOATP	302
#define	TOK_INTEGER	303
#define	TOK_DECLSPEC	304
#define	TOK_PROP_KEY	305
#define	TOK_PROP_VALUE	306
#define	TOK_NATIVE_TYPE	307
#define	TOK_IDENT	308
#define	TOK_SQSTRING	309
#define	TOK_DQSTRING	310
#define	TOK_FIXEDP	311
#define	TOK_CODEFRAG	312

#line 24 "parser.y"

#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include <errno.h>
#include "rename.h"
#include "util.h"

#define do_binop(rv,op,a,b)		do {		\
	if (IDL_binop_chktypes (op, a, b))		\
		YYABORT;				\
	if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) {	\
		rv = IDL_binop_eval (op, a, b);		\
		IDL_tree_free (a);			\
		IDL_tree_free (b);			\
		if (!rv) YYABORT;			\
	} else {					\
		rv = IDL_binop_new (op, a, b);		\
	}						\
} while (0)

#define do_unaryop(rv,op,a)		do {		\
	if (IDL_unaryop_chktypes (op, a))		\
		YYABORT;				\
	if (!(__IDL_flags & IDLF_NO_EVAL_CONST)) {	\
		rv = IDL_unaryop_eval (op, a);		\
		IDL_tree_free (a);			\
		if (!rv) YYABORT;			\
	} else {					\
		rv = IDL_unaryop_new (op, a);		\
	}						\
} while (0)

#define assign_props(tree,props)	do {		\
	if (__IDL_flags & IDLF_XPIDL)			\
		IDL_NODE_PROPERTIES (tree) = (props);	\
	else						\
		__IDL_free_properties (props);		\
} while (0)

extern int		yylex				(void);
static IDL_declspec_t	IDL_parse_declspec		(const char *strspec);
static int		IDL_binop_chktypes		(enum IDL_binop op,
							 IDL_tree a,
							 IDL_tree b);
static int		IDL_unaryop_chktypes		(enum IDL_unaryop op,
							 IDL_tree a);
static IDL_tree		IDL_binop_eval			(enum IDL_binop op,
							 IDL_tree a,
							 IDL_tree b);
static IDL_tree		IDL_unaryop_eval		(enum IDL_unaryop op,
							 IDL_tree a);
static IDL_tree		list_start			(IDL_tree a,
							 gboolean filter_null);
static IDL_tree		list_chain			(IDL_tree a,
							 IDL_tree b,
							 gboolean filter_null);
static IDL_tree		zlist_chain			(IDL_tree a,
							 IDL_tree b,
							 gboolean filter_null);
static int		do_token_error			(IDL_tree p,
							 const char *message,
							 gboolean prev);

#line 92 "parser.y"
typedef union {
	IDL_tree tree;
	struct {
		IDL_tree tree;
		gpointer data;
	} treedata;
	GHashTable *hash_table;
	char *str;
	gboolean boolean;
	IDL_declspec_t declspec;
	IDL_longlong_t integer;
	double floatp;
	enum IDL_unaryop unaryop;
	enum IDL_param_attr paramattr;
} YYSTYPE;
#include <stdio.h>

#ifndef __cplusplus
#ifndef __STDC__
#define const
#endif
#endif



#define	YYFINAL		381
#define	YYFLAG		-32768
#define	YYNTBASE	79

#define YYTRANSLATE(x) ((unsigned)(x) <= 312 ? yytranslate[x] : 216)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,    73,    68,     2,    63,
    64,    71,    69,    59,    70,     2,    72,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,    62,    58,    75,
    65,    76,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    77,     2,    78,    67,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,    60,    66,    61,    74,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
     6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
    16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
    26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
    36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
    46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
    56,    57
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     1,     3,     4,     6,     8,    11,    13,    14,    16,
    18,    19,    21,    24,    27,    30,    33,    36,    38,    40,
    42,    45,    46,    54,    56,    58,    60,    61,    62,    75,
    81,    82,    85,    87,    91,    93,    94,    97,   100,   103,
   106,   109,   112,   114,   116,   119,   122,   124,   126,   128,
   131,   132,   138,   141,   143,   145,   147,   149,   151,   153,
   155,   157,   158,   166,   167,   179,   181,   183,   185,   187,
   189,   191,   193,   196,   200,   203,   205,   208,   212,   215,
   218,   224,   227,   234,   235,   238,   239,   241,   244,   250,
   252,   254,   256,   258,   260,   261,   263,   264,   266,   269,
   279,   281,   283,   284,   286,   287,   290,   295,   299,   301,
   305,   310,   312,   314,   316,   318,   319,   321,   322,   324,
   329,   334,   336,   338,   340,   342,   344,   346,   348,   350,
   352,   354,   356,   360,   362,   366,   368,   372,   374,   378,
   382,   384,   388,   392,   394,   398,   402,   406,   409,   411,
   413,   415,   417,   419,   421,   425,   427,   429,   431,   433,
   435,   437,   443,   445,   447,   450,   454,   456,   460,   462,
   465,   469,   471,   473,   475,   477,   479,   481,   483,   485,
   487,   489,   491,   493,   495,   502,   507,   509,   511,   514,
   521,   523,   525,   527,   529,   531,   533,   535,   537,   540,
   542,   544,   546,   549,   552,   556,   558,   560,   562,   564,
   566,   568,   570,   575,   577,   582,   584,   586,   590,   592,
   594,   596,   598,   600,   604,   607,   609,   612,   616,   619,
   622,   627,   629,   633,   635,   637,   639,   641,   642,   644,
   646,   648,   650,   652,   656,   658,   659,   661,   662,   663,
   668,   670,   672,   674,   676,   678,   680,   682,   685,   687,
   690,   692
};

static const short yyrhs[] = {    -1,
    81,     0,     0,    81,     0,    86,     0,    81,    86,     0,
    58,     0,     0,    58,     0,    59,     0,     0,   154,     0,
    99,    82,     0,   117,    82,     0,   119,    82,     0,    91,
    82,     0,    88,    82,     0,   212,     0,    85,     0,    83,
     0,   203,    21,     0,     0,    87,   195,    89,    60,    80,
    61,   196,     0,   195,     0,    24,     0,    39,     0,     0,
     0,   203,   204,    19,    90,    92,   196,    94,    93,    60,
    96,    61,   196,     0,   203,   204,    19,    90,   196,     0,
     0,    62,    95,     0,   154,     0,    95,    84,   154,     0,
    97,     0,     0,    97,    98,     0,    99,    82,     0,   119,
    82,     0,   128,    82,     0,   123,    82,     0,   117,    82,
     0,   212,     0,    83,     0,   203,   100,     0,    40,   102,
     0,   106,     0,   108,     0,   153,     0,    22,   185,     0,
     0,    22,   185,    63,   101,    52,     0,   103,   183,     0,
   104,     0,   105,     0,   159,     0,   160,     0,   154,     0,
   106,     0,   108,     0,   153,     0,     0,    36,   194,    60,
   107,   157,    61,   196,     0,     0,    41,   194,    37,    63,
   110,    64,    60,   109,   111,    61,   196,     0,   165,     0,
   174,     0,   176,     0,   153,     0,   154,     0,   112,     0,
   113,     0,   112,   113,     0,   115,   114,    82,     0,   103,
   184,     0,   116,     0,   115,   116,     0,     6,   142,    62,
     0,    10,    62,     0,   203,   118,     0,     8,   141,   193,
    65,   142,     0,   203,   120,     0,    13,   194,    60,   121,
    61,   196,     0,     0,   121,   158,     0,     0,    32,     0,
   203,   124,     0,   204,   122,     4,   125,   187,     0,   159,
     0,   181,     0,   182,     0,   163,     0,   154,     0,     0,
    23,     0,     0,    26,     0,   203,   129,     0,   204,   126,
   127,   130,   194,   133,   196,   137,   138,     0,   125,     0,
    44,     0,     0,    43,     0,     0,    59,    43,     0,    63,
   134,   132,    64,     0,    63,   131,    64,     0,   135,     0,
   134,    84,   135,     0,   204,   136,   125,   185,     0,    17,
     0,    30,     0,    18,     0,   125,     0,     0,   139,     0,
     0,   140,     0,    31,    63,    95,    64,     0,     9,    63,
   201,    64,     0,   165,     0,   174,     0,   175,     0,   176,
     0,   162,     0,   181,     0,   182,     0,   164,     0,   154,
     0,   143,     0,   144,     0,   143,    66,   144,     0,   145,
     0,   144,    67,   145,     0,   146,     0,   145,    68,   146,
     0,   147,     0,   146,    29,   147,     0,   146,    28,   147,
     0,   148,     0,   147,    69,   148,     0,   147,    70,   148,
     0,   149,     0,   148,    71,   149,     0,   148,    72,   149,
     0,   148,    73,   149,     0,   150,   151,     0,   151,     0,
    70,     0,    69,     0,    74,     0,   154,     0,   152,     0,
    63,   142,    64,     0,   206,     0,   207,     0,   208,     0,
   209,     0,   210,     0,   211,     0,    12,   193,    60,   156,
    61,     0,   155,     0,   198,     0,    27,   200,     0,   155,
    27,   192,     0,   193,     0,   156,    84,   193,     0,   158,
     0,   157,   158,     0,   103,   183,    82,     0,   162,     0,
   165,     0,   174,     0,   175,     0,   176,     0,   177,     0,
   178,     0,   179,     0,   180,     0,   161,     0,   181,     0,
   182,     0,   163,     0,    33,    75,   104,    59,   202,    76,
     0,    33,    75,   104,    76,     0,    16,     0,    11,     0,
    20,    11,     0,    15,    75,   202,    59,   206,    76,     0,
    15,     0,   166,     0,   170,     0,   167,     0,   168,     0,
   169,     0,    34,     0,    20,     0,    20,    20,     0,   171,
     0,   172,     0,   173,     0,    42,    34,     0,    42,    20,
     0,    42,    20,    20,     0,     7,     0,    45,     0,     5,
     0,    25,     0,     3,     0,    24,     0,    39,     0,    35,
    75,   202,    76,     0,    35,     0,    46,    75,   202,    76,
     0,    46,     0,   184,     0,   183,    84,   184,     0,   185,
     0,   186,     0,   193,     0,   188,     0,   185,     0,   187,
    84,   185,     0,   193,   189,     0,   190,     0,   189,   190,
     0,    77,   202,    78,     0,    77,    78,     0,    50,    51,
     0,   191,    59,    50,    51,     0,    50,     0,   191,    59,
    50,     0,    53,     0,   197,     0,   197,     0,   199,     0,
     0,   192,     0,   192,     0,   192,     0,   192,     0,   207,
     0,   201,    84,   207,     0,   142,     0,     0,    49,     0,
     0,     0,    77,   205,   191,    78,     0,    48,     0,   213,
     0,   215,     0,    56,     0,    47,     0,    38,     0,    14,
     0,   203,    57,     0,   214,     0,   213,   214,     0,    55,
     0,    54,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   279,   280,   283,   284,   287,   288,   291,   292,   298,   304,
   305,   311,   320,   321,   322,   323,   324,   325,   326,   327,
   330,   333,   342,   374,   375,   379,   385,   411,   417,   425,
   440,   441,   487,   488,   492,   495,   496,   499,   500,   501,
   502,   503,   504,   505,   508,   516,   517,   518,   519,   520,
   521,   530,   539,   542,   543,   546,   547,   548,   551,   552,
   553,   556,   560,   568,   574,   582,   583,   584,   585,   586,
   589,   592,   593,   596,   600,   614,   615,   618,   619,   622,
   630,   637,   645,   650,   651,   654,   655,   658,   666,   686,
   687,   688,   689,   690,   693,   694,   697,   698,   701,   709,
   723,   724,   727,   728,   731,   732,   735,   742,   748,   749,
   753,   762,   763,   764,   765,   771,   772,   775,   776,   779,
   784,   789,   790,   791,   792,   793,   794,   795,   796,   797,
   800,   803,   804,   807,   808,   811,   812,   815,   816,   817,
   820,   821,   822,   825,   826,   827,   828,   831,   832,   835,
   836,   837,   840,   854,   855,   858,   859,   860,   861,   862,
   863,   866,   871,   879,   880,   881,   908,   909,   913,   914,
   917,   932,   933,   934,   935,   936,   937,   938,   939,   940,
   943,   944,   945,   946,   949,   952,   957,   958,   959,   962,
   967,   970,   971,   974,   975,   976,   979,   982,   985,   988,
   989,   990,   993,   996,   999,  1002,  1005,  1008,  1011,  1014,
  1017,  1020,  1023,  1026,  1029,  1032,  1035,  1036,  1040,  1041,
  1044,  1047,  1050,  1051,  1055,  1070,  1071,  1075,  1076,  1079,
  1084,  1090,  1094,  1101,  1104,  1112,  1124,  1140,  1150,  1186,
  1202,  1225,  1242,  1243,  1247,  1284,  1285,  1291,  1292,  1301,
  1309,  1312,  1315,  1318,  1321,  1324,  1325,  1328,  1336,  1337,
  1345,  1352
};
#endif


#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)

static const char * const yytname[] = {   "$","error","$undefined.","TOK_ANY",
"TOK_ATTRIBUTE","TOK_BOOLEAN","TOK_CASE","TOK_CHAR","TOK_CONST","TOK_CONTEXT",
"TOK_DEFAULT","TOK_DOUBLE","TOK_ENUM","TOK_EXCEPTION","TOK_FALSE","TOK_FIXED",
"TOK_FLOAT","TOK_IN","TOK_INOUT","TOK_INTERFACE","TOK_LONG","TOK_MODULE","TOK_NATIVE",
"TOK_NOSCRIPT","TOK_OBJECT","TOK_OCTET","TOK_ONEWAY","TOK_OP_SCOPE","TOK_OP_SHL",
"TOK_OP_SHR","TOK_OUT","TOK_RAISES","TOK_READONLY","TOK_SEQUENCE","TOK_SHORT",
"TOK_STRING","TOK_STRUCT","TOK_SWITCH","TOK_TRUE","TOK_TYPECODE","TOK_TYPEDEF",
"TOK_UNION","TOK_UNSIGNED","TOK_VARARGS","TOK_VOID","TOK_WCHAR","TOK_WSTRING",
"TOK_FLOATP","TOK_INTEGER","TOK_DECLSPEC","TOK_PROP_KEY","TOK_PROP_VALUE","TOK_NATIVE_TYPE",
"TOK_IDENT","TOK_SQSTRING","TOK_DQSTRING","TOK_FIXEDP","TOK_CODEFRAG","';'",
"','","'{'","'}'","':'","'('","')'","'='","'|'","'^'","'&'","'+'","'-'","'*'",
"'/'","'%'","'~'","'<'","'>'","'['","']'","specification","z_definition_list",
"definition_list","check_semicolon","useless_semicolon","check_comma","illegal_ident",
"definition","module_declspec","module","@1","interface_catch_ident","interface",
"@2","@3","z_inheritance","scoped_name_list","interface_body","export_list",
"export","type_dcl","type_dcl_def","@4","type_declarator","type_spec","simple_type_spec",
"constr_type_spec","struct_type","@5","union_type","@6","switch_type_spec","switch_body",
"case_stmt_list","case_stmt","element_spec","case_label_list","case_label","const_dcl",
"const_dcl_def","except_dcl","except_dcl_def","member_zlist","is_readonly","attr_dcl",
"attr_dcl_def","param_type_spec","is_noscript","is_oneway","op_dcl","op_dcl_def",
"op_type_spec","is_varargs","is_cvarargs","parameter_dcls","param_dcl_list",
"param_dcl","param_attribute","is_raises_expr","is_context_expr","raises_expr",
"context_expr","const_type","const_exp","or_expr","xor_expr","and_expr","shift_expr",
"add_expr","mult_expr","unary_expr","unary_op","primary_expr","literal","enum_type",
"scoped_name","ns_scoped_name","enumerator_list","member_list","member","base_type_spec",
"template_type_spec","sequence_type","floating_pt_type","fixed_pt_type","fixed_pt_const_type",
"integer_type","signed_int","signed_short_int","signed_long_int","signed_longlong_int",
"unsigned_int","unsigned_short_int","unsigned_long_int","unsigned_longlong_int",
"char_type","wide_char_type","boolean_type","octet_type","any_type","object_type",
"typecode_type","string_type","wide_string_type","declarator_list","declarator",
"simple_declarator","complex_declarator","simple_declarator_list","array_declarator",
"fixed_array_size_list","fixed_array_size","prop_hash","ident","new_ident","new_scope",
"new_or_prev_scope","pop_scope","ns_new_ident","ns_prev_ident","cur_ns_new_or_prev_ident",
"ns_global_ident","string_lit_list","positive_int_const","z_declspec","z_props",
"@7","integer_lit","string_lit","char_lit","fixed_pt_lit","floating_pt_lit",
"boolean_lit","codefrag","dqstring_cat","dqstring","sqstring", NULL
};
#endif

static const short yyr1[] = {     0,
    79,    79,    80,    80,    81,    81,    82,    82,    83,    84,
    84,    85,    86,    86,    86,    86,    86,    86,    86,    86,
    87,    89,    88,    90,    90,    90,    92,    93,    91,    91,
    94,    94,    95,    95,    96,    97,    97,    98,    98,    98,
    98,    98,    98,    98,    99,   100,   100,   100,   100,   100,
   101,   100,   102,   103,   103,   104,   104,   104,   105,   105,
   105,   107,   106,   109,   108,   110,   110,   110,   110,   110,
   111,   112,   112,   113,   114,   115,   115,   116,   116,   117,
   118,   119,   120,   121,   121,   122,   122,   123,   124,   125,
   125,   125,   125,   125,   126,   126,   127,   127,   128,   129,
   130,   130,   131,   131,   132,   132,   133,   133,   134,   134,
   135,   136,   136,   136,   136,   137,   137,   138,   138,   139,
   140,   141,   141,   141,   141,   141,   141,   141,   141,   141,
   142,   143,   143,   144,   144,   145,   145,   146,   146,   146,
   147,   147,   147,   148,   148,   148,   148,   149,   149,   150,
   150,   150,   151,   151,   151,   152,   152,   152,   152,   152,
   152,   153,   154,   155,   155,   155,   156,   156,   157,   157,
   158,   159,   159,   159,   159,   159,   159,   159,   159,   159,
   160,   160,   160,   160,   161,   161,   162,   162,   162,   163,
   164,   165,   165,   166,   166,   166,   167,   168,   169,   170,
   170,   170,   171,   172,   173,   174,   175,   176,   177,   178,
   179,   180,   181,   181,   182,   182,   183,   183,   184,   184,
   185,   186,   187,   187,   188,   189,   189,   190,   190,   191,
   191,   191,   191,   192,   193,   194,   195,   196,   197,   198,
   199,   200,   201,   201,   202,   203,   203,   204,   205,   204,
   206,   207,   208,   209,   210,   211,   211,   212,   213,   213,
   214,   215
};

static const short yyr2[] = {     0,
     0,     1,     0,     1,     1,     2,     1,     0,     1,     1,
     0,     1,     2,     2,     2,     2,     2,     1,     1,     1,
     2,     0,     7,     1,     1,     1,     0,     0,    12,     5,
     0,     2,     1,     3,     1,     0,     2,     2,     2,     2,
     2,     2,     1,     1,     2,     2,     1,     1,     1,     2,
     0,     5,     2,     1,     1,     1,     1,     1,     1,     1,
     1,     0,     7,     0,    11,     1,     1,     1,     1,     1,
     1,     1,     2,     3,     2,     1,     2,     3,     2,     2,
     5,     2,     6,     0,     2,     0,     1,     2,     5,     1,
     1,     1,     1,     1,     0,     1,     0,     1,     2,     9,
     1,     1,     0,     1,     0,     2,     4,     3,     1,     3,
     4,     1,     1,     1,     1,     0,     1,     0,     1,     4,
     4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     1,     3,     1,     3,     1,     3,     1,     3,     3,
     1,     3,     3,     1,     3,     3,     3,     2,     1,     1,
     1,     1,     1,     1,     3,     1,     1,     1,     1,     1,
     1,     5,     1,     1,     2,     3,     1,     3,     1,     2,
     3,     1,     1,     1,     1,     1,     1,     1,     1,     1,
     1,     1,     1,     1,     6,     4,     1,     1,     2,     6,
     1,     1,     1,     1,     1,     1,     1,     1,     2,     1,
     1,     1,     2,     2,     3,     1,     1,     1,     1,     1,
     1,     1,     4,     1,     4,     1,     1,     3,     1,     1,
     1,     1,     1,     3,     2,     1,     2,     3,     2,     2,
     4,     1,     3,     1,     1,     1,     1,     0,     1,     1,
     1,     1,     1,     3,     1,     0,     1,     0,     0,     4,
     1,     1,     1,     1,     1,     1,     1,     2,     1,     2,
     1,     1
};

static const short yydefact[] = {   246,
     0,   247,   234,     9,   246,    20,    19,     5,     0,     8,
     8,     8,     8,     8,    12,   163,   240,   164,   248,    18,
   242,   165,     6,   241,    22,   237,     7,    17,    16,    13,
    14,    15,     0,     0,     0,     0,    21,     0,     0,     0,
     0,   258,   249,    45,    47,    48,    80,    82,    49,     0,
     0,   166,   208,   206,   188,   191,   187,   198,   197,   214,
     0,   207,   216,     0,   130,   126,   129,   122,   192,   194,
   195,   196,   193,   200,   201,   202,   123,   124,   125,   127,
   128,   239,     0,   235,     0,   236,    50,   221,     0,   210,
     0,   211,   209,     0,   212,    46,     0,    54,    55,    59,
    60,    61,    58,    56,    57,   181,   172,   184,   173,   174,
   175,   176,   177,   178,   179,   180,   182,   183,     0,     0,
     0,   246,   189,   199,     0,   204,   203,     0,     0,     0,
    84,    51,    62,     0,     0,    53,   217,   219,   220,   222,
   221,     0,   232,     0,    25,    26,   238,    24,     0,   246,
   257,   256,   255,   251,   262,   261,   254,     0,   151,   150,
   152,   245,   131,   132,   134,   136,   138,   141,   144,     0,
   149,   154,   153,     0,   156,   157,   158,   159,   160,   161,
   252,   259,   253,   205,     0,     0,    11,   167,     0,     0,
     0,     0,     0,    10,     0,     0,   225,   226,     0,   230,
     0,   250,   238,    30,   238,     0,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,   148,   213,   260,   215,
    81,   162,     0,   238,     0,    85,    52,     0,   169,     0,
     0,   186,   218,   229,     0,   227,   198,     0,    69,    70,
    66,    67,    68,   233,    31,    23,   155,   133,   135,   137,
   140,   139,   142,   143,   145,   146,   147,   168,    83,     8,
   238,   170,     0,     0,   228,     0,   231,     0,    28,   171,
    63,   190,   185,    64,    11,    33,     0,     0,     0,    36,
     0,     0,     0,    71,    72,     0,    76,    34,     0,   246,
     0,    79,   238,    73,     0,     8,    77,   238,    44,    37,
     8,     8,     8,     8,     8,   248,    43,    78,    65,    75,
    74,    29,    38,    42,    39,    41,    40,    88,    99,    95,
    96,    87,     0,    97,     0,    98,     0,     0,    94,    90,
    93,    91,    92,   102,   101,     0,   223,    89,     0,     0,
   248,   238,   224,   104,     0,    11,   109,     0,   116,   108,
    10,   248,     0,   112,   114,   113,   115,     0,     0,   118,
   117,   106,   110,   107,     0,     0,     0,   100,   119,   111,
    11,     0,   120,    11,   243,   121,     0,   244,     0,     0,
     0
};

static const short yydefgoto[] = {   379,
   149,     5,    28,     6,   195,     7,     8,     9,    10,    51,
   147,    11,   203,   277,   269,   275,   289,   290,   300,    12,
    44,   190,    96,   225,    98,    99,   100,   191,   101,   278,
   238,   283,   284,   285,   296,   286,   287,    13,    47,    14,
    48,   189,   323,   304,   318,   328,   324,   327,   305,   319,
   336,   345,   353,   342,   346,   347,   358,   360,   368,   361,
   369,    64,   162,   163,   164,   165,   166,   167,   168,   169,
   170,   171,   172,   102,   173,    16,   187,   228,   226,   104,
   105,   106,   107,   108,    67,   109,    69,    70,    71,    72,
    73,    74,    75,    76,   110,   111,   112,   113,   114,   115,
   116,   117,   118,   136,   137,   138,   139,   338,   140,   197,
   198,   144,    17,    88,    85,    25,   204,    84,    18,    26,
    22,   374,   174,    19,   348,   120,   175,   176,   177,   178,
   179,   180,    20,   181,   182,   183
};

static const short yypact[] = {    58,
    42,-32768,-32768,-32768,   106,-32768,-32768,-32768,    42,   -12,
   -12,   -12,   -12,   -12,-32768,    82,-32768,-32768,    40,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,    42,   625,    42,    42,-32768,    42,    42,   472,
    42,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    93,
    71,-32768,-32768,-32768,-32768,-32768,-32768,    63,-32768,    48,
    55,-32768,    66,    42,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,    92,-32768,   119,-32768,    95,-32768,   124,-32768,
    97,-32768,-32768,   118,-32768,-32768,    42,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   165,   154,
    33,   113,-32768,-32768,    91,   185,-32768,    91,   146,    42,
-32768,-32768,-32768,    91,   232,    73,-32768,-32768,-32768,-32768,
   144,   160,   179,   -23,-32768,-32768,    36,-32768,   175,   193,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,    91,-32768,-32768,
-32768,-32768,   172,   177,   187,    50,   112,   105,-32768,   159,
-32768,-32768,-32768,   182,-32768,-32768,-32768,-32768,-32768,-32768,
   198,-32768,-32768,-32768,   188,    91,   109,-32768,   340,   211,
   472,   210,     1,-32768,    42,   171,   144,-32768,   646,-32768,
   222,-32768,-32768,-32768,-32768,   209,    91,    91,    91,    91,
    91,    91,    91,    91,    91,    91,-32768,-32768,-32768,-32768,
-32768,-32768,    42,-32768,    42,-32768,-32768,   384,-32768,   227,
    91,-32768,-32768,-32768,   203,-32768,   256,   218,-32768,-32768,
-32768,-32768,-32768,   233,   221,-32768,-32768,   177,   187,    50,
   112,   112,   105,   105,-32768,-32768,-32768,-32768,-32768,   129,
-32768,-32768,   212,   213,-32768,   234,-32768,    41,-32768,-32768,
-32768,-32768,-32768,-32768,   136,-32768,   236,   147,    41,-32768,
    91,   225,   231,   147,-32768,   428,-32768,-32768,   241,    52,
   245,-32768,-32768,-32768,    42,   -12,-32768,-32768,-32768,-32768,
   -12,   -12,   -12,   -12,   -12,    51,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    98,
-32768,-32768,   304,   284,   604,-32768,   560,    42,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,    42,-32768,    73,   254,    42,
     7,-32768,-32768,-32768,   255,   -21,-32768,   516,   287,-32768,
   278,   246,   258,-32768,-32768,-32768,-32768,   604,   261,   320,
-32768,-32768,-32768,-32768,    42,    41,   268,-32768,-32768,-32768,
    78,   198,-32768,    84,-32768,-32768,   198,-32768,   332,   333,
-32768
};

static const short yypgoto[] = {-32768,
-32768,   214,    10,    45,  -171,-32768,    13,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,   -29,-32768,-32768,-32768,    49,
-32768,-32768,-32768,   -36,   205,-32768,    -8,-32768,    -6,-32768,
-32768,-32768,-32768,    54,-32768,-32768,    64,    59,-32768,    67,
-32768,-32768,-32768,-32768,-32768,  -234,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,   -11,-32768,-32768,-32768,-32768,
-32768,-32768,  -132,-32768,   137,   145,   150,    22,     4,    46,
-32768,   184,-32768,   -16,     0,-32768,-32768,-32768,  -163,  -292,
-32768,-32768,   327,  -258,-32768,    -9,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,    -7,   328,    -5,-32768,-32768,-32768,
-32768,   -32,   -28,   138,  -176,   -37,-32768,-32768,-32768,-32768,
   173,-32768,     6,   -15,   -31,   247,  -173,   -27,-32768,-32768,
-32768,-32768,   -97,    79,    -2,-32768,   142,  -221,-32768,-32768,
-32768,-32768,    87,-32768,   197,-32768
};


#define	YYLAST		699


static const short yytable[] = {    15,
    87,    80,    49,    97,    15,    81,    21,    89,    86,   119,
    45,    86,    46,    86,    24,   223,    50,    23,   233,    83,
    29,    30,    31,    32,    68,   206,    77,   229,    79,   245,
   185,   246,   330,    65,   330,   201,   192,   351,    52,   103,
    82,    82,  -105,    82,    82,    27,    82,    34,   129,   344,
   259,    35,    36,   221,   202,   330,   145,    -1,    34,   231,
    37,    38,    35,    36,   262,   330,   331,     1,   331,    82,
  -103,   146,    38,   123,   126,    39,   232,   210,   211,    40,
    41,   141,   124,    43,     1,     3,    39,   271,   127,   331,
    40,    41,   335,     3,     3,   -27,    42,   -27,   235,   331,
     2,   -86,    82,   279,   151,    -2,     2,    42,    33,     4,
     3,   121,   -35,   357,   188,     4,    43,     1,   310,   309,
   321,    15,   125,   365,   312,   -11,    24,    43,   152,   322,
   122,   194,     1,   264,   103,    82,   194,   153,   154,     1,
   128,   373,   194,     3,   155,   156,   157,   376,   291,    15,
   375,   130,   281,   158,     2,   378,   282,   132,     3,   159,
   160,     2,    23,     4,   161,     3,   340,   194,   349,   222,
     4,   134,   151,    -3,   352,   214,   215,   216,   131,   141,
   212,   213,   239,   133,   151,     1,    27,   194,   103,   241,
   103,   242,   135,   243,   194,   -32,   152,     1,   240,   279,
    82,   142,   377,   143,   184,   153,   154,   258,   152,   141,
   186,     3,   155,   156,   157,   253,   254,   153,   154,     1,
   196,   158,   199,     3,   155,   156,   157,   103,    82,   200,
    82,   251,   252,   158,    90,   205,    53,   207,    54,   159,
   160,     2,    55,   208,   161,     3,    91,    57,   234,   295,
     4,    58,   156,    -4,   209,    92,    93,   218,     1,   255,
   256,   257,   227,   220,    94,    59,    60,   276,   230,   270,
    95,   244,   247,    61,   154,   124,    62,    63,   288,   141,
   265,   266,   268,   267,     3,   103,   292,   272,   273,    49,
   337,   293,   332,   274,   332,   280,   333,    45,   333,    46,
    82,   298,   343,   320,   339,   311,   308,   325,    86,   326,
   313,   314,   315,   316,   317,   332,   341,   359,   350,   333,
   362,   364,    43,   366,   329,   332,   329,   370,   367,   333,
   372,   380,   381,    82,   299,   150,   371,   294,   301,   193,
   363,    82,    90,   248,    53,    82,    54,   329,   302,   297,
    55,    35,   249,   217,    91,    57,   303,   329,   250,    58,
    66,    78,   260,    92,    93,   276,     1,   148,   306,   236,
    82,   263,    94,    59,    60,    39,   307,   219,    95,     0,
    41,    61,     0,     0,    62,    63,    90,     0,    53,     0,
    54,     0,     3,     0,    55,    35,     0,     0,    91,    57,
   224,     0,     0,    58,     0,     0,     0,    92,    93,     0,
     1,     0,     0,     0,     0,     0,    94,    59,    60,    39,
     0,     0,    95,     0,    41,    61,     0,     0,    62,    63,
    90,     0,    53,   281,    54,     0,     3,   282,    55,    35,
     0,     0,    91,    57,   261,     0,     0,    58,     0,     0,
     0,    92,    93,     0,     1,     0,     0,     0,     0,     0,
    94,    59,    60,    39,     0,     0,    95,     0,    41,    61,
     0,     0,    62,    63,    90,     0,    53,     0,    54,     0,
     3,     0,    55,    35,     0,     0,    91,    57,     0,     0,
     0,    58,     0,     0,     0,    92,    93,     0,     1,     0,
     0,     0,     0,     0,    94,    59,    60,    39,     0,     0,
    95,     0,    41,    61,     0,     0,    62,    63,    90,     0,
    53,     0,    54,     0,     3,     0,    55,     0,     0,     0,
    91,    57,   354,   355,     0,    58,     0,     0,     0,    92,
    93,     0,     1,     0,     0,   356,     0,     0,     0,    59,
    60,     0,     0,     0,    95,     0,     0,    61,     0,     0,
    62,    63,    90,     0,    53,     0,    54,     0,     3,     0,
    55,     0,     0,     0,    91,    57,     0,     0,     0,    58,
     0,     0,     0,    92,    93,     0,     1,     0,     0,     0,
     0,     0,     0,    59,    60,     0,     0,     0,    95,     0,
     0,    61,     0,   334,    62,    63,    90,     0,    53,     0,
    54,     0,     3,     0,    55,     0,     0,     0,    91,    57,
     0,     0,     0,    58,     0,     0,     0,    92,    93,    53,
     1,    54,     0,     0,     0,    55,     0,    59,    60,    56,
    57,     0,    95,     0,    58,    61,     0,     0,    62,    63,
    53,     1,    54,     0,     0,     0,     3,    35,    59,    60,
     0,     0,     0,     0,     0,   237,    61,     0,     0,    62,
    63,     0,     1,     0,     0,     0,     0,     3,     0,    59,
     0,     0,     0,     0,     0,     0,     0,    61,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,     3
};

static const short yycheck[] = {     0,
    38,    34,    19,    40,     5,    34,     1,    39,    36,    41,
    19,    39,    19,    41,     9,   187,    19,     5,   195,    35,
    11,    12,    13,    14,    34,   158,    34,   191,    34,   203,
   128,   205,   325,    34,   327,    59,   134,    59,    33,    40,
    35,    36,    64,    38,    39,    58,    41,     8,    64,    43,
   224,    12,    13,   186,    78,   348,    24,     0,     8,    59,
    21,    22,    12,    13,   228,   358,   325,    27,   327,    64,
    64,    39,    22,    11,    20,    36,    76,    28,    29,    40,
    41,    97,    20,    77,    27,    53,    36,   261,    34,   348,
    40,    41,   327,    53,    53,    60,    57,    62,   196,   358,
    49,     4,    97,   275,    14,     0,    49,    57,    27,    58,
    53,    19,    61,   348,   130,    58,    77,    27,   295,   293,
    23,   122,    75,   358,   298,    53,   121,    77,    38,    32,
    60,    59,    27,   231,   135,   130,    59,    47,    48,    27,
    75,    64,    59,    53,    54,    55,    56,    64,   281,   150,
   372,    60,     6,    63,    49,   377,    10,    63,    53,    69,
    70,    49,   150,    58,    74,    53,   338,    59,   342,    61,
    58,    75,    14,    61,   346,    71,    72,    73,    60,   195,
    69,    70,   199,    60,    14,    27,    58,    59,   189,   199,
   191,   199,    75,   199,    59,    60,    38,    27,   199,   371,
   195,    37,   374,    50,    20,    47,    48,   223,    38,   225,
    65,    53,    54,    55,    56,   212,   213,    47,    48,    27,
    77,    63,    63,    53,    54,    55,    56,   228,   223,    51,
   225,   210,   211,    63,     3,    61,     5,    66,     7,    69,
    70,    49,    11,    67,    74,    53,    15,    16,    78,   286,
    58,    20,    55,    61,    68,    24,    25,    76,    27,   214,
   215,   216,    52,    76,    33,    34,    35,   268,    59,   260,
    39,    50,    64,    42,    48,    20,    45,    46,   279,   295,
    78,    64,    62,    51,    53,   286,    62,    76,    76,   306,
   328,    61,   325,    60,   327,    60,   325,   306,   327,   306,
   295,    61,   340,   306,   336,   296,    62,     4,   336,    26,
   301,   302,   303,   304,   305,   348,    63,    31,    64,   348,
    43,    64,    77,    63,   325,   358,   327,   365,     9,   358,
    63,     0,     0,   328,   290,   122,   366,   284,   290,   135,
   352,   336,     3,   207,     5,   340,     7,   348,   290,   286,
    11,    12,   208,   170,    15,    16,   290,   358,   209,    20,
    34,    34,   225,    24,    25,   366,    27,   121,   290,   197,
   365,   230,    33,    34,    35,    36,   290,   181,    39,    -1,
    41,    42,    -1,    -1,    45,    46,     3,    -1,     5,    -1,
     7,    -1,    53,    -1,    11,    12,    -1,    -1,    15,    16,
    61,    -1,    -1,    20,    -1,    -1,    -1,    24,    25,    -1,
    27,    -1,    -1,    -1,    -1,    -1,    33,    34,    35,    36,
    -1,    -1,    39,    -1,    41,    42,    -1,    -1,    45,    46,
     3,    -1,     5,     6,     7,    -1,    53,    10,    11,    12,
    -1,    -1,    15,    16,    61,    -1,    -1,    20,    -1,    -1,
    -1,    24,    25,    -1,    27,    -1,    -1,    -1,    -1,    -1,
    33,    34,    35,    36,    -1,    -1,    39,    -1,    41,    42,
    -1,    -1,    45,    46,     3,    -1,     5,    -1,     7,    -1,
    53,    -1,    11,    12,    -1,    -1,    15,    16,    -1,    -1,
    -1,    20,    -1,    -1,    -1,    24,    25,    -1,    27,    -1,
    -1,    -1,    -1,    -1,    33,    34,    35,    36,    -1,    -1,
    39,    -1,    41,    42,    -1,    -1,    45,    46,     3,    -1,
     5,    -1,     7,    -1,    53,    -1,    11,    -1,    -1,    -1,
    15,    16,    17,    18,    -1,    20,    -1,    -1,    -1,    24,
    25,    -1,    27,    -1,    -1,    30,    -1,    -1,    -1,    34,
    35,    -1,    -1,    -1,    39,    -1,    -1,    42,    -1,    -1,
    45,    46,     3,    -1,     5,    -1,     7,    -1,    53,    -1,
    11,    -1,    -1,    -1,    15,    16,    -1,    -1,    -1,    20,
    -1,    -1,    -1,    24,    25,    -1,    27,    -1,    -1,    -1,
    -1,    -1,    -1,    34,    35,    -1,    -1,    -1,    39,    -1,
    -1,    42,    -1,    44,    45,    46,     3,    -1,     5,    -1,
     7,    -1,    53,    -1,    11,    -1,    -1,    -1,    15,    16,
    -1,    -1,    -1,    20,    -1,    -1,    -1,    24,    25,     5,
    27,     7,    -1,    -1,    -1,    11,    -1,    34,    35,    15,
    16,    -1,    39,    -1,    20,    42,    -1,    -1,    45,    46,
     5,    27,     7,    -1,    -1,    -1,    53,    12,    34,    35,
    -1,    -1,    -1,    -1,    -1,    20,    42,    -1,    -1,    45,
    46,    -1,    27,    -1,    -1,    -1,    -1,    53,    -1,    34,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    42,    -1,    -1,
    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    53
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/local/share/bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */

/* As a special exception, when this file is copied by Bison into a
   Bison output file, you may use that output file without restriction.
   This special exception was added by the Free Software Foundation
   in version 1.24 of Bison.  */

#ifndef alloca
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* not GNU C.  */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
#include <alloca.h>
#else /* not sparc */
#if defined (MSDOS) && !defined (__TURBOC__)
#include <malloc.h>
#else /* not MSDOS, or __TURBOC__ */
#if defined(_AIX)
#include <malloc.h>
 #pragma alloca
#else /* not MSDOS, __TURBOC__, or _AIX */
#ifdef __hpux
#ifdef __cplusplus
extern "C" {
void *alloca (unsigned int);
};
#else /* not __cplusplus */
void *alloca ();
#endif /* not __cplusplus */
#endif /* __hpux */
#endif /* not _AIX */
#endif /* not MSDOS, or __TURBOC__ */
#endif /* not sparc.  */
#endif /* not GNU C.  */
#endif /* alloca not defined.  */

/* This is the parser code that is written into each bison parser
  when the %semantic_parser declaration is not specified in the grammar.
  It was written by Richard Stallman by simplifying the hairy parser
  used when %semantic_parser is specified.  */

/* Note: there must be only one dollar sign in this file.
   It is replaced by the list of actions, each action
   as one case of the switch.  */

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		-2
#define YYEOF		0
#define YYACCEPT	return(0)
#define YYABORT 	return(1)
#define YYERROR		goto yyerrlab1
/* Like YYERROR except do call yyerror.
   This remains here temporarily to ease the
   transition to the new meaning of YYERROR, for GCC.
   Once GCC version 2 has supplanted version 1, this can go.  */
#define YYFAIL		goto yyerrlab
#define YYRECOVERING()  (!!yyerrstatus)
#define YYBACKUP(token, value) \
do								\
  if (yychar == YYEMPTY && yylen == 1)				\
    { yychar = (token), yylval = (value);			\
      yychar1 = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { yyerror ("syntax error: cannot back up"); YYERROR; }	\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, &yylloc, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval, &yylloc)
#endif
#else /* not YYLSP_NEEDED */
#ifdef YYLEX_PARAM
#define YYLEX		yylex(&yylval, YYLEX_PARAM)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif /* not YYLSP_NEEDED */
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

int	yychar;			/*  the lookahead symbol		*/
YYSTYPE	yylval;			/*  the semantic value of the		*/
				/*  lookahead symbol			*/

#ifdef YYLSP_NEEDED
YYLTYPE yylloc;			/*  location data for the lookahead	*/
				/*  symbol				*/
#endif

int yynerrs;			/*  number of parse errors so far       */
#endif  /* not YYPURE */

#if YYDEBUG != 0
int yydebug;			/*  nonzero means print parse trace	*/
/* Since this is uninitialized, it does not stop multiple parsers
   from coexisting.  */
#endif

/*  YYINITDEPTH indicates the initial size of the parser's stacks	*/

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

/*  YYMAXDEPTH is the maximum size the stacks can grow to
    (effective only if the built-in stack extension method is used).  */

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

/* Prevent warning if -Wstrict-prototypes.  */
#ifdef __GNUC__
int yyparse (void);
#endif

#if __GNUC__ > 1		/* GNU C and GNU C++ define this.  */
#define __yy_memcpy(TO,FROM,COUNT)	__builtin_memcpy(TO,FROM,COUNT)
#else				/* not GNU C or C++ */
#ifndef __cplusplus

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (to, from, count)
     char *to;
     char *from;
     int count;
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#else /* __cplusplus */

/* This is the most reliable way to avoid incompatibilities
   in available built-in functions on various systems.  */
static void
__yy_memcpy (char *to, char *from, int count)
{
  register char *f = from;
  register char *t = to;
  register int i = count;

  while (i-- > 0)
    *t++ = *f++;
}

#endif
#endif

#line 196 "/usr/local/share/bison.simple"

/* The user can define YYPARSE_PARAM as the name of an argument to be passed
   into yyparse.  The argument should have type void *.
   It should actually point to an object.
   Grammar actions can access the variable by casting it
   to the proper pointer type.  */

#ifdef YYPARSE_PARAM
#ifdef __cplusplus
#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
#define YYPARSE_PARAM_DECL
#else /* not __cplusplus */
#define YYPARSE_PARAM_ARG YYPARSE_PARAM
#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
#endif /* not __cplusplus */
#else /* not YYPARSE_PARAM */
#define YYPARSE_PARAM_ARG
#define YYPARSE_PARAM_DECL
#endif /* not YYPARSE_PARAM */

int
yyparse(YYPARSE_PARAM_ARG)
     YYPARSE_PARAM_DECL
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

  short	yyssa[YYINITDEPTH];	/*  the state stack			*/
  YYSTYPE yyvsa[YYINITDEPTH];	/*  the semantic value stack		*/

  short *yyss = yyssa;		/*  refer to the stacks thru separate pointers */
  YYSTYPE *yyvs = yyvsa;	/*  to allow yyoverflow to reallocate them elsewhere */

#ifdef YYLSP_NEEDED
  YYLTYPE yylsa[YYINITDEPTH];	/*  the location stack			*/
  YYLTYPE *yyls = yylsa;
  YYLTYPE *yylsp;

#define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
#else
#define YYPOPSTACK   (yyvsp--, yyssp--)
#endif

  int yystacksize = YYINITDEPTH;

#ifdef YYPURE
  int yychar;
  YYSTYPE yylval;
  int yynerrs;
#ifdef YYLSP_NEEDED
  YYLTYPE yylloc;
#endif
#endif

  YYSTYPE yyval;		/*  the variable used to return		*/
				/*  semantic values from the action	*/
				/*  routines				*/

  int yylen;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Starting parse\n");
#endif

  yystate = 0;
  yyerrstatus = 0;
  yynerrs = 0;
  yychar = YYEMPTY;		/* Cause a token to be read.  */

  /* Initialize stack pointers.
     Waste one element of value and location stack
     so that they stay on the same level as the state stack.
     The wasted elements are never initialized.  */

  yyssp = yyss - 1;
  yyvsp = yyvs;
#ifdef YYLSP_NEEDED
  yylsp = yyls;
#endif

/* Push a new state, which is found in  yystate  .  */
/* In all cases, when you get here, the value and location stacks
   have just been pushed. so pushing a state here evens the stacks.  */
yynewstate:

  *++yyssp = yystate;

  if (yyssp >= yyss + yystacksize - 1)
    {
      /* Give user a chance to reallocate the stack */
      /* Use copies of these so that the &'s don't force the real ones into memory. */
      YYSTYPE *yyvs1 = yyvs;
      short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
      YYLTYPE *yyls1 = yyls;
#endif

      /* Get the current used size of the three stacks, in elements.  */
      int size = yyssp - yyss + 1;

#ifdef yyoverflow
      /* Each stack pointer address is followed by the size of
	 the data in use in that stack, in bytes.  */
#ifdef YYLSP_NEEDED
      /* This used to be a conditional around just the two extra args,
	 but that might be undefined if yyoverflow is a macro.  */
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yyls1, size * sizeof (*yylsp),
		 &yystacksize);
#else
      yyoverflow("parser stack overflow",
		 &yyss1, size * sizeof (*yyssp),
		 &yyvs1, size * sizeof (*yyvsp),
		 &yystacksize);
#endif

      yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
      yyls = yyls1;
#endif
#else /* no yyoverflow */
      /* Extend the stack our own way.  */
      if (yystacksize >= YYMAXDEPTH)
	{
	  yyerror("parser stack overflow");
	  return 2;
	}
      yystacksize *= 2;
      if (yystacksize > YYMAXDEPTH)
	yystacksize = YYMAXDEPTH;
      yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
      __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp));
      yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
      __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
      yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
      __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */

      yyssp = yyss + size - 1;
      yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
      yylsp = yyls + size - 1;
#endif

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif

      if (yyssp >= yyss + yystacksize - 1)
	YYABORT;
    }

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Entering state %d\n", yystate);
#endif

  goto yybackup;
 yybackup:

/* Do appropriate processing given the current state.  */
/* Read a lookahead token if we need one and don't already have one.  */
/* yyresume: */

  /* First try to decide what to do without reference to lookahead token.  */

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yydefault;

  /* Not known => get a lookahead token if don't already have one.  */

  /* yychar is either YYEMPTY or YYEOF
     or a valid token in external form.  */

  if (yychar == YYEMPTY)
    {
#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Reading a token: ");
#endif
      yychar = YYLEX;
    }

  /* Convert token to internal form (in yychar1) for indexing tables with */

  if (yychar <= 0)		/* This means end of input. */
    {
      yychar1 = 0;
      yychar = YYEOF;		/* Don't call YYLEX any more */

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Now at end of input.\n");
#endif
    }
  else
    {
      yychar1 = YYTRANSLATE(yychar);

#if YYDEBUG != 0
      if (yydebug)
	{
	  fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
	  /* Give the individual parser a way to print the precise meaning
	     of a token, for further debugging info.  */
#ifdef YYPRINT
	  YYPRINT (stderr, yychar, yylval);
#endif
	  fprintf (stderr, ")\n");
	}
#endif
    }

  yyn += yychar1;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
    goto yydefault;

  yyn = yytable[yyn];

  /* yyn is what to do for this token type in this state.
     Negative => reduce, -yyn is rule number.
     Positive => shift, yyn is new state.
       New state is final state => don't bother to shift,
       just return success.
     0, or most negative number => error.  */

  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrlab;

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif

  /* Discard the token being shifted unless it is eof.  */
  if (yychar != YYEOF)
    yychar = YYEMPTY;

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  /* count tokens shifted since error; after three, turn off error status.  */
  if (yyerrstatus) yyerrstatus--;

  yystate = yyn;
  goto yynewstate;

/* Do the default action for the current state.  */
yydefault:

  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;

/* Do a reduction.  yyn is the number of a rule to reduce with.  */
yyreduce:
  yylen = yyr2[yyn];
  if (yylen > 0)
    yyval = yyvsp[1-yylen]; /* implement default value of the action */

#if YYDEBUG != 0
  if (yydebug)
    {
      int i;

      fprintf (stderr, "Reducing via rule %d (line %d), ",
	       yyn, yyrline[yyn]);

      /* Print the symbols being reduced, and their result.  */
      for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
	fprintf (stderr, "%s ", yytname[yyrhs[i]]);
      fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
    }
#endif


  switch (yyn) {

case 1:
#line 279 "parser.y"
{ yyerror ("Empty file"); YYABORT; ;
    break;}
case 2:
#line 280 "parser.y"
{ __IDL_root = yyvsp[0].tree; ;
    break;}
case 3:
#line 283 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 5:
#line 287 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 6:
#line 288 "parser.y"
{ yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 8:
#line 292 "parser.y"
{
	if (do_token_error (yyvsp[0].tree, "Missing semicolon after", TRUE))
		YYABORT;
;
    break;}
case 9:
#line 298 "parser.y"
{
	yyerror ("Dangling semicolon has no effect");
	yyval.tree = NULL;
;
    break;}
case 11:
#line 305 "parser.y"
{
	if (do_token_error (yyvsp[0].tree, "Missing comma after", TRUE))
		YYABORT;
;
    break;}
case 12:
#line 311 "parser.y"
{
	if (IDL_NODE_UP (yyvsp[0].tree))
	    do_token_error (IDL_NODE_UP (yyvsp[0].tree), "Illegal context for", FALSE);
	else
		yyerror ("Illegal context for identifier");
	YYABORT;
;
    break;}
case 22:
#line 334 "parser.y"
{
	if (IDL_NODE_UP (yyvsp[0].tree) != NULL &&
	    IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_MODULE) {
		yyerror ("Module definition conflicts");
		do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE);
		YYABORT;
	}
;
    break;}
case 23:
#line 343 "parser.y"
{
	IDL_tree module;

	if (yyvsp[-2].tree == NULL) {
		yyerrorv ("Empty module declaration `%s' is not legal IDL",
			  IDL_IDENT (yyvsp[-5].tree).str);
		module = NULL;
	}

	if (__IDL_flags & IDLF_COMBINE_REOPENED_MODULES) {
		if (IDL_NODE_UP (yyvsp[-5].tree) == NULL)
			module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree);
		else {
			module = IDL_NODE_UP (yyvsp[-5].tree);
			IDL_MODULE (module).definition_list =
				IDL_list_concat (IDL_MODULE (module).definition_list, yyvsp[-2].tree);
			module = NULL;
		}
	} else
		module = IDL_module_new (yyvsp[-5].tree, yyvsp[-2].tree);

	yyval.tree = module;
	if (yyval.tree) {
		IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-6].declspec;	
		if (__IDL_inhibits > 0)
			IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST |
				IDLF_DECLSPEC_INHIBIT;
	}
;
    break;}
case 25:
#line 375 "parser.y"
{
	yyerror ("Interfaces cannot be named `Object'");
	YYABORT;
;
    break;}
case 26:
#line 379 "parser.y"
{
	yyerror ("Interfaces cannot be named `TypeCode'");
	YYABORT;
;
    break;}
case 27:
#line 388 "parser.y"
{
	assert (yyvsp[0].tree != NULL);
	assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT);
	assert (IDL_IDENT_TO_NS (yyvsp[0].tree) != NULL);
	assert (IDL_NODE_TYPE (IDL_IDENT_TO_NS (yyvsp[0].tree)) == IDLN_GENTREE);

	if (IDL_NODE_UP (yyvsp[0].tree) != NULL &&
	    IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_INTERFACE &&
	    IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) {
		yyerrorl ("Interface definition conflicts",
			  __IDL_prev_token_line - __IDL_cur_token_line);
		do_token_error (IDL_NODE_UP (yyvsp[0].tree), "with", FALSE);
		YYABORT;
	} else if (IDL_NODE_UP (yyvsp[0].tree) != NULL &&
		   IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) != IDLN_FORWARD_DCL) {
		yyerrorv ("Cannot redeclare interface `%s'", IDL_IDENT (yyvsp[0].tree).str);
		IDL_tree_error (yyvsp[0].tree, "Previous declaration of interface `%s'", IDL_IDENT (yyvsp[0].tree).str);
		YYABORT;
	} else if (IDL_NODE_UP (yyvsp[0].tree) != NULL &&
		   IDL_NODE_TYPE (IDL_NODE_UP (yyvsp[0].tree)) == IDLN_FORWARD_DCL)
		__IDL_assign_this_location (yyvsp[0].tree, __IDL_cur_filename, __IDL_cur_line);
;
    break;}
case 28:
#line 411 "parser.y"
{
	IDL_GENTREE (IDL_IDENT_TO_NS (yyvsp[-3].tree))._import = yyvsp[0].tree;
	IDL_ns_push_scope (__IDL_root_ns, IDL_IDENT_TO_NS (yyvsp[-3].tree));
	if (IDL_ns_check_for_ambiguous_inheritance (yyvsp[-3].tree, yyvsp[0].tree))
		__IDL_is_okay = FALSE;
;
    break;}
case 29:
#line 418 "parser.y"
{
 	yyval.tree = IDL_interface_new (yyvsp[-8].tree, yyvsp[-5].tree, yyvsp[-2].tree);
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-11].declspec;
	if (__IDL_inhibits > 0)
		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
	assign_props (IDL_INTERFACE (yyval.tree).ident, yyvsp[-10].hash_table);
;
    break;}
case 30:
#line 429 "parser.y"
{
	if (yyvsp[-3].hash_table) yywarningv (IDL_WARNING1,
			    "Ignoring properties for forward declaration `%s'",
			    IDL_IDENT (yyvsp[-1].tree));
	yyval.tree = IDL_forward_dcl_new (yyvsp[-1].tree);
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-4].declspec;
	if (__IDL_inhibits > 0)
		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 31:
#line 440 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 32:
#line 441 "parser.y"
{
	GHashTable *table = g_hash_table_new (g_direct_hash, g_direct_equal);
	gboolean die = FALSE;
	IDL_tree p = yyvsp[0].tree;

	assert (IDL_NODE_TYPE (p) == IDLN_LIST);
	for (; p != NULL && !die; p = IDL_LIST (p).next) {
		assert (IDL_LIST (p).data != NULL);
		assert (IDL_NODE_TYPE (IDL_LIST (p).data) == IDLN_IDENT);

		if (g_hash_table_lookup_extended (table, IDL_LIST (p).data, NULL, NULL)) {
			char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0);
			yyerrorv ("Cannot inherit from interface `%s' more than once", s);
			g_free (s);
			die = TRUE;
			break;
		} else
			g_hash_table_insert (table, IDL_LIST (p).data, NULL);

		if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) == IDLN_FORWARD_DCL) {
			char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0);
			yyerrorv ("Incomplete definition of interface `%s'", s);
			IDL_tree_error (IDL_LIST (p).data,
					"Previous forward declaration of `%s'", s);
			g_free (s);
			die = TRUE;
		}
		else if (IDL_NODE_TYPE (IDL_NODE_UP (IDL_LIST (p).data)) != IDLN_INTERFACE) {
			char *s = IDL_ns_ident_to_qstring (IDL_LIST (p).data, "::", 0);
			yyerrorv ("`%s' is not an interface", s);
			IDL_tree_error (IDL_LIST (p).data,
					"Previous declaration of `%s'", s);
			g_free (s);
			die = TRUE;
		}
	}

	g_hash_table_destroy (table);

	if (die)
		YYABORT;

	yyval.tree = yyvsp[0].tree;
;
    break;}
case 33:
#line 487 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 34:
#line 489 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 36:
#line 495 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 37:
#line 496 "parser.y"
{ yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 45:
#line 508 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 46:
#line 516 "parser.y"
{ yyval.tree = yyvsp[0].tree; ;
    break;}
case 50:
#line 520 "parser.y"
{ yyval.tree = IDL_native_new (yyvsp[0].tree); ;
    break;}
case 51:
#line 522 "parser.y"
{
	/* Enable native type scanning */
	if (__IDL_flags & IDLF_XPIDL)
		__IDL_flagsi |= IDLFP_XPIDL_NATIVE;
	else {
		yyerror ("XPIDL syntax not enabled, cannot specify native extension");
		YYABORT;
	}
;
    break;}
case 52:
#line 530 "parser.y"
{
	/* Disable native type scanning */
	if (__IDL_flags & IDLF_XPIDL)
		__IDL_flagsi &= ~IDLFP_XPIDL_NATIVE;
	yyval.tree = IDL_native_new (yyvsp[-3].tree);
	IDL_NATIVE (yyval.tree).user_type = yyvsp[0].str;
;
    break;}
case 53:
#line 539 "parser.y"
{ yyval.tree = IDL_type_dcl_new (yyvsp[-1].tree, yyvsp[0].tree); ;
    break;}
case 62:
#line 556 "parser.y"
{
	g_hash_table_insert (__IDL_structunion_ht, yyvsp[-1].tree, yyvsp[-1].tree);
	yyval.tree = IDL_type_struct_new (yyvsp[-1].tree, NULL);
;
    break;}
case 63:
#line 560 "parser.y"
{
	g_hash_table_remove (__IDL_structunion_ht, yyvsp[-5].tree);
	yyval.tree = yyvsp[-3].tree;
	__IDL_assign_up_node (yyval.tree, yyvsp[-2].tree);
	IDL_TYPE_STRUCT (yyval.tree).member_list = yyvsp[-2].tree;
;
    break;}
case 64:
#line 570 "parser.y"
{
	g_hash_table_insert (__IDL_structunion_ht, yyvsp[-5].tree, yyvsp[-5].tree);
	yyval.tree = IDL_type_union_new (yyvsp[-5].tree, yyvsp[-2].tree, NULL);
;
    break;}
case 65:
#line 574 "parser.y"
{
	g_hash_table_remove (__IDL_structunion_ht, yyvsp[-9].tree);
	yyval.tree = yyvsp[-3].tree;
	__IDL_assign_up_node (yyval.tree, yyvsp[-2].tree);
	IDL_TYPE_UNION (yyval.tree).switch_body = yyvsp[-2].tree;
;
    break;}
case 72:
#line 592 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 73:
#line 593 "parser.y"
{ yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 74:
#line 597 "parser.y"
{ yyval.tree = IDL_case_stmt_new (yyvsp[-2].tree, yyvsp[-1].tree); ;
    break;}
case 75:
#line 600 "parser.y"
{
	char *s;

	yyval.tree = IDL_member_new (yyvsp[-1].tree, list_start (yyvsp[0].tree, TRUE));
	if (IDL_NODE_TYPE (yyvsp[-1].tree) == IDLN_IDENT &&
	    g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-1].tree)) {
		s = IDL_ns_ident_to_qstring (yyvsp[0].tree, "::", 0);
		yyerrorv ("Member `%s'", s);
		do_token_error (IDL_NODE_UP (yyvsp[-1].tree), "recurses", TRUE);
		g_free (s);
	}
;
    break;}
case 76:
#line 614 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, FALSE); ;
    break;}
case 77:
#line 615 "parser.y"
{ yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); ;
    break;}
case 78:
#line 618 "parser.y"
{ yyval.tree = yyvsp[-1].tree; ;
    break;}
case 79:
#line 619 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 80:
#line 622 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 81:
#line 631 "parser.y"
{
	yyval.tree = IDL_const_dcl_new (yyvsp[-3].tree, yyvsp[-2].tree, yyvsp[0].tree);
	/* Should probably do some type checking here... */
;
    break;}
case 82:
#line 637 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 83:
#line 647 "parser.y"
{ yyval.tree = IDL_except_dcl_new (yyvsp[-4].tree, yyvsp[-2].tree); ;
    break;}
case 84:
#line 650 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 85:
#line 651 "parser.y"
{ yyval.tree = zlist_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 86:
#line 654 "parser.y"
{ yyval.boolean = FALSE; ;
    break;}
case 87:
#line 655 "parser.y"
{ yyval.boolean = TRUE; ;
    break;}
case 88:
#line 658 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 89:
#line 670 "parser.y"
{
	IDL_tree_node node;
	IDL_tree p, dcl;

	yyval.tree = IDL_attr_dcl_new (yyvsp[-3].boolean, yyvsp[-1].tree, yyvsp[0].tree);
	node.properties = yyvsp[-4].hash_table;
	for (p = yyvsp[0].tree; p; p = IDL_LIST (p).next) {
		dcl = IDL_LIST (p).data;
		IDL_tree_properties_copy (&node, dcl);
	}
	__IDL_free_properties (node.properties);
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 95:
#line 693 "parser.y"
{ yyval.boolean = FALSE; ;
    break;}
case 96:
#line 694 "parser.y"
{ yyval.boolean = TRUE; ;
    break;}
case 97:
#line 697 "parser.y"
{ yyval.boolean = FALSE; ;
    break;}
case 98:
#line 698 "parser.y"
{ yyval.boolean = TRUE; ;
    break;}
case 99:
#line 701 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;
	if (__IDL_inhibits > 0)
 		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 100:
#line 715 "parser.y"
{
	yyval.tree = IDL_op_dcl_new (yyvsp[-6].boolean, yyvsp[-5].tree, yyvsp[-4].tree, yyvsp[-3].treedata.tree, yyvsp[-1].tree, yyvsp[0].tree);
	IDL_OP_DCL (yyval.tree).f_noscript = yyvsp[-7].boolean;
	IDL_OP_DCL (yyval.tree).f_varargs = (gboolean) GPOINTER_TO_INT (yyvsp[-3].treedata.data);
	assign_props (IDL_OP_DCL (yyval.tree).ident, yyvsp[-8].hash_table);
;
    break;}
case 102:
#line 724 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 103:
#line 727 "parser.y"
{ yyval.boolean = FALSE; ;
    break;}
case 104:
#line 728 "parser.y"
{ yyval.boolean = TRUE; ;
    break;}
case 105:
#line 731 "parser.y"
{ yyval.boolean = FALSE; ;
    break;}
case 106:
#line 732 "parser.y"
{ yyval.boolean = TRUE; ;
    break;}
case 107:
#line 738 "parser.y"
{
	yyval.treedata.tree = yyvsp[-2].tree;
	yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean);
;
    break;}
case 108:
#line 742 "parser.y"
{
	yyval.treedata.tree = NULL;
	yyval.treedata.data = GINT_TO_POINTER (yyvsp[-1].boolean);
;
    break;}
case 109:
#line 748 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 110:
#line 750 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 111:
#line 756 "parser.y"
{
	yyval.tree = IDL_param_dcl_new (yyvsp[-2].paramattr, yyvsp[-1].tree, yyvsp[0].tree);
	assign_props (IDL_PARAM_DCL (yyval.tree).simple_declarator, yyvsp[-3].hash_table);
;
    break;}
case 112:
#line 762 "parser.y"
{ yyval.paramattr = IDL_PARAM_IN; ;
    break;}
case 113:
#line 763 "parser.y"
{ yyval.paramattr = IDL_PARAM_OUT; ;
    break;}
case 114:
#line 764 "parser.y"
{ yyval.paramattr = IDL_PARAM_INOUT; ;
    break;}
case 115:
#line 765 "parser.y"
{
	yyerrorv ("Missing direction attribute (in, out, inout) before parameter");
	IDL_tree_free (yyvsp[0].tree);
;
    break;}
case 116:
#line 771 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 118:
#line 775 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 120:
#line 781 "parser.y"
{ yyval.tree = yyvsp[-1].tree; ;
    break;}
case 121:
#line 786 "parser.y"
{ yyval.tree = yyvsp[-1].tree; ;
    break;}
case 133:
#line 804 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_OR, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 135:
#line 808 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_XOR, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 137:
#line 812 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_AND, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 139:
#line 816 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_SHR, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 140:
#line 817 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_SHL, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 142:
#line 821 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_ADD, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 143:
#line 822 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_SUB, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 145:
#line 826 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_MULT, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 146:
#line 827 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_DIV, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 147:
#line 828 "parser.y"
{ do_binop (yyval.tree, IDL_BINOP_MOD, yyvsp[-2].tree, yyvsp[0].tree); ;
    break;}
case 148:
#line 831 "parser.y"
{ do_unaryop (yyval.tree, yyvsp[-1].unaryop, yyvsp[0].tree); ;
    break;}
case 150:
#line 835 "parser.y"
{ yyval.unaryop = IDL_UNARYOP_MINUS; ;
    break;}
case 151:
#line 836 "parser.y"
{ yyval.unaryop = IDL_UNARYOP_PLUS; ;
    break;}
case 152:
#line 837 "parser.y"
{ yyval.unaryop = IDL_UNARYOP_COMPLEMENT; ;
    break;}
case 153:
#line 840 "parser.y"
{
	IDL_tree p, literal;
	
	assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT);

	p = IDL_NODE_UP (yyvsp[0].tree);
	
	if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_ANY))) {
		++IDL_NODE_REFS (literal);
		yyval.tree = literal;
		IDL_tree_free (yyvsp[0].tree);
	} else
		yyval.tree = yyvsp[0].tree;
;
    break;}
case 155:
#line 855 "parser.y"
{ yyval.tree = yyvsp[-1].tree; ;
    break;}
case 162:
#line 868 "parser.y"
{ yyval.tree = IDL_type_enum_new (yyvsp[-3].tree, yyvsp[-1].tree); ;
    break;}
case 163:
#line 871 "parser.y"
{
	assert (yyvsp[0].tree != NULL);
	assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE);
	assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT);
	yyval.tree = IDL_GENTREE (yyvsp[0].tree).data;
;
    break;}
case 165:
#line 880 "parser.y"
{ yyval.tree = yyvsp[0].tree; ;
    break;}
case 166:
#line 882 "parser.y"
{
	IDL_tree p;

	assert (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_GENTREE);
	assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_IDENT);

#ifdef YYDEBUG
	if (yydebug)
		printf ("looking in %s\n", IDL_IDENT (IDL_GENTREE (yyvsp[-2].tree).data).str);
#endif

	if ((p = IDL_ns_lookup_this_scope (__IDL_root_ns, yyvsp[-2].tree, yyvsp[0].tree, NULL)) == NULL) {
#ifdef YYDEBUG
		if (yydebug)
			printf ("'%s'\n", IDL_IDENT (yyvsp[0].tree).str);
#endif
		yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str);
		IDL_tree_free (yyvsp[0].tree);
		YYABORT;
	}
	IDL_tree_free (yyvsp[0].tree);
	++IDL_NODE_REFS (IDL_GENTREE (p).data);
	yyval.tree = p;
;
    break;}
case 167:
#line 908 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 168:
#line 910 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 169:
#line 913 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 170:
#line 914 "parser.y"
{ yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 171:
#line 918 "parser.y"
{
	char *s;

	yyval.tree = IDL_member_new (yyvsp[-2].tree, yyvsp[-1].tree);
	if (IDL_NODE_TYPE (yyvsp[-2].tree) == IDLN_IDENT &&
	    g_hash_table_lookup (__IDL_structunion_ht, yyvsp[-2].tree)) {
		s = IDL_ns_ident_to_qstring (IDL_LIST (yyvsp[-1].tree).data, "::", 0);
		yyerrorv ("Member `%s'", s);
		do_token_error (IDL_NODE_UP (yyvsp[-2].tree), "recurses", TRUE);
		g_free (s);
	}
;
    break;}
case 185:
#line 951 "parser.y"
{ yyval.tree = IDL_type_sequence_new (yyvsp[-3].tree, yyvsp[-1].tree); ;
    break;}
case 186:
#line 954 "parser.y"
{ yyval.tree = IDL_type_sequence_new (yyvsp[-1].tree, NULL); ;
    break;}
case 187:
#line 957 "parser.y"
{ yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_FLOAT); ;
    break;}
case 188:
#line 958 "parser.y"
{ yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_DOUBLE); ;
    break;}
case 189:
#line 959 "parser.y"
{ yyval.tree = IDL_type_float_new (IDL_FLOAT_TYPE_LONGDOUBLE); ;
    break;}
case 190:
#line 964 "parser.y"
{ yyval.tree = IDL_type_fixed_new (yyvsp[-3].tree, yyvsp[-1].tree); ;
    break;}
case 191:
#line 967 "parser.y"
{ yyval.tree = IDL_type_fixed_new (NULL, NULL); ;
    break;}
case 192:
#line 970 "parser.y"
{ yyval.tree = IDL_type_integer_new (TRUE, yyvsp[0].integer); ;
    break;}
case 193:
#line 971 "parser.y"
{ yyval.tree = IDL_type_integer_new (FALSE, yyvsp[0].integer); ;
    break;}
case 194:
#line 974 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_SHORT; ;
    break;}
case 195:
#line 975 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_LONG; ;
    break;}
case 196:
#line 976 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_LONGLONG; ;
    break;}
case 200:
#line 988 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_SHORT; ;
    break;}
case 201:
#line 989 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_LONG; ;
    break;}
case 202:
#line 990 "parser.y"
{ yyval.integer = IDL_INTEGER_TYPE_LONGLONG; ;
    break;}
case 206:
#line 1002 "parser.y"
{ yyval.tree = IDL_type_char_new (); ;
    break;}
case 207:
#line 1005 "parser.y"
{ yyval.tree = IDL_type_wide_char_new (); ;
    break;}
case 208:
#line 1008 "parser.y"
{ yyval.tree = IDL_type_boolean_new (); ;
    break;}
case 209:
#line 1011 "parser.y"
{ yyval.tree = IDL_type_octet_new (); ;
    break;}
case 210:
#line 1014 "parser.y"
{ yyval.tree = IDL_type_any_new (); ;
    break;}
case 211:
#line 1017 "parser.y"
{ yyval.tree = IDL_type_object_new (); ;
    break;}
case 212:
#line 1020 "parser.y"
{ yyval.tree = IDL_type_typecode_new (); ;
    break;}
case 213:
#line 1025 "parser.y"
{ yyval.tree = IDL_type_string_new (yyvsp[-1].tree); ;
    break;}
case 214:
#line 1026 "parser.y"
{ yyval.tree = IDL_type_string_new (NULL); ;
    break;}
case 215:
#line 1031 "parser.y"
{ yyval.tree = IDL_type_wide_string_new (yyvsp[-1].tree); ;
    break;}
case 216:
#line 1032 "parser.y"
{ yyval.tree = IDL_type_wide_string_new (NULL); ;
    break;}
case 217:
#line 1035 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 218:
#line 1037 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 223:
#line 1050 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 224:
#line 1052 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 225:
#line 1056 "parser.y"
{
	IDL_tree p;
	int i;

	yyval.tree = IDL_type_array_new (yyvsp[-1].tree, yyvsp[0].tree);
	for (i = 1, p = yyvsp[0].tree; p; ++i, p = IDL_LIST (p).next)
		if (!IDL_LIST (p).data) {
			char *s = IDL_ns_ident_to_qstring (yyvsp[-1].tree, "::", 0);
			yyerrorv ("Missing value in dimension %d of array `%s'", i, s);
			g_free (s);
		}
;
    break;}
case 226:
#line 1070 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, FALSE); ;
    break;}
case 227:
#line 1072 "parser.y"
{ yyval.tree = list_chain (yyvsp[-1].tree, yyvsp[0].tree, FALSE); ;
    break;}
case 228:
#line 1075 "parser.y"
{ yyval.tree = yyvsp[-1].tree; ;
    break;}
case 229:
#line 1076 "parser.y"
{ yyval.tree = NULL; ;
    break;}
case 230:
#line 1080 "parser.y"
{
	yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal);
	g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str);
;
    break;}
case 231:
#line 1086 "parser.y"
{
	yyval.hash_table = yyvsp[-3].hash_table;
	g_hash_table_insert (yyval.hash_table, yyvsp[-1].str, yyvsp[0].str);
;
    break;}
case 232:
#line 1090 "parser.y"
{
	yyval.hash_table = g_hash_table_new (IDL_strcase_hash, IDL_strcase_equal);
	g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup (""));
;
    break;}
case 233:
#line 1095 "parser.y"
{
	yyval.hash_table = yyvsp[-2].hash_table;
	g_hash_table_insert (yyval.hash_table, yyvsp[0].str, g_strdup (""));
;
    break;}
case 234:
#line 1101 "parser.y"
{ yyval.tree = IDL_ident_new (yyvsp[0].str); ;
    break;}
case 235:
#line 1104 "parser.y"
{
	assert (yyvsp[0].tree != NULL);
	assert (IDL_NODE_TYPE (yyvsp[0].tree) == IDLN_GENTREE);
	assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT);
	yyval.tree = IDL_GENTREE (yyvsp[0].tree).data;
;
    break;}
case 236:
#line 1112 "parser.y"
{
	IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree);
#ifdef YYDEBUG
	if (yydebug)
		printf ("entering new/prev scope of %s\n", 
		       IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str);
#endif
	assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT);
	yyval.tree = IDL_GENTREE (yyvsp[0].tree).data;
;
    break;}
case 237:
#line 1124 "parser.y"
{
	IDL_ns_push_scope (__IDL_root_ns, yyvsp[0].tree);
	assert (IDL_NS (__IDL_root_ns).current != NULL);
	assert (IDL_NODE_TYPE (IDL_NS (__IDL_root_ns).current) == IDLN_GENTREE);
	assert (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data != NULL);
	assert (IDL_NODE_TYPE (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data) == IDLN_IDENT);
#ifdef YYDEBUG
	if (yydebug)
		printf ("entering new/prev scope of %s\n", 
		       IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str);
#endif
	assert (IDL_NODE_TYPE (IDL_GENTREE (yyvsp[0].tree).data) == IDLN_IDENT);
	yyval.tree = IDL_GENTREE (yyvsp[0].tree).data;
;
    break;}
case 238:
#line 1140 "parser.y"
{
#ifdef YYDEBUG
	if (yydebug)
		printf ("scope to parent of %s\n", 
		       IDL_IDENT (IDL_GENTREE (IDL_NS (__IDL_root_ns).current).data).str);
#endif
	IDL_ns_pop_scope (__IDL_root_ns);
;
    break;}
case 239:
#line 1150 "parser.y"
{
	IDL_tree p;

	if ((p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree)) == NULL) {
		IDL_tree q;
		int i;

		p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL);

		for (i = 0, q = IDL_GENTREE (p).data;
		     q && (IDL_NODE_TYPE (q) == IDLN_IDENT ||
			   IDL_NODE_TYPE (q) == IDLN_LIST) && i < 4;
		     ++i)
			if (IDL_NODE_UP (q))
				q = IDL_NODE_UP (q);

		if (q) {
			IDL_tree_error (yyvsp[0].tree, "`%s' conflicts", IDL_IDENT (yyvsp[0].tree).str);
			do_token_error (q, "with", FALSE);
		} else
			yyerrorv ("`%s' duplicate identifier", IDL_IDENT (yyvsp[0].tree).str);

		IDL_tree_free (yyvsp[0].tree);
		YYABORT;
	}
	assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p);
	++IDL_NODE_REFS (IDL_GENTREE (p).data);
	if (__IDL_new_ident_comments != NULL) {
		assert (IDL_IDENT (yyvsp[0].tree).comments == NULL);
		IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments;
		__IDL_new_ident_comments = NULL;
	}
	yyval.tree = p;
;
    break;}
case 240:
#line 1186 "parser.y"
{
	IDL_tree p;

	if ((p = IDL_ns_resolve_ident (__IDL_root_ns, yyvsp[0].tree)) == NULL) {
		yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str);
		IDL_tree_free (yyvsp[0].tree);
		YYABORT;
	}
	IDL_tree_free (yyvsp[0].tree);
	assert (IDL_GENTREE (p).data != NULL);
	assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p);
	++IDL_NODE_REFS (IDL_GENTREE (p).data);
	yyval.tree = p;
;
    break;}
case 241:
#line 1203 "parser.y"
{
	IDL_tree p;

	if ((p = IDL_ns_lookup_cur_scope (__IDL_root_ns, yyvsp[0].tree, NULL)) == NULL) {
		p = IDL_ns_place_new (__IDL_root_ns, yyvsp[0].tree);
		assert (p != NULL);
		assert (IDL_IDENT (yyvsp[0].tree)._ns_ref == p);
		if (__IDL_new_ident_comments != NULL) {
			assert (IDL_IDENT (yyvsp[0].tree).comments == NULL);
			IDL_IDENT (yyvsp[0].tree).comments = __IDL_new_ident_comments;
			__IDL_new_ident_comments = NULL;
		}
	} else {
		IDL_tree_free (yyvsp[0].tree);
		assert (IDL_GENTREE (p).data != NULL);
		assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p);
	}
	++IDL_NODE_REFS (IDL_GENTREE (p).data);
	yyval.tree = p;
;
    break;}
case 242:
#line 1225 "parser.y"
{
	IDL_tree p;

	if ((p = IDL_ns_lookup_this_scope (
		__IDL_root_ns,IDL_NS (__IDL_root_ns).file, yyvsp[0].tree, NULL)) == NULL) {
		yyerrorv ("`%s' undeclared identifier", IDL_IDENT (yyvsp[0].tree).str);
		IDL_tree_free (yyvsp[0].tree);
		YYABORT;
	}
	IDL_tree_free (yyvsp[0].tree);
	assert (IDL_GENTREE (p).data != NULL);
	assert (IDL_IDENT (IDL_GENTREE (p).data)._ns_ref == p);
	++IDL_NODE_REFS (IDL_GENTREE (p).data);
	yyval.tree = p;
;
    break;}
case 243:
#line 1242 "parser.y"
{ yyval.tree = list_start (yyvsp[0].tree, TRUE); ;
    break;}
case 244:
#line 1244 "parser.y"
{ yyval.tree = list_chain (yyvsp[-2].tree, yyvsp[0].tree, TRUE); ;
    break;}
case 245:
#line 1247 "parser.y"
{
	IDL_tree literal, ident = NULL;
	IDL_longlong_t value = 0;

	if ((literal = IDL_resolve_const_exp (yyvsp[0].tree, IDLN_INTEGER))) {
		assert (IDL_NODE_TYPE (literal) == IDLN_INTEGER);
		value = IDL_INTEGER (literal).value;
		IDL_tree_free (yyvsp[0].tree);
	}

	if (literal && IDL_NODE_UP (literal) &&
	    IDL_NODE_TYPE (IDL_NODE_UP (literal)) == IDLN_CONST_DCL)
		ident = IDL_CONST_DCL (IDL_NODE_UP (literal)).ident;
	
	if (literal == NULL) {
		if (!(__IDL_flags & IDLF_NO_EVAL_CONST))
			yyerror ("Could not resolve constant expression");
		yyval.tree = yyvsp[0].tree;
	} else if (value == 0) {
		yyerror ("Zero array size is illegal");
		if (ident)
			IDL_tree_error (ident, "From constant declared here");
		yyval.tree = NULL;
	} else if (value < 0) {
		yywarningv (IDL_WARNING1, "Cannot use negative value %"
			    IDL_LL "d, using %" IDL_LL "d",
			   value, -value);
		if (ident)
			IDL_tree_warning (ident,
					  IDL_WARNING1, "From constant declared here");
		yyval.tree = IDL_integer_new (-value);
	}
	else
		yyval.tree = IDL_integer_new (value);
;
    break;}
case 246:
#line 1284 "parser.y"
{ yyval.declspec = 0; ;
    break;}
case 247:
#line 1285 "parser.y"
{
	yyval.declspec = IDL_parse_declspec (yyvsp[0].str);
	g_free (yyvsp[0].str);
;
    break;}
case 248:
#line 1291 "parser.y"
{ yyval.hash_table = NULL; ;
    break;}
case 249:
#line 1292 "parser.y"
{
	/* Enable property scanning */
	if (__IDL_flags & IDLF_XPIDL)
		__IDL_flagsi |= IDLFP_XPIDL_PROPERTY;
	else {
		yyerror ("XPIDL syntax not enabled, cannot specify properties");
		YYABORT;
	}
;
    break;}
case 250:
#line 1301 "parser.y"
{
	/* Disable property scanning */
	if (__IDL_flags & IDLF_XPIDL)
		__IDL_flagsi &= ~IDLFP_XPIDL_PROPERTY;
	yyval.hash_table = yyvsp[-1].hash_table;
;
    break;}
case 251:
#line 1309 "parser.y"
{ yyval.tree = IDL_integer_new (yyvsp[0].integer); ;
    break;}
case 252:
#line 1312 "parser.y"
{ yyval.tree = IDL_string_new (yyvsp[0].str); ;
    break;}
case 253:
#line 1315 "parser.y"
{ yyval.tree = IDL_char_new (yyvsp[0].str); ;
    break;}
case 254:
#line 1318 "parser.y"
{ yyval.tree = IDL_fixed_new (yyvsp[0].str); ;
    break;}
case 255:
#line 1321 "parser.y"
{ yyval.tree = IDL_float_new (yyvsp[0].floatp); ;
    break;}
case 256:
#line 1324 "parser.y"
{ yyval.tree = IDL_boolean_new (TRUE); ;
    break;}
case 257:
#line 1325 "parser.y"
{ yyval.tree = IDL_boolean_new (FALSE); ;
    break;}
case 258:
#line 1328 "parser.y"
{
	yyval.tree = yyvsp[0].tree;
	IDL_NODE_DECLSPEC (yyval.tree) = yyvsp[-1].declspec;	
	if (__IDL_inhibits > 0)
		IDL_NODE_DECLSPEC (yyval.tree) |= IDLF_DECLSPEC_EXIST | IDLF_DECLSPEC_INHIBIT;
;
    break;}
case 260:
#line 1337 "parser.y"
{
	char *catstr = g_malloc (strlen (yyvsp[-1].str) + strlen (yyvsp[0].str) + 1);
	strcpy (catstr, yyvsp[-1].str); g_free (yyvsp[-1].str);
	strcat (catstr, yyvsp[0].str); g_free (yyvsp[0].str);
	yyval.str = catstr;
;
    break;}
case 261:
#line 1345 "parser.y"
{
	char *s = IDL_do_escapes (yyvsp[0].str);
	g_free (yyvsp[0].str);
	yyval.str = s;
;
    break;}
case 262:
#line 1352 "parser.y"
{
	char *s = IDL_do_escapes (yyvsp[0].str);
	g_free (yyvsp[0].str);
	yyval.str = s;
;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 498 "/usr/local/share/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

  *++yyvsp = yyval;

#ifdef YYLSP_NEEDED
  yylsp++;
  if (yylen == 0)
    {
      yylsp->first_line = yylloc.first_line;
      yylsp->first_column = yylloc.first_column;
      yylsp->last_line = (yylsp-1)->last_line;
      yylsp->last_column = (yylsp-1)->last_column;
      yylsp->text = 0;
    }
  else
    {
      yylsp->last_line = (yylsp+yylen-1)->last_line;
      yylsp->last_column = (yylsp+yylen-1)->last_column;
    }
#endif

  /* Now "shift" the result of the reduction.
     Determine what state that goes to,
     based on the state we popped back to
     and the rule number reduced by.  */

  yyn = yyr1[yyn];

  yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTBASE];

  goto yynewstate;

yyerrlab:   /* here on detecting error */

  if (! yyerrstatus)
    /* If not already recovering from an error, report this error.  */
    {
      ++yynerrs;

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (yyn > YYFLAG && yyn < YYLAST)
	{
	  int size = 0;
	  char *msg;
	  int x, count;

	  count = 0;
	  /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
	  for (x = (yyn < 0 ? -yyn : 0);
	       x < (sizeof(yytname) / sizeof(char *)); x++)
	    if (yycheck[x + yyn] == x)
	      size += strlen(yytname[x]) + 15, count++;
	  msg = (char *) malloc(size + 15);
	  if (msg != 0)
	    {
	      strcpy(msg, "parse error");

	      if (count < 5)
		{
		  count = 0;
		  for (x = (yyn < 0 ? -yyn : 0);
		       x < (sizeof(yytname) / sizeof(char *)); x++)
		    if (yycheck[x + yyn] == x)
		      {
			strcat(msg, count == 0 ? ", expecting `" : " or `");
			strcat(msg, yytname[x]);
			strcat(msg, "'");
			count++;
		      }
		}
	      yyerror(msg);
	      free(msg);
	    }
	  else
	    yyerror ("parse error; also virtual memory exceeded");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror("parse error");
    }

  goto yyerrlab1;
yyerrlab1:   /* here on error raised explicitly by an action */

  if (yyerrstatus == 3)
    {
      /* if just tried and failed to reuse lookahead token after an error, discard it.  */

      /* return failure if at end of input */
      if (yychar == YYEOF)
	YYABORT;

#if YYDEBUG != 0
      if (yydebug)
	fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif

      yychar = YYEMPTY;
    }

  /* Else will try to reuse lookahead token
     after shifting the error token.  */

  yyerrstatus = 3;		/* Each real token shifted decrements this */

  goto yyerrhandle;

yyerrdefault:  /* current state does not do anything special for the error token. */

#if 0
  /* This is wrong; only states that explicitly want error tokens
     should shift them.  */
  yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  if (yyn) goto yydefault;
#endif

yyerrpop:   /* pop the current state because it cannot handle the error token */

  if (yyssp == yyss) YYABORT;
  yyvsp--;
  yystate = *--yyssp;
#ifdef YYLSP_NEEDED
  yylsp--;
#endif

#if YYDEBUG != 0
  if (yydebug)
    {
      short *ssp1 = yyss - 1;
      fprintf (stderr, "Error: state stack now");
      while (ssp1 != yyssp)
	fprintf (stderr, " %d", *++ssp1);
      fprintf (stderr, "\n");
    }
#endif

yyerrhandle:

  yyn = yypact[yystate];
  if (yyn == YYFLAG)
    goto yyerrdefault;

  yyn += YYTERROR;
  if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
    goto yyerrdefault;

  yyn = yytable[yyn];
  if (yyn < 0)
    {
      if (yyn == YYFLAG)
	goto yyerrpop;
      yyn = -yyn;
      goto yyreduce;
    }
  else if (yyn == 0)
    goto yyerrpop;

  if (yyn == YYFINAL)
    YYACCEPT;

#if YYDEBUG != 0
  if (yydebug)
    fprintf(stderr, "Shifting error token, ");
#endif

  *++yyvsp = yylval;
#ifdef YYLSP_NEEDED
  *++yylsp = yylloc;
#endif

  yystate = yyn;
  goto yynewstate;
}
#line 1359 "parser.y"


static const char *IDL_ns_get_cur_prefix (IDL_ns ns)
{
	IDL_tree p;

	p = IDL_NS (ns).current;

	assert (p != NULL);

	while (p && !IDL_GENTREE (p)._cur_prefix)
		p = IDL_NODE_UP (p);

	return p ? IDL_GENTREE (p)._cur_prefix : NULL;
}

char *IDL_ns_ident_make_repo_id (IDL_ns ns, IDL_tree p,
				 const char *p_prefix, int *major, int *minor)
{
	GString *s = g_string_new (NULL);
	const char *prefix;
	char *q;

	assert (p != NULL);
	
	if (IDL_NODE_TYPE (p) == IDLN_IDENT)
		p = IDL_IDENT_TO_NS (p);

	assert (p != NULL);

	prefix = p_prefix ? p_prefix : IDL_ns_get_cur_prefix (ns);

	q = IDL_ns_ident_to_qstring (p, "/", 0);
	g_string_sprintf (s, "IDL:%s%s%s:%d.%d",
			  prefix ? prefix : "",
			  prefix && *prefix ? "/" : "",
			  q,
			  major ? *major : 1,
			  minor ? *minor : 0);
	g_free (q);

	q = s->str;
	g_string_free (s, FALSE);

	return q;
}

static const char *get_name_token (const char *s, char **tok)
{
	const char *begin = s;
	int state = 0;

	if (!s)
		return NULL;

	while (isspace (*s)) ++s;
	
	while (1) switch (state) {
	case 0:		/* Unknown */
		if (*s == ':')
			state = 1;
		else if (isalnum (*s) || *s == '_') {
			begin = s;
			state = 2;
		} else
			return NULL;
		break;
	case 1:		/* Scope */
		if (strncmp (s, "::", 2) == 0) {
			char *r = g_malloc (3);
			strcpy (r, "::");
			*tok = r;
			return s + 2;
		} else	/* Invalid */
			return NULL;
		break;
	case 2:
		if (isalnum (*s) || *s == '_')
			++s;
		else {
			char *r = g_malloc (s - begin + 1);
			strncpy (r, begin, s - begin + 1);
			r[s - begin] = 0;
			*tok = r;
			return s;
		}
		break;
	}
}

static IDL_tree IDL_ns_pragma_parse_name (IDL_ns ns, const char *s)
{
	IDL_tree p = IDL_NS (ns).current;
	int start = 1;
	char *tok;

	while (p && *s && (s = get_name_token (s, &tok))) {
		if (tok == NULL)
			return NULL;
		if (strcmp (tok, "::") == 0) {
			if (start) {
				/* Globally scoped */
				p = IDL_NS (ns).file;
			}
			g_free (tok);
		} else {
			IDL_tree ident = IDL_ident_new (tok);
			p = IDL_ns_lookup_this_scope (__IDL_root_ns, p, ident, NULL);
			IDL_tree_free (ident);
		}
		start = 0;
	}
	
	return p;
}

void IDL_ns_ID (IDL_ns ns, const char *s)
{
	char name[1024], id[1024];
	IDL_tree p, ident;
	int n;

	n = sscanf (s, "%1023s \"%1023s\"", name, id);
	if (n < 2 && __IDL_is_parsing) {
		yywarning (IDL_WARNING1, "Malformed pragma ID");
		return;
	}
	if (id[strlen (id) - 1] == '"')
		id[strlen (id) - 1] = 0;

	p = IDL_ns_pragma_parse_name (__IDL_root_ns, name);
	if (!p && __IDL_is_parsing) {
		yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma ID", name);
		return;
	}

	/* We have resolved the identifier, so assign the repo id */
	assert (IDL_NODE_TYPE (p) == IDLN_GENTREE);
	assert (IDL_GENTREE (p).data != NULL);
	assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT);
	ident = IDL_GENTREE (p).data;

	if (IDL_IDENT_REPO_ID (ident) != NULL)
		g_free (IDL_IDENT_REPO_ID (ident));

	IDL_IDENT_REPO_ID (ident) = g_strdup (id);
}

void IDL_ns_version (IDL_ns ns, const char *s)
{
	char name[1024];
	int n, major, minor;
	IDL_tree p, ident;

	n = sscanf (s, "%1023s %u %u", name, &major, &minor);
	if (n < 3 && __IDL_is_parsing) {
		yywarning (IDL_WARNING1, "Malformed pragma version");
		return;
	}

	p = IDL_ns_pragma_parse_name (__IDL_root_ns, name);
	if (!p && __IDL_is_parsing) {
		yywarningv (IDL_WARNING1, "Unknown identifier `%s' in pragma version", name);
		return;
	}

	/* We have resolved the identifier, so assign the repo id */
	assert (IDL_NODE_TYPE (p) == IDLN_GENTREE);
	assert (IDL_GENTREE (p).data != NULL);
	assert (IDL_NODE_TYPE (IDL_GENTREE (p).data) == IDLN_IDENT);
	ident = IDL_GENTREE (p).data;

	if (IDL_IDENT_REPO_ID (ident) != NULL) {
		char *v = strrchr (IDL_IDENT_REPO_ID (ident), ':');
		if (v) {
			GString *s;

			*v = 0;
			s = g_string_new (NULL);
			g_string_sprintf (s, "%s:%d.%d",
					  IDL_IDENT_REPO_ID (ident), major, minor);
			g_free (IDL_IDENT_REPO_ID (ident));
			IDL_IDENT_REPO_ID (ident) = s->str;
			g_string_free (s, FALSE);
		} else if (__IDL_is_parsing)
			yywarningv (IDL_WARNING1, "Cannot find RepositoryID OMG IDL version in ID `%s'",
				    IDL_IDENT_REPO_ID (ident));
	} else
		IDL_IDENT_REPO_ID (ident) =
			IDL_ns_ident_make_repo_id (
				__IDL_root_ns, p, NULL, &major, &minor);
}

int IDL_inhibit_get (void)
{
	g_return_val_if_fail (__IDL_is_parsing, -1);

	return __IDL_inhibits;
}

void IDL_inhibit_push (void)
{
	g_return_if_fail (__IDL_is_parsing);

	++__IDL_inhibits;
}

void IDL_inhibit_pop (void)
{
	g_return_if_fail (__IDL_is_parsing);

	if (--__IDL_inhibits < 0)
		__IDL_inhibits = 0;
}

static void IDL_inhibit (IDL_ns ns, const char *s)
{
	if (g_strcasecmp ("push", s) == 0)
		IDL_inhibit_push ();
	else if (g_strcasecmp ("pop", s) == 0)
		IDL_inhibit_pop ();
}

void __IDL_do_pragma (const char *s)
{
	int n;
	char directive[256];

	g_return_if_fail (__IDL_is_parsing);
	g_return_if_fail (s != NULL);

	if (sscanf (s, "%255s%n", directive, &n) < 1)
		return;
	s += n;
	while (isspace (*s)) ++s;

	if (strcmp (directive, "prefix") == 0)
		IDL_ns_prefix (__IDL_root_ns, s);
	else if (strcmp (directive, "ID") == 0)
		IDL_ns_ID (__IDL_root_ns, s);
	else if (strcmp (directive, "version") == 0)
		IDL_ns_version (__IDL_root_ns, s);
	else if (strcmp (directive, "inhibit") == 0)
		IDL_inhibit (__IDL_root_ns, s);
}

static IDL_declspec_t IDL_parse_declspec (const char *strspec)
{
	IDL_declspec_t flags = IDLF_DECLSPEC_EXIST;

	if (strspec == NULL)
		return flags;

	if (strcmp (strspec, "inhibit") == 0)
		flags |= IDLF_DECLSPEC_INHIBIT;
	else if (__IDL_is_parsing)
		yywarningv (IDL_WARNING1, "Ignoring unknown declspec `%s'", strspec);

	return flags;
}

void IDL_file_set (const char *filename, int line)
{
	IDL_fileinfo *fi;
	char *orig;

	g_return_if_fail (__IDL_is_parsing);

	if (filename) {
		__IDL_cur_filename = g_strdup (filename);

		if (
#ifdef HAVE_CPP_PIPE_STDIN
			!strlen (__IDL_cur_filename)
#else
			__IDL_tmp_filename &&
			!strcmp (__IDL_cur_filename, __IDL_tmp_filename)
#endif
			) {
			g_free (__IDL_cur_filename);
			__IDL_cur_filename = g_strdup (__IDL_real_filename);
		}

		if (g_hash_table_lookup_extended (__IDL_filename_hash, __IDL_cur_filename,
						  (gpointer) &orig, (gpointer) &fi)) {
			g_free (__IDL_cur_filename);
			__IDL_cur_filename = orig;
			__IDL_cur_fileinfo = fi;
		} else {
			fi = g_new0 (IDL_fileinfo, 1);
			__IDL_cur_fileinfo = fi;
			g_hash_table_insert (__IDL_filename_hash, __IDL_cur_filename, fi);
		}
	}

	if (__IDL_cur_line > 0)
		__IDL_cur_line = line;
}

void IDL_file_get (const char **filename, int *line)
{
	g_return_if_fail (__IDL_is_parsing);

	if (filename)
		*filename = __IDL_cur_filename;

	if (line)
		*line = __IDL_cur_line;
}

static int do_token_error (IDL_tree p, const char *message, gboolean prev)
{
	int dienow;
	char *what = NULL, *who = NULL;

	assert (p != NULL);

	dienow = IDL_tree_get_node_info (p, &what, &who);

	assert (what != NULL);
	
	if (who && *who)
		IDL_tree_error (p, "%s %s `%s'", message, what, who);
	else
		IDL_tree_error (p, "%s %s", message, what);
	
	return dienow;
}

static IDL_tree list_start (IDL_tree a, gboolean filter_null)
{
	IDL_tree p;

	if (!a && filter_null)
		return NULL;

	p = IDL_list_new (a);

	return p;
}

static IDL_tree list_chain (IDL_tree a, IDL_tree b, gboolean filter_null)
{
	IDL_tree p;

	if (filter_null) {
		if (!b)
			return a;
		if (!a)
			return list_start (b, filter_null);
	}

	p = IDL_list_new (b);
	a = IDL_list_concat (a, p);

	return a;
}

static IDL_tree zlist_chain (IDL_tree a, IDL_tree b, gboolean filter_null)
{
	if (a == NULL)
		return list_start (b, filter_null);
	else
		return list_chain (a, b, filter_null);
}

static int IDL_binop_chktypes (enum IDL_binop op, IDL_tree a, IDL_tree b)
{
	if (IDL_NODE_TYPE (a) != IDLN_BINOP &&
	    IDL_NODE_TYPE (b) != IDLN_BINOP &&
	    IDL_NODE_TYPE (a) != IDLN_UNARYOP &&
	    IDL_NODE_TYPE (b) != IDLN_UNARYOP &&
	    IDL_NODE_TYPE (a) != IDL_NODE_TYPE (b)) {
		yyerror ("Invalid mix of types in constant expression");
		return -1;
	}

	switch (op) {
	case IDL_BINOP_MULT:
	case IDL_BINOP_DIV:
	case IDL_BINOP_ADD:
	case IDL_BINOP_SUB:
		break;

	case IDL_BINOP_MOD:
	case IDL_BINOP_SHR:
	case IDL_BINOP_SHL:
	case IDL_BINOP_AND:
	case IDL_BINOP_OR:
	case IDL_BINOP_XOR:
		if ((IDL_NODE_TYPE (a) != IDLN_INTEGER ||
		     IDL_NODE_TYPE (b) != IDLN_INTEGER) &&
		    !(IDL_NODE_TYPE (a) == IDLN_BINOP ||
		      IDL_NODE_TYPE (b) == IDLN_BINOP ||
		      IDL_NODE_TYPE (a) == IDLN_UNARYOP ||
		      IDL_NODE_TYPE (b) == IDLN_UNARYOP)) {
			yyerror ("Invalid operation on non-integer value");
			return -1;
		}
		break;
	}

	return 0;
}

static int IDL_unaryop_chktypes (enum IDL_unaryop op, IDL_tree a)
{
	switch (op) {
	case IDL_UNARYOP_PLUS:
	case IDL_UNARYOP_MINUS:
		break;

	case IDL_UNARYOP_COMPLEMENT:
		if (IDL_NODE_TYPE (a) != IDLN_INTEGER &&
		    !(IDL_NODE_TYPE (a) == IDLN_BINOP ||
		      IDL_NODE_TYPE (a) == IDLN_UNARYOP)) {
			yyerror ("Operand to complement must be integer");
			return -1;
		}
		break;
	}

	return 0;
}

static IDL_tree IDL_binop_eval_integer (enum IDL_binop op, IDL_tree a, IDL_tree b)
{
	IDL_tree p = NULL;

	assert (IDL_NODE_TYPE (a) == IDLN_INTEGER);

	switch (op) {
	case IDL_BINOP_MULT:
		p = IDL_integer_new (IDL_INTEGER (a).value * IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_DIV:
		if (IDL_INTEGER (b).value == 0) {
			yyerror ("Divide by zero in constant expression");
			return NULL;
		}
		p = IDL_integer_new (IDL_INTEGER (a).value / IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_ADD:
		p = IDL_integer_new (IDL_INTEGER (a).value + IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_SUB:
		p = IDL_integer_new (IDL_INTEGER (a).value - IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_MOD:
		if (IDL_INTEGER (b).value == 0) {
			yyerror ("Modulo by zero in constant expression");
			return NULL;
		}
		p = IDL_integer_new (IDL_INTEGER (a).value % IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_SHR:
		p = IDL_integer_new (IDL_INTEGER (a).value >> IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_SHL:
		p = IDL_integer_new (IDL_INTEGER (a).value << IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_AND:
		p = IDL_integer_new (IDL_INTEGER (a).value & IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_OR:
		p = IDL_integer_new (IDL_INTEGER (a).value | IDL_INTEGER (b).value);
		break;

	case IDL_BINOP_XOR:
		p = IDL_integer_new (IDL_INTEGER (a).value ^ IDL_INTEGER (b).value);
		break;
	}

	return p;
}

static IDL_tree IDL_binop_eval_float (enum IDL_binop op, IDL_tree a, IDL_tree b)
{
	IDL_tree p = NULL;

	assert (IDL_NODE_TYPE (a) == IDLN_FLOAT);

	switch (op) {
	case IDL_BINOP_MULT:
		p = IDL_float_new (IDL_FLOAT (a).value * IDL_FLOAT (b).value);
		break;

	case IDL_BINOP_DIV:
		if (IDL_FLOAT (b).value == 0.0) {
			yyerror ("Divide by zero in constant expression");
			return NULL;
		}
		p = IDL_float_new (IDL_FLOAT (a).value / IDL_FLOAT (b).value);
		break;

	case IDL_BINOP_ADD:
		p = IDL_float_new (IDL_FLOAT (a).value + IDL_FLOAT (b).value);
		break;

	case IDL_BINOP_SUB:
		p = IDL_float_new (IDL_FLOAT (a).value - IDL_FLOAT (b).value);
		break;

	default:
		break;
	}

	return p;
}

static IDL_tree IDL_binop_eval (enum IDL_binop op, IDL_tree a, IDL_tree b)
{
	assert (IDL_NODE_TYPE (a) == IDL_NODE_TYPE (b));

	switch (IDL_NODE_TYPE (a)) {
	case IDLN_INTEGER: return IDL_binop_eval_integer (op, a, b);
	case IDLN_FLOAT: return IDL_binop_eval_float (op, a, b);
	default: return NULL;
	}
}

static IDL_tree IDL_unaryop_eval_integer (enum IDL_unaryop op, IDL_tree a)
{
	IDL_tree p = NULL;

	assert (IDL_NODE_TYPE (a) == IDLN_INTEGER);

	switch (op) {
	case IDL_UNARYOP_PLUS:
		p = IDL_integer_new (IDL_INTEGER (a).value);
		break;

	case IDL_UNARYOP_MINUS:
		p = IDL_integer_new (-IDL_INTEGER (a).value);
		break;

	case IDL_UNARYOP_COMPLEMENT:
		p = IDL_integer_new (~IDL_INTEGER (a).value);
		break;
	}
       
	return p;
}

static IDL_tree IDL_unaryop_eval_fixed (enum IDL_unaryop op, IDL_tree a)
{
	IDL_tree p = NULL;

	assert (IDL_NODE_TYPE (a) == IDLN_FIXED);

	switch (op) {
	case IDL_UNARYOP_PLUS:
		p = IDL_fixed_new (IDL_FIXED (a).value);
		break;

	default:
		break;
	}
       
	return p;
}

static IDL_tree IDL_unaryop_eval_float (enum IDL_unaryop op, IDL_tree a)
{
	IDL_tree p = NULL;

	assert (IDL_NODE_TYPE (a) == IDLN_FLOAT);

	switch (op) {
	case IDL_UNARYOP_PLUS:
		p = IDL_float_new (IDL_FLOAT (a).value);
		break;

	case IDL_UNARYOP_MINUS:
		p = IDL_float_new (-IDL_FLOAT (a).value);
		break;

	default:
		break;
	}
       
	return p;
}

static IDL_tree IDL_unaryop_eval (enum IDL_unaryop op, IDL_tree a)
{
	switch (IDL_NODE_TYPE (a)) {
	case IDLN_INTEGER: return IDL_unaryop_eval_integer (op, a);
	case IDLN_FIXED: return IDL_unaryop_eval_fixed (op, a);
	case IDLN_FLOAT: return IDL_unaryop_eval_float (op, a);
	default: return NULL;
	}
}

IDL_tree IDL_resolve_const_exp (IDL_tree p, IDL_tree_type type)
{
	gboolean resolved_value = FALSE, die = FALSE;
	gboolean wrong_type = FALSE;

	while (!resolved_value && !die) {
		if (IDL_NODE_TYPE (p) == IDLN_IDENT) {
			IDL_tree q = IDL_NODE_UP (p);
			
			assert (q != NULL);
			if (IDL_NODE_UP (q) &&
			    IDL_NODE_TYPE (IDL_NODE_UP (q)) == IDLN_TYPE_ENUM) {
				p = q;
				die = TRUE;
				break;
			} else if (IDL_NODE_TYPE (q) != IDLN_CONST_DCL) {
				p = q;
				wrong_type = TRUE;
				die = TRUE;
			} else
 				p = IDL_CONST_DCL (q).const_exp;
		}
		
		if (p == NULL ||
		    IDL_NODE_TYPE (p) == IDLN_BINOP ||
		    IDL_NODE_TYPE (p) == IDLN_UNARYOP) {
			die = TRUE;
			continue;
		}
		
		resolved_value = IDL_NODE_IS_LITERAL (p);
	}

	if (resolved_value &&
	    type != IDLN_ANY &&
	    IDL_NODE_TYPE (p) != type)
		wrong_type = TRUE;
	
	if (wrong_type) {
		yyerror ("Invalid type for constant");
		IDL_tree_error (p, "Previous resolved type declaration");
		return NULL;
	}

	return resolved_value ? p : NULL;
}

void IDL_queue_new_ident_comment (const char *str)
{
	g_return_if_fail (str != NULL);

	__IDL_new_ident_comments = g_slist_append (__IDL_new_ident_comments, g_strdup (str));
}

/*
 * Local variables:
 * mode: C
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 */
