
/*  A Bison parser, made from parser.y with Bison version GNU Bison version 1.22
  */

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

#define	LBRACE	258
#define	RBRACE	259
#define	LBRACKET	260
#define	RBRACKET	261
#define	LPAREN	262
#define	RPAREN	263
#define	LDIRECT	264
#define	RDIRECT	265
#define	COMMA	266
#define	ABSTRACTGRAPH	267
#define	MHYPERGRAPH	268
#define	MUHYPERGRAPH	269
#define	MDHYPERGRAPH	270
#define	MBINGRAPH	271
#define	MUBINGRAPH	272
#define	MDBINGRAPH	273
#define	HYPERGRAPH	274
#define	UHYPERGRAPH	275
#define	DHYPERGRAPH	276
#define	BINGRAPH	277
#define	UBINGRAPH	278
#define	DBINGRAPH	279
#define	VERTICES	280
#define	EDGES	281
#define	LOCATION	282
#define	SUBGRAPH	283
#define	IDENT	284
#define	INT_ATTR	285
#define	STR_ATTR	286
#define	DBL_ATTR	287
#define	VPTR_ATTR	288
#define	EPTR_ATTR	289
#define	STR_CONST	290
#define	INT_CONST	291
#define	FLT_CONST	292
#define	DBL_CONST	293
#define	ERROR_TOKEN	294

#line 35 "parser.y"


/*================================================================
   LINK Graph Language Input System 
	ver 1.0 by Sue Mniszewski
	ver 2.0 by Patricia Fasel, for recursive descent parsing of subgraphs

	YACC input
================================================================*/

#include <string.h>
#include <stream.h>
#include <stdio.h>
#include <iostream.h>
#include <stdlib.h>
#include <strstream.h>

#include <LINK/graph/Graph.h>
#include <LINK/graph/UHyperGraph.h>
#include <LINK/graph/DHyperGraph.h>
#include <LINK/graph/UBinGraph.h>
#include <LINK/graph/DBinGraph.h>
#include <LINK/graph/Vertex.h>
#include <LINK/graph/Edge.h>
#include <LINK/graph/Attribute.h>

#include <LINK/basic/Set.h>
#include <LINK/basic/Sequence.h>

#define UNDEFINED_ATTR    -20
#define MULTIPLY_DEFINED  -21
#define VERTEX_UNDECLARED -22

void yyerror(char *str);
int yylex(void);

enum	Edge_type	{ binary, hyper };
enum	Direct_type	{ directed, undirected, mixed };

/******************************************************************************/
/* the following indicate the most specific graph type matching that parsed.  */
/* they determine the graph type of the parsed graph when none is specified.  */
/******************************************************************************/
int			auto_type;	/* true if no graph type specified    */
int			bingraph;	/* true as long as we dont see |E|neq2*/
int			mult_seen;	/* have we seen multiedges yet?       */
int			und_seen;	/* have we seen an undir. edge yet?   */
int			dir_seen;	/* have we seen a dir. edge yet?      */
/******************************************************************************/

Edge_type		graph_type;	/* indicates what the user specified */
Direct_type		graph_direct;	/* indicates what the user specified */

extern	Graph*		new_graph;	/* defined in parseGraph.cc	     */
extern	int		line_count;

Sequence<Vertex*>	seq_vs;
Sequence<Vertex*>	seq_supervs;
Vertex*			yyvertex;
Edge*			yyedge;
Array<Graph*>		yygraph;
Array<Vertex*>		yysuper;
int			yycur = 0;
int			yymain = 0;

void	CircleLayout(GraphView*, Graph*);

#define VERTEX 0
#define EDGE   1

#include <LINK/basic/Iterator.h>
#include <LINK/basic/List.h>
#include <LINK/graph/Attribute.h>


void updateGraphObjectAttribute(GraphObject *go, int flag)
{
	List<AttributeBase*> alist = go->attributes();
	Iterator<AttributeBase*> get_attr(&alist);
	AttributeBase* attribute;
	while (get_attr(attribute)) {
		char *name, *n = (char*) attribute->name();
		if ((strlen(n) > 4) && n[0] == '_' && n[1] == 'g' &&
		                       n[2] == 'o' && n[3] == '_') {
			getAttribute(go, n, name);
			GraphObject *attr_value; 
			if (flag==VERTEX)
				attr_value = new_graph->findVertexByName(name);
			else
				attr_value = new_graph->findEdgeByName(name);
			if (attr_value) {
				setAttribute(go, n+4, attr_value);
				deleteAttribute(new_graph, n);
			}
		}
	}
}

void  updateVertexPtrAttributes(Graph *new_graph)
{
	int i, order = new_graph->order();
	char *name;
	Vertex** vertices = new_graph->vertexStart();
	for (i=0; i<order; i++) 
		updateGraphObjectAttribute(vertices[i], VERTEX);
}

void  updateEdgePtrAttributes(Graph *new_graph)
{
	char *name;
	const MSet<Edge*>& edges = new_graph->edges();
	Iterator<Edge*> get_edge(&edges);
	Edge *e;
	while (get_edge(e)) 
		updateGraphObjectAttribute(e, EDGE);
}


#line 154 "parser.y"
typedef union {
  void	      *STK;	   /* pointer to stack    */
  char        *STR;        /* string          */
  int          NUM;        /* integer         */
  float        FLT;        //  used to be int with comment:/* scaled float    */
  double       DBL;
} YYSTYPE;

#ifndef YYLTYPE
typedef
  struct yyltype
    {
      int timestamp;
      int first_line;
      int first_column;
      int last_line;
      int last_column;
      char *text;
   }
  yyltype;

#define YYLTYPE yyltype
#endif

#ifndef YYDEBUG
#define YYDEBUG 1
#endif

#include <stdio.h>

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



#define	YYFINAL		245
#define	YYFLAG		-32768
#define	YYNTBASE	40

#define YYTRANSLATE(x) ((unsigned)(x) <= 294 ? yytranslate[x] : 102)

static const char yytranslate[] = {     0,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     2,     2,     2,     2,     2,     2,     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,     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
};

#if YYDEBUG != 0
static const short yyprhs[] = {     0,
     0,     2,     7,     8,    13,    18,    22,    24,    25,    30,
    33,    35,    38,    41,    44,    47,    50,    53,    56,    59,
    62,    65,    68,    71,    73,    76,    78,    80,    82,    84,
    86,    88,    90,    92,    94,   101,   106,   111,   116,   121,
   126,   131,   136,   141,   146,   150,   153,   155,   158,   160,
   162,   165,   170,   174,   176,   178,   180,   182,   184,   186,
   189,   191,   193,   195,   197,   199,   201,   203,   205,   207,
   209,   211,   213,   220,   225,   227,   232,   237,   242,   247,
   252,   257,   262,   267,   272,   276,   279,   281,   284,   286,
   288,   291,   297,   302,   307,   311,   314,   316,   318,   320,
   322,   324,   327,   329,   331,   333,   335,   337,   339,   341,
   343,   345,   352,   357,   362,   367,   372,   377,   382,   387,
   392,   397,   401,   405,   407,   410,   412,   417,   419,   422,
   424
};

static const short yyrhs[] = {    41,
     0,     3,    43,    45,     4,     0,     0,     3,    42,    45,
     4,     0,    46,     7,    47,     8,     0,    46,     7,     8,
     0,    46,     0,     0,     7,    44,    47,     8,     0,    58,
    78,     0,    12,     0,    12,    13,     0,    12,    19,     0,
    12,    14,     0,    12,    20,     0,    12,    15,     0,    12,
    21,     0,    12,    16,     0,    12,    22,     0,    12,    17,
     0,    12,    23,     0,    12,    18,     0,    12,    24,     0,
    48,     0,    47,    48,     0,    49,     0,    51,     0,    56,
     0,    54,     0,    55,     0,    52,     0,    53,     0,    57,
     0,    50,     0,    27,     7,    66,    11,    66,     8,     0,
    31,     7,    35,     8,     0,    29,     7,    35,     8,     0,
    30,     7,    36,     8,     0,    29,     7,    36,     8,     0,
    29,     7,    37,     8,     0,    33,     7,    64,     8,     0,
    34,     7,    64,     8,     0,    32,     7,    66,     8,     0,
    29,     7,    38,     8,     0,    59,    61,     6,     0,    59,
     6,     0,    60,     0,    25,    60,     0,     5,     0,    62,
     0,    61,    62,     0,    63,     7,    65,     8,     0,    63,
     7,     8,     0,    63,     0,    64,     0,    35,     0,    29,
     0,    36,     0,    67,     0,    65,    67,     0,    36,     0,
    37,     0,    38,     0,    76,     0,    69,     0,    72,     0,
    73,     0,    74,     0,    70,     0,    71,     0,    75,     0,
    77,     0,    27,     7,    66,    11,    66,     8,     0,    68,
     7,    41,     8,     0,    28,     0,    30,     7,    36,     8,
     0,    29,     7,    36,     8,     0,    29,     7,    37,     8,
     0,    32,     7,    66,     8,     0,    33,     7,    64,     8,
     0,    34,     7,    64,     8,     0,    29,     7,    38,     8,
     0,    31,     7,    35,     8,     0,    29,     7,    35,     8,
     0,    79,    81,     4,     0,    79,     4,     0,    80,     0,
    26,    80,     0,     3,     0,    82,     0,    81,    82,     0,
    83,    84,     7,    85,     8,     0,    84,     7,    85,     8,
     0,    83,    84,     7,     8,     0,    84,     7,     8,     0,
    83,    84,     0,    84,     0,    64,     0,    97,     0,    96,
     0,    86,     0,    85,    86,     0,    94,     0,    87,     0,
    90,     0,    92,     0,    93,     0,    95,     0,    88,     0,
    89,     0,    91,     0,    27,     7,    66,    11,    66,     8,
     0,    30,     7,    36,     8,     0,    29,     7,    36,     8,
     0,    29,     7,    37,     8,     0,    32,     7,    66,     8,
     0,    29,     7,    38,     8,     0,    33,     7,    64,     8,
     0,    34,     7,    64,     8,     0,    31,     7,    35,     8,
     0,    29,     7,    35,     8,     0,     3,    98,     4,     0,
     9,   100,    10,     0,    99,     0,    98,    99,     0,    64,
     0,    64,     5,    64,     6,     0,   101,     0,   100,   101,
     0,    64,     0,    64,     5,    64,     6,     0
};

#endif

#if YYDEBUG != 0
static const short yyrline[] = { 0,
   207,   258,   259,   269,   271,   272,   273,   274,   285,   287,
   289,   291,   297,   303,   309,   315,   321,   327,   333,   339,
   345,   351,   357,   365,   366,   368,   369,   370,   371,   372,
   373,   374,   375,   376,   377,   383,   392,   400,   408,   416,
   424,   437,   450,   458,   468,   469,   471,   472,   474,   480,
   481,   483,   484,   485,   487,   499,   500,   501,   507,   508,
   510,   511,   512,   514,   515,   516,   517,   518,   519,   520,
   521,   522,   523,   528,   550,   560,   572,   583,   594,   605,
   620,   635,   646,   657,   669,   670,   672,   673,   675,   681,
   682,   684,   685,   686,   687,   688,   689,   691,   694,   695,
   697,   698,   700,   701,   702,   703,   704,   705,   706,   707,
   708,   709,   715,   726,   737,   748,   759,   770,   785,   800,
   809,   822,   866,   909,   910,   912,   925,   951,   952,   954,
   967
};

static const char * const yytname[] = {   "$","error","$illegal.","LBRACE","RBRACE",
"LBRACKET","RBRACKET","LPAREN","RPAREN","LDIRECT","RDIRECT","COMMA","ABSTRACTGRAPH",
"MHYPERGRAPH","MUHYPERGRAPH","MDHYPERGRAPH","MBINGRAPH","MUBINGRAPH","MDBINGRAPH",
"HYPERGRAPH","UHYPERGRAPH","DHYPERGRAPH","BINGRAPH","UBINGRAPH","DBINGRAPH",
"VERTICES","EDGES","LOCATION","SUBGRAPH","IDENT","INT_ATTR","STR_ATTR","DBL_ATTR",
"VPTR_ATTR","EPTR_ATTR","STR_CONST","INT_CONST","FLT_CONST","DBL_CONST","ERROR_TOKEN",
"graph_main","graph_decl","@1","graph_desc","@2","graph_deflist","graph_type",
"graph_attrs","graph_attr","rstr_g_attr","str_g_attr","rint_g_attr","int_g_attr",
"flt_g_attr","rvptr_g_attr","reptr_g_attr","rdbl_g_attr","dbl_g_attr","vertices",
"vertex_hdr","v_hdr","vertex_list","vertex","vertex_name","obj_name","vertex_attrs",
"number","vertex_attr","subgrph_attr","rint_v_attr","int_v_attr","flt_v_attr",
"rdbl_v_attr","rvptr_v_attr","reptr_v_attr","dbl_v_attr","rstr_v_attr","str_v_attr",
"edges","edge_hdr","e_hdr","edge_list","edge","edge_name","edge_def","edge_attrlist",
"edge_attr","rint_e_attr","int_e_attr","flt_e_attr","rdbl_e_attr","dbl_e_attr",
"rvptr_e_attr","reptr_e_attr","rstr_e_attr","str_e_attr","und_edge","dir_edge",
"vertex_set","vertex_und","vertex_seq","vertex_dir",""
};
#endif

static const short yyr1[] = {     0,
    40,    41,    42,    41,    43,    43,    43,    44,    43,    45,
    46,    46,    46,    46,    46,    46,    46,    46,    46,    46,
    46,    46,    46,    47,    47,    48,    48,    48,    48,    48,
    48,    48,    48,    48,    48,    49,    50,    51,    52,    53,
    54,    55,    56,    57,    58,    58,    59,    59,    60,    61,
    61,    62,    62,    62,    63,    64,    64,    64,    65,    65,
    66,    66,    66,    67,    67,    67,    67,    67,    67,    67,
    67,    67,    67,    67,    68,    69,    70,    71,    72,    73,
    74,    75,    76,    77,    78,    78,    79,    79,    80,    81,
    81,    82,    82,    82,    82,    82,    82,    83,    84,    84,
    85,    85,    86,    86,    86,    86,    86,    86,    86,    86,
    86,    86,    87,    88,    89,    90,    91,    92,    93,    94,
    95,    96,    97,    98,    98,    99,    99,   100,   100,   101,
   101
};

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

static const short yydefact[] = {     0,
     3,     1,     8,    11,     0,     0,     7,     0,    12,    14,
    16,    18,    20,    22,    13,    15,    17,    19,    21,    23,
    49,     0,     0,     0,     0,    47,     0,     0,     0,     0,
     0,     0,     0,     0,     0,     0,    24,    26,    34,    27,
    31,    32,    29,    30,    28,    33,    48,     4,    89,     0,
    10,     0,    87,    46,    57,    56,    58,     0,    50,    54,
    55,     2,     6,     0,     0,     0,     0,     0,     0,     0,
     0,     9,    25,    88,     0,    86,     0,    98,     0,    90,
     0,    97,   100,    99,    45,    51,     0,     5,    61,    62,
    63,     0,     0,     0,     0,     0,     0,     0,     0,     0,
     0,   126,     0,   124,   130,     0,   128,    85,    91,    96,
     0,    53,     0,    75,     0,     0,     0,     0,     0,     0,
     0,    59,     0,    65,    69,    70,    66,    67,    68,    71,
    64,    72,     0,    37,    39,    40,    44,    38,    36,    43,
    41,    42,     0,   122,   125,     0,   123,   129,     0,    95,
     0,     0,     0,     0,     0,     0,     0,     0,   101,   104,
   109,   110,   105,   111,   106,   107,   103,   108,     0,     0,
     0,     0,     0,     0,     0,    52,    60,     0,     0,     0,
     0,    94,     0,     0,     0,     0,     0,     0,     0,     0,
    93,   102,     0,     0,     0,     0,     0,     0,     0,     0,
     0,     0,     0,    35,   127,   131,    92,     0,     0,     0,
     0,     0,     0,     0,     0,     0,     0,     0,    84,    77,
    78,    82,    76,    83,    79,    80,    81,    74,     0,   121,
   114,   115,   117,   113,   120,   116,   118,   119,     0,     0,
    73,   112,     0,     0,     0
};

static const short yydefgoto[] = {   243,
     2,     5,     6,     8,    23,     7,    36,    37,    38,    39,
    40,    41,    42,    43,    44,    45,    46,    24,    25,    26,
    58,    59,    60,    61,   121,    92,   122,   123,   124,   125,
   126,   127,   128,   129,   130,   131,   132,    51,    52,    53,
    79,    80,    81,    82,   158,   159,   160,   161,   162,   163,
   164,   165,   166,   167,   168,    83,    84,   103,   104,   106,
   107
};

static const short yypact[] = {     7,
    86,-32768,-32768,   189,    17,    17,     6,    29,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,    16,    39,    27,    10,-32768,    50,    57,    59,    60,
    78,    87,    89,    90,    92,    98,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   102,
-32768,     0,-32768,-32768,-32768,-32768,-32768,    12,-32768,   109,
-32768,-32768,-32768,   113,    65,    72,    81,    83,    65,   -21,
   -21,-32768,-32768,-32768,   -21,-32768,   -21,-32768,     2,-32768,
    14,   115,-32768,-32768,-32768,-32768,    41,-32768,-32768,-32768,
-32768,   130,   112,   118,   142,   143,   145,   154,   155,   156,
   157,   161,    -2,-32768,   163,    15,-32768,-32768,-32768,   169,
   125,-32768,   170,-32768,   171,   172,   174,   181,   182,   183,
    49,-32768,   184,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,    65,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,   -21,-32768,-32768,   -21,-32768,-32768,   140,-32768,
   185,   186,   188,   207,   208,   209,   210,   153,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    65,    76,
   187,   190,    65,   -21,   -21,-32768,-32768,     7,   211,   212,
   214,-32768,   167,    65,    99,   191,   193,    65,   -21,   -21,
-32768,-32768,   213,   218,   221,   222,   223,   224,   225,   226,
   227,   228,   229,-32768,-32768,-32768,-32768,   230,   231,   232,
   234,   235,   236,   237,   238,   239,   240,    65,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,    65,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   241,   242,
-32768,-32768,   251,   252,-32768
};

static const short yypgoto[] = {-32768,
    43,-32768,-32768,-32768,   216,-32768,   233,   -24,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   243,
-32768,   180,-32768,   -51,-32768,   -69,   132,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   204,
-32768,   176,-32768,   175,   108,  -151,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,   159,-32768,
   152
};


#define	YYLAST		265


static const short yytable[] = {    99,
    78,   144,    75,    76,    75,   108,   192,    55,    77,     1,
    77,    73,    28,    56,    57,    54,    75,    85,   100,   101,
    21,    21,    77,   102,   147,   105,    55,    78,    55,    49,
    55,   192,    56,    57,    56,    57,    56,    57,    55,    73,
    55,    22,    48,    55,    56,    57,    56,    57,   112,    56,
    57,   102,    50,    62,   105,    29,   176,    30,    31,    32,
    33,    34,    35,   179,    63,    65,    66,   113,   114,   115,
   116,   117,   118,   119,   120,   113,   114,   115,   116,   117,
   118,   119,   120,    29,    67,    30,    31,    32,    33,    34,
    35,   180,     3,    68,   181,    69,    70,     4,    71,   193,
    89,    90,    91,   200,    49,    72,    93,    94,    95,    96,
   194,   195,   196,   197,   208,    87,    97,    98,   215,   134,
    88,   111,   201,   202,    29,   135,    30,    31,    32,    33,
    34,    35,   150,   209,   210,   211,   212,   216,   217,    29,
   133,    30,    31,    32,    33,    34,    35,   182,   239,   136,
   137,   151,   138,   152,   153,   154,   155,   156,   157,   240,
   191,   139,   140,   141,   142,   143,   151,   146,   152,   153,
   154,   155,   156,   157,   207,   149,   169,   170,   171,   151,
   172,   152,   153,   154,   155,   156,   157,   173,   174,   175,
   178,   184,   185,   151,   186,   152,   153,   154,   155,   156,
   157,     9,    10,    11,    12,    13,    14,    15,    16,    17,
    18,    19,    20,   187,   188,   189,   190,   205,   204,   206,
   203,    27,   198,   218,   199,   219,   213,   214,   220,   221,
   222,   223,   224,   225,   226,   227,   228,    86,   230,   231,
   229,   232,   233,   234,   235,   236,   237,   238,   241,   242,
   244,   245,   177,    74,   109,   110,   183,   148,     0,     0,
    64,   145,     0,     0,    47
};

static const short yycheck[] = {    69,
    52,     4,     3,     4,     3,     4,   158,    29,     9,     3,
     9,    36,     7,    35,    36,     6,     3,     6,    70,    71,
     5,     5,     9,    75,    10,    77,    29,    79,    29,     3,
    29,   183,    35,    36,    35,    36,    35,    36,    29,    64,
    29,    25,     4,    29,    35,    36,    35,    36,     8,    35,
    36,   103,    26,     4,   106,    27,     8,    29,    30,    31,
    32,    33,    34,   133,     8,     7,     7,    27,    28,    29,
    30,    31,    32,    33,    34,    27,    28,    29,    30,    31,
    32,    33,    34,    27,     7,    29,    30,    31,    32,    33,
    34,   143,     7,     7,   146,     7,     7,    12,     7,   169,
    36,    37,    38,   173,     3,     8,    35,    36,    37,    38,
    35,    36,    37,    38,   184,     7,    36,    35,   188,     8,
     8,     7,   174,   175,    27,     8,    29,    30,    31,    32,
    33,    34,     8,    35,    36,    37,    38,   189,   190,    27,
    11,    29,    30,    31,    32,    33,    34,     8,   218,     8,
     8,    27,     8,    29,    30,    31,    32,    33,    34,   229,
     8,     8,     8,     8,     8,     5,    27,     5,    29,    30,
    31,    32,    33,    34,     8,     7,     7,     7,     7,    27,
     7,    29,    30,    31,    32,    33,    34,     7,     7,     7,
     7,     7,     7,    27,     7,    29,    30,    31,    32,    33,
    34,    13,    14,    15,    16,    17,    18,    19,    20,    21,
    22,    23,    24,     7,     7,     7,     7,     6,     8,     6,
   178,     6,    36,    11,    35,     8,    36,    35,     8,     8,
     8,     8,     8,     8,     8,     8,     8,    58,     8,     8,
    11,     8,     8,     8,     8,     8,     8,     8,     8,     8,
     0,     0,   121,    50,    79,    81,   149,   106,    -1,    -1,
    28,   103,    -1,    -1,    22
};
/* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
#line 3 "/usr/local/gnu/lib/bison.simple"

/* Skeleton output parser for bison,
   Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman

   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 1, or (at your option)
   any later version.

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

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


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

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

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

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

#define YYTERROR	1
#define YYERRCODE	256

#ifndef YYPURE
#define YYLEX		yylex()
#endif

#ifdef YYPURE
#ifdef YYLSP_NEEDED
#define YYLEX		yylex(&yylval, &yylloc)
#else
#define YYLEX		yylex(&yylval)
#endif
#endif

/* If nonreentrant, generate the variables here */

#ifndef YYPURE

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

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

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

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

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

#ifndef	YYINITDEPTH
#define YYINITDEPTH 200
#endif

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

#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif

#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif

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

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

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

#else /* __cplusplus */

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

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

#endif
#endif

#line 184 "/usr/local/gnu/lib/bison.simple"
int
yyparse()
{
  register int yystate;
  register int yyn;
  register short *yyssp;
  register YYSTYPE *yyvsp;
  int yyerrstatus;	/*  number of tokens to shift before error messages enabled */
  int yychar1 = 0;		/*  lookahead token as an internal (translated) token number */

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

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

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

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

  int yystacksize = YYINITDEPTH;

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

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

  int yylen;

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

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

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

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

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

  *++yyssp = yystate;

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

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

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

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

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

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

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

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

  goto yybackup;
 yybackup:

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

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

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

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

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

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

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

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

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

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

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

  yyn = yytable[yyn];

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

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

  if (yyn == YYFINAL)
    YYACCEPT;

  /* Shift the lookahead token.  */

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

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

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

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

  yystate = yyn;
  goto yynewstate;

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

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

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

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

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

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


  switch (yyn) {

case 1:
#line 208 "parser.y"
{
    if (auto_type) {
	if (bingraph) {
	    if (mult_seen) {
	       if (und_seen && dir_seen)
		 new_graph = new MBinGraph(*(MBinGraph*)yygraph[yymain],1);
	       else if (dir_seen)
		 new_graph = new MDBinGraph(*(MDBinGraph*)yygraph[yymain],1);
	       else
		 new_graph = new MUBinGraph(*(MUBinGraph*)yygraph[yymain],1);
	    } else {
	       if (und_seen && dir_seen)
		 new_graph = new BinGraph(*(BinGraph*)yygraph[yymain],1);
	       else if (dir_seen)
		 new_graph = new DBinGraph(*(DBinGraph*)yygraph[yymain],1);
	       else
		 new_graph = new UBinGraph(*(UBinGraph*)yygraph[yymain],1);
	    }
	} else {
	    if (mult_seen) {
	       if (und_seen && dir_seen)
		 new_graph=new MHyperGraph(*(MHyperGraph*)yygraph[yymain],1);
	       else if (dir_seen)
		 new_graph=new MDHyperGraph(*(MDHyperGraph*)yygraph[yymain],1);
	       else
		 new_graph=new MUHyperGraph(*(MUHyperGraph*)yygraph[yymain],1);
	    } else {
	       if (und_seen && dir_seen)
		 new_graph=new HyperGraph(*(HyperGraph*)yygraph[yymain],1);
	       else if (dir_seen)
		 new_graph=new DHyperGraph(*(DHyperGraph*)yygraph[yymain],1);
	       else
		 new_graph=new UHyperGraph(*(UHyperGraph*)yygraph[yymain],1);
	    }
	}
	yygraph.remove(yygraph[yymain]);
	delete yygraph[yymain]; 
    } else
        new_graph = yygraph[yymain];

    // graphobject attributes (ex: pred) must be set now.  When they
    // were parsed, a temporary attribute named _go_<attrname> was created.
    // Now we must go through the graph and use this attribute to look up
    // the appropriate graphobjects.
    updateVertexPtrAttributes(new_graph);
    updateEdgePtrAttributes(new_graph);

    // open the subgraphs if specified (
    ;
    break;}
case 3:
#line 259 "parser.y"
{
			auto_type = TRUE;
			bingraph =  TRUE;	/* these ultimately determine*/
			mult_seen = FALSE;	/* graph type.		     */
			und_seen =  FALSE;
			dir_seen =  FALSE;
		        graph_type = hyper;	/* parse with this type */
		        graph_direct = mixed;	/* assumed.             */
		        yygraph[yycur] = new MHyperGraph();
		        ;
    break;}
case 8:
#line 275 "parser.y"
{
			auto_type = TRUE;
			bingraph =  TRUE;	/* these ultimately determine*/
			mult_seen = FALSE;	/* graph type.		     */
			und_seen =  FALSE;
			dir_seen =  FALSE;
		        graph_type = hyper;	/* parse with this type */
		        graph_direct = mixed;	/* assumed.             */
		        yygraph[yycur] = new MHyperGraph();
		  ;
    break;}
case 11:
#line 290 "parser.y"
{;
    break;}
case 12:
#line 292 "parser.y"
{
		        graph_type = hyper;
		        graph_direct = mixed;
		        yygraph[yycur] = new MHyperGraph();
		    ;
    break;}
case 13:
#line 298 "parser.y"
{
		        graph_type = hyper;
		        graph_direct = mixed;
		        yygraph[yycur] = new HyperGraph();
		    ;
    break;}
case 14:
#line 304 "parser.y"
{
			graph_type = hyper;
			graph_direct = undirected;
			yygraph[yycur] = new MUHyperGraph();
		    ;
    break;}
case 15:
#line 310 "parser.y"
{
			graph_type = hyper;
			graph_direct = undirected;
			yygraph[yycur] = new UHyperGraph();
		    ;
    break;}
case 16:
#line 316 "parser.y"
{
			graph_type = hyper;
			graph_direct = directed;
                	yygraph[yycur] = new MDHyperGraph();
                    ;
    break;}
case 17:
#line 322 "parser.y"
{
			graph_type = hyper;
			graph_direct = directed;
                	yygraph[yycur] = new DHyperGraph();
		    ;
    break;}
case 18:
#line 328 "parser.y"
{ 
			graph_type = binary;
			graph_direct = mixed;
                	yygraph[yycur] = new MBinGraph();
                    ;
    break;}
case 19:
#line 334 "parser.y"
{ 
			graph_type = binary;
			graph_direct = mixed;
                	yygraph[yycur] = new BinGraph();
                    ;
    break;}
case 20:
#line 340 "parser.y"
{ 
			graph_type = binary;
			graph_direct = undirected;
                	yygraph[yycur] = new MUBinGraph();
                    ;
    break;}
case 21:
#line 346 "parser.y"
{ 
			graph_type = binary;
			graph_direct = undirected;
                	yygraph[yycur] = new UBinGraph();
                    ;
    break;}
case 22:
#line 352 "parser.y"
{
			graph_type = binary;
			graph_direct = directed;
                	yygraph[yycur] = new MDBinGraph(); 
                    ;
    break;}
case 23:
#line 358 "parser.y"
{
			graph_type = binary;
			graph_direct = directed;
                	yygraph[yycur] = new DBinGraph(); 
                    ;
    break;}
case 35:
#line 378 "parser.y"
{
		   setAttribute((GraphObject*) yygraph[yycur], "x", yyvsp[-2].DBL);
		   setAttribute((GraphObject*) yygraph[yycur], "y", yyvsp[0].DBL);
		;
    break;}
case 36:
#line 384 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		     new Attribute<String>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].STR);
		else {
		     setAttribute((GraphObject*)yygraph[yycur],yyvsp[-3].STR,yyvsp[-1].STR);
		}
	    ;
    break;}
case 37:
#line 393 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		     new Attribute<String>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].STR);
		else
		     setAttribute((GraphObject*)yygraph[yycur],yyvsp[-3].STR,yyvsp[-1].STR);
	    ;
    break;}
case 38:
#line 401 "parser.y"
{
	      if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		  new Attribute<int>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].NUM);
	      else
		  setAttribute((GraphObject*)yygraph[yycur],yyvsp[-3].STR,yyvsp[-1].NUM);
	      ;
    break;}
case 39:
#line 409 "parser.y"
{
	      if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		  new Attribute<int>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].NUM);
	      else
		  setAttribute((GraphObject*)yygraph[yycur],yyvsp[-3].STR,yyvsp[-1].NUM);
	      ;
    break;}
case 40:
#line 417 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		   new Attribute<float>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].FLT);
		else
		   setAttribute((GraphObject*) yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].FLT);
		;
    break;}
case 41:
#line 425 "parser.y"
{
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		  new Attribute<String>(yygraph[yycur], ns, yyvsp[-1].STR);
		  new Attribute<Vertex*>(yygraph[yycur], yyvsp[-3].STR, 
						(Vertex*)0);
		}
		delete ns;
		;
    break;}
case 42:
#line 438 "parser.y"
{
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		  new Attribute<String>(yygraph[yycur], ns, yyvsp[-1].STR);
		  new Attribute<Edge*>(yygraph[yycur], yyvsp[-3].STR, 
						(Edge*)0);
		}
		delete ns;
		;
    break;}
case 43:
#line 451 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		  new Attribute<double>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].DBL);
		else
		  setAttribute((GraphObject*) yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 44:
#line 459 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		  new Attribute<double>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].DBL);
		else
		  setAttribute((GraphObject*) yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 49:
#line 475 "parser.y"
{
			seq_vs.clear();
			seq_supervs.clear();
		    ;
    break;}
case 55:
#line 488 "parser.y"
{
	    	    yyvertex = yygraph[yymain]->addVertex(yyvsp[0].STR);
		    yygraph[yymain]->removeVertex(yyvertex);
		    yygraph[yycur]->subgraphAddVertex(yyvertex);

		    if (yycur != yymain)
			// parent of this vertex is a subgraph
			setAttribute((GraphObject*) yyvertex, "x_parent",
			    yygraph[yycur]);
		    ;
    break;}
case 56:
#line 499 "parser.y"
{ yyval.STR = yyvsp[0].STR; ;
    break;}
case 57:
#line 500 "parser.y"
{ yyval.STR = yyvsp[0].STR; ;
    break;}
case 58:
#line 501 "parser.y"
{ char tmp[80];
				  sprintf(tmp, "%d", yyvsp[0].NUM);
				  extern char *newString(char *);
				  yyval.STR = newString(tmp);
				;
    break;}
case 61:
#line 510 "parser.y"
{ yyval.DBL = (double) yyvsp[0].NUM; ;
    break;}
case 62:
#line 511 "parser.y"
{ yyval.DBL = (double) yyvsp[0].FLT; ;
    break;}
case 63:
#line 512 "parser.y"
{ yyval.DBL = yyvsp[0].DBL;          ;
    break;}
case 73:
#line 524 "parser.y"
{
		    setAttribute((GraphObject*) yyvertex, "x", yyvsp[-2].DBL);
		    setAttribute((GraphObject*) yyvertex, "y", yyvsp[0].DBL);
		    ;
    break;}
case 74:
#line 529 "parser.y"
{ 
		    GraphObject* subgraph = (GraphObject*) yygraph[yycur];
		    GraphObject* supervertex = (GraphObject*) yysuper[yycur];

		    setAttribute(supervertex, "x_subgraph", yygraph[yycur]);
		    setAttribute(supervertex, "x_open", 0);
		    setAttribute(supervertex, "x_parent", yygraph[yycur-1]);

		    setAttribute(subgraph, "x_open", 0);
		    setAttribute(subgraph, "x_parent", yygraph[yycur-1]);
		    setAttribute(subgraph, "graph_name", supervertex->name());
		    setAttribute(subgraph, "x_supervertex", supervertex);

		    List<Vertex*>* supervertices;
		    getAttribute((GraphObject*) yygraph[yycur], 
			"x_supervertices", supervertices);
		    supervertices->append(yysuper[yycur]);
		    yyvertex = yysuper[yycur];
		    yycur--;
		    ;
    break;}
case 75:
#line 551 "parser.y"
{
		    yycur++;
		    yysuper[yycur] = yyvertex;
		    List<Vertex*>* supervertices;
		    getAttribute((GraphObject*) yygraph[yymain], 
			"x_supervertices", supervertices);
		    supervertices->append(yyvertex);
		    ;
    break;}
case 76:
#line 561 "parser.y"
{
                if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
                       char tmp[80];
                       sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
                       yyerror(tmp);
		       return UNDEFINED_ATTR;
                } else 
                        setAttribute((GraphObject*) yyvertex,yyvsp[-3].STR,yyvsp[-1].NUM);
		;
    break;}
case 77:
#line 573 "parser.y"
{
                if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
                       char tmp[80];
                       sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
                       yyerror(tmp);
		       return UNDEFINED_ATTR;
                } else 
                        setAttribute((GraphObject*) yyvertex,yyvsp[-3].STR,yyvsp[-1].NUM);
		;
    break;}
case 78:
#line 584 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyvertex, yyvsp[-3].STR, yyvsp[-1].FLT);
		;
    break;}
case 79:
#line 595 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyvertex, yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 80:
#line 606 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
		}
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		setAttribute((GraphObject*) yyvertex, ns, yyvsp[-1].STR);
		delete ns;
		;
    break;}
case 81:
#line 621 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
		}
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		setAttribute((GraphObject*) yyvertex, ns, yyvsp[-1].STR);
		delete ns;
		;
    break;}
case 82:
#line 636 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyvertex, yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 83:
#line 647 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyvertex, yyvsp[-3].STR, yyvsp[-1].STR);
		;
    break;}
case 84:
#line 658 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyvertex, yyvsp[-3].STR, yyvsp[-1].STR);
		;
    break;}
case 89:
#line 676 "parser.y"
{
			seq_vs.clear();
			seq_supervs.clear();
		    ;
    break;}
case 98:
#line 692 "parser.y"
{/* this to override default $$ = $1 action */;
    break;}
case 112:
#line 710 "parser.y"
{
			setAttribute((GraphObject*) yyedge, "x", yyvsp[-2].DBL);
			setAttribute((GraphObject*) yyedge, "y", yyvsp[0].DBL);
		    ;
    break;}
case 113:
#line 716 "parser.y"
{
                if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
                       char tmp[80];
                       sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
                       yyerror(tmp);
		       return UNDEFINED_ATTR;
                } else 
                        setAttribute((GraphObject*) yyedge,yyvsp[-3].STR,yyvsp[-1].NUM);
		;
    break;}
case 114:
#line 727 "parser.y"
{
                if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
                       char tmp[80];
                       sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
                       yyerror(tmp);
		       return UNDEFINED_ATTR;
                } else 
                        setAttribute((GraphObject*) yyedge,yyvsp[-3].STR,yyvsp[-1].NUM);
		;
    break;}
case 115:
#line 738 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyedge, yyvsp[-3].STR, yyvsp[-1].FLT);
		;
    break;}
case 116:
#line 749 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyedge, yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 117:
#line 760 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyedge, yyvsp[-3].STR, yyvsp[-1].DBL);
		;
    break;}
case 118:
#line 771 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
		} 
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		setAttribute((GraphObject*) yyedge, ns, yyvsp[-1].STR);
		delete ns;
		;
    break;}
case 119:
#line 786 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
		}
		ostrstream oss;
		oss << "_go_" << yyvsp[-3].STR << ends;
		char *ns = oss.str();
		setAttribute((GraphObject*) yyvertex, ns, yyvsp[-1].STR);
		delete ns;
		;
    break;}
case 120:
#line 801 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR))
		     new Attribute<String>(yygraph[yycur], yyvsp[-3].STR, yyvsp[-1].STR);
		else {
		     setAttribute((GraphObject*) yyedge, yyvsp[-3].STR, yyvsp[-1].STR);
		}
	    ;
    break;}
case 121:
#line 810 "parser.y"
{
		if (!yygraph[yycur]->findAttr(yyvsp[-3].STR)) {
		      char tmp[80];
		      sprintf(tmp, "attribute %s undefined", yyvsp[-3].STR);
		      yyerror(tmp);
		      return UNDEFINED_ATTR;
	    	} else
		      setAttribute((GraphObject*) yyedge, yyvsp[-3].STR, yyvsp[-1].STR);
		;
    break;}
case 122:
#line 823 "parser.y"
{
		    if (graph_type == binary && seq_vs.size() != 2) {
			printf("Binary edge must have two vertices\n");
		    } else {
		    	if (seq_vs.size() != 2) 
				bingraph = FALSE;
			if (yygraph[yymain]->isEdge(seq_vs))
				mult_seen = TRUE;
			und_seen = TRUE;
			Set<Vertex*> set_vs = seq_vs;
            		yyedge = yygraph[yymain]->addEdge(set_vs);
			yygraph[yymain]->removeEdge(yyedge);
			yygraph[yycur]->subgraphAddEdge(yyedge);

			Iterator<Vertex*> get_superv(&seq_supervs);
			Iterator<Vertex*> get_vertex(&seq_vs);
			Vertex* vertex;
			Vertex* superv;
			while (get_vertex(vertex) && get_superv(superv)) {
			    if (superv != vertex) {
				// must add edge to all supervertices in between
				Graph* parent;
				getAttribute((GraphObject*) vertex,
				    "x_parent", parent);
				Vertex* v;
				getAttribute((GraphObject*) parent,
				    "x_supervertex", v);
				while (v != superv) {
				    v->addEdge(yyedge);
				    getAttribute((GraphObject*) parent,
					"x_parent", parent);
				    getAttribute((GraphObject*) parent,
				        "x_supervertex", v);
				}
				superv->addEdge(yyedge);
				yyedge->replace(vertex, superv);
			    }
			}
        	    }
		    seq_vs.clear();
		    seq_supervs.clear();
		    ;
    break;}
case 123:
#line 867 "parser.y"
{
		    if (graph_type == binary && seq_vs.size() != 2) {
			printf("Binary edge must have two vertices\n");
		    } else {
		    	if (seq_vs.size() != 2) 
				bingraph = FALSE;
			if (yygraph[yymain]->isEdge(seq_vs))
				mult_seen = TRUE;
			dir_seen = TRUE;
            		yyedge = yygraph[yymain]->addEdge(seq_vs);
			yygraph[yymain]->removeEdge(yyedge);
			yygraph[yycur]->subgraphAddEdge(yyedge);

			Iterator<Vertex*> get_superv(&seq_supervs);
			Iterator<Vertex*> get_vertex(&seq_vs);
			Vertex* vertex;
			Vertex* superv;
			while (get_vertex(vertex) && get_superv(superv)) {
			    if (superv != vertex) {
				// must add edge to all supervertices in between
				Graph* parent;
				getAttribute((GraphObject*) vertex,
				    "x_parent", parent);
				Vertex* v;
				getAttribute((GraphObject*) parent,
				    "x_supervertex", v);
				while (v != superv) {
				    v->addEdge(yyedge);
				    getAttribute((GraphObject*) parent,
					"x_parent", parent);
				    getAttribute((GraphObject*) parent,
				        "x_supervertex", v);
				}
				superv->addEdge(yyedge);
				yyedge->replace(vertex, superv);
			    }
			}
		    }
		    seq_vs.clear();
		    seq_supervs.clear();
		    ;
    break;}
case 126:
#line 913 "parser.y"
{
		    yyvertex = yygraph[yycur]->findVertexByName(yyvsp[0].STR);
		    if (yyvertex) {
		    	seq_vs.insert(yyvertex);
		    	seq_supervs.insert(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[0].STR);
			yyerror(tmp);
		       return VERTEX_UNDECLARED;
		    }
		    ;
    break;}
case 127:
#line 926 "parser.y"
{
		    yyvertex = yygraph[yycur]->findVertexByName(yyvsp[-3].STR);
		    if (yyvertex) {
		    	seq_supervs.insert(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[-3].STR);
			yyerror(tmp);
		        return VERTEX_UNDECLARED;
		    }
		    {
		    Graph *g;
		    getAttribute((GraphObject*) yyvertex, "x_subgraph", g);
		    yyvertex = g->findVertexByName(yyvsp[-1].STR);
		    if (yyvertex) {
		    	seq_vs.insert(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[-1].STR);
			yyerror(tmp);
		        return VERTEX_UNDECLARED;
		    }
		    }
		    ;
    break;}
case 130:
#line 955 "parser.y"
{
		    yyvertex = yygraph[yycur]->findVertexByName(yyvsp[0].STR);
		    if (yyvertex) {
		    	seq_vs.append(yyvertex);
		    	seq_supervs.append(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[0].STR);
			yyerror(tmp);
		        return VERTEX_UNDECLARED;
		    }
		    ;
    break;}
case 131:
#line 968 "parser.y"
{
		    yyvertex = yygraph[yycur]->findVertexByName(yyvsp[-3].STR);
		    if (yyvertex) {
		    	seq_supervs.append(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[-3].STR);
			yyerror(tmp);
		        return VERTEX_UNDECLARED;
		    }
		    {
		    Graph *g;
		    getAttribute((GraphObject*) yyvertex, "x_subgraph", g);
		    yyvertex = g->findVertexByName(yyvsp[-1].STR);
		    //yyvertex = yygraph[yycur]->findVertexByName($<STR>3);
		    if (yyvertex) {
		    	seq_vs.append(yyvertex);
		    } else {
			char tmp[80];
			sprintf(tmp, "vertex %s is undeclared", yyvsp[-1].STR);
			yyerror(tmp);
		        return VERTEX_UNDECLARED;
		    }
		    }	
		    ;
    break;}
}
   /* the action file gets copied in in place of this dollarsign */
#line 465 "/usr/local/gnu/lib/bison.simple"

  yyvsp -= yylen;
  yyssp -= yylen;
#ifdef YYLSP_NEEDED
  yylsp -= yylen;
#endif

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

  *++yyvsp = yyval;

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

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

  yyn = yyr1[yyn];

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

  goto yynewstate;

yyerrlab:   /* here on detecting error */

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

#ifdef YYERROR_VERBOSE
      yyn = yypact[yystate];

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

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

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

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

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

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

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

      yychar = YYEMPTY;
    }

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

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

  goto yyerrhandle;

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

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

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

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

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

yyerrhandle:

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

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

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

  if (yyn == YYFINAL)
    YYACCEPT;

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

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

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