/* A Bison parser, made by GNU Bison 1.875d.  */

/* Skeleton parser for Yacc-like parsing with Bison,
   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, 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.  */

/* Written by Richard Stallman by simplifying the original so called
   ``semantic'' parser.  */

/* All symbols defined below should begin with yy or YY, to avoid
   infringing on user name space.  This should be done even for local
   variables, as they might otherwise be expanded by user macros.
   There are some unavoidable exceptions within include files to
   define necessary library symbols; they are noted "INFRINGES ON
   USER NAME SPACE" below.  */

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

/* Skeleton name.  */
#define YYSKELETON_NAME "yacc.c"

/* Pure parsers.  */
#define YYPURE 0

/* Using locations.  */
#define YYLSP_NEEDED 0



/* Tokens.  */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
   /* Put the tokens into the symbol table, so that GDB and other debuggers
      know about them.  */
   enum yytokentype {
     TK_DOC = 258,
     TK_EXPORTEDDOC = 259,
     TK_MAKEFILE = 260,
     TK_ACCESSCODE = 261,
     TK_PREINITCODE = 262,
     TK_POSTINITCODE = 263,
     TK_MODCODE = 264,
     TK_TYPECODE = 265,
     TK_PREPYCODE = 266,
     TK_COPYING = 267,
     TK_MAPPEDTYPE = 268,
     TK_CODEBLOCK = 269,
     TK_IF = 270,
     TK_END = 271,
     TK_NAME = 272,
     TK_PATHNAME = 273,
     TK_STRING = 274,
     TK_VIRTUALCATCHERCODE = 275,
     TK_METHODCODE = 276,
     TK_FROMTYPE = 277,
     TK_TOTYPE = 278,
     TK_TOSUBCLASS = 279,
     TK_INCLUDE = 280,
     TK_OPTINCLUDE = 281,
     TK_IMPORT = 282,
     TK_MODHEADERCODE = 283,
     TK_TYPEHEADERCODE = 284,
     TK_MODULE = 285,
     TK_CMODULE = 286,
     TK_CLASS = 287,
     TK_STRUCT = 288,
     TK_PUBLIC = 289,
     TK_PROTECTED = 290,
     TK_PRIVATE = 291,
     TK_SIGNALS = 292,
     TK_SLOTS = 293,
     TK_BOOL = 294,
     TK_SHORT = 295,
     TK_INT = 296,
     TK_LONG = 297,
     TK_FLOAT = 298,
     TK_DOUBLE = 299,
     TK_CHAR = 300,
     TK_VOID = 301,
     TK_PYOBJECT = 302,
     TK_PYTUPLE = 303,
     TK_PYLIST = 304,
     TK_PYDICT = 305,
     TK_PYCALLABLE = 306,
     TK_PYSLICE = 307,
     TK_VIRTUAL = 308,
     TK_ENUM = 309,
     TK_UNSIGNED = 310,
     TK_SCOPE = 311,
     TK_LOGICAL_OR = 312,
     TK_CONST = 313,
     TK_STATIC = 314,
     TK_SIPSIGNAL = 315,
     TK_SIPSLOT = 316,
     TK_SIPRXCON = 317,
     TK_SIPRXDIS = 318,
     TK_SIPSLOTCON = 319,
     TK_SIPSLOTDIS = 320,
     TK_NUMBER = 321,
     TK_REAL = 322,
     TK_TYPEDEF = 323,
     TK_NAMESPACE = 324,
     TK_TIMELINE = 325,
     TK_PLATFORMS = 326,
     TK_FEATURE = 327,
     TK_LICENSE = 328,
     TK_QCHAR = 329,
     TK_TRUE = 330,
     TK_FALSE = 331,
     TK_OPERATOR = 332,
     TK_THROW = 333,
     TK_QOBJECT = 334
   };
#endif
#define TK_DOC 258
#define TK_EXPORTEDDOC 259
#define TK_MAKEFILE 260
#define TK_ACCESSCODE 261
#define TK_PREINITCODE 262
#define TK_POSTINITCODE 263
#define TK_MODCODE 264
#define TK_TYPECODE 265
#define TK_PREPYCODE 266
#define TK_COPYING 267
#define TK_MAPPEDTYPE 268
#define TK_CODEBLOCK 269
#define TK_IF 270
#define TK_END 271
#define TK_NAME 272
#define TK_PATHNAME 273
#define TK_STRING 274
#define TK_VIRTUALCATCHERCODE 275
#define TK_METHODCODE 276
#define TK_FROMTYPE 277
#define TK_TOTYPE 278
#define TK_TOSUBCLASS 279
#define TK_INCLUDE 280
#define TK_OPTINCLUDE 281
#define TK_IMPORT 282
#define TK_MODHEADERCODE 283
#define TK_TYPEHEADERCODE 284
#define TK_MODULE 285
#define TK_CMODULE 286
#define TK_CLASS 287
#define TK_STRUCT 288
#define TK_PUBLIC 289
#define TK_PROTECTED 290
#define TK_PRIVATE 291
#define TK_SIGNALS 292
#define TK_SLOTS 293
#define TK_BOOL 294
#define TK_SHORT 295
#define TK_INT 296
#define TK_LONG 297
#define TK_FLOAT 298
#define TK_DOUBLE 299
#define TK_CHAR 300
#define TK_VOID 301
#define TK_PYOBJECT 302
#define TK_PYTUPLE 303
#define TK_PYLIST 304
#define TK_PYDICT 305
#define TK_PYCALLABLE 306
#define TK_PYSLICE 307
#define TK_VIRTUAL 308
#define TK_ENUM 309
#define TK_UNSIGNED 310
#define TK_SCOPE 311
#define TK_LOGICAL_OR 312
#define TK_CONST 313
#define TK_STATIC 314
#define TK_SIPSIGNAL 315
#define TK_SIPSLOT 316
#define TK_SIPRXCON 317
#define TK_SIPRXDIS 318
#define TK_SIPSLOTCON 319
#define TK_SIPSLOTDIS 320
#define TK_NUMBER 321
#define TK_REAL 322
#define TK_TYPEDEF 323
#define TK_NAMESPACE 324
#define TK_TIMELINE 325
#define TK_PLATFORMS 326
#define TK_FEATURE 327
#define TK_LICENSE 328
#define TK_QCHAR 329
#define TK_TRUE 330
#define TK_FALSE 331
#define TK_OPERATOR 332
#define TK_THROW 333
#define TK_QOBJECT 334




/* Copy the first part of user declarations.  */
#line 16 "parser.y"

#include <stdlib.h>
#include <string.h>

#include "sip.h"


#define	MAX_NESTED_IF		10
#define	MAX_NESTED_SCOPE	10

#define	inMainModule()		(currentSpec -> module == currentModule)


static sipSpec *currentSpec;		/* The current spec being parsed. */
static stringList *neededQualifiers;	/* The list of required qualifiers. */
static stringList *excludedQualifiers;	/* The list of excluded qualifiers. */
static moduleDef *currentModule;	/* The current module being parsed. */
static mappedTypeDef *currentMappedType;	/* The current mapped type. */
static enumDef *currentEnum;		/* The current enum being parsed. */
static int sectionFlags;		/* The current section flags. */
static int currentOverIsVirt;		/* Set if the overload is virtual. */
static int currentIsStatic;		/* Set if the current is static. */
static char *previousFile;		/* The file just parsed. */
static parserContext newContext;	/* The new pending context. */
static int skipStackPtr;		/* The skip stack pointer. */
static int skipStack[MAX_NESTED_IF];	/* Stack of skip flags. */
static classDef *scopeStack[MAX_NESTED_SCOPE];	/* The scope stack. */
static int sectFlagsStack[MAX_NESTED_SCOPE];	/* The section flags stack. */
static int currentScopeIdx;		/* The scope stack index. */
static int currentTimelineOrder;	/* The current timeline order. */


static char *getPythonName(optFlags *optflgs, char *cname);
static nameDef *cacheName(sipSpec *,char *);
static ifaceFileDef *findIfaceFile(sipSpec *,scopedNameDef *,ifaceFileType,
				   argDef *);
static classDef *findClass(sipSpec *,ifaceFileType,scopedNameDef *);
static classDef *newClass(sipSpec *,ifaceFileType,scopedNameDef *);
static void finishClass(sipSpec *,classDef *,optFlags *);
static mappedTypeDef *newMappedType(sipSpec *,argDef *);
static enumDef *newEnum(sipSpec *,moduleDef *,char *,optFlags *,int);
static void newTypedef(sipSpec *,moduleDef *,char *,argDef *);
static void newVar(sipSpec *,moduleDef *,char *,int,argDef *,optFlags *,
		   codeBlock *);
static void newCtor(char *,int,signatureDef *,optFlags *,codeBlock *,
		    throwArgs *,signatureDef *);
static void newFunction(sipSpec *,moduleDef *,int,int,int,char *,
			signatureDef *,int,int,optFlags *,codeBlock *,
			codeBlock *,throwArgs *,signatureDef *);
static optFlag *findOptFlag(optFlags *,char *,flagType);
static memberDef *findFunction(sipSpec *,moduleDef *,classDef *,nameDef *,int,
			       int);
static void checkAttributes(sipSpec *,classDef *,char *,int);
static void newModule(FILE *,char *);
static void appendCodeBlock(codeBlock **,codeBlock *);
static void parseFile(FILE *,char *,moduleDef *,int);
static void handleEOF(void);
static void handleEOM(void);
static qualDef *findQualifier(char *);
static scopedNameDef *text2scopedName(char *);
static void pushScope(classDef *);
static void popScope(void);
static classDef *currentScope(void);
static void newQualifier(moduleDef *,int,int,char *,qualType);
static void newImport(char *);
static void usedInMainModule(sipSpec *,ifaceFileDef *);
static int timePeriod(char *,char *);
static int platOrFeature(char *,int);
static int isNeeded(qualDef *);
static int notSkipping(void);
static void getHooks(optFlags *,char **,char **);
static int getReleaseGIL(optFlags *);


/* Enabling traces.  */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif

/* Enabling verbose error messages.  */
#ifdef YYERROR_VERBOSE
# undef YYERROR_VERBOSE
# define YYERROR_VERBOSE 1
#else
# define YYERROR_VERBOSE 0
#endif

#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
#line 90 "parser.y"
typedef union YYSTYPE {
	char		qchar;
	char		*text;
	long		number;
	double		real;
	argDef		memArg;
	signatureDef	signature;
	signatureDef	*optsignature;
	throwArgs	*throwlist;
	codeBlock	*codeb;
	valueDef	value;
	valueDef	*valp;
	optFlags	optflags;
	optFlag		flag;
	scopedNameDef	*scpvalp;
	fcallDef	fcall;
	int		boolean;
} YYSTYPE;
/* Line 191 of yacc.c.  */
#line 327 "parser.c"
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif



/* Copy the second part of user declarations.  */


/* Line 214 of yacc.c.  */
#line 339 "parser.c"

#if ! defined (yyoverflow) || YYERROR_VERBOSE

# ifndef YYFREE
#  define YYFREE free
# endif
# ifndef YYMALLOC
#  define YYMALLOC malloc
# endif

/* The parser invokes alloca or malloc; define the necessary symbols.  */

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   define YYSTACK_ALLOC alloca
#  endif
# else
#  if defined (alloca) || defined (_ALLOCA_H)
#   define YYSTACK_ALLOC alloca
#  else
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   endif
#  endif
# endif

# ifdef YYSTACK_ALLOC
   /* Pacify GCC's `empty if-body' warning. */
#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# else
#  if defined (__STDC__) || defined (__cplusplus)
#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
#   define YYSIZE_T size_t
#  endif
#  define YYSTACK_ALLOC YYMALLOC
#  define YYSTACK_FREE YYFREE
# endif
#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */


#if (! defined (yyoverflow) \
     && (! defined (__cplusplus) \
	 || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))

/* A type that is properly aligned for any stack member.  */
union yyalloc
{
  short int yyss;
  YYSTYPE yyvs;
  };

/* The size of the maximum gap between one aligned stack and the next.  */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)

/* The size of an array large to enough to hold all stacks, each with
   N elements.  */
# define YYSTACK_BYTES(N) \
     ((N) * (sizeof (short int) + sizeof (YYSTYPE))			\
      + YYSTACK_GAP_MAXIMUM)

/* Copy COUNT objects from FROM to TO.  The source and destination do
   not overlap.  */
# ifndef YYCOPY
#  if defined (__GNUC__) && 1 < __GNUC__
#   define YYCOPY(To, From, Count) \
      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
#  else
#   define YYCOPY(To, From, Count)		\
      do					\
	{					\
	  register YYSIZE_T yyi;		\
	  for (yyi = 0; yyi < (Count); yyi++)	\
	    (To)[yyi] = (From)[yyi];		\
	}					\
      while (0)
#  endif
# endif

/* Relocate STACK from its old location to the new one.  The
   local variables YYSIZE and YYSTACKSIZE give the old and new number of
   elements in the stack, and YYPTR gives the new location of the
   stack.  Advance YYPTR to a properly aligned location for the next
   stack.  */
# define YYSTACK_RELOCATE(Stack)					\
    do									\
      {									\
	YYSIZE_T yynewbytes;						\
	YYCOPY (&yyptr->Stack, Stack, yysize);				\
	Stack = &yyptr->Stack;						\
	yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
	yyptr += yynewbytes / sizeof (*yyptr);				\
      }									\
    while (0)

#endif

#if defined (__STDC__) || defined (__cplusplus)
   typedef signed char yysigned_char;
#else
   typedef short int yysigned_char;
#endif

/* YYFINAL -- State number of the termination state. */
#define YYFINAL  4
/* YYLAST -- Last index in YYTABLE.  */
#define YYLAST   706

/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS  102
/* YYNNTS -- Number of nonterminals. */
#define YYNNTS  108
/* YYNRULES -- Number of rules. */
#define YYNRULES  282
/* YYNRULES -- Number of states. */
#define YYNSTATES  448

/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
#define YYUNDEFTOK  2
#define YYMAXUTOK   334

#define YYTRANSLATE(YYX) 						\
  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)

/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
static const unsigned 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,    85,     2,     2,     2,    98,    92,     2,
      83,    84,    90,    89,    87,    86,     2,    91,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,    95,    82,
     100,    88,   101,     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,    96,     2,    97,    99,     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,    80,    93,    81,    94,     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,    58,    59,    60,    61,    62,    63,    64,
      65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
      75,    76,    77,    78,    79
};

#if YYDEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
   YYRHS.  */
static const unsigned short int yyprhs[] =
{
       0,     0,     3,     5,     8,     9,    12,    14,    16,    18,
      20,    22,    24,    26,    28,    30,    32,    34,    36,    38,
      40,    42,    44,    46,    48,    50,    52,    54,    56,    58,
      60,    62,    64,    66,    68,    70,    71,    79,    81,    84,
      86,    89,    92,    93,   101,   103,   106,   107,   113,   115,
     118,   120,   123,   124,   130,   132,   135,   137,   142,   144,
     147,   151,   156,   158,   162,   164,   167,   171,   173,   175,
     176,   178,   181,   184,   187,   188,   191,   194,   197,   200,
     203,   206,   209,   212,   215,   218,   221,   226,   229,   230,
     239,   240,   242,   243,   245,   246,   248,   250,   253,   255,
     257,   262,   263,   265,   266,   269,   270,   273,   275,   279,
     281,   283,   285,   287,   289,   291,   292,   294,   296,   298,
     300,   303,   305,   309,   311,   313,   318,   320,   322,   324,
     326,   328,   330,   331,   333,   337,   342,   353,   357,   358,
     367,   368,   378,   379,   382,   384,   388,   390,   392,   395,
     397,   399,   401,   403,   405,   407,   409,   411,   413,   415,
     417,   419,   421,   424,   427,   431,   435,   439,   442,   443,
     445,   456,   466,   467,   473,   474,   481,   482,   484,   498,
     513,   515,   517,   519,   521,   523,   525,   527,   529,   532,
     535,   538,   541,   544,   547,   550,   553,   556,   559,   563,
     567,   569,   572,   575,   577,   580,   583,   586,   588,   591,
     592,   594,   595,   598,   599,   603,   605,   609,   611,   615,
     617,   619,   621,   622,   625,   626,   629,   631,   632,   634,
     638,   640,   642,   644,   646,   651,   656,   658,   661,   662,
     666,   668,   670,   672,   673,   677,   679,   685,   690,   694,
     697,   698,   700,   701,   704,   706,   711,   714,   717,   719,
     721,   724,   726,   728,   731,   733,   735,   737,   740,   742,
     744,   746,   748,   750,   752,   754,   756,   758,   762,   763,
     768,   769,   771
};

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

/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
static const unsigned short int yyrline[] =
{
       0,   235,   235,   236,   239,   239,   258,   259,   260,   261,
     262,   263,   264,   265,   266,   267,   271,   275,   276,   277,
     278,   279,   280,   281,   282,   285,   286,   287,   288,   289,
     290,   291,   292,   293,   294,   297,   297,   319,   320,   323,
     327,   336,   347,   347,   371,   372,   375,   375,   402,   403,
     406,   411,   416,   416,   441,   442,   445,   450,   465,   468,
     471,   474,   479,   480,   485,   491,   518,   537,   540,   546,
     549,   552,   557,   562,   567,   570,   575,   581,   586,   591,
     596,   601,   607,   613,   622,   628,   633,   639,   642,   642,
     653,   656,   661,   664,   669,   670,   673,   674,   677,   678,
     679,   708,   709,   712,   713,   716,   719,   724,   725,   743,
     746,   749,   752,   755,   758,   763,   766,   769,   772,   775,
     780,   798,   799,   807,   812,   822,   832,   836,   840,   844,
     848,   852,   858,   863,   869,   887,   891,   914,   936,   936,
     958,   958,   983,   984,   987,   988,   991,  1006,  1007,  1010,
    1011,  1012,  1013,  1014,  1015,  1016,  1017,  1018,  1022,  1026,
    1027,  1028,  1029,  1040,  1051,  1058,  1065,  1072,  1081,  1084,
    1089,  1121,  1137,  1140,  1147,  1150,  1158,  1161,  1166,  1183,
    1199,  1200,  1201,  1202,  1203,  1204,  1205,  1206,  1207,  1208,
    1209,  1210,  1211,  1212,  1213,  1214,  1215,  1216,  1217,  1218,
    1219,  1220,  1221,  1222,  1223,  1224,  1225,  1226,  1227,  1230,
    1233,  1238,  1241,  1249,  1252,  1258,  1262,  1274,  1278,  1284,
    1288,  1292,  1298,  1301,  1306,  1309,  1314,  1362,  1367,  1373,
    1405,  1412,  1419,  1426,  1433,  1447,  1461,  1466,  1472,  1472,
    1473,  1476,  1477,  1480,  1480,  1481,  1484,  1505,  1510,  1517,
    1570,  1573,  1581,  1584,  1589,  1593,  1603,  1616,  1619,  1622,
    1625,  1628,  1631,  1634,  1637,  1640,  1643,  1646,  1649,  1652,
    1655,  1658,  1661,  1664,  1667,  1670,  1675,  1681,  1699,  1702,
    1717,  1723,  1730
};
#endif

#if YYDEBUG || YYERROR_VERBOSE
/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
   First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
  "$end", "error", "$undefined", "TK_DOC", "TK_EXPORTEDDOC",
  "TK_MAKEFILE", "TK_ACCESSCODE", "TK_PREINITCODE", "TK_POSTINITCODE",
  "TK_MODCODE", "TK_TYPECODE", "TK_PREPYCODE", "TK_COPYING",
  "TK_MAPPEDTYPE", "TK_CODEBLOCK", "TK_IF", "TK_END", "TK_NAME",
  "TK_PATHNAME", "TK_STRING", "TK_VIRTUALCATCHERCODE", "TK_METHODCODE",
  "TK_FROMTYPE", "TK_TOTYPE", "TK_TOSUBCLASS", "TK_INCLUDE",
  "TK_OPTINCLUDE", "TK_IMPORT", "TK_MODHEADERCODE", "TK_TYPEHEADERCODE",
  "TK_MODULE", "TK_CMODULE", "TK_CLASS", "TK_STRUCT", "TK_PUBLIC",
  "TK_PROTECTED", "TK_PRIVATE", "TK_SIGNALS", "TK_SLOTS", "TK_BOOL",
  "TK_SHORT", "TK_INT", "TK_LONG", "TK_FLOAT", "TK_DOUBLE", "TK_CHAR",
  "TK_VOID", "TK_PYOBJECT", "TK_PYTUPLE", "TK_PYLIST", "TK_PYDICT",
  "TK_PYCALLABLE", "TK_PYSLICE", "TK_VIRTUAL", "TK_ENUM", "TK_UNSIGNED",
  "TK_SCOPE", "TK_LOGICAL_OR", "TK_CONST", "TK_STATIC", "TK_SIPSIGNAL",
  "TK_SIPSLOT", "TK_SIPRXCON", "TK_SIPRXDIS", "TK_SIPSLOTCON",
  "TK_SIPSLOTDIS", "TK_NUMBER", "TK_REAL", "TK_TYPEDEF", "TK_NAMESPACE",
  "TK_TIMELINE", "TK_PLATFORMS", "TK_FEATURE", "TK_LICENSE", "TK_QCHAR",
  "TK_TRUE", "TK_FALSE", "TK_OPERATOR", "TK_THROW", "TK_QOBJECT", "'{'",
  "'}'", "';'", "'('", "')'", "'!'", "'-'", "','", "'='", "'+'", "'*'",
  "'/'", "'&'", "'|'", "'~'", "':'", "'['", "']'", "'%'", "'^'", "'<'",
  "'>'", "$accept", "specification", "statement", "@1", "modstatement",
  "nsstatement", "mappedtype", "@2", "mtbody", "mtline", "namespace", "@3",
  "nsbody", "platforms", "@4", "platformlist", "platform", "feature",
  "timeline", "@5", "qualifierlist", "qualifiername", "ifstart",
  "oredqualifiers", "qualifiers", "ifend", "license", "module", "modlang",
  "optnumber", "include", "optinclude", "import", "optaccesscode",
  "copying", "modhdrcode", "typehdrcode", "modcode", "typecode",
  "preinitcode", "postinitcode", "prepycode", "doc", "exporteddoc",
  "makefile", "codeblock", "enum", "@6", "optfilename", "optname",
  "optenumbody", "enumbody", "enumline", "optcomma", "optenumassign",
  "optassign", "expr", "binop", "optunop", "value", "scopedname",
  "scopepart", "simplevalue", "valuelist", "typedef", "opaqueclass",
  "struct", "@7", "class", "@8", "superclasses", "superlist", "superclass",
  "classbody", "classline", "optslot", "dtor", "ctor", "optctorsig",
  "optsig", "optvirtual", "function", "operatorname", "optconst",
  "optabstract", "optflags", "flaglist", "flag", "flagvalue", "methodcode",
  "virtualcatchercode", "arglist", "rawarglist", "argvalue", "varmember",
  "@9", "varmem", "member", "@10", "variable", "cpptype", "argtype",
  "optref", "deref", "basetype", "cpptypelist", "optexceptions",
  "exceptionlist", 0
};
#endif

# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
   token YYLEX-NUM.  */
static const unsigned short int yytoknum[] =
{
       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
     285,   286,   287,   288,   289,   290,   291,   292,   293,   294,
     295,   296,   297,   298,   299,   300,   301,   302,   303,   304,
     305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
     315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
     325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
     123,   125,    59,    40,    41,    33,    45,    44,    61,    43,
      42,    47,    38,   124,   126,    58,    91,    93,    37,    94,
      60,    62
};
# endif

/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
static const unsigned char yyr1[] =
{
       0,   102,   103,   103,   105,   104,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   106,   106,   106,   106,   106,
     106,   106,   106,   106,   106,   107,   107,   107,   107,   107,
     107,   107,   107,   107,   107,   109,   108,   110,   110,   111,
     111,   111,   113,   112,   114,   114,   116,   115,   117,   117,
     118,   119,   121,   120,   122,   122,   123,   124,   125,   125,
     125,   125,   126,   126,   127,   128,   129,   130,   130,   131,
     131,   132,   133,   134,   135,   135,   136,   137,   138,   139,
     140,   141,   142,   143,   144,   145,   146,   147,   149,   148,
     150,   150,   151,   151,   152,   152,   153,   153,   154,   154,
     154,   155,   155,   156,   156,   157,   157,   158,   158,   159,
     159,   159,   159,   159,   159,   160,   160,   160,   160,   160,
     161,   162,   162,   163,   164,   164,   164,   164,   164,   164,
     164,   164,   165,   165,   165,   166,   166,   167,   169,   168,
     171,   170,   172,   172,   173,   173,   174,   175,   175,   176,
     176,   176,   176,   176,   176,   176,   176,   176,   176,   176,
     176,   176,   176,   176,   176,   176,   176,   176,   177,   177,
     178,   179,   180,   180,   181,   181,   182,   182,   183,   183,
     184,   184,   184,   184,   184,   184,   184,   184,   184,   184,
     184,   184,   184,   184,   184,   184,   184,   184,   184,   184,
     184,   184,   184,   184,   184,   184,   184,   184,   184,   185,
     185,   186,   186,   187,   187,   188,   188,   189,   189,   190,
     190,   190,   191,   191,   192,   192,   193,   194,   194,   194,
     195,   195,   195,   195,   195,   195,   195,   195,   197,   196,
     196,   198,   198,   200,   199,   199,   201,   202,   202,   203,
     204,   204,   205,   205,   206,   206,   206,   206,   206,   206,
     206,   206,   206,   206,   206,   206,   206,   206,   206,   206,
     206,   206,   206,   206,   206,   206,   207,   207,   208,   208,
     209,   209,   209
};

/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
static const unsigned char yyr2[] =
{
       0,     2,     1,     2,     0,     2,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     1,     1,     1,     0,     7,     1,     2,     1,
       2,     2,     0,     7,     1,     2,     0,     5,     1,     2,
       1,     2,     0,     5,     1,     2,     1,     4,     1,     2,
       3,     4,     1,     3,     1,     2,     3,     1,     1,     0,
       1,     2,     2,     2,     0,     2,     2,     2,     2,     2,
       2,     2,     2,     2,     2,     2,     4,     2,     0,     8,
       0,     1,     0,     1,     0,     1,     1,     2,     1,     1,
       4,     0,     1,     0,     2,     0,     2,     1,     3,     1,
       1,     1,     1,     1,     1,     0,     1,     1,     1,     1,
       2,     1,     3,     1,     1,     4,     1,     1,     1,     1,
       1,     1,     0,     1,     3,     4,    10,     3,     0,     8,
       0,     9,     0,     2,     1,     3,     1,     1,     2,     1,
       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
       1,     1,     2,     2,     3,     3,     3,     2,     0,     1,
      10,     9,     0,     5,     0,     6,     0,     1,    13,    14,
       1,     1,     1,     1,     1,     1,     1,     1,     2,     2,
       2,     2,     2,     2,     2,     2,     2,     2,     3,     3,
       1,     2,     2,     1,     2,     2,     2,     1,     2,     0,
       1,     0,     2,     0,     3,     1,     3,     1,     3,     1,
       1,     1,     0,     2,     0,     2,     1,     0,     1,     3,
       1,     1,     1,     1,     4,     4,     1,     2,     0,     3,
       1,     1,     1,     0,     3,     1,     5,     4,     3,     2,
       0,     1,     0,     2,     1,     4,     2,     2,     1,     1,
       2,     1,     1,     2,     1,     1,     1,     2,     1,     1,
       1,     1,     1,     1,     1,     1,     1,     3,     0,     4,
       0,     1,     3
};

/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
   means the default is an error.  */
static const unsigned short int yydefact[] =
{
       4,     4,     2,     0,     1,     3,     0,     0,     0,     0,
       0,     0,     0,     0,     0,     0,    64,   123,     0,     0,
       0,     0,    67,    68,     0,     0,   266,   258,   261,   262,
     264,   265,   268,   269,   270,   271,   272,   273,   274,   275,
      92,   259,     0,     0,     0,    52,    46,     0,   213,     5,
      24,    23,    27,    12,    13,    11,    25,    26,    14,     6,
       0,     8,     9,    10,     7,    15,    16,    17,    18,    19,
      20,    21,    22,    32,   254,   121,    31,    30,    28,    29,
      33,    34,     0,   252,     0,    84,    85,    90,    81,    82,
      79,    83,    76,     0,    35,    92,    71,    72,    73,    77,
     140,     0,   123,   256,    93,   213,   257,   260,   263,   267,
     252,     0,    42,     0,     0,    51,     0,    65,    69,     0,
       0,   213,     0,   250,    87,    91,     0,     0,    58,     0,
      62,     0,     0,   142,   137,   213,    88,   250,     0,   252,
       0,     0,     0,   217,     0,   215,    70,    66,   122,   276,
       0,   227,     0,     0,     0,   181,     0,   180,   182,   183,
     185,   186,   200,     0,   184,   187,   203,   207,     0,   253,
     251,   248,    86,     0,    59,     0,    57,    92,     0,   213,
       0,     0,   247,   135,     0,     0,    56,     0,    54,    50,
       0,    48,     0,     0,   214,     0,   255,   230,   231,   232,
     233,     0,     0,   236,     0,   226,   228,   213,   105,    74,
     201,   206,   191,   205,   190,   192,   193,   195,   196,   202,
     194,   197,   204,   188,   208,   189,   227,     0,     0,     0,
       0,    37,    39,    60,     0,    63,   146,   143,   144,     0,
     176,    94,     0,    44,     0,    53,    55,    47,    49,   219,
     220,   221,   218,   216,   277,   227,   227,   209,     0,   249,
     115,   237,     0,   246,   198,   199,     0,    40,    41,    78,
       0,    38,    61,     0,   176,     0,   123,     0,     0,   168,
     168,   168,     0,   243,   238,   151,   149,   150,   158,   157,
     156,   155,   154,   152,   153,   176,   147,   160,   159,     0,
     245,   161,   240,   241,   242,   103,    98,    99,     0,    95,
      96,     0,     0,    45,     0,     0,   210,   278,   229,   116,
     118,   119,   117,   106,     0,   107,    75,   209,    36,   145,
     176,    80,   227,   163,   162,   169,     0,     0,     0,   167,
       0,     0,     0,   148,     0,   115,   213,     0,    97,     0,
      43,   234,   235,     0,   211,   109,   110,   111,   112,   113,
     114,   115,   130,   127,   126,   131,   128,   129,   124,   120,
     278,     0,     0,   164,   165,   166,   244,     0,   243,   239,
     139,     0,   104,   101,    89,     0,   280,     0,   213,   108,
     115,   211,   141,   278,     0,     0,   102,   100,     0,   281,
       0,   212,   174,   133,     0,   213,   213,   278,   136,   279,
       0,     0,     0,   125,   115,   174,   172,   213,   282,     0,
     222,   134,     0,     0,     0,     0,   227,     0,   224,   222,
     227,   222,   222,     0,   223,     0,   178,   224,     0,   171,
     224,     0,   225,   179,     0,   170,   175,   173
};

/* YYDEFGOTO[NTERM-NUM]. */
static const short int yydefgoto[] =
{
      -1,     1,     2,     3,    49,    50,    51,   127,   230,   231,
     285,   140,   244,    53,   114,   190,   191,    54,    55,   113,
     187,   188,   286,   130,   131,   287,    58,    59,    60,   147,
      61,    62,    63,   263,    64,    65,   288,    66,   289,    67,
      68,    69,    70,    71,    72,    85,   290,   181,   126,   105,
     308,   309,   310,   397,   346,   261,   323,   361,   324,   325,
      74,    75,   369,   404,   291,   292,   293,   135,   294,   133,
     179,   237,   238,   295,   296,   336,   297,   298,   424,   412,
     299,   300,   168,   317,   388,   117,   144,   145,   252,   428,
     436,   204,   205,   206,   301,   341,   302,   303,   340,   304,
      82,   208,   171,   123,    83,   150,   354,   400
};

/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
   STATE-NUM.  */
#define YYPACT_NINF -337
static const short int yypact[] =
{
    -337,    51,  -337,   430,  -337,  -337,    42,    42,    48,    42,
      42,    42,    42,    42,   191,   -11,  -337,  -337,    65,    71,
      75,    42,  -337,  -337,    87,    88,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,
      94,   164,   191,   634,   100,  -337,  -337,   104,    31,  -337,
    -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,
     140,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,   -27,  -337,  -337,  -337,  -337,  -337,
    -337,  -337,    13,  -337,   147,  -337,  -337,   169,  -337,  -337,
    -337,  -337,  -337,   171,  -337,     7,  -337,  -337,  -337,  -337,
     -13,    -8,   -31,   151,  -337,    31,  -337,  -337,  -337,  -337,
    -337,    19,  -337,   130,   131,  -337,   195,  -337,   149,   171,
     634,   -15,   605,   106,  -337,  -337,    42,   137,   132,   202,
     168,   142,   143,   133,  -337,    31,  -337,   106,   162,  -337,
     165,   230,   246,   176,   -12,  -337,  -337,  -337,  -337,  -337,
     -37,   472,   183,   182,   179,   181,   184,   185,   186,   187,
     188,   189,  -337,   190,   192,   193,   -41,   -43,   196,  -337,
    -337,  -337,  -337,    58,  -337,    11,  -337,    94,   171,    31,
     198,   203,  -337,  -337,     5,   574,  -337,    22,  -337,  -337,
      29,  -337,    25,   195,  -337,   634,  -337,  -337,  -337,  -337,
    -337,   199,   201,  -337,   204,   205,  -337,    31,   197,   280,
    -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,   206,  -337,   207,   472,    42,    42,    42,
      32,  -337,  -337,  -337,   272,  -337,   151,   209,  -337,   211,
     529,   175,   213,  -337,   287,  -337,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,  -337,   472,   472,   241,   472,  -337,
      62,  -337,    42,  -337,  -337,  -337,   216,  -337,  -337,  -337,
     219,  -337,  -337,   171,   529,    42,   222,    42,    42,   268,
     268,   268,   214,   218,  -337,  -337,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,  -337,    91,  -337,  -337,  -337,   220,
    -337,  -337,  -337,  -337,  -337,   225,  -337,  -337,   234,   175,
    -337,   233,   239,  -337,   240,   256,  -337,   245,  -337,  -337,
    -337,  -337,  -337,    78,    99,  -337,  -337,   241,  -337,  -337,
     363,  -337,   472,  -337,  -337,  -337,   248,   251,   252,  -337,
     634,   613,   243,  -337,   331,    62,    31,   267,  -337,   634,
    -337,  -337,  -337,   269,   262,  -337,  -337,  -337,  -337,  -337,
    -337,    62,  -337,  -337,  -337,  -337,  -337,  -337,   -18,  -337,
     245,   271,   270,  -337,  -337,  -337,  -337,    20,  -337,  -337,
    -337,   274,  -337,   264,  -337,    -2,   171,   292,    31,  -337,
      92,   262,  -337,   245,   276,   277,  -337,  -337,   278,   151,
      74,  -337,   266,  -337,    96,    31,    31,   245,  -337,  -337,
     171,   634,   281,  -337,    62,   266,   275,    31,   151,   282,
     343,  -337,   284,   289,   285,   293,   472,    42,   354,   343,
     472,   343,   343,   297,  -337,    42,  -337,   354,   298,  -337,
     354,   279,  -337,  -337,   286,  -337,  -337,  -337
};

/* YYPGOTO[NTERM-NUM].  */
static const short int yypgoto[] =
{
    -337,  -337,   376,  -337,  -337,  -158,  -337,  -337,  -337,   155,
      10,  -337,  -337,  -337,  -337,  -337,   200,  -337,  -337,  -337,
    -337,   232,     8,  -337,  -337,     9,  -337,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,  -337,  -337,  -142,  -337,  -337,  -337,
    -337,  -337,  -337,  -337,  -337,    -7,    12,  -337,  -337,   -79,
    -337,  -337,    80,  -337,  -337,  -337,  -337,  -337,  -337,  -320,
     -16,   304,  -337,  -337,    14,    15,    16,  -337,    17,  -337,
    -337,  -337,   118,   119,  -263,  -181,  -337,  -337,  -337,   -14,
    -337,     4,  -337,    97,    34,   -95,  -337,   236,  -337,  -277,
    -255,  -203,  -337,   172,  -337,  -337,    85,  -337,  -337,    18,
     -42,  -337,   290,   -77,    21,   101,  -336,  -337
};

/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
   positive, shift that token.  If negative, reduce the rule which
   number is the opposite.  If zero, do what YYDEFACT says.
   If YYTABLE_NINF, syntax error.  */
#define YYTABLE_NINF -178
static const short int yytable[] =
{
      86,   111,    88,    89,    90,    91,    92,    80,   101,   103,
     136,    56,    57,    52,    99,    73,   132,    76,    77,    78,
      79,    81,   242,   266,   128,   382,   152,   243,   233,   119,
     121,   232,   343,   137,   391,    94,   138,   394,   119,   186,
     180,   389,   249,  -123,   250,   224,   189,   222,   119,  -138,
     195,     4,   314,   315,   227,   228,    84,   406,   225,   223,
    -138,   229,   184,   110,   196,   390,    87,   343,   151,  -123,
     403,   417,    95,   120,   134,   193,   116,   103,   149,   194,
     227,   228,   398,    96,   239,   195,   313,   229,   232,    97,
     122,   251,   129,    98,   421,   169,   234,   122,   235,   337,
     338,   275,   139,   245,   100,   102,    15,    16,   276,   207,
     247,   104,   259,   270,   277,   278,    17,   112,   362,   172,
     229,   115,   116,    24,    25,   279,   280,   281,   282,   372,
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
      36,    37,    38,    39,   283,    40,    41,   319,   320,    42,
     284,   321,   437,   254,   439,   440,   322,   118,   409,    43,
      44,   410,   236,   124,   355,   363,   364,   356,   357,   358,
     359,   360,   342,   365,   366,   367,  -132,   319,   320,  -132,
     413,   321,   443,   414,   207,   445,   322,   125,    17,    80,
      15,    16,   305,    56,    57,    52,   169,    73,   170,    76,
      77,    78,    79,    81,   106,   107,   108,   119,    17,   109,
     141,   142,   143,   207,   207,   146,   207,   173,   -93,   174,
     267,   268,   269,   433,    93,   175,   176,   438,   178,   177,
      26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
      36,    37,    38,    39,   183,   185,    41,   186,    80,   306,
     307,   383,    56,    57,    52,   326,    73,   236,    76,    77,
      78,    79,    81,   189,   192,   209,   210,   211,   331,   212,
     333,   334,   213,   214,   215,   216,   217,   218,   240,   226,
     220,   221,   255,   241,   256,   260,   262,   219,   257,   272,
     207,   274,   258,   402,   264,   265,   273,   311,   377,   316,
     327,   328,    15,    16,    17,   332,   335,   149,   368,   339,
     415,   416,  -177,   345,   344,   347,   349,   306,   307,    24,
      25,   350,   425,   353,   351,   380,    26,    27,    28,    29,
      30,    31,    32,    33,    34,    35,    36,    37,    38,    39,
     352,    40,    41,   373,   376,    42,   374,   375,   381,   384,
     387,   396,   386,   392,   393,    43,    44,   395,   401,   151,
     408,   407,   411,   420,   427,   426,   429,   431,   312,   419,
     399,   423,   430,   275,   435,   432,   446,     5,    15,    16,
     276,   441,   444,   447,   207,   271,   277,   278,   207,   348,
     248,   329,   229,   330,   418,    24,    25,   279,   280,   281,
     282,   422,    26,    27,    28,    29,    30,    31,    32,    33,
      34,    35,    36,    37,    38,    39,   283,    40,    41,   246,
     434,    42,   284,   148,   370,   405,   379,   182,   442,   253,
     318,    43,    44,     6,     7,     8,     0,     9,    10,    11,
       0,    12,    13,    14,   371,    15,    16,    17,     0,     0,
     385,     0,     0,     0,     0,    18,    19,    20,    21,     0,
      22,    23,    24,    25,     0,     0,     0,     0,     0,    26,
      27,    28,    29,    30,    31,    32,    33,    34,    35,    36,
      37,    38,    39,     0,    40,    41,     0,     0,    42,    17,
       0,     0,     0,     0,     0,     0,     0,     0,    43,    44,
      45,    46,    47,    48,     0,    93,     0,     0,     0,     0,
       0,    26,    27,    28,    29,    30,    31,    32,    33,    34,
      35,    36,    37,    38,    39,     0,     0,    41,     0,     0,
      42,     0,   197,   198,   199,   200,   201,   202,     0,   275,
       0,     0,     0,     0,    15,    16,   276,     0,     0,     0,
       0,   203,   277,   278,     0,     0,     0,     0,   229,     0,
       0,    24,    25,   279,   280,   281,   282,     0,    26,    27,
      28,    29,    30,    31,    32,    33,    34,    35,    36,    37,
      38,    39,   283,    40,    41,     0,     0,    42,   284,    15,
      16,    17,     0,     0,     0,     0,     0,    43,    44,     0,
       0,     0,     0,     0,     0,     0,    24,    25,     0,     0,
       0,     0,     0,    26,    27,    28,    29,    30,    31,    32,
      33,    34,    35,    36,    37,    38,    39,     0,    40,    41,
      17,     0,    42,     0,     0,     0,     0,     0,     0,     0,
       0,     0,    43,    44,     0,     0,    93,     0,     0,     0,
       0,    17,    26,    27,    28,    29,    30,    31,    32,    33,
      34,    35,    36,    37,    38,    39,   378,    93,    41,     0,
       0,    42,     0,    26,    27,    28,    29,    30,    31,    32,
      33,    34,    35,    36,    37,    38,    39,     0,   153,    41,
     154,   155,    42,   156,   157,   158,   159,   160,   161,   162,
       0,   163,     0,   164,   165,   166,   167
};

static const short int yycheck[] =
{
       7,    43,     9,    10,    11,    12,    13,     3,    24,    25,
     105,     3,     3,     3,    21,     3,    95,     3,     3,     3,
       3,     3,    17,   226,    17,   345,   121,   185,    17,    56,
      17,   173,   295,   110,   370,    14,    17,    17,    56,    17,
     135,   361,    17,    56,    19,    88,    17,    88,    56,    80,
      87,     0,   255,   256,    22,    23,    14,   393,   101,   100,
      91,    29,   139,    42,   101,    83,    18,   330,    83,    82,
     390,   407,    83,   100,    82,    87,    91,    93,   120,    91,
      22,    23,    84,    18,   179,    87,   244,    29,   230,    18,
      77,    66,    85,    18,   414,    90,    85,    77,   177,   280,
     281,    10,    83,    81,    17,    17,    15,    16,    17,   151,
      81,    17,   207,    81,    23,    24,    17,    17,    19,   126,
      29,    17,    91,    32,    33,    34,    35,    36,    37,   332,
      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
      49,    50,    51,    52,    53,    54,    55,    85,    86,    58,
      59,    89,   429,   195,   431,   432,    94,    17,    84,    68,
      69,    87,   178,    16,    86,    66,    67,    89,    90,    91,
      92,    93,    81,    74,    75,    76,    84,    85,    86,    87,
      84,    89,   437,    87,   226,   440,    94,    18,    17,   185,
      15,    16,    17,   185,   185,   185,    90,   185,    92,   185,
     185,   185,   185,   185,    40,    41,    42,    56,    17,    45,
      80,    80,    17,   255,   256,    66,   258,    80,    86,    17,
     227,   228,   229,   426,    33,    57,    84,   430,    95,    86,
      39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
      49,    50,    51,    52,    82,    80,    55,    17,   244,   241,
     241,   346,   244,   244,   244,   262,   244,   273,   244,   244,
     244,   244,   244,    17,    88,    82,    84,    88,   275,    88,
     277,   278,    88,    88,    88,    88,    88,    88,    80,    83,
      88,    88,    83,    80,    83,    88,     6,    97,    84,    17,
     332,    80,    87,   388,    88,    88,    87,    84,   340,    58,
      84,    82,    15,    16,    17,    83,    38,   349,   324,    95,
     405,   406,    94,    88,    94,    81,    83,   309,   309,    32,
      33,    82,   417,    78,    84,    82,    39,    40,    41,    42,
      43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
      84,    54,    55,    95,   340,    58,    95,    95,    17,    82,
      88,    87,    83,    82,    84,    68,    69,    83,    66,    83,
      82,    84,    96,    82,    21,    83,    82,    82,    81,   411,
     386,    96,    83,    10,    20,    82,    97,     1,    15,    16,
      17,    84,    84,    97,   426,   230,    23,    24,   430,   309,
     190,   273,    29,   274,   410,    32,    33,    34,    35,    36,
      37,   415,    39,    40,    41,    42,    43,    44,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    54,    55,   187,
     427,    58,    59,   119,   327,   391,   341,   137,   435,   193,
     258,    68,    69,     3,     4,     5,    -1,     7,     8,     9,
      -1,    11,    12,    13,    81,    15,    16,    17,    -1,    -1,
     349,    -1,    -1,    -1,    -1,    25,    26,    27,    28,    -1,
      30,    31,    32,    33,    -1,    -1,    -1,    -1,    -1,    39,
      40,    41,    42,    43,    44,    45,    46,    47,    48,    49,
      50,    51,    52,    -1,    54,    55,    -1,    -1,    58,    17,
      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    68,    69,
      70,    71,    72,    73,    -1,    33,    -1,    -1,    -1,    -1,
      -1,    39,    40,    41,    42,    43,    44,    45,    46,    47,
      48,    49,    50,    51,    52,    -1,    -1,    55,    -1,    -1,
      58,    -1,    60,    61,    62,    63,    64,    65,    -1,    10,
      -1,    -1,    -1,    -1,    15,    16,    17,    -1,    -1,    -1,
      -1,    79,    23,    24,    -1,    -1,    -1,    -1,    29,    -1,
      -1,    32,    33,    34,    35,    36,    37,    -1,    39,    40,
      41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
      51,    52,    53,    54,    55,    -1,    -1,    58,    59,    15,
      16,    17,    -1,    -1,    -1,    -1,    -1,    68,    69,    -1,
      -1,    -1,    -1,    -1,    -1,    -1,    32,    33,    -1,    -1,
      -1,    -1,    -1,    39,    40,    41,    42,    43,    44,    45,
      46,    47,    48,    49,    50,    51,    52,    -1,    54,    55,
      17,    -1,    58,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
      -1,    -1,    68,    69,    -1,    -1,    33,    -1,    -1,    -1,
      -1,    17,    39,    40,    41,    42,    43,    44,    45,    46,
      47,    48,    49,    50,    51,    52,    53,    33,    55,    -1,
      -1,    58,    -1,    39,    40,    41,    42,    43,    44,    45,
      46,    47,    48,    49,    50,    51,    52,    -1,    83,    55,
      85,    86,    58,    88,    89,    90,    91,    92,    93,    94,
      -1,    96,    -1,    98,    99,   100,   101
};

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

#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
# define YYSIZE_T __SIZE_TYPE__
#endif
#if ! defined (YYSIZE_T) && defined (size_t)
# define YYSIZE_T size_t
#endif
#if ! defined (YYSIZE_T)
# if defined (__STDC__) || defined (__cplusplus)
#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
#  define YYSIZE_T size_t
# endif
#endif
#if ! defined (YYSIZE_T)
# define YYSIZE_T unsigned int
#endif

#define yyerrok		(yyerrstatus = 0)
#define yyclearin	(yychar = YYEMPTY)
#define YYEMPTY		(-2)
#define YYEOF		0

#define YYACCEPT	goto yyacceptlab
#define YYABORT		goto yyabortlab
#define YYERROR		goto yyerrorlab


/* 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);						\
      yytoken = YYTRANSLATE (yychar);				\
      YYPOPSTACK;						\
      goto yybackup;						\
    }								\
  else								\
    { 								\
      yyerror ("syntax error: cannot back up");\
      YYERROR;							\
    }								\
while (0)

#define YYTERROR	1
#define YYERRCODE	256

/* YYLLOC_DEFAULT -- Compute the default location (before the actions
   are run).  */

#ifndef YYLLOC_DEFAULT
# define YYLLOC_DEFAULT(Current, Rhs, N)		\
   ((Current).first_line   = (Rhs)[1].first_line,	\
    (Current).first_column = (Rhs)[1].first_column,	\
    (Current).last_line    = (Rhs)[N].last_line,	\
    (Current).last_column  = (Rhs)[N].last_column)
#endif

/* YYLEX -- calling `yylex' with the right arguments.  */

#ifdef YYLEX_PARAM
# define YYLEX yylex (YYLEX_PARAM)
#else
# define YYLEX yylex ()
#endif

/* Enable debugging if requested.  */
#if YYDEBUG

# ifndef YYFPRINTF
#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
#  define YYFPRINTF fprintf
# endif

# define YYDPRINTF(Args)			\
do {						\
  if (yydebug)					\
    YYFPRINTF Args;				\
} while (0)

# define YYDSYMPRINT(Args)			\
do {						\
  if (yydebug)					\
    yysymprint Args;				\
} while (0)

# define YYDSYMPRINTF(Title, Token, Value, Location)		\
do {								\
  if (yydebug)							\
    {								\
      YYFPRINTF (stderr, "%s ", Title);				\
      yysymprint (stderr, 					\
                  Token, Value);	\
      YYFPRINTF (stderr, "\n");					\
    }								\
} while (0)

/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
| TOP (included).                                                   |
`------------------------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_stack_print (short int *bottom, short int *top)
#else
static void
yy_stack_print (bottom, top)
    short int *bottom;
    short int *top;
#endif
{
  YYFPRINTF (stderr, "Stack now");
  for (/* Nothing. */; bottom <= top; ++bottom)
    YYFPRINTF (stderr, " %d", *bottom);
  YYFPRINTF (stderr, "\n");
}

# define YY_STACK_PRINT(Bottom, Top)				\
do {								\
  if (yydebug)							\
    yy_stack_print ((Bottom), (Top));				\
} while (0)


/*------------------------------------------------.
| Report that the YYRULE is going to be reduced.  |
`------------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yy_reduce_print (int yyrule)
#else
static void
yy_reduce_print (yyrule)
    int yyrule;
#endif
{
  int yyi;
  unsigned int yylno = yyrline[yyrule];
  YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ",
             yyrule - 1, yylno);
  /* Print the symbols being reduced, and their result.  */
  for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++)
    YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]);
  YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]);
}

# define YY_REDUCE_PRINT(Rule)		\
do {					\
  if (yydebug)				\
    yy_reduce_print (Rule);		\
} while (0)

/* Nonzero means print parse trace.  It is left uninitialized so that
   multiple parsers can coexist.  */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
# define YYDSYMPRINT(Args)
# define YYDSYMPRINTF(Title, Token, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */


/* YYINITDEPTH -- initial size of the parser's stacks.  */
#ifndef	YYINITDEPTH
# define YYINITDEPTH 200
#endif

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

   Do not make this value too large; the results are undefined if
   SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
   evaluated with infinite-precision integer arithmetic.  */

#if defined (YYMAXDEPTH) && YYMAXDEPTH == 0
# undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif



#if YYERROR_VERBOSE

# ifndef yystrlen
#  if defined (__GLIBC__) && defined (_STRING_H)
#   define yystrlen strlen
#  else
/* Return the length of YYSTR.  */
static YYSIZE_T
#   if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
#   else
yystrlen (yystr)
     const char *yystr;
#   endif
{
  register const char *yys = yystr;

  while (*yys++ != '\0')
    continue;

  return yys - yystr - 1;
}
#  endif
# endif

# ifndef yystpcpy
#  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
#   define yystpcpy stpcpy
#  else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
   YYDEST.  */
static char *
#   if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
#   else
yystpcpy (yydest, yysrc)
     char *yydest;
     const char *yysrc;
#   endif
{
  register char *yyd = yydest;
  register const char *yys = yysrc;

  while ((*yyd++ = *yys++) != '\0')
    continue;

  return yyd - 1;
}
#  endif
# endif

#endif /* !YYERROR_VERBOSE */



#if YYDEBUG
/*--------------------------------.
| Print this symbol on YYOUTPUT.  |
`--------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep)
#else
static void
yysymprint (yyoutput, yytype, yyvaluep)
    FILE *yyoutput;
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  if (yytype < YYNTOKENS)
    {
      YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
# ifdef YYPRINT
      YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# endif
    }
  else
    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);

  switch (yytype)
    {
      default:
        break;
    }
  YYFPRINTF (yyoutput, ")");
}

#endif /* ! YYDEBUG */
/*-----------------------------------------------.
| Release the memory associated to this symbol.  |
`-----------------------------------------------*/

#if defined (__STDC__) || defined (__cplusplus)
static void
yydestruct (int yytype, YYSTYPE *yyvaluep)
#else
static void
yydestruct (yytype, yyvaluep)
    int yytype;
    YYSTYPE *yyvaluep;
#endif
{
  /* Pacify ``unused variable'' warnings.  */
  (void) yyvaluep;

  switch (yytype)
    {

      default:
        break;
    }
}


/* Prevent warnings from -Wmissing-prototypes.  */

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM);
# else
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int yyparse (void);
#else
int yyparse ();
#endif
#endif /* ! YYPARSE_PARAM */



/* The lookahead symbol.  */
int yychar;

/* The semantic value of the lookahead symbol.  */
YYSTYPE yylval;

/* Number of syntax errors so far.  */
int yynerrs;



/*----------.
| yyparse.  |
`----------*/

#ifdef YYPARSE_PARAM
# if defined (__STDC__) || defined (__cplusplus)
int yyparse (void *YYPARSE_PARAM)
# else
int yyparse (YYPARSE_PARAM)
  void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
#if defined (__STDC__) || defined (__cplusplus)
int
yyparse (void)
#else
int
yyparse ()

#endif
#endif
{
  
  register int yystate;
  register int yyn;
  int yyresult;
  /* Number of tokens to shift before error messages enabled.  */
  int yyerrstatus;
  /* Lookahead token as an internal (translated) token number.  */
  int yytoken = 0;

  /* Three stacks and their tools:
     `yyss': related to states,
     `yyvs': related to semantic values,
     `yyls': related to locations.

     Refer to the stacks thru separate pointers, to allow yyoverflow
     to reallocate them elsewhere.  */

  /* The state stack.  */
  short int yyssa[YYINITDEPTH];
  short int *yyss = yyssa;
  register short int *yyssp;

  /* The semantic value stack.  */
  YYSTYPE yyvsa[YYINITDEPTH];
  YYSTYPE *yyvs = yyvsa;
  register YYSTYPE *yyvsp;



#define YYPOPSTACK   (yyvsp--, yyssp--)

  YYSIZE_T yystacksize = YYINITDEPTH;

  /* The variables used to return semantic value and location from the
     action routines.  */
  YYSTYPE yyval;


  /* When reducing, the number of symbols on the RHS of the reduced
     rule.  */
  int yylen;

  YYDPRINTF ((stderr, "Starting parse\n"));

  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;
  yyvsp = yyvs;


  goto yysetstate;

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

 yysetstate:
  *yyssp = yystate;

  if (yyss + yystacksize - 1 <= yyssp)
    {
      /* Get the current used size of the three stacks, in elements.  */
      YYSIZE_T yysize = yyssp - yyss + 1;

#ifdef yyoverflow
      {
	/* 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 int *yyss1 = yyss;


	/* Each stack pointer address is followed by the size of the
	   data in use in that stack, in bytes.  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, yysize * sizeof (*yyssp),
		    &yyvs1, yysize * sizeof (*yyvsp),

		    &yystacksize);

	yyss = yyss1;
	yyvs = yyvs1;
      }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
      goto yyoverflowlab;
# else
      /* Extend the stack our own way.  */
      if (YYMAXDEPTH <= yystacksize)
	goto yyoverflowlab;
      yystacksize *= 2;
      if (YYMAXDEPTH < yystacksize)
	yystacksize = YYMAXDEPTH;

      {
	short int *yyss1 = yyss;
	union yyalloc *yyptr =
	  (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
	if (! yyptr)
	  goto yyoverflowlab;
	YYSTACK_RELOCATE (yyss);
	YYSTACK_RELOCATE (yyvs);

#  undef YYSTACK_RELOCATE
	if (yyss1 != yyssa)
	  YYSTACK_FREE (yyss1);
      }
# endif
#endif /* no yyoverflow */

      yyssp = yyss + yysize - 1;
      yyvsp = yyvs + yysize - 1;


      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
		  (unsigned long int) yystacksize));

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

  YYDPRINTF ((stderr, "Entering state %d\n", yystate));

  goto yybackup;

/*-----------.
| 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 == YYPACT_NINF)
    goto yydefault;

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

  /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
  if (yychar == YYEMPTY)
    {
      YYDPRINTF ((stderr, "Reading a token: "));
      yychar = YYLEX;
    }

  if (yychar <= YYEOF)
    {
      yychar = yytoken = YYEOF;
      YYDPRINTF ((stderr, "Now at end of input.\n"));
    }
  else
    {
      yytoken = YYTRANSLATE (yychar);
      YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
    }

  /* If the proper action on seeing token YYTOKEN is to reduce or to
     detect an error, take that action.  */
  yyn += yytoken;
  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
    goto yydefault;
  yyn = yytable[yyn];
  if (yyn <= 0)
    {
      if (yyn == 0 || yyn == YYTABLE_NINF)
	goto yyerrlab;
      yyn = -yyn;
      goto yyreduce;
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */
  YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken]));

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

  *++yyvsp = yylval;


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

  yystate = yyn;
  goto yynewstate;


/*-----------------------------------------------------------.
| yydefault -- do the default action for the current state.  |
`-----------------------------------------------------------*/
yydefault:
  yyn = yydefact[yystate];
  if (yyn == 0)
    goto yyerrlab;
  goto yyreduce;


/*-----------------------------.
| yyreduce -- Do a reduction.  |
`-----------------------------*/
yyreduce:
  /* yyn is the number of a rule to reduce with.  */
  yylen = yyr2[yyn];

  /* If YYLEN is nonzero, implement the default value of the action:
     `$$ = $1'.

     Otherwise, the following line sets YYVAL to garbage.
     This behavior is undocumented and Bison
     users should not rely upon it.  Assigning to YYVAL
     unconditionally makes the parser a bit smaller, and it avoids a
     GCC warning that YYVAL may be used uninitialized.  */
  yyval = yyvsp[1-yylen];


  YY_REDUCE_PRINT (yyn);
  switch (yyn)
    {
        case 4:
#line 239 "parser.y"
    {
			/*
			 * We don't do these in parserEOF() because the parser
			 * is reading ahead and that would be too early.
			 */

			if (previousFile != NULL)
			{
				handleEOF();

				if (newContext.prevmod != NULL)
					handleEOM();

				free(previousFile);
				previousFile = NULL;
			}
	}
    break;

  case 15:
#line 267 "parser.y"
    {
			if (notSkipping() && inMainModule())
				appendCodeBlock(&currentSpec -> hdrcode,yyvsp[0].codeb);
		}
    break;

  case 16:
#line 271 "parser.y"
    {
			if (notSkipping() && inMainModule())
				appendCodeBlock(&currentSpec -> cppcode,yyvsp[0].codeb);
		}
    break;

  case 35:
#line 297 "parser.y"
    {
			if (notSkipping())
			{
				yyvsp[0].memArg.nrderefs = 0;
				yyvsp[0].memArg.argflags = 0;

				currentMappedType = newMappedType(currentSpec,&yyvsp[0].memArg);
			}
		}
    break;

  case 36:
#line 305 "parser.y"
    {
			if (notSkipping())
			{
				if (currentMappedType -> convfromcode == NULL)
					yyerror("%MappedType must have a %ConvertFromTypeCode directive");

				if (currentMappedType -> convtocode == NULL)
					yyerror("%MappedType must have a %ConvertToTypeCode directive");

				currentMappedType = NULL;
			}
		}
    break;

  case 39:
#line 323 "parser.y"
    {
			if (notSkipping())
				appendCodeBlock(&currentMappedType -> hdrcode,yyvsp[0].codeb);
		}
    break;

  case 40:
#line 327 "parser.y"
    {
			if (notSkipping())
			{
				if (currentMappedType -> convfromcode != NULL)
					yyerror("%MappedType has more than one %ConvertFromTypeCode directive");

				currentMappedType -> convfromcode = yyvsp[0].codeb;
			}
		}
    break;

  case 41:
#line 336 "parser.y"
    {
			if (notSkipping())
			{
				if (currentMappedType -> convtocode != NULL)
					yyerror("%MappedType has more than one %ConvertToTypeCode directive");

				currentMappedType -> convtocode = yyvsp[0].codeb;
			}
		}
    break;

  case 42:
#line 347 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("namespace definition not allowed in a C module");

			if (notSkipping())
			{
				classDef *ns;

				ns = newClass(currentSpec,namespace_iface,text2scopedName(yyvsp[0].text));

				setCannotCreate(ns);

				pushScope(ns);

				sectionFlags = 0;
			}
		}
    break;

  case 43:
#line 363 "parser.y"
    {
			/* Remove the namespace name. */

			if (notSkipping())
				popScope();
		}
    break;

  case 46:
#line 375 "parser.y"
    {
			qualDef *qd;

			for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next)
				if (qd -> qtype == platform_qualifier)
					yyerror("%Platforms has already been defined for this module");
		}
    break;

  case 47:
#line 382 "parser.y"
    {
			qualDef *qd;
			int nrneeded;

			/*
			 * Check that exactly one platform in the set was
			 * requested.
			 */

			nrneeded = 0;

			for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next)
				if (qd -> qtype == platform_qualifier && isNeeded(qd))
					++nrneeded;

			if (nrneeded != 1)
				yyerror("Exactly one of these %Platforms must be specified with the -t flag");
		}
    break;

  case 50:
#line 406 "parser.y"
    {
			newQualifier(currentModule,-1,-1,yyvsp[0].text,platform_qualifier);
		}
    break;

  case 51:
#line 411 "parser.y"
    {
			newQualifier(currentModule,-1,-1,yyvsp[0].text,feature_qualifier);
		}
    break;

  case 52:
#line 416 "parser.y"
    {
			currentTimelineOrder = 0;
		}
    break;

  case 53:
#line 419 "parser.y"
    {
			qualDef *qd;
			int nrneeded;

			/*
			 * Check that exactly one time slot in the set was
			 * requested.
			 */

			nrneeded = 0;

			for (qd = currentModule -> qualifiers; qd != NULL; qd = qd -> next)
				if (qd -> qtype == time_qualifier && isNeeded(qd))
					++nrneeded;

			if (nrneeded != 1)
				yyerror("Exactly one of this %Timeline must be specified with the -t flag");

			currentModule -> nrtimelines++;
		}
    break;

  case 56:
#line 445 "parser.y"
    {
			newQualifier(currentModule,currentModule -> nrtimelines,currentTimelineOrder++,yyvsp[0].text,time_qualifier);
		}
    break;

  case 57:
#line 450 "parser.y"
    {
			int skipNext;

			if (skipStackPtr >= MAX_NESTED_IF)
				yyerror("Internal error: increase the value of MAX_NESTED_IF");

			/* Nested %Ifs are implicit logical ands. */

			if (skipStackPtr > 0)
				yyvsp[-1].boolean = (yyvsp[-1].boolean && skipStack[skipStackPtr - 1]);

			skipStack[skipStackPtr++] = yyvsp[-1].boolean;
		}
    break;

  case 58:
#line 465 "parser.y"
    {
			yyval.boolean = platOrFeature(yyvsp[0].text,FALSE);
		}
    break;

  case 59:
#line 468 "parser.y"
    {
			yyval.boolean = platOrFeature(yyvsp[0].text,TRUE);
		}
    break;

  case 60:
#line 471 "parser.y"
    {
			yyval.boolean = (platOrFeature(yyvsp[0].text,FALSE) || yyvsp[-2].boolean);
		}
    break;

  case 61:
#line 474 "parser.y"
    {
			yyval.boolean = (platOrFeature(yyvsp[0].text,TRUE) || yyvsp[-3].boolean);
		}
    break;

  case 63:
#line 480 "parser.y"
    {
			yyval.boolean = timePeriod(yyvsp[-2].text,yyvsp[0].text);
		}
    break;

  case 64:
#line 485 "parser.y"
    {
			if (skipStackPtr-- <= 0)
				yyerror("Too many %End directives");
		}
    break;

  case 65:
#line 491 "parser.y"
    {
			optFlag *of;

			if (yyvsp[0].optflags.nrFlags == 0)
				yyerror("%License details not specified");

			if ((of = findOptFlag(&yyvsp[0].optflags,"Type",string_flag)) == NULL)
				yyerror("%License type not specified");

			currentModule -> license = sipMalloc(sizeof (licenseDef));

			currentModule -> license -> type = of -> fvalue.sval;

			currentModule -> license -> licensee = 
				((of = findOptFlag(&yyvsp[0].optflags,"Licensee",string_flag)) != NULL)
					? of -> fvalue.sval : NULL;

			currentModule -> license -> timestamp = 
				((of = findOptFlag(&yyvsp[0].optflags,"Timestamp",string_flag)) != NULL)
					? of -> fvalue.sval : NULL;

			currentModule -> license -> sig = 
				((of = findOptFlag(&yyvsp[0].optflags,"Signature",string_flag)) != NULL)
					? of -> fvalue.sval : NULL;
		}
    break;

  case 66:
#line 518 "parser.y"
    {
			/* Check the module hasn't already been defined. */

			moduleDef *mod;

			for (mod = currentSpec -> modules; mod != NULL; mod = mod -> next)
				if (mod -> name != NULL && strcmp(mod -> name,yyvsp[-1].text) == 0)
					yyerror("Module is already defined");

			currentModule -> name = yyvsp[-1].text;
			currentModule -> version = yyvsp[0].number;

			if (currentSpec -> genc < 0)
				currentSpec -> genc = yyvsp[-2].boolean;
			else if (currentSpec -> genc != yyvsp[-2].boolean)
				yyerror("Cannot mix C and C++ modules");
		}
    break;

  case 67:
#line 537 "parser.y"
    {
			yyval.boolean = FALSE;
		}
    break;

  case 68:
#line 540 "parser.y"
    {
			yyval.boolean = TRUE;
		}
    break;

  case 69:
#line 546 "parser.y"
    {
			yyval.number = -1;
		}
    break;

  case 71:
#line 552 "parser.y"
    {
			parseFile(NULL,yyvsp[0].text,NULL,FALSE);
		}
    break;

  case 72:
#line 557 "parser.y"
    {
			parseFile(NULL,yyvsp[0].text,NULL,TRUE);
		}
    break;

  case 73:
#line 562 "parser.y"
    {
			newImport(yyvsp[0].text);
		}
    break;

  case 74:
#line 567 "parser.y"
    {
			yyval.codeb = NULL;
		}
    break;

  case 75:
#line 570 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 76:
#line 575 "parser.y"
    {
			if (inMainModule())
				appendCodeBlock(&currentSpec -> copying,yyvsp[0].codeb);
		}
    break;

  case 77:
#line 581 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 78:
#line 586 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 79:
#line 591 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 80:
#line 596 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 81:
#line 601 "parser.y"
    {
			if (notSkipping() && inMainModule())
				appendCodeBlock(&currentSpec -> preinitcode,yyvsp[0].codeb);
		}
    break;

  case 82:
#line 607 "parser.y"
    {
			if (notSkipping() && inMainModule())
				appendCodeBlock(&currentSpec -> postinitcode,yyvsp[0].codeb);
		}
    break;

  case 83:
#line 613 "parser.y"
    {
			/*
			 * This is a no-op and is retained for compatibility
			 * until the last use of it (by SIP v3) can be removed
			 * from PyQt.
			 */
		}
    break;

  case 84:
#line 622 "parser.y"
    {
			if (inMainModule())
				appendCodeBlock(&currentSpec -> docs,yyvsp[0].codeb);
		}
    break;

  case 85:
#line 628 "parser.y"
    {
			appendCodeBlock(&currentSpec -> docs,yyvsp[0].codeb);
		}
    break;

  case 86:
#line 633 "parser.y"
    {
			if (inMainModule())
				yywarning("%Makefile is ignored, please use the -b flag instead");
		}
    break;

  case 88:
#line 642 "parser.y"
    {
			if (notSkipping())
			{
				if (sectionFlags != 0 && (sectionFlags & ~(SECT_IS_PUBLIC | SECT_IS_PROT)) != 0)
					yyerror("Class enums must be in the public or protected sections");

				currentEnum = newEnum(currentSpec,currentModule,yyvsp[-1].text,&yyvsp[0].optflags,sectionFlags);
			}
		}
    break;

  case 90:
#line 653 "parser.y"
    {
			yyval.text = NULL;
		}
    break;

  case 91:
#line 656 "parser.y"
    {
			yyval.text = yyvsp[0].text;
		}
    break;

  case 92:
#line 661 "parser.y"
    {
			yyval.text = NULL;
		}
    break;

  case 93:
#line 664 "parser.y"
    {
			yyval.text = yyvsp[0].text;
		}
    break;

  case 100:
#line 679 "parser.y"
    {
			if (notSkipping())
			{
				/*
				 * Note that we don't use the assigned value.
				 * This is a hangover from when enums where
				 * generated in Python.  We can remove it when
				 * we have got around to updating all the .sip
				 * files.
				 */
				enumMemberDef *emd;

				emd = sipMalloc(sizeof (enumMemberDef));

				emd -> pyname = cacheName(currentSpec, getPythonName(&yyvsp[-1].optflags, yyvsp[-3].text));
				emd -> cname = yyvsp[-3].text;
				emd -> ed = currentEnum;

				checkAttributes(currentSpec,emd -> ed -> ecd,emd -> pyname -> text,FALSE);

				emd -> next = currentEnum -> members;
				currentEnum -> members = emd;

				if (inMainModule())
					setIsUsedName(emd -> pyname);
			}
		}
    break;

  case 105:
#line 716 "parser.y"
    {
			yyval.valp = NULL;
		}
    break;

  case 106:
#line 719 "parser.y"
    {
			yyval.valp = yyvsp[0].valp;
		}
    break;

  case 108:
#line 725 "parser.y"
    {
			valueDef *vd;
 
			if (yyvsp[-2].valp -> vtype == string_value || yyvsp[0].valp -> vtype == string_value)
				yyerror("Invalid binary operator for string");
 
			/* Find the last value in the existing expression. */
 
			for (vd = yyvsp[-2].valp; vd -> next != NULL; vd = vd -> next)
				;
 
			vd -> vbinop = yyvsp[-1].qchar;
			vd -> next = yyvsp[0].valp;

			yyval.valp = yyvsp[-2].valp;
		}
    break;

  case 109:
#line 743 "parser.y"
    {
			yyval.qchar = '-';
		}
    break;

  case 110:
#line 746 "parser.y"
    {
			yyval.qchar = '+';
		}
    break;

  case 111:
#line 749 "parser.y"
    {
			yyval.qchar = '*';
		}
    break;

  case 112:
#line 752 "parser.y"
    {
			yyval.qchar = '/';
		}
    break;

  case 113:
#line 755 "parser.y"
    {
			yyval.qchar = '&';
		}
    break;

  case 114:
#line 758 "parser.y"
    {
			yyval.qchar = '|';
		}
    break;

  case 115:
#line 763 "parser.y"
    {
			yyval.qchar = '\0';
		}
    break;

  case 116:
#line 766 "parser.y"
    {
			yyval.qchar = '!';
		}
    break;

  case 117:
#line 769 "parser.y"
    {
			yyval.qchar = '~';
		}
    break;

  case 118:
#line 772 "parser.y"
    {
			yyval.qchar = '-';
		}
    break;

  case 119:
#line 775 "parser.y"
    {
			yyval.qchar = '+';
		}
    break;

  case 120:
#line 780 "parser.y"
    {
			if (yyvsp[-1].qchar != '\0' && yyvsp[0].value.vtype == string_value)
				yyerror("Invalid unary operator for string");
 
			/*
			 * Convert the value to a simple expression on the
			 * heap.
			 */
 
			yyval.valp = sipMalloc(sizeof (valueDef));
 
			*yyval.valp = yyvsp[0].value;
			yyval.valp -> vunop = yyvsp[-1].qchar;
			yyval.valp -> vbinop = '\0';
			yyval.valp -> next = NULL;
		}
    break;

  case 122:
#line 799 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("Scoped names are not allowed in a C module");

			appendScopedName(&yyvsp[-2].scpvalp,yyvsp[0].scpvalp);
		}
    break;

  case 123:
#line 807 "parser.y"
    {
			yyval.scpvalp = text2scopePart(yyvsp[0].text);
		}
    break;

  case 124:
#line 812 "parser.y"
    {
			/*
			 * We let the C++ compiler decide if the value is a
			 * valid one - no point in building a full C++ parser
			 * here.
			 */

			yyval.value.vtype = scoped_value;
			yyval.value.u.vscp = yyvsp[0].scpvalp;
		}
    break;

  case 125:
#line 822 "parser.y"
    {
			fcallDef *fcd;

			fcd = sipMalloc(sizeof (fcallDef));
			*fcd = yyvsp[-1].fcall;
			fcd -> name = yyvsp[-3].scpvalp;

			yyval.value.vtype = fcall_value;
			yyval.value.u.fcd = fcd;
		}
    break;

  case 126:
#line 832 "parser.y"
    {
			yyval.value.vtype = real_value;
			yyval.value.u.vreal = yyvsp[0].real;
		}
    break;

  case 127:
#line 836 "parser.y"
    {
			yyval.value.vtype = numeric_value;
			yyval.value.u.vnum = yyvsp[0].number;
		}
    break;

  case 128:
#line 840 "parser.y"
    {
			yyval.value.vtype = numeric_value;
			yyval.value.u.vnum = 1;
		}
    break;

  case 129:
#line 844 "parser.y"
    {
			yyval.value.vtype = numeric_value;
			yyval.value.u.vnum = 0;
		}
    break;

  case 130:
#line 848 "parser.y"
    {
			yyval.value.vtype = string_value;
			yyval.value.u.vstr = yyvsp[0].text;
		}
    break;

  case 131:
#line 852 "parser.y"
    {
			yyval.value.vtype = qchar_value;
			yyval.value.u.vqchar = yyvsp[0].qchar;
		}
    break;

  case 132:
#line 858 "parser.y"
    {
			/* No values. */

			yyval.fcall.nrArgs = 0;
		}
    break;

  case 133:
#line 863 "parser.y"
    {
			/* The single or first value. */

			yyval.fcall.args[0] = yyvsp[0].valp;
			yyval.fcall.nrArgs = 1;
		}
    break;

  case 134:
#line 869 "parser.y"
    {
			/* Check that it wasn't ...(,value...). */

			if (yyval.fcall.nrArgs == 0)
				yyerror("First argument to function call is missing");

			/* Check there is room. */

			if (yyvsp[-2].fcall.nrArgs == MAX_NR_ARGS)
				yyerror("Too many arguments to function call");

			yyval.fcall = yyvsp[-2].fcall;

			yyval.fcall.args[yyval.fcall.nrArgs] = yyvsp[0].valp;
			yyval.fcall.nrArgs++;
		}
    break;

  case 135:
#line 887 "parser.y"
    {
			if (notSkipping())
				newTypedef(currentSpec,currentModule,yyvsp[-1].text,&yyvsp[-2].memArg);
		}
    break;

  case 136:
#line 891 "parser.y"
    {
			if (notSkipping())
			{
				argDef ftype;
				signatureDef *sig;

				/* Create the full signature on the heap. */
				sig = sipMalloc(sizeof (signatureDef));
				*sig = yyvsp[-2].signature;
				sig -> result = yyvsp[-8].memArg;

				/* Create the full type. */
				ftype.atype = function_type;
				ftype.argflags = 0;
				ftype.nrderefs = yyvsp[-6].number;
				ftype.defval = NULL;
				ftype.u.sa = sig;

				newTypedef(currentSpec,currentModule,yyvsp[-5].text,&ftype);
			}
		}
    break;

  case 137:
#line 914 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("class definition not allowed in a C module");

			if (notSkipping())
			{
				classDef *cd;

				cd = newClass(currentSpec,class_iface,yyvsp[-1].scpvalp);

				setCannotCreate(cd);
				setIsOpaque(cd);

				if (inMainModule())
				{
					setIsUsedName(cd -> iff -> name);
					setIsClassName(cd -> iff -> name);
				}
			}
		}
    break;

  case 138:
#line 936 "parser.y"
    {
			if (notSkipping())
			{
				classDef *cd;

				cd = newClass(currentSpec,class_iface,text2scopedName(yyvsp[0].text));

				setCannotCreate(cd);

				pushScope(cd);

				sectionFlags = SECT_IS_PUBLIC;
			}
		}
    break;

  case 139:
#line 949 "parser.y"
    {
			if (notSkipping())
			{
				finishClass(currentSpec,currentScope(),&yyvsp[-4].optflags);
				popScope();
			}
		}
    break;

  case 140:
#line 958 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("class definition not allowed in a C module");

			if (notSkipping())
			{
				classDef *cd;

				cd = newClass(currentSpec,class_iface,text2scopedName(yyvsp[0].text));

				setCannotCreate(cd);

				pushScope(cd);

				sectionFlags = SECT_IS_PRIVATE;
			}
		}
    break;

  case 141:
#line 974 "parser.y"
    {
			if (notSkipping())
			{
				finishClass(currentSpec,currentScope(),&yyvsp[-4].optflags);
				popScope();
			}
		}
    break;

  case 146:
#line 991 "parser.y"
    {
			if (notSkipping())
			{
				classDef *cd, *super;

				cd = currentScope();

				super = findClass(currentSpec,class_iface,yyvsp[0].scpvalp);

				appendToClassList(&cd -> supers,super);
				addToUsedList(&cd -> iff -> used,super -> iff);
			}
		}
    break;

  case 157:
#line 1018 "parser.y"
    {
			if (notSkipping())
				appendCodeBlock(&currentScope() -> cppcode,yyvsp[0].codeb);
		}
    break;

  case 158:
#line 1022 "parser.y"
    {
			if (notSkipping())
				appendCodeBlock(&currentScope() -> hdrcode,yyvsp[0].codeb);
		}
    break;

  case 162:
#line 1029 "parser.y"
    {
			if (notSkipping())
			{
				classDef *cd = currentScope();

				if (cd -> convtosubcode != NULL)
					yyerror("Class has more than one %ConvertToSubClassCode directive");

				cd -> convtosubcode = yyvsp[0].codeb;
			}
		}
    break;

  case 163:
#line 1040 "parser.y"
    {
			if (notSkipping())
			{
				classDef *cd = currentScope();

				if (cd -> convtocode != NULL)
					yyerror("Class has more than one %ConvertToTypeCode directive");

				cd -> convtocode = yyvsp[0].codeb;
			}
		}
    break;

  case 164:
#line 1051 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("public section not allowed in a C module");

			if (notSkipping())
				sectionFlags = SECT_IS_PUBLIC | yyvsp[-1].number;
		}
    break;

  case 165:
#line 1058 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("protected section not allowed in a C module");

			if (notSkipping())
				sectionFlags = SECT_IS_PROT | yyvsp[-1].number;
		}
    break;

  case 166:
#line 1065 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("private section not allowed in a C module");

			if (notSkipping())
				sectionFlags = SECT_IS_PRIVATE | yyvsp[-1].number;
		}
    break;

  case 167:
#line 1072 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("signals section not allowed in a C module");

			if (notSkipping())
				sectionFlags = SECT_IS_SIGNAL;
		}
    break;

  case 168:
#line 1081 "parser.y"
    {
			yyval.number = 0;
		}
    break;

  case 169:
#line 1084 "parser.y"
    {
			yyval.number = SECT_IS_SLOT;
		}
    break;

  case 170:
#line 1089 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("C++ destructor not allowed in a C module");

			if (notSkipping())
			{
				classDef *cd = currentScope();

				if (strcmp(classBaseName(cd),yyvsp[-7].text) != 0)
					yyerror("Destructor doesn't have the same name as its class");

				if (isDtor(cd))
					yyerror("Destructor has already been defined");

				cd -> dealloccode = yyvsp[-1].codeb;
				cd -> dtorcode = yyvsp[0].codeb;
				cd -> dtorexceptions = yyvsp[-4].throwlist;
				cd -> classflags |= sectionFlags;

				/*
				 * Make the class complex if we have a virtual
				 * dtor or some dtor code.
				 */
				if (yyvsp[-9].number || yyvsp[-1].codeb != NULL)
					setIsComplex(cd);

				if (getReleaseGIL(&yyvsp[-3].optflags))
					setIsReleaseGILDtor(cd);
			}
		}
    break;

  case 171:
#line 1121 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("C++ constructor not allowed in a C module");

			if (notSkipping())
			{
				if ((sectionFlags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE)) == 0)
					yyerror("Constructor must be in the public, private or protected sections");

				newCtor(yyvsp[-8].text,sectionFlags,&yyvsp[-6].signature,&yyvsp[-3].optflags,yyvsp[0].codeb,yyvsp[-4].throwlist,yyvsp[-2].optsignature);
			}

			free(yyvsp[-8].text);
		}
    break;

  case 172:
#line 1137 "parser.y"
    {
			yyval.optsignature = NULL;
		}
    break;

  case 173:
#line 1140 "parser.y"
    {
			yyval.optsignature = sipMalloc(sizeof (signatureDef));

			*yyval.optsignature = yyvsp[-2].signature;
		}
    break;

  case 174:
#line 1147 "parser.y"
    {
			yyval.optsignature = NULL;
		}
    break;

  case 175:
#line 1150 "parser.y"
    {
			yyval.optsignature = sipMalloc(sizeof (signatureDef));

			*yyval.optsignature = yyvsp[-2].signature;
			yyval.optsignature -> result = yyvsp[-4].memArg;
		}
    break;

  case 176:
#line 1158 "parser.y"
    {
			yyval.number = FALSE;
		}
    break;

  case 177:
#line 1161 "parser.y"
    {
			yyval.number = TRUE;
		}
    break;

  case 178:
#line 1166 "parser.y"
    {
			if (notSkipping())
			{
				if (sectionFlags != 0 && (sectionFlags & (SECT_IS_PUBLIC | SECT_IS_PROT | SECT_IS_PRIVATE | SECT_IS_SLOT | SECT_IS_SIGNAL)) == 0)
					yyerror("Class function must be in the public, private, protected, slot or signal sections");

				yyvsp[-9].signature.result = yyvsp[-12].memArg;

				newFunction(currentSpec,currentModule,
					    sectionFlags,currentIsStatic,
					    currentOverIsVirt,
					    yyvsp[-11].text,&yyvsp[-9].signature,yyvsp[-7].number,yyvsp[-5].number,&yyvsp[-4].optflags,yyvsp[-1].codeb,yyvsp[0].codeb,yyvsp[-6].throwlist,yyvsp[-3].optsignature);
			}

			currentIsStatic = FALSE;
			currentOverIsVirt = FALSE;
		}
    break;

  case 179:
#line 1183 "parser.y"
    {
			if (notSkipping())
			{
				yyvsp[-9].signature.result = yyvsp[-13].memArg;

				newFunction(currentSpec,currentModule,
					    sectionFlags,currentIsStatic,
					    currentOverIsVirt,
					    yyvsp[-11].text,&yyvsp[-9].signature,yyvsp[-7].number,yyvsp[-5].number,&yyvsp[-4].optflags,yyvsp[-1].codeb,yyvsp[0].codeb,yyvsp[-6].throwlist,yyvsp[-3].optsignature);
			}

			currentIsStatic = FALSE;
			currentOverIsVirt = FALSE;
		}
    break;

  case 180:
#line 1199 "parser.y"
    {yyval.text = "__add__";}
    break;

  case 181:
#line 1200 "parser.y"
    {yyval.text = "__sub__";}
    break;

  case 182:
#line 1201 "parser.y"
    {yyval.text = "__mul__";}
    break;

  case 183:
#line 1202 "parser.y"
    {yyval.text = "__div__";}
    break;

  case 184:
#line 1203 "parser.y"
    {yyval.text = "__mod__";}
    break;

  case 185:
#line 1204 "parser.y"
    {yyval.text = "__and__";}
    break;

  case 186:
#line 1205 "parser.y"
    {yyval.text = "__or__";}
    break;

  case 187:
#line 1206 "parser.y"
    {yyval.text = "__xor__";}
    break;

  case 188:
#line 1207 "parser.y"
    {yyval.text = "__lshift__";}
    break;

  case 189:
#line 1208 "parser.y"
    {yyval.text = "__rshift__";}
    break;

  case 190:
#line 1209 "parser.y"
    {yyval.text = "__iadd__";}
    break;

  case 191:
#line 1210 "parser.y"
    {yyval.text = "__isub__";}
    break;

  case 192:
#line 1211 "parser.y"
    {yyval.text = "__imul__";}
    break;

  case 193:
#line 1212 "parser.y"
    {yyval.text = "__idiv__";}
    break;

  case 194:
#line 1213 "parser.y"
    {yyval.text = "__imod__";}
    break;

  case 195:
#line 1214 "parser.y"
    {yyval.text = "__iand__";}
    break;

  case 196:
#line 1215 "parser.y"
    {yyval.text = "__ior__";}
    break;

  case 197:
#line 1216 "parser.y"
    {yyval.text = "__ixor__";}
    break;

  case 198:
#line 1217 "parser.y"
    {yyval.text = "__ilshift__";}
    break;

  case 199:
#line 1218 "parser.y"
    {yyval.text = "__irshift__";}
    break;

  case 200:
#line 1219 "parser.y"
    {yyval.text = "__invert__";}
    break;

  case 201:
#line 1220 "parser.y"
    {yyval.text = "__call__";}
    break;

  case 202:
#line 1221 "parser.y"
    {yyval.text = "__getitem__";}
    break;

  case 203:
#line 1222 "parser.y"
    {yyval.text = "__lt__";}
    break;

  case 204:
#line 1223 "parser.y"
    {yyval.text = "__le__";}
    break;

  case 205:
#line 1224 "parser.y"
    {yyval.text = "__eq__";}
    break;

  case 206:
#line 1225 "parser.y"
    {yyval.text = "__ne__";}
    break;

  case 207:
#line 1226 "parser.y"
    {yyval.text = "__gt__";}
    break;

  case 208:
#line 1227 "parser.y"
    {yyval.text = "__ge__";}
    break;

  case 209:
#line 1230 "parser.y"
    {
			yyval.number = FALSE;
		}
    break;

  case 210:
#line 1233 "parser.y"
    {
			yyval.number = TRUE;
		}
    break;

  case 211:
#line 1238 "parser.y"
    {
			yyval.number = 0;
		}
    break;

  case 212:
#line 1241 "parser.y"
    {
			if (yyvsp[0].number != 0)
				yyerror("Abstract virtual function '= 0' expected");

			yyval.number = TRUE;
		}
    break;

  case 213:
#line 1249 "parser.y"
    {
			yyval.optflags.nrFlags = 0;
		}
    break;

  case 214:
#line 1252 "parser.y"
    {
			yyval.optflags = yyvsp[-1].optflags;
		}
    break;

  case 215:
#line 1258 "parser.y"
    {
			yyval.optflags.flags[0] = yyvsp[0].flag;
			yyval.optflags.nrFlags = 1;
		}
    break;

  case 216:
#line 1262 "parser.y"
    {
			/* Check there is room. */

			if (yyvsp[-2].optflags.nrFlags == MAX_NR_FLAGS)
				yyerror("Too many optional flags");

			yyval.optflags = yyvsp[-2].optflags;

			yyval.optflags.flags[yyval.optflags.nrFlags++] = yyvsp[0].flag;
		}
    break;

  case 217:
#line 1274 "parser.y"
    {
			yyval.flag.ftype = bool_flag;
			yyval.flag.fname = yyvsp[0].text;
		}
    break;

  case 218:
#line 1278 "parser.y"
    {
			yyval.flag = yyvsp[0].flag;
			yyval.flag.fname = yyvsp[-2].text;
		}
    break;

  case 219:
#line 1284 "parser.y"
    {
			yyval.flag.ftype = name_flag;
			yyval.flag.fvalue.sval = yyvsp[0].text;
		}
    break;

  case 220:
#line 1288 "parser.y"
    {
			yyval.flag.ftype = string_flag;
			yyval.flag.fvalue.sval = yyvsp[0].text;
		}
    break;

  case 221:
#line 1292 "parser.y"
    {
			yyval.flag.ftype = integer_flag;
			yyval.flag.fvalue.ival = yyvsp[0].number;
		}
    break;

  case 222:
#line 1298 "parser.y"
    {
			yyval.codeb = NULL;
		}
    break;

  case 223:
#line 1301 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 224:
#line 1306 "parser.y"
    {
			yyval.codeb = NULL;
		}
    break;

  case 225:
#line 1309 "parser.y"
    {
			yyval.codeb = yyvsp[0].codeb;
		}
    break;

  case 226:
#line 1314 "parser.y"
    {
			int a, nrrxcon, nrrxdis, nrslotcon, nrslotdis, nrarray, nrarraysize;

			nrrxcon = nrrxdis = nrslotcon = nrslotdis = nrarray = nrarraysize = 0;

			for (a = 0; a < yyvsp[0].signature.nrArgs; ++a)
			{
				argDef *ad = &yyvsp[0].signature.args[a];

				switch (ad -> atype)
				{
				case rxcon_type:
					++nrrxcon;
					break;

				case rxdis_type:
					++nrrxdis;
					break;

				case slotcon_type:
					++nrslotcon;
					break;

				case slotdis_type:
					++nrslotdis;
					break;
				}

				if (isArray(ad))
					++nrarray;

				if (isArraySize(ad))
					++nrarraysize;
			}

			if (nrrxcon != nrslotcon || nrrxcon > 1)
				yyerror("SIP_RXOBJ_CON and SIP_SLOT_CON must both be given and at most once");

			if (nrrxdis != nrslotdis || nrrxdis > 1)
				yyerror("SIP_RXOBJ_DIS and SIP_SLOT_DIS must both be given and at most once");

			if (nrarray != nrarraysize || nrarray > 1)
				yyerror("/Array/ and /ArraySize/ must both be given and at most once");

			yyval.signature = yyvsp[0].signature;
		}
    break;

  case 227:
#line 1362 "parser.y"
    {
			/* No arguments. */

			yyval.signature.nrArgs = 0;
		}
    break;

  case 228:
#line 1367 "parser.y"
    {
			/* The single or first argument. */

			yyval.signature.args[0] = yyvsp[0].memArg;
			yyval.signature.nrArgs = 1;
		}
    break;

  case 229:
#line 1373 "parser.y"
    {
			/* Check that it wasn't ...(,arg...). */

			if (yyvsp[-2].signature.nrArgs == 0)
				yyerror("First argument of list is missing");

			/*
			 * If this argument has no default value, then all
			 * previous ones mustn't either.
			 */

			if (yyvsp[0].memArg.defval == NULL)
			{
				int a;

				for (a = 0; a < yyvsp[-2].signature.nrArgs; ++a)
					if (yyvsp[-2].signature.args[a].defval != NULL)
						yyerror("Compulsory argument given after optional argument");
			}

			/* Check there is room. */

			if (yyvsp[-2].signature.nrArgs == MAX_NR_ARGS)
				yyerror("Internal error - increase the value of MAX_NR_ARGS");

			yyval.signature = yyvsp[-2].signature;

			yyval.signature.args[yyval.signature.nrArgs] = yyvsp[0].memArg;
			yyval.signature.nrArgs++;
		}
    break;

  case 230:
#line 1405 "parser.y"
    {
			yyval.memArg.atype = signal_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 231:
#line 1412 "parser.y"
    {
			yyval.memArg.atype = slot_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 232:
#line 1419 "parser.y"
    {
			yyval.memArg.atype = rxcon_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 233:
#line 1426 "parser.y"
    {
			yyval.memArg.atype = rxdis_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 234:
#line 1433 "parser.y"
    {
			yyval.memArg.atype = slotcon_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			yyvsp[-1].signature.result.atype = void_type;
			yyvsp[-1].signature.result.argflags = 0;
			yyvsp[-1].signature.result.nrderefs = 0;

			yyval.memArg.u.sa = sipMalloc(sizeof (signatureDef));
			*yyval.memArg.u.sa = yyvsp[-1].signature;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 235:
#line 1447 "parser.y"
    {
			yyval.memArg.atype = slotdis_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;

			yyvsp[-1].signature.result.atype = void_type;
			yyvsp[-1].signature.result.argflags = 0;
			yyvsp[-1].signature.result.nrderefs = 0;

			yyval.memArg.u.sa = sipMalloc(sizeof (signatureDef));
			*yyval.memArg.u.sa = yyvsp[-1].signature;

			currentSpec -> sigslots = TRUE;
		}
    break;

  case 236:
#line 1461 "parser.y"
    {
			yyval.memArg.atype = qobject_type;
			yyval.memArg.argflags = 0;
			yyval.memArg.nrderefs = 0;
		}
    break;

  case 237:
#line 1466 "parser.y"
    {
			yyval.memArg = yyvsp[-1].memArg;
			yyval.memArg.defval = yyvsp[0].valp;
		}
    break;

  case 238:
#line 1472 "parser.y"
    {currentIsStatic = TRUE;}
    break;

  case 243:
#line 1480 "parser.y"
    {currentOverIsVirt = TRUE;}
    break;

  case 246:
#line 1484 "parser.y"
    {
			if (notSkipping())
			{
				/* Check the section. */

				if (sectionFlags != 0)
				{
					if ((sectionFlags & SECT_IS_PUBLIC) == 0)
						yyerror("Class variables must be in the public section");

					if (!currentIsStatic && yyvsp[0].codeb != NULL)
						yyerror("%AccessCode cannot be specified for non-static class variables");
				}

				newVar(currentSpec,currentModule,yyvsp[-3].text,currentIsStatic,&yyvsp[-4].memArg,&yyvsp[-2].optflags,yyvsp[0].codeb);
			}

			currentIsStatic = FALSE;
		}
    break;

  case 247:
#line 1505 "parser.y"
    {
			yyval.memArg = yyvsp[-2].memArg;
			yyval.memArg.nrderefs = yyvsp[-1].number;
			yyval.memArg.argflags = ARG_IS_CONST | yyvsp[0].number;
		}
    break;

  case 248:
#line 1510 "parser.y"
    {
			yyval.memArg = yyvsp[-2].memArg;
			yyval.memArg.nrderefs = yyvsp[-1].number;
			yyval.memArg.argflags = yyvsp[0].number;
		}
    break;

  case 249:
#line 1517 "parser.y"
    {
			yyval.memArg = yyvsp[-1].memArg;

			if (findOptFlag(&yyvsp[0].optflags,"AllowNone",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_ALLOW_NONE;

			if (findOptFlag(&yyvsp[0].optflags,"GetWrapper",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_GET_WRAPPER;

			if (findOptFlag(&yyvsp[0].optflags,"Array",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_ARRAY;

			if (findOptFlag(&yyvsp[0].optflags,"ArraySize",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_ARRAY_SIZE;

			if (findOptFlag(&yyvsp[0].optflags,"Transfer",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_XFERRED;

			if (findOptFlag(&yyvsp[0].optflags,"TransferThis",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_THIS_XFERRED;

			if (findOptFlag(&yyvsp[0].optflags,"TransferBack",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_XFERRED_BACK;

			if (findOptFlag(&yyvsp[0].optflags,"In",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_IN;

			if (findOptFlag(&yyvsp[0].optflags,"Out",bool_flag) != NULL)
				yyval.memArg.argflags |= ARG_OUT;

			if (findOptFlag(&yyvsp[0].optflags,"Constrained",bool_flag) != NULL)
			{
				switch (yyval.memArg.atype)
				{
				case int_type:
					yyval.memArg.atype = cint_type;
					break;

				case float_type:
					yyval.memArg.atype = cfloat_type;
					break;

				case double_type:
					yyval.memArg.atype = cdouble_type;
					break;

				default:
					yyerror("/Constrained/ may not be specified for this type");
				}
			}
		}
    break;

  case 250:
#line 1570 "parser.y"
    {
			yyval.number = 0;
		}
    break;

  case 251:
#line 1573 "parser.y"
    {
			if (currentSpec -> genc)
				yyerror("References not allowed in a C module");

			yyval.number = ARG_IS_REF;
		}
    break;

  case 252:
#line 1581 "parser.y"
    {
			yyval.number = 0;
		}
    break;

  case 253:
#line 1584 "parser.y"
    {
			yyval.number = yyvsp[-1].number + 1;
		}
    break;

  case 254:
#line 1589 "parser.y"
    {
			yyval.memArg.atype = defined_type;
			yyval.memArg.u.snd = yyvsp[0].scpvalp;
		}
    break;

  case 255:
#line 1593 "parser.y"
    {
			templateDef *td;

			td = sipMalloc(sizeof(templateDef));
			td -> fqname = yyvsp[-3].scpvalp;
			td -> types = yyvsp[-1].signature;

			yyval.memArg.atype = template_type;
			yyval.memArg.u.td = td;
		}
    break;

  case 256:
#line 1603 "parser.y"
    {
			/* In a C module all structures must be defined. */
			if (currentSpec -> genc)
			{
				yyval.memArg.atype = defined_type;
				yyval.memArg.u.snd = yyvsp[0].scpvalp;
			}
			else
			{
				yyval.memArg.atype = struct_type;
				yyval.memArg.u.sname = yyvsp[0].scpvalp;
			}
		}
    break;

  case 257:
#line 1616 "parser.y"
    {
			yyval.memArg.atype = ushort_type;
		}
    break;

  case 258:
#line 1619 "parser.y"
    {
			yyval.memArg.atype = short_type;
		}
    break;

  case 259:
#line 1622 "parser.y"
    {
			yyval.memArg.atype = uint_type;
		}
    break;

  case 260:
#line 1625 "parser.y"
    {
			yyval.memArg.atype = uint_type;
		}
    break;

  case 261:
#line 1628 "parser.y"
    {
			yyval.memArg.atype = int_type;
		}
    break;

  case 262:
#line 1631 "parser.y"
    {
			yyval.memArg.atype = long_type;
		}
    break;

  case 263:
#line 1634 "parser.y"
    {
			yyval.memArg.atype = ulong_type;
		}
    break;

  case 264:
#line 1637 "parser.y"
    {
			yyval.memArg.atype = float_type;
		}
    break;

  case 265:
#line 1640 "parser.y"
    {
			yyval.memArg.atype = double_type;
		}
    break;

  case 266:
#line 1643 "parser.y"
    {
			yyval.memArg.atype = bool_type;
		}
    break;

  case 267:
#line 1646 "parser.y"
    {
			yyval.memArg.atype = ustring_type;
		}
    break;

  case 268:
#line 1649 "parser.y"
    {
			yyval.memArg.atype = string_type;
		}
    break;

  case 269:
#line 1652 "parser.y"
    {
			yyval.memArg.atype = void_type;
		}
    break;

  case 270:
#line 1655 "parser.y"
    {
			yyval.memArg.atype = pyobject_type;
		}
    break;

  case 271:
#line 1658 "parser.y"
    {
			yyval.memArg.atype = pytuple_type;
		}
    break;

  case 272:
#line 1661 "parser.y"
    {
			yyval.memArg.atype = pylist_type;
		}
    break;

  case 273:
#line 1664 "parser.y"
    {
			yyval.memArg.atype = pydict_type;
		}
    break;

  case 274:
#line 1667 "parser.y"
    {
			yyval.memArg.atype = pycallable_type;
		}
    break;

  case 275:
#line 1670 "parser.y"
    {
			yyval.memArg.atype = pyslice_type;
		}
    break;

  case 276:
#line 1675 "parser.y"
    {
			/* The single or first type. */

			yyval.signature.args[0] = yyvsp[0].memArg;
			yyval.signature.nrArgs = 1;
		}
    break;

  case 277:
#line 1681 "parser.y"
    {
			/* Check that it wasn't ,type... */

			if (yyval.signature.nrArgs == 0)
				yyerror("First type of list is missing");

			/* Check there is room. */

			if (yyvsp[-2].signature.nrArgs == MAX_NR_ARGS)
				yyerror("Internal error - increase the value of MAX_NR_ARGS");

			yyval.signature = yyvsp[-2].signature;

			yyval.signature.args[yyval.signature.nrArgs] = yyvsp[0].memArg;
			yyval.signature.nrArgs++;
		}
    break;

  case 278:
#line 1699 "parser.y"
    {
			yyval.throwlist = NULL;
		}
    break;

  case 279:
#line 1702 "parser.y"
    {
			int e;

			/*
			 * Make sure the exceptions' header files are
			 * included.
			 */

			for (e = 0; e < yyvsp[-1].throwlist -> nrArgs; ++e)
				addToUsedList(&currentScope() -> iff -> used,yyvsp[-1].throwlist -> args[e] -> iff);

			yyval.throwlist = yyvsp[-1].throwlist;
		}
    break;

  case 280:
#line 1717 "parser.y"
    {
			/* Empty list so use a blank. */

			yyval.throwlist = sipMalloc(sizeof (throwArgs));
			yyval.throwlist -> nrArgs = 0;
		}
    break;

  case 281:
#line 1723 "parser.y"
    {
			/* The only or first exception. */

			yyval.throwlist = sipMalloc(sizeof (throwArgs));
			yyval.throwlist -> nrArgs = 1;
			yyval.throwlist -> args[0] = findClass(currentSpec,class_iface,yyvsp[0].scpvalp);
		}
    break;

  case 282:
#line 1730 "parser.y"
    {
			/* Check that it wasn't ...(,arg...). */

			if (yyvsp[-2].throwlist -> nrArgs == 0)
				yyerror("First exception of throw specifier is missing");

			/* Check there is room. */

			if (yyvsp[-2].throwlist -> nrArgs == MAX_NR_ARGS)
				yyerror("Internal error - increase the value of MAX_NR_ARGS");

			yyval.throwlist = yyvsp[-2].throwlist;
			yyval.throwlist -> args[yyval.throwlist -> nrArgs++] = findClass(currentSpec,class_iface,yyvsp[0].scpvalp);
		}
    break;


    }

/* Line 1010 of yacc.c.  */
#line 3806 "parser.c"

  yyvsp -= yylen;
  yyssp -= yylen;


  YY_STACK_PRINT (yyss, yyssp);

  *++yyvsp = yyval;


  /* 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 - YYNTOKENS] + *yyssp;
  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
    yystate = yytable[yystate];
  else
    yystate = yydefgoto[yyn - YYNTOKENS];

  goto yynewstate;


/*------------------------------------.
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
  /* If not already recovering from an error, report this error.  */
  if (!yyerrstatus)
    {
      ++yynerrs;
#if YYERROR_VERBOSE
      yyn = yypact[yystate];

      if (YYPACT_NINF < yyn && yyn < YYLAST)
	{
	  YYSIZE_T yysize = 0;
	  int yytype = YYTRANSLATE (yychar);
	  const char* yyprefix;
	  char *yymsg;
	  int yyx;

	  /* Start YYX at -YYN if negative to avoid negative indexes in
	     YYCHECK.  */
	  int yyxbegin = yyn < 0 ? -yyn : 0;

	  /* Stay within bounds of both yycheck and yytname.  */
	  int yychecklim = YYLAST - yyn;
	  int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
	  int yycount = 0;

	  yyprefix = ", expecting ";
	  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
	    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
	      {
		yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]);
		yycount += 1;
		if (yycount == 5)
		  {
		    yysize = 0;
		    break;
		  }
	      }
	  yysize += (sizeof ("syntax error, unexpected ")
		     + yystrlen (yytname[yytype]));
	  yymsg = (char *) YYSTACK_ALLOC (yysize);
	  if (yymsg != 0)
	    {
	      char *yyp = yystpcpy (yymsg, "syntax error, unexpected ");
	      yyp = yystpcpy (yyp, yytname[yytype]);

	      if (yycount < 5)
		{
		  yyprefix = ", expecting ";
		  for (yyx = yyxbegin; yyx < yyxend; ++yyx)
		    if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
		      {
			yyp = yystpcpy (yyp, yyprefix);
			yyp = yystpcpy (yyp, yytname[yyx]);
			yyprefix = " or ";
		      }
		}
	      yyerror (yymsg);
	      YYSTACK_FREE (yymsg);
	    }
	  else
	    yyerror ("syntax error; also virtual memory exhausted");
	}
      else
#endif /* YYERROR_VERBOSE */
	yyerror ("syntax error");
    }



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

      if (yychar <= YYEOF)
        {
          /* If at end of input, pop the error token,
	     then the rest of the stack, then return failure.  */
	  if (yychar == YYEOF)
	     for (;;)
	       {
		 YYPOPSTACK;
		 if (yyssp == yyss)
		   YYABORT;
		 YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
		 yydestruct (yystos[*yyssp], yyvsp);
	       }
        }
      else
	{
	  YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
	  yydestruct (yytoken, &yylval);
	  yychar = YYEMPTY;

	}
    }

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


/*---------------------------------------------------.
| yyerrorlab -- error raised explicitly by YYERROR.  |
`---------------------------------------------------*/
yyerrorlab:

#ifdef __GNUC__
  /* Pacify GCC when the user code never invokes YYERROR and the label
     yyerrorlab therefore never appears in user code.  */
  if (0)
     goto yyerrorlab;
#endif

  yyvsp -= yylen;
  yyssp -= yylen;
  yystate = *yyssp;
  goto yyerrlab1;


/*-------------------------------------------------------------.
| yyerrlab1 -- common code for both syntax error and YYERROR.  |
`-------------------------------------------------------------*/
yyerrlab1:
  yyerrstatus = 3;	/* Each real token shifted decrements this.  */

  for (;;)
    {
      yyn = yypact[yystate];
      if (yyn != YYPACT_NINF)
	{
	  yyn += YYTERROR;
	  if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
	    {
	      yyn = yytable[yyn];
	      if (0 < yyn)
		break;
	    }
	}

      /* Pop the current state because it cannot handle the error token.  */
      if (yyssp == yyss)
	YYABORT;

      YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
      yydestruct (yystos[yystate], yyvsp);
      YYPOPSTACK;
      yystate = *yyssp;
      YY_STACK_PRINT (yyss, yyssp);
    }

  if (yyn == YYFINAL)
    YYACCEPT;

  YYDPRINTF ((stderr, "Shifting error token, "));

  *++yyvsp = yylval;


  yystate = yyn;
  goto yynewstate;


/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here.  |
`-------------------------------------*/
yyacceptlab:
  yyresult = 0;
  goto yyreturn;

/*-----------------------------------.
| yyabortlab -- YYABORT comes here.  |
`-----------------------------------*/
yyabortlab:
  yyresult = 1;
  goto yyreturn;

#ifndef yyoverflow
/*----------------------------------------------.
| yyoverflowlab -- parser overflow comes here.  |
`----------------------------------------------*/
yyoverflowlab:
  yyerror ("parser stack overflow");
  yyresult = 2;
  /* Fall through.  */
#endif

yyreturn:
#ifndef yyoverflow
  if (yyss != yyssa)
    YYSTACK_FREE (yyss);
#endif
  return yyresult;
}


#line 1746 "parser.y"



/*
 * Parse the specification.
 */
void parse(sipSpec *spec,FILE *fp,char *filename,stringList *tsl,
	   stringList *xfl)
{
        /* Initialise the spec. */
 
	spec -> modules = NULL;
	spec -> namecache = NULL;
	spec -> ifacefiles = NULL;
	spec -> classes = NULL;
	spec -> mappedtypes = NULL;
	spec -> qobjclass = -1;
	spec -> enums = NULL;
	spec -> vars = NULL;
	spec -> othfuncs = NULL;
	spec -> overs = NULL;
	spec -> typedefs = NULL;
	spec -> copying = NULL;
	spec -> hdrcode = NULL;
	spec -> cppcode = NULL;
	spec -> docs = NULL;
	spec -> preinitcode = NULL;
	spec -> postinitcode = NULL;
	spec -> used = NULL;
	spec -> sigslots = FALSE;
	spec -> genc = -1;

	currentSpec = spec;
	neededQualifiers = tsl;
	excludedQualifiers = xfl;
	currentModule = NULL;
	currentMappedType = NULL;
	currentOverIsVirt = FALSE;
	currentIsStatic = FALSE;
	previousFile = NULL;
	skipStackPtr = 0;
	currentScopeIdx = 0;
	sectionFlags = 0;

	newModule(fp,filename);
	spec -> module = currentModule;

	yyparse();

	handleEOF();
	handleEOM();
}


/*
 * Tell the parser that a complete file has now been read.
 */
void parserEOF(char *name,parserContext *pc)
{
	previousFile = sipStrdup(name);
	newContext = *pc;
}


/*
 * Append a class definition to a class list if it doesn't already appear.
 * Append is needed specifically for the list of super-classes because the
 * order is important to Python.
 */
void appendToClassList(classList **clp,classDef *cd)
{
	classList *new;

	/* Find the end of the list. */

	while (*clp != NULL)
	{
		if ((*clp) -> cd == cd)
			return;

		clp = &(*clp) -> next;
	}

	new = sipMalloc(sizeof (classList));

	new -> cd = cd;
	new -> next = NULL;

	*clp = new;
}


/*
 * Create a new module for the current specification and make it current.
 */
static void newModule(FILE *fp,char *filename)
{
	moduleDef *newmod;

	parseFile(fp,filename,currentModule,FALSE);

	newmod = sipMalloc(sizeof (moduleDef));
	newmod -> name = NULL;
	newmod -> version = -1;
	newmod -> modulenr = -1;
	newmod -> file = filename;
	newmod -> qualifiers = NULL;
	newmod -> root.cd = NULL;
	newmod -> root.child = NULL;
	newmod -> nrtimelines = 0;
	newmod -> nrclasses = 0;
	newmod -> nrmappedtypes = 0;
	newmod -> nrenums = 0;
	newmod -> nrtypedefs = 0;
	newmod -> nrvirthandlers = 0;
	newmod -> virthandlers = NULL;
	newmod -> license = NULL;
	newmod -> imports = NULL;
	newmod -> next = currentSpec -> modules;

	currentSpec -> modules = newmod;

	/*
	 * If there is a current module then append the new one to its list of
	 * imports.  We know by this time that it hasn't already been imported.
	 */
	if (currentModule != NULL)
	{
		moduleListDef *mld, **tailp;

		/* Find the tail. */
		tailp = &currentModule -> imports;

		while (*tailp != NULL)
			tailp = &(*tailp) -> next;

		mld = sipMalloc(sizeof (moduleListDef));
		mld -> module = newmod;
		mld -> next = NULL;

		*tailp = mld;
	}

	currentModule = newmod;
}


/*
 * Switch to parsing a new file.
 */
static void parseFile(FILE *fp,char *name,moduleDef *prevmod,int optional)
{
	parserContext pc;

	pc.ifdepth = skipStackPtr;
	pc.prevmod = prevmod;

	setInputFile(fp,name,&pc,optional);
}


/*
 * Find an interface file, or create a new one.
 */
static ifaceFileDef *findIfaceFile(sipSpec *pt,scopedNameDef *fqname,
				   ifaceFileType iftype,argDef *ad)
{
	ifaceFileDef *iff;

	/* See if the name is already used. */

	for (iff = pt -> ifacefiles; iff != NULL; iff = iff -> next)
	{
		if (!sameScopedName(iff -> fqcname,fqname))
			continue;

		/* They must be the same type. */

		if (iff -> type != iftype)
			yyerror("A class, namespace or mapped type has already been defined with the same name");

		/*
		 * If this is a mapped type with the same name defined in a
		 * different module, then check that this type isn't the same
		 * as any of the mapped types defined in that module.
		 */

		if (iftype == mappedtype_iface && iff -> module != currentModule)
		{
			mappedTypeDef *mtd;

			for (mtd = pt -> mappedtypes; mtd != NULL; mtd = mtd -> next)
			{
				if (mtd -> iff != iff)
					continue;

				if (ad -> atype != template_type ||
				    mtd -> type.atype != template_type ||
				    sameBaseType(ad,&mtd -> type,TRUE))
					yyerror("Mapped type has already been defined in another module");
			}

			/*
			 * If we got here then we have a mapped type based on
			 * an existing template, but with unique parameters.
			 * We don't want to use interface files from other
			 * modules, so skip this one.
			 */

			continue;
		}

		return iff;
	}

	iff = sipMalloc(sizeof (ifaceFileDef));

	iff -> name = cacheName(pt,scopedNameTail(fqname));
	iff -> type = iftype;
	iff -> fqcname = fqname;
	iff -> module = NULL;
	iff -> used = NULL;
	iff -> next = pt -> ifacefiles;

	pt -> ifacefiles = iff;

	return iff;
}


/*
 * Find a class definition in a parse tree.
 */
static classDef *findClass(sipSpec *pt,ifaceFileType iftype,
			   scopedNameDef *fqname)
{
	classDef *cd;
	ifaceFileDef *iff;

	/* See if the name is already used. */
	iff = findIfaceFile(pt,fqname,iftype,NULL);

	for (cd = pt -> classes; cd != NULL; cd = cd -> next)
		if (cd -> iff == iff)
			return cd;

	/* Create a new one. */
	cd = sipMalloc(sizeof (classDef));

	cd -> dtorexceptions = NULL;
	cd -> iff = iff;
	cd -> pyname = classBaseName(cd);
	cd -> next = pt -> classes;

	pt -> classes = cd;

	return cd;
}


/*
 * Add an interface file to an interface file list if it isn't already there.
 */
void addToUsedList(ifaceFileList **ifflp,ifaceFileDef *iff)
{
	ifaceFileList *iffl;

	while ((iffl = *ifflp) != NULL)
	{
		/* Don't bother if it is already there. */

		if (iffl -> iff == iff)
			return;

		ifflp = &iffl -> next;
	}

	iffl = sipMalloc(sizeof (ifaceFileList));

	iffl -> iff = iff;
	iffl -> next = NULL;

	*ifflp = iffl;
}


/*
 * Find an undefined (or create a new) class definition in a parse tree.
 */
static classDef *newClass(sipSpec *pt,ifaceFileType iftype,
			  scopedNameDef *fqname)
{
	int flags;
	classDef *cd, *scope;
	codeBlock *hdrcode;

	if (sectionFlags & SECT_IS_PRIVATE)
		yyerror("Classes, structs and namespaces must be in the public or or protected sections");

	flags = 0;

	if ((scope = currentScope()) != NULL)
	{
		if (sectionFlags & SECT_IS_PROT)
			flags = CLASS_IS_PROTECTED;

		hdrcode = scope -> hdrcode;
	}
	else
		hdrcode = NULL;

	if (pt -> genc)
	{
		/* C structs are always global types. */
		while (fqname -> next != NULL)
			fqname = fqname -> next;

		scope = NULL;
	}

	cd = findClass(pt,iftype,fqname);

	/* Check it hasn't already been defined. */

	if (cd -> iff -> module != NULL)
	{
		/*
		 * Namespaces can be defined any number of times in the same
		 * module.
		 */

		if (iftype == namespace_iface && cd -> iff -> module == currentModule)
			return cd;

		yyerror(iftype == class_iface ?
			"The struct/class has already been defined" :
			"The namespace has already been defined in another module");
	}

	cd -> iff -> module = currentModule;

	/* Complete the initialisation. */

	cd -> classflags = flags;
	cd -> classnr = -1;
	cd -> ecd = scope;
	cd -> node = NULL;
	cd -> supers = NULL;
	cd -> mro = NULL;
	cd -> ctors = NULL;
	cd -> defctor = NULL;
	cd -> dealloccode = NULL;
	cd -> dtorcode = NULL;
	cd -> members = NULL;
	cd -> overs = NULL;
	cd -> vmembers = NULL;
	cd -> visible = NULL;
	cd -> cppcode = NULL;
	cd -> hdrcode = hdrcode;
	cd -> convtosubcode = NULL;
	cd -> subbase = NULL;
	cd -> convtocode = NULL;

	return cd;
}


/*
 * Tidy up after finishing a class definition.
 */
static void finishClass(sipSpec *pt,classDef *cd,optFlags *of)
{
	int seq_might, seq_not;
	memberDef *md;
	char *pyname;

	/* Get the Python name and see if it is different to the C++ name. */
	pyname = getPythonName(of, classBaseName(cd));

	cd -> pyname = NULL;
	checkAttributes(pt, cd->ecd, pyname, FALSE);
	cd->pyname = pyname;

	if (cd->pyname != classBaseName(cd))
		setIsRenamedClass(cd);

	if (cd -> ctors == NULL)
	{
		if (!pt -> genc)
		{
			/* Provide a default ctor. */

			cd -> ctors = sipMalloc(sizeof (ctorDef));
 
			cd -> ctors -> ctorflags = SECT_IS_PUBLIC;
			cd -> ctors -> pysig.nrArgs = 0;
			cd -> ctors -> cppsig = &cd -> ctors -> pysig;
			cd -> ctors -> exceptions = NULL;
			cd -> ctors -> methodcode = NULL;
			cd -> ctors -> prehook = NULL;
			cd -> ctors -> posthook = NULL;
			cd -> ctors -> next = NULL;

			cd -> defctor = cd -> ctors;
		}

		resetCannotCreate(cd);
	}
	else if (cd -> defctor == NULL)
	{
		ctorDef *ct;

		for (ct = cd -> ctors; ct != NULL; ct = ct -> next)
			if (ct -> pysig.nrArgs == 0 || ct -> pysig.args[0].defval != NULL)
			{
				cd -> defctor = ct;
				break;
			}
	}

	/*
	 * We can't create this class if it has private abstract functions or
	 * if it is explicitly annotated as abstract.
	 */
	if (findOptFlag(of,"Abstract",bool_flag) != NULL)
		setCannotCreate(cd);
	else
	{
		overDef *od;

		for (od = cd -> overs; od != NULL; od = od -> next)
			if (isAbstract(od) && isPrivate(od))
			{
				setCannotCreate(cd);
				break;
			}
	}

	/* We assume a public dtor if nothing specific was provided. */
	if (!isDtor(cd))
		setIsPublicDtor(cd);

	if (inMainModule())
	{
		setIsUsedName(cd -> iff -> name);
		setIsClassName(cd -> iff -> name);
	}

	/*
	 * There are subtle differences between the add and concat methods and
	 * the multiply and repeat methods.  The number versions can have their
	 * operands swapped and may return NotImplemented.  If the user has
	 * used the /Numeric/ annotation or there are other numeric operators
	 * then we use add/multiply.  Otherwise, if there are indexing
	 * operators then we use concat/repeat.
	 */
	seq_might = seq_not = FALSE;

	for (md = cd -> members; md != NULL; md = md -> next)
		switch (md -> slot)
		{
		case getitem_slot:
		case setitem_slot:
		case delitem_slot:
			/* This might be a sequence. */
			seq_might = TRUE;
			break;

		case sub_slot:
		case isub_slot:
		case div_slot:
		case idiv_slot:
		case mod_slot:
		case imod_slot:
			/* This is definately not a sequence. */
			seq_not = TRUE;
			break;
		}

	if (!seq_not && seq_might)
		for (md = cd -> members; md != NULL; md = md -> next)
		{
			/* Ignore if the user has been explicit. */
			if (isNumeric(md))
				continue;

			switch (md -> slot)
			{
			case add_slot:
				md -> slot = concat_slot;
				break;

			case iadd_slot:
				md -> slot = iconcat_slot;
				break;

			case mul_slot:
				md -> slot = repeat_slot;
				break;

			case imul_slot:
				md -> slot = irepeat_slot;
				break;
			}
		}
}


/*
 * Create a new mapped type.
 */
static mappedTypeDef *newMappedType(sipSpec *pt,argDef *ad)
{
	mappedTypeDef *mtd;
	scopedNameDef *snd;
	ifaceFileDef *iff;

	/* Check that the type is one we want to map. */
	switch (ad -> atype)
	{
	case defined_type:
		snd = ad -> u.snd;
		break;

	case template_type:
		snd = ad -> u.td -> fqname;
		break;

	case struct_type:
		snd = ad -> u.sname;
		break;

	default:
		yyerror("Invalid type for %MappedType");
	}

	iff = findIfaceFile(pt,snd,mappedtype_iface,ad);

	if (inMainModule())
		setIsUsedName(iff -> name);

	/* Check it hasn't already been defined. */
	for (mtd = pt -> mappedtypes; mtd != NULL; mtd = mtd -> next)
		if (mtd -> iff == iff)
		{
			/*
			 * We allow types based on the same template but with
			 * different arguments.
			 */

			if (ad -> atype != template_type ||
			    sameBaseType(ad,&mtd -> type,TRUE))
				yyerror("Mapped type has already been defined in this module");
		}

	/* The module may not have been set yet. */
	iff -> module = currentModule;

	/* Create a new mapped type. */
	mtd = sipMalloc(sizeof (mappedTypeDef));

	mtd -> type = *ad;
	mtd -> mappednr = -1;
	mtd -> iff = iff;
	mtd -> hdrcode = NULL;
	mtd -> convfromcode = NULL;
	mtd -> convtocode = NULL;
	mtd -> next = pt -> mappedtypes;

	pt -> mappedtypes = mtd;

	return mtd;
}


/*
 * Create a new enum.
 */
static enumDef *newEnum(sipSpec *pt,moduleDef *mod,char *name,optFlags *of,
			int flags)
{
	enumDef *ed;
	classDef *escope = currentScope();

	ed = sipMalloc(sizeof (enumDef));

	if (name != NULL)
	{
		ed -> fqcname = text2scopedName(name);
		ed -> pyname = getPythonName(of, name);

		checkAttributes(pt, escope, ed -> pyname, FALSE);
	}
	else
	{
		ed -> fqcname = NULL;
		ed -> pyname = NULL;
	}

	ed -> enumflags = 0;
	ed -> enumnr = -1;
	ed -> ecd = escope;
	ed -> pcd = (flags & SECT_IS_PROT) ? escope : NULL;
	ed -> module = mod;
	ed -> members = NULL;
	ed -> next = pt -> enums;

	if (ed -> pyname != name)
		setIsRenamedEnum(ed);

	pt -> enums = ed;

	if (escope != NULL)
		setHasEnums(escope);

	return ed;
}


/*
 * Create a new typedef.
 */
static void newTypedef(sipSpec *pt,moduleDef *mod,char *name,argDef *type)
{
	typedefDef *td;
	scopedNameDef *fqname = text2scopedName(name);

	/* Check it doesn't already exist. */

	for (td = pt -> typedefs; td != NULL; td = td -> next)
		if (sameScopedName(td -> fqname,fqname))
		{
			fatalScopedName(fqname);
			fatal(" already defined\n");
		}

	td = sipMalloc(sizeof (typedefDef));

	td -> fqname = fqname;
	td -> ecd = currentScope();
	td -> module = mod;
	td -> type = *type;
	td -> next = pt -> typedefs;

	mod -> nrtypedefs++;

	pt -> typedefs = td;
}


/*
 * Create a new variable.
 */
static void newVar(sipSpec *pt,moduleDef *mod,char *name,int isstatic,
		   argDef *type,optFlags *of,codeBlock *code)
{
	varDef *var;
	classDef *escope = currentScope();
	nameDef *nd = cacheName(pt,getPythonName(of,name));

	if (inMainModule())
		setIsUsedName(nd);

	checkAttributes(pt,escope,nd -> text,FALSE);

	var = sipMalloc(sizeof (varDef));

	var -> pyname = nd;
	var -> fqcname = text2scopedName(name);
	var -> ecd = escope;
	var -> module = mod;
	var -> varflags = 0;
	var -> type = *type;
	var -> accessfunc = code;
	var -> next = pt -> vars;

	if (isstatic)
		setIsStaticVar(var);

	pt -> vars = var;
}


/*
 * Create a new ctor.
 */
static void newCtor(char *name,int sectFlags,signatureDef *args,
		    optFlags *optflgs,codeBlock *methodcode,
		    throwArgs *exceptions,signatureDef *cppsig)
{
	ctorDef *ct, **ctp;
	classDef *cd = currentScope();

	/* Check the name of the constructor. */
	if (strcmp(classBaseName(cd),name) != 0)
		yyerror("Constructor doesn't have the same name as its class");

	/*
	 * Find the end of the list and, at the same time, check for any
	 * existing one with the same signature.
	 */
	for (ctp = &cd -> ctors; *ctp != NULL; ctp = &(*ctp) -> next)
		if (sameSignature(&(*ctp) -> pysig,args,FALSE))
			yyerror("A constructor with the same Python signature has already been defined");

	/* Add to the list of constructors. */
	ct = sipMalloc(sizeof (ctorDef));

	ct -> ctorflags = sectFlags;
	ct -> pysig = *args;
	ct -> cppsig = (cppsig != NULL ? cppsig : &ct -> pysig);
	ct -> exceptions = exceptions;
	ct -> methodcode = methodcode;
	ct -> next = NULL;

	if (isProtectedCtor(ct))
		setIsComplex(cd);

	if (!isPrivateCtor(ct))
		resetCannotCreate(cd);

	getHooks(optflgs,&ct -> prehook,&ct -> posthook);

	if (getReleaseGIL(optflgs))
		setIsReleaseGILCtor(ct);

	if (findOptFlag(optflgs,"Default",bool_flag) != NULL)
	{
		if (cd -> defctor != NULL)
			yyerror("A constructor with the /Default/ flag has already been defined");

		cd -> defctor = ct;
	}

	*ctp = ct;
}


/*
 * Create a new function.
 */
static void newFunction(sipSpec *pt,moduleDef *mod,int sflags,int isstatic,
			int isvirt,char *name,signatureDef *sig,int isconst,
			int isabstract,optFlags *optflgs,codeBlock *methodcode,
			codeBlock *vcode,throwArgs *exceptions,
			signatureDef *cppsig)
{
	classDef *cd = currentScope();
	nameDef *pname;
	int factory, xferback;
	overDef *od, **odp, **headp;
	optFlag *of;
	virtHandlerDef *vhd;

	/* Extra checks for a C module. */
	if (pt -> genc)
	{
		if (cd != NULL)
			yyerror("Function declaration not allowed in a struct in a C module");

		if (isstatic)
			yyerror("Static functions not allowed in a C module");

		if (exceptions != NULL)
			yyerror("Exceptions not allowed in a C module");
	}

	headp = (cd != NULL ?  &cd -> overs : &pt -> overs);

	/* See if it is a factory method. */
	if (findOptFlag(optflgs,"Factory",bool_flag) != NULL)
		factory = TRUE;
	else
	{
		int a;

		factory = FALSE;

		/* Check /TransferThis/ wasn't specified. */
		for (a = 0; a < sig -> nrArgs; ++a)
			if (isThisTransferred(&sig -> args[a]))
				yyerror("/TransferThis/ may only be specified in constructors and /Factory/ methods");
	}

	/* See if the result is to be returned to Python ownership. */
	xferback = (findOptFlag(optflgs,"TransferBack",bool_flag) != NULL);

	if (factory && xferback)
		yyerror("/TransferBack/ and /Factory/ cannot both be specified");

	/* Use the C++ name if a Python name wasn't given. */
	pname = cacheName(pt, getPythonName(optflgs, name));

	/* Create a new overload definition. */

	od = sipMalloc(sizeof (overDef));

	/* Set the overload flags. */

	od -> overflags = sflags;

	if (factory)
		setIsFactory(od);

	if (xferback)
		setIsResultTransferredBack(od);

	if (isProtected(od))
		setIsComplex(cd);

	if ((isSlot(od) || isSignal(od)) && !isPrivate(od))
	{
		if (isSignal(od))
			setIsComplex(cd);

		pt -> sigslots = TRUE;
	}

	if (isSignal(od) && (methodcode != NULL || vcode != NULL))
		yyerror("Cannot provide code for signals");

	if (isstatic)
	{
		if (isSlot(od) || isSignal(od))
			yyerror("Static functions cannot be slots or signals");

		if (isvirt)
			yyerror("Static functions cannot be virtual");

		setIsStatic(od);
	}

	if (isconst)
		setIsConst(od);

	if (isabstract)
	{
		if (sflags == 0)
			yyerror("Non-class function specified as abstract");

		setIsAbstract(od);
	}

	if ((of = findOptFlag(optflgs,"AutoGen",opt_name_flag)) != NULL)
	{
		setIsAutoGen(od);

		if (of -> fvalue.sval != NULL)
		{
			qualDef *qd;

			if ((qd = findQualifier(of -> fvalue.sval)) == NULL || qd -> qtype != feature_qualifier)
				yyerror("No such feature");

			if (excludedFeature(excludedQualifiers,qd))
				resetIsAutoGen(od);
		}
	}

	if (isvirt)
	{
		if (isSignal(od))
			yyerror("Virtual signals aren't supported");

		setIsVirtual(od);
		setIsComplex(cd);

		vhd = sipMalloc(sizeof (virtHandlerDef));

		vhd -> virthandlernr = -1;
		vhd -> vhflags = 0;
		vhd -> sd = (cppsig != NULL ? cppsig : &od -> pysig);
		vhd -> module = currentModule;
		vhd -> virtcode = vcode;
		vhd -> next = currentModule -> virthandlers;

		if (factory || xferback)
			setIsTransferVH(vhd);

		currentModule -> virthandlers = vhd;
	}
	else
	{
		if (vcode != NULL)
			yyerror("%VirtualCatcherCode provided for non-virtual function");

		vhd = NULL;
	}

	od -> cppname = name;
	od -> pysig = *sig;
	od -> cppsig = (cppsig != NULL ? cppsig : &od -> pysig);
	od -> exceptions = exceptions;
	od -> methodcode = methodcode;
	od -> virthandler = vhd;
	od -> common = findFunction(pt,mod,cd,pname,(methodcode != NULL),sig -> nrArgs);

	if (findOptFlag(optflgs,"Numeric",bool_flag) != NULL)
		setIsNumeric(od -> common);

	/* Methods that run in new threads must be virtual. */
	if (findOptFlag(optflgs,"NewThread",bool_flag) != NULL)
	{
		argDef *res;

		if (!isvirt)
			yyerror("/NewThread/ may only be specified for virtual functions");

		/*
		 * This is an arbitary limitation to make the code generator
		 * slightly easier - laziness on my part.
		 */
		res = &od -> cppsig -> result;

		if (res -> atype != void_type || res -> nrderefs != 0)
			yyerror("/NewThread/ may only be specified for void functions");

		setIsNewThread(od);
	}

	getHooks(optflgs,&od -> prehook,&od -> posthook);

	if (getReleaseGIL(optflgs))
		setIsReleaseGIL(od);

	od -> next = NULL;

	/*
	 * Find the end of the list and, at the same time, check for any
	 * existing one with the same signature.
	 */

	for (odp = headp; *odp != NULL; odp = &(*odp) -> next)
	{
		if ((*odp) -> common != od -> common)
			continue;

		if (isConst(*odp) != isConst(od))
			continue;

		if (!sameSignature(&(*odp) -> pysig,&od -> pysig,FALSE))
			continue;

		yyerror("A function with the same Python signature has already been defined");
	}

	*odp = od;
}


/*
 * Return the Python name based on the C/C++ name and any /PyName/ annotation.
 */
static char *getPythonName(optFlags *optflgs, char *cname)
{
	char *pname;
	optFlag *of;

	if ((of = findOptFlag(optflgs, "PyName", name_flag)) != NULL)
		pname = of -> fvalue.sval;
	else
		pname = cname;

	return pname;
}


/*
 * Cache a name in a module.
 */
static nameDef *cacheName(sipSpec *pt,char *name)
{
	nameDef *nd;

	/* See if it already exists. */
	for (nd = pt -> namecache; nd != NULL; nd = nd -> next)
		if (strcmp(nd -> text,name) == 0)
			return nd;

	/* Create a new one. */
	nd = sipMalloc(sizeof (nameDef));

	nd -> nameflags = 0;
	nd -> module = currentSpec -> module;
	nd -> text = name;
	nd -> next = pt -> namecache;

	pt -> namecache = nd;

	return nd;
}


/*
 * Find (or create) an overloaded function name.
 */
static memberDef *findFunction(sipSpec *pt,moduleDef *mod,classDef *cd,
			       nameDef *pname,int hwcode,int nrargs)
{
	static struct slot_map {
		char *name;		/* The slot name. */
		slotType type;		/* The corresponding type. */
		int needs_hwcode;	/* If handwritten code is required. */
		int nrargs;		/* Nr. of arguments. */
	} slot_table[] = {
		{"__str__", str_slot, TRUE, 0},
		{"__unicode__", unicode_slot, TRUE, 0},
		{"__int__", int_slot, FALSE, 0},
		{"__len__", len_slot, TRUE, 0},
		{"__contains__", contains_slot, TRUE, 1},
		{"__add__", add_slot, FALSE, 1},
		{"__sub__", sub_slot, FALSE, 1},
		{"__mul__", mul_slot, FALSE, 1},
		{"__div__", div_slot, FALSE, 1},
		{"__mod__", mod_slot, FALSE, 1},
		{"__and__", and_slot, FALSE, 1},
		{"__or__", or_slot, FALSE, 1},
		{"__xor__", xor_slot, FALSE, 1},
		{"__lshift__", lshift_slot, FALSE, 1},
		{"__rshift__", rshift_slot, FALSE, 1},
		{"__iadd__", iadd_slot, FALSE, 1},
		{"__isub__", isub_slot, FALSE, 1},
		{"__imul__", imul_slot, FALSE, 1},
		{"__idiv__", idiv_slot, FALSE, 1},
		{"__imod__", imod_slot, FALSE, 1},
		{"__iand__", iand_slot, FALSE, 1},
		{"__ior__", ior_slot, FALSE, 1},
		{"__ixor__", ixor_slot, FALSE, 1},
		{"__ilshift__", ilshift_slot, FALSE, 1},
		{"__irshift__", irshift_slot, FALSE, 1},
		{"__invert__", invert_slot, FALSE, 0},
		{"__call__", call_slot, FALSE, -1},
		{"__getitem__", getitem_slot, TRUE, -1},
		{"__setitem__", setitem_slot, TRUE, -1},
		{"__delitem__", delitem_slot, TRUE, -1},
		{"__lt__", lt_slot, FALSE, 1},
		{"__le__", le_slot, FALSE, 1},
		{"__eq__", eq_slot, FALSE, 1},
		{"__ne__", ne_slot, FALSE, 1},
		{"__gt__", gt_slot, FALSE, 1},
		{"__ge__", ge_slot, FALSE, 1},
		{"__cmp__", cmp_slot, FALSE, 1},
		{"__nonzero__", nonzero_slot, TRUE, 0},
		{"__neg__", neg_slot, FALSE, 0},
		{"__repr__", repr_slot, TRUE, 0},
		{NULL}
	};

	memberDef *md, **flist;
	struct slot_map *sm;
	slotType st;

	/* Get the slot type. */
	st = no_slot;

	for (sm = slot_table; sm -> name != NULL; ++sm)
		if (strcmp(sm -> name,pname -> text) == 0)
		{
			if (cd == NULL)
				yyerror("Python slots must be class methods");

			if (sm -> needs_hwcode && !hwcode)
				yyerror("This Python slot requires %MethodCode");

			if (sm -> nrargs < 0)
			{
				int min_nr;

				/* These require a minimum number. */
				switch (sm -> type)
				{
				case getitem_slot:
				case delitem_slot:
					min_nr = 1;
					break;

				case setitem_slot:
					min_nr = 2;
					break;

				default:
					min_nr = 0;
				}

				if (nrargs < min_nr)
					yyerror("Insufficient number of arguments to Python slot");
			}
			else if (sm -> nrargs != nrargs)
				yyerror("Incorrect number of arguments to Python slot");

			st = sm -> type;

			break;
		}

	if (inMainModule())
		setIsUsedName(pname);

	/* Check there is no name clash. */
	checkAttributes(pt,cd,pname -> text,TRUE);

	/* See if it already exists. */
	flist = (cd != NULL ? &cd -> members : &pt -> othfuncs);

	for (md = *flist; md != NULL; md = md -> next)
		if (md -> pyname == pname)
			return md;

	/* Create a new one. */
	md = sipMalloc(sizeof (memberDef));

	md -> pyname = pname;
	md -> memberflags = 0;
	md -> slot = st;
	md -> module = mod;
	md -> next = *flist;

	*flist = md;

	return md;
}


/*
 * Search a set of flags for a particular one and check its type.
 */
static optFlag *findOptFlag(optFlags *flgs,char *name,flagType ft)
{
	int f;

	for (f = 0; f < flgs -> nrFlags; ++f)
	{
		optFlag *of = &flgs -> flags[f];

		if (strcmp(of -> fname,name) == 0)
		{
			/*
			 * An optional name can look like a boolean or a name.
			 */

			if (ft == opt_name_flag)
			{
				if (of -> ftype == bool_flag)
				{
					of -> ftype = opt_name_flag;
					of -> fvalue.sval = NULL;
				}
				else if (of -> ftype == name_flag)
					of -> ftype = opt_name_flag;
			}

			if (ft != of -> ftype)
				yyerror("Optional flag has a value of the wrong type");

			return of;
		}
	}

	return NULL;
}


/*
 * A name is going to be used as a Python attribute name within a Python scope
 * (ie. a Python dictionary), so check against what we already know is going in
 * the same scope in case there is a clash.
 */
static void checkAttributes(sipSpec *pt,classDef *pyscope,char *attr,int isfunc)
{
	enumDef *ed;
	varDef *vd;
	classDef *cd;

	/* Check the enums. */

	for (ed = pt -> enums; ed != NULL; ed = ed -> next)
	{
		enumMemberDef *emd;

		if (ed -> ecd != pyscope || ed -> pyname == NULL)
			continue;

		if (strcmp(ed -> pyname, attr) == 0)
			yyerror("There is already an enum in scope with the same Python name");

		for (emd = ed -> members; emd != NULL; emd = emd -> next)
			if (strcmp(emd -> pyname -> text, attr) == 0)
				yyerror("There is already an enum member in scope with the same Python name");
	}

	/* Check the variables. */

	for (vd = pt -> vars; vd != NULL; vd = vd -> next)
	{
		if (vd -> ecd != pyscope)
			continue;

		if (strcmp(vd -> pyname -> text, attr) == 0)
			yyerror("There is already a variable in scope with the same Python name");
	}

	/*
	 * Only check the members if this attribute isn't a member because we
	 * can handle members with the same name in the same scope.
	 */
	if (!isfunc)
	{
		memberDef *md, *membs;

		membs = (pyscope != NULL ? pyscope -> members : pt -> othfuncs);

		for (md = membs; md != NULL; md = md -> next)
		{
			overDef *od, *overs;

			if (strcmp(md -> pyname -> text, attr) != 0)
				continue;

			/* Check for a conflict with all overloads. */

			overs = (pyscope != NULL ? pyscope -> overs : pt -> overs);

			for (od = overs; od != NULL; od = od -> next)
			{
				if (od -> common != md)
					continue;

				yyerror("There is already a function in scope with the same Python name");
			}
		}
	}

	/* Check the classes. */

	for (cd = pt -> classes; cd != NULL; cd = cd -> next)
	{
		if (cd -> ecd != pyscope || cd -> pyname == NULL)
			continue;

		if (strcmp(cd -> pyname, attr) == 0)
			yyerror("There is already a class or namespace in scope with the same Python name");
	}
}


/*
 * Append a code block to a list of them.  Append is needed to give the
 * specifier easy control over the order of the documentation.
 */
static void appendCodeBlock(codeBlock **headp,codeBlock *new)
{
	while (*headp != NULL)
		headp = &(*headp) -> next;

	*headp = new;
}


/*
 * Handle the end of a fully parsed a file.
 */
static void handleEOF()
{
	/*
	 * Check that the number of nested if's is the same as when we started
	 * the file.
	 */

	if (skipStackPtr > newContext.ifdepth)
		fatal("Too many %%If statements in %s\n",previousFile);

	if (skipStackPtr < newContext.ifdepth)
		fatal("Too many %%End statements in %s\n",previousFile);
}


/*
 * Handle the end of a fully parsed a module.
 */
static void handleEOM()
{
	/* Check it has been named. */

	if (currentModule -> name == NULL)
		fatal("No %%Module has been specified for module defined in %s\n",previousFile);

	/* The previous module is now current. */

	currentModule = newContext.prevmod;
}


/*
 * Find an existing qualifier.
 */
static qualDef *findQualifier(char *name)
{
	moduleDef *mod;

	for (mod = currentSpec -> modules; mod != NULL; mod = mod -> next)
	{
		qualDef *qd;

		for (qd = mod -> qualifiers; qd != NULL; qd = qd -> next)
			if (strcmp(qd -> name,name) == 0)
				return qd;
	}

	return NULL;
}


/*
 * Return a copy of a scoped name.
 */
scopedNameDef *copyScopedName(scopedNameDef *snd)
{
	scopedNameDef *head;

	head = NULL;

	while (snd != NULL)
	{
		appendScopedName(&head,text2scopePart(snd -> name));
		snd = snd -> next;
	}

	return head;
}


/*
 * Append a name to a list of scopes.
 */
void appendScopedName(scopedNameDef **headp,scopedNameDef *newsnd)
{
	while (*headp != NULL)
		headp = &(*headp) -> next;

	*headp = newsnd;
}


/*
 * Free a scoped name - but not the text itself.
 */
void freeScopedName(scopedNameDef *snd)
{
	while (snd != NULL)
	{
		scopedNameDef *next = snd -> next;

		free(snd);

		snd = next;
	}
}


/*
 * Convert a text string to a scope part structure.
 */
scopedNameDef *text2scopePart(char *text)
{
	scopedNameDef *snd;

	snd = sipMalloc(sizeof (scopedNameDef));

	snd -> name = text;
	snd -> next = NULL;

	return snd;
}


/*
 * Convert a text string to a fully scoped name.
 */
static scopedNameDef *text2scopedName(char *text)
{
	classDef *cd = currentScope();
	scopedNameDef *snd;

	snd = (cd != NULL ? copyScopedName(cd -> iff -> fqcname) : NULL);

	appendScopedName(&snd,text2scopePart(text));

	return snd;
}


/*
 * Return a pointer to the tail part of a scoped name.
 */
char *scopedNameTail(scopedNameDef *snd)
{
	if (snd == NULL)
		return NULL;

	while (snd -> next != NULL)
		snd = snd -> next;

	return snd -> name;
}


/*
 * Push the given scope onto the scope stack.
 */
static void pushScope(classDef *scope)
{
	if (currentScopeIdx >= MAX_NESTED_SCOPE)
		fatal("Internal error: increase the value of MAX_NESTED_SCOPE\n");

	scopeStack[currentScopeIdx] = scope;
	sectFlagsStack[currentScopeIdx] = sectionFlags;

	++currentScopeIdx;
}


/*
 * Pop the scope stack.
 */
static void popScope(void)
{
	if (currentScopeIdx > 0)
		sectionFlags = sectFlagsStack[--currentScopeIdx];
}


/*
 * Return non-zero if the current input should be parsed rather than be
 * skipped.
 */
static int notSkipping()
{
	return (skipStackPtr == 0 ? TRUE : skipStack[skipStackPtr - 1]);
}


/*
 * Return the value of an expression involving a time period.
 */
static int timePeriod(char *lname,char *uname)
{
	int this, line;
	qualDef *qd, *lower, *upper;
	moduleDef *mod;

	if (lname == NULL)
		lower = NULL;
	else if ((lower = findQualifier(lname)) == NULL || lower -> qtype != time_qualifier)
		yyerror("Lower bound is not a time version");

	if (uname == NULL)
		upper = NULL;
	else if ((upper = findQualifier(uname)) == NULL || upper -> qtype != time_qualifier)
		yyerror("Upper bound is not a time version");

	/* Sanity checks on the bounds. */

	if (lower == NULL && upper == NULL)
		yyerror("Lower and upper bounds cannot both be omitted");

	if (lower != NULL && upper != NULL)
	{
		if (lower -> module != upper -> module || lower -> line != upper -> line)
			yyerror("Lower and upper bounds are from different timelines");

		if (lower == upper)
			yyerror("Lower and upper bounds must be different");

		if (lower -> order > upper -> order)
			yyerror("Later version specified as lower bound");
	}

	/* Go through each slot in the relevant timeline. */

	if (lower != NULL)
	{
		mod = lower -> module;
		line = lower -> line;
	}
	else
	{
		mod = upper -> module;
		line = upper -> line;
	}

	this = FALSE;

	for (qd = mod -> qualifiers; qd != NULL; qd = qd -> next)
	{
		if (qd -> qtype != time_qualifier || qd -> line != line)
			continue;

		if (lower != NULL && qd -> order < lower -> order)
			continue;

		if (upper != NULL && qd -> order >= upper -> order)
			continue;

		/*
		 * This is within the required range so if it is also needed
		 * then the expression is true.
		 */

		if (isNeeded(qd))
		{
			this = TRUE;
			break;
		}
	}

	return this;
}


/*
 * Return the value of an expression involving a single platform or feature.
 */
static int platOrFeature(char *name,int optnot)
{
	int this;
	qualDef *qd;

	if ((qd = findQualifier(name)) == NULL || qd -> qtype == time_qualifier)
		yyerror("No such platform or feature");

	/* Assume this sub-expression is false. */

	this = FALSE;

	if (qd -> qtype == feature_qualifier)
	{
		if (!excludedFeature(excludedQualifiers,qd))
			this = TRUE;
	}
	else if (isNeeded(qd))
		this = TRUE;

	if (optnot)
		this = !this;

	return this;
}


/*
 * Return TRUE if the given qualifier is excluded.
 */
int excludedFeature(stringList *xsl,qualDef *qd)
{
	while (xsl != NULL)
	{
		if (strcmp(qd -> name,xsl -> s) == 0)
			return TRUE;

		xsl = xsl -> next;
	}

	return FALSE;
}


/*
 * Return TRUE if the given qualifier is needed.
 */
static int isNeeded(qualDef *qd)
{
	stringList *sl;

	for (sl = neededQualifiers; sl != NULL; sl = sl -> next)
		if (strcmp(qd -> name,sl -> s) == 0)
			return TRUE;

	return FALSE;
}


/*
 * Return the current scope.  currentScope() is only valid if notSkipping()
 * returns non-zero.
 */
static classDef *currentScope(void)
{
	return (currentScopeIdx > 0 ? scopeStack[currentScopeIdx - 1] : NULL);
}


/*
 * Create a new qualifier.
 */
static void newQualifier(moduleDef *mod,int line,int order,char *name,qualType qt)
{
	qualDef *qd;

	/* Check it doesn't already exist. */

	if (findQualifier(name) != NULL)
		yyerror("Version is already defined");

	qd = sipMalloc(sizeof (qualDef));
	qd -> name = name;
	qd -> qtype = qt;
	qd -> module = mod;
	qd -> line = line;
	qd -> order = order;
	qd -> next = mod -> qualifiers;
	mod -> qualifiers = qd;
}


/*
 * Create a new imported module.
 */
static void newImport(char *name)
{
	/* Ignore if the file has already been imported. */

	moduleDef *mod;

	for (mod = currentSpec -> modules; mod != NULL; mod = mod -> next)
		if (strcmp(mod -> file,name) == 0)
			return;

	newModule(NULL,name);
}


/*
 * Set up pointers to hook names.
 */
static void getHooks(optFlags *optflgs,char **pre,char **post)
{
	optFlag *of;

	if ((of = findOptFlag(optflgs,"PreHook",name_flag)) != NULL)
		*pre = of -> fvalue.sval;
	else
		*pre = NULL;

	if ((of = findOptFlag(optflgs,"PostHook",name_flag)) != NULL)
		*post = of -> fvalue.sval;
	else
		*post = NULL;
}


/*
 * Get the /ReleaseGIL/ option flag.
 */
static int getReleaseGIL(optFlags *optflgs)
{
	return (findOptFlag(optflgs,"ReleaseGIL",bool_flag) != NULL);
}

