Graphviz  2.29.20120524.0446
lib/graph/parser.c
Go to the documentation of this file.
00001 /* A Bison parser, made by GNU Bison 2.5.  */
00002 
00003 /* Bison implementation for Yacc-like parsers in C
00004    
00005       Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
00006    
00007    This program is free software: you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation, either version 3 of the License, or
00010    (at your option) any later version.
00011    
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016    
00017    You should have received a copy of the GNU General Public License
00018    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00019 
00020 /* As a special exception, you may create a larger work that contains
00021    part or all of the Bison parser skeleton and distribute that work
00022    under terms of your choice, so long as that work isn't itself a
00023    parser generator using the skeleton or a modified version thereof
00024    as a parser skeleton.  Alternatively, if you modify or redistribute
00025    the parser skeleton itself, you may (at your option) remove this
00026    special exception, which will cause the skeleton and the resulting
00027    Bison output files to be licensed under the GNU General Public
00028    License without this special exception.
00029    
00030    This special exception was added by the Free Software Foundation in
00031    version 2.2 of Bison.  */
00032 
00033 /* C LALR(1) parser skeleton written by Richard Stallman, by
00034    simplifying the original so-called "semantic" parser.  */
00035 
00036 /* All symbols defined below should begin with ag or YY, to avoid
00037    infringing on user name space.  This should be done even for local
00038    variables, as they might otherwise be expanded by user macros.
00039    There are some unavoidable exceptions within include files to
00040    define necessary library symbols; they are noted "INFRINGES ON
00041    USER NAME SPACE" below.  */
00042 
00043 /* Identify Bison output.  */
00044 #define YYBISON 1
00045 
00046 /* Bison version.  */
00047 #define YYBISON_VERSION "2.5"
00048 
00049 /* Skeleton name.  */
00050 #define YYSKELETON_NAME "yacc.c"
00051 
00052 /* Pure parsers.  */
00053 #define YYPURE 0
00054 
00055 /* Push parsers.  */
00056 #define YYPUSH 0
00057 
00058 /* Pull parsers.  */
00059 #define YYPULL 1
00060 
00061 /* Using locations.  */
00062 #define YYLSP_NEEDED 0
00063 
00064 
00065 
00066 /* Copy the first part of user declarations.  */
00067 
00068 /* Line 268 of yacc.c  */
00069 #line 14 "../../lib/graph/parser.y"
00070 
00071 
00072 #include        "libgraph.h"
00073 
00074 #ifdef DMALLOC
00075 #include "dmalloc.h"
00076 #endif
00077 
00078 static char             *Port;
00079 static char             In_decl,In_edge_stmt;
00080 static int              Current_class,Agraph_type;
00081 static Agsym_t          *headsubsym;
00082 static Agsym_t          *tailsubsym;
00083 static Agraph_t         *G;
00084 static Agnode_t         *N;
00085 static Agedge_t         *E;
00086 static objstack_t       *SP;
00087 #define GSTACK_SIZE 64
00088 static Agraph_t         *Gstack[GSTACK_SIZE];
00089 static int                      GSP;
00090 
00091 static void subgraph_warn (void)
00092 {
00093     agerr (AGWARN, "The use of \"subgraph %s\", line %d, without a body is deprecated.\n",
00094         G->name, aglinenumber());
00095     agerr (AGPREV, "This may cause unexpected behavior or crash the program.\n");
00096     agerr (AGPREV, "Please use a single definition of the subgraph within the context of its parent graph \"%s\"\n", Gstack[GSP-2]->name);
00097 }
00098 
00099 static int push_subg(Agraph_t *g)
00100 {
00101         if (GSP >= GSTACK_SIZE) {
00102                 agerr (AGERR, "Gstack overflow in graph parser\n"); return(1);
00103         }
00104         G = Gstack[GSP++] = g;
00105         return 0;
00106 }
00107 
00108 static Agraph_t *pop_subg(void)
00109 {
00110         Agraph_t                *g;
00111         if (GSP == 0) {
00112                 agerr (AGERR, "Gstack underflow in graph parser\n"); return(NULL);
00113         }
00114         g = Gstack[--GSP];                                      /* graph being popped off */
00115         if (GSP > 0) G = Gstack[GSP - 1];       /* current graph */
00116         else G = 0;
00117         return g;
00118 }
00119 
00120 static objport_t pop_gobj(void)
00121 {
00122         objport_t       rv;
00123         rv.obj = pop_subg();
00124         rv.port = NULL;
00125         return rv;
00126 }
00127 
00128 static void anonname(char* buf)
00129 {
00130         static int              anon_id = 0;
00131 
00132         sprintf(buf,"_anonymous_%d",anon_id++);
00133 }
00134 
00135 static int begin_graph(char *name)
00136 {
00137         Agraph_t                *g;
00138         char                    buf[SMALLBUF];
00139 
00140         if (!name) {
00141                 anonname(buf);
00142                 name = buf;
00143     }
00144         g = AG.parsed_g = agopen(name,Agraph_type);
00145         Current_class = TAG_GRAPH;
00146         headsubsym = tailsubsym = NULL;
00147         if (push_subg(g)) return 1;
00148         In_decl = TRUE;
00149         return 0;
00150 }
00151 
00152 static Agraph_t* end_graph(void)
00153 {
00154         return (pop_subg());
00155 }
00156 
00157 static Agnode_t *bind_node(char *name)
00158 {
00159         Agnode_t        *n = agnode(G,name);
00160         In_decl = FALSE;
00161         return n;
00162 }
00163 
00164 static int anonsubg(void)
00165 {
00166         char                    buf[SMALLBUF];
00167         Agraph_t                        *subg;
00168 
00169         In_decl = FALSE;
00170         anonname(buf);
00171         subg = agsubg(G,buf);
00172         if (push_subg(subg)) return 1;
00173         else return 0;
00174 }
00175 
00176 #if 0 /* NOT USED */
00177 static int isanonsubg(Agraph_t *g)
00178 {
00179         return (strncmp("_anonymous_",g->name,11) == 0);
00180 }
00181 #endif
00182 
00183 static void begin_edgestmt(objport_t objp)
00184 {
00185         struct objstack_t       *new_sp;
00186 
00187         new_sp = NEW(objstack_t);
00188         new_sp->link = SP;
00189         SP = new_sp;
00190         SP->list = SP->last = NEW(objlist_t);
00191         SP->list->data  = objp;
00192         SP->list->link = NULL;
00193         SP->in_edge_stmt = In_edge_stmt;
00194         SP->subg = G;
00195         agpushproto(G);
00196         In_edge_stmt = TRUE;
00197 }
00198 
00199 static void mid_edgestmt(objport_t objp)
00200 {
00201         SP->last->link = NEW(objlist_t);
00202         SP->last = SP->last->link;
00203         SP->last->data = objp;
00204         SP->last->link = NULL;
00205 }
00206 
00207 static int end_edgestmt(void)
00208 {
00209         objstack_t      *old_SP;
00210         objlist_t       *tailptr,*headptr,*freeptr;
00211         Agraph_t                *t_graph,*h_graph;
00212         Agnode_t        *t_node,*h_node,*t_first,*h_first;
00213         Agedge_t        *e;
00214         char            *tport,*hport;
00215 
00216         for (tailptr = SP->list; tailptr->link; tailptr = tailptr->link) {
00217                 headptr = tailptr->link;
00218                 tport = tailptr->data.port;
00219                 hport = headptr->data.port;
00220                 if (TAG_OF(tailptr->data.obj) == TAG_NODE) {
00221                         t_graph = NULL;
00222                         t_first = (Agnode_t*)(tailptr->data.obj);
00223                 }
00224                 else {
00225                         t_graph = (Agraph_t*)(tailptr->data.obj);
00226                         t_first = agfstnode(t_graph);
00227                 }
00228                 if (TAG_OF(headptr->data.obj) == TAG_NODE) {
00229                         h_graph = NULL;
00230                         h_first = (Agnode_t*)(headptr->data.obj);
00231                 }
00232                 else {
00233                         h_graph = (Agraph_t*)(headptr->data.obj);
00234                         h_first = agfstnode(h_graph);
00235                 }
00236 
00237                 for (t_node = t_first; t_node; t_node = t_graph ?
00238                   agnxtnode(t_graph,t_node) : NULL) {
00239                         for (h_node = h_first; h_node; h_node = h_graph ?
00240                           agnxtnode(h_graph,h_node) : NULL ) {
00241                                 e = agedge(G,t_node,h_node);
00242                                 if (e) {
00243                                         char    *tp = tport;
00244                                         char    *hp = hport;
00245                                         if ((e->tail != e->head) && (e->head == t_node)) {
00246                                                 /* could happen with an undirected edge */
00247                                                 char    *temp;
00248                                                 temp = tp; tp = hp; hp = temp;
00249                                         }
00250                                         if (tp && tp[0]) {
00251                                                 agxset(e,TAILX,tp);
00252                                                 agstrfree(tp); 
00253                                         }
00254                                         if (hp && hp[0]) {
00255                                                 agxset(e,HEADX,hp);
00256                                                 agstrfree(hp); 
00257                                         }
00258                                 }
00259                         }
00260                 }
00261         }
00262         tailptr = SP->list; 
00263         while (tailptr) {
00264                 freeptr = tailptr;
00265                 tailptr = tailptr->link;
00266                 if (TAG_OF(freeptr->data.obj) == TAG_NODE)
00267                 free(freeptr);
00268         }
00269         if (G != SP->subg) return 1;
00270         agpopproto(G);
00271         In_edge_stmt = SP->in_edge_stmt;
00272         old_SP = SP;
00273         SP = SP->link;
00274         In_decl = FALSE;
00275         free(old_SP);
00276         Current_class = TAG_GRAPH;
00277         return 0;
00278 }
00279 
00280 #if 0 /* NOT USED */
00281 static Agraph_t *parent_of(Agraph_t *g)
00282 {
00283         Agraph_t                *rv;
00284         rv = agusergraph(agfstin(g->meta_node->graph,g->meta_node)->tail);
00285         return rv;
00286 }
00287 #endif
00288 
00289 static void attr_set(char *name, char *value)
00290 {
00291         Agsym_t         *ap = NULL;
00292         char            *defval = "";
00293 
00294         if (In_decl && (G->root == G)) defval = value;
00295         switch (Current_class) {
00296                 case TAG_NODE:
00297                         ap = agfindattr(G->proto->n,name);
00298                         if (ap == NULL)
00299                                 ap = agnodeattr(AG.parsed_g,name,defval);
00300             else if (ap->fixed && In_decl)
00301               return;
00302                         agxset(N,ap->index,value);
00303                         break;
00304                 case TAG_EDGE:
00305                         ap = agfindattr(G->proto->e,name);
00306                         if (ap == NULL)
00307                                 ap = agedgeattr(AG.parsed_g,name,defval);
00308             else if (ap->fixed && In_decl && (G->root == G))
00309               return;
00310                         agxset(E,ap->index,value);
00311                         break;
00312                 case 0:         /* default */
00313                 case TAG_GRAPH:
00314                         ap = agfindattr(G,name);
00315                         if (ap == NULL) 
00316                                 ap = agraphattr(AG.parsed_g,name,defval);
00317             else if (ap->fixed && In_decl)
00318               return;
00319                         agxset(G,ap->index,value);
00320                         break;
00321         }
00322 }
00323 
00324 /* concat:
00325  */
00326 static char*
00327 concat (char* s1, char* s2)
00328 {
00329   char*  s;
00330   char   buf[BUFSIZ];
00331   char*  sym;
00332   int    len = strlen(s1) + strlen(s2) + 1;
00333 
00334   if (len <= BUFSIZ) sym = buf;
00335   else sym = (char*)malloc(len);
00336   strcpy(sym,s1);
00337   strcat(sym,s2);
00338   s = agstrdup (sym);
00339   if (sym != buf) free (sym);
00340   return s;
00341 }
00342 
00343 /* concat3:
00344  */
00345 static char*
00346 concat3 (char* s1, char* s2, char*s3)
00347 {
00348   char*  s;
00349   char   buf[BUFSIZ];
00350   char*  sym;
00351   int    len = strlen(s1) + strlen(s2) + strlen(s3) + 1;
00352 
00353   if (len <= BUFSIZ) sym = buf;
00354   else sym = (char*)malloc(len);
00355   strcpy(sym,s1);
00356   strcat(sym,s2);
00357   strcat(sym,s3);
00358   s = agstrdup (sym);
00359   if (sym != buf) free (sym);
00360   return s;
00361 }
00362 
00363 
00364 
00365 /* Line 268 of yacc.c  */
00366 #line 367 "y.tab.c"
00367 
00368 /* Enabling traces.  */
00369 #ifndef YYDEBUG
00370 # define YYDEBUG 0
00371 #endif
00372 
00373 /* Enabling verbose error messages.  */
00374 #ifdef YYERROR_VERBOSE
00375 # undef YYERROR_VERBOSE
00376 # define YYERROR_VERBOSE 1
00377 #else
00378 # define YYERROR_VERBOSE 0
00379 #endif
00380 
00381 /* Enabling the token table.  */
00382 #ifndef YYTOKEN_TABLE
00383 # define YYTOKEN_TABLE 0
00384 #endif
00385 
00386 
00387 /* Tokens.  */
00388 #ifndef YYTOKENTYPE
00389 # define YYTOKENTYPE
00390    /* Put the tokens into the symbol table, so that GDB and other debuggers
00391       know about them.  */
00392    enum agtokentype {
00393      T_graph = 258,
00394      T_digraph = 259,
00395      T_strict = 260,
00396      T_node = 261,
00397      T_edge = 262,
00398      T_edgeop = 263,
00399      T_symbol = 264,
00400      T_qsymbol = 265,
00401      T_subgraph = 266
00402    };
00403 #endif
00404 /* Tokens.  */
00405 #define T_graph 258
00406 #define T_digraph 259
00407 #define T_strict 260
00408 #define T_node 261
00409 #define T_edge 262
00410 #define T_edgeop 263
00411 #define T_symbol 264
00412 #define T_qsymbol 265
00413 #define T_subgraph 266
00414 
00415 
00416 
00417 
00418 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00419 typedef union YYSTYPE
00420 {
00421 
00422 /* Line 293 of yacc.c  */
00423 #line 309 "../../lib/graph/parser.y"
00424 
00425                         int                                     i;
00426                         char                            *str;
00427                         struct objport_t        obj;
00428                         struct Agnode_t         *n;
00429 
00430 
00431 
00432 /* Line 293 of yacc.c  */
00433 #line 434 "y.tab.c"
00434 } YYSTYPE;
00435 # define YYSTYPE_IS_TRIVIAL 1
00436 # define agstype YYSTYPE /* obsolescent; will be withdrawn */
00437 # define YYSTYPE_IS_DECLARED 1
00438 #endif
00439 
00440 
00441 /* Copy the second part of user declarations.  */
00442 
00443 
00444 /* Line 343 of yacc.c  */
00445 #line 446 "y.tab.c"
00446 
00447 #ifdef short
00448 # undef short
00449 #endif
00450 
00451 #ifdef YYTYPE_UINT8
00452 typedef YYTYPE_UINT8 agtype_uint8;
00453 #else
00454 typedef unsigned char agtype_uint8;
00455 #endif
00456 
00457 #ifdef YYTYPE_INT8
00458 typedef YYTYPE_INT8 agtype_int8;
00459 #elif (defined __STDC__ || defined __C99__FUNC__ \
00460      || defined __cplusplus || defined _MSC_VER)
00461 typedef signed char agtype_int8;
00462 #else
00463 typedef short int agtype_int8;
00464 #endif
00465 
00466 #ifdef YYTYPE_UINT16
00467 typedef YYTYPE_UINT16 agtype_uint16;
00468 #else
00469 typedef unsigned short int agtype_uint16;
00470 #endif
00471 
00472 #ifdef YYTYPE_INT16
00473 typedef YYTYPE_INT16 agtype_int16;
00474 #else
00475 typedef short int agtype_int16;
00476 #endif
00477 
00478 #ifndef YYSIZE_T
00479 # ifdef __SIZE_TYPE__
00480 #  define YYSIZE_T __SIZE_TYPE__
00481 # elif defined size_t
00482 #  define YYSIZE_T size_t
00483 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00484      || defined __cplusplus || defined _MSC_VER)
00485 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
00486 #  define YYSIZE_T size_t
00487 # else
00488 #  define YYSIZE_T unsigned int
00489 # endif
00490 #endif
00491 
00492 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00493 
00494 #ifndef YY_
00495 # if defined YYENABLE_NLS && YYENABLE_NLS
00496 #  if ENABLE_NLS
00497 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
00498 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
00499 #  endif
00500 # endif
00501 # ifndef YY_
00502 #  define YY_(msgid) msgid
00503 # endif
00504 #endif
00505 
00506 /* Suppress unused-variable warnings by "using" E.  */
00507 #if ! defined lint || defined __GNUC__
00508 # define YYUSE(e) ((void) (e))
00509 #else
00510 # define YYUSE(e) /* empty */
00511 #endif
00512 
00513 /* Identity function, used to suppress warnings about constant conditions.  */
00514 #ifndef lint
00515 # define YYID(n) (n)
00516 #else
00517 #if (defined __STDC__ || defined __C99__FUNC__ \
00518      || defined __cplusplus || defined _MSC_VER)
00519 static int
00520 YYID (int agi)
00521 #else
00522 static int
00523 YYID (agi)
00524     int agi;
00525 #endif
00526 {
00527   return agi;
00528 }
00529 #endif
00530 
00531 #if ! defined agoverflow || YYERROR_VERBOSE
00532 
00533 /* The parser invokes alloca or malloc; define the necessary symbols.  */
00534 
00535 # ifdef YYSTACK_USE_ALLOCA
00536 #  if YYSTACK_USE_ALLOCA
00537 #   ifdef __GNUC__
00538 #    define YYSTACK_ALLOC __builtin_alloca
00539 #   elif defined __BUILTIN_VA_ARG_INCR
00540 #    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
00541 #   elif defined _AIX
00542 #    define YYSTACK_ALLOC __alloca
00543 #   elif defined _MSC_VER
00544 #    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
00545 #    define alloca _alloca
00546 #   else
00547 #    define YYSTACK_ALLOC alloca
00548 #    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00549      || defined __cplusplus || defined _MSC_VER)
00550 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00551 #     ifndef EXIT_SUCCESS
00552 #      define EXIT_SUCCESS 0
00553 #     endif
00554 #    endif
00555 #   endif
00556 #  endif
00557 # endif
00558 
00559 # ifdef YYSTACK_ALLOC
00560    /* Pacify GCC's `empty if-body' warning.  */
00561 #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
00562 #  ifndef YYSTACK_ALLOC_MAXIMUM
00563     /* The OS might guarantee only one guard page at the bottom of the stack,
00564        and a page size can be as small as 4096 bytes.  So we cannot safely
00565        invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
00566        to allow for a few compiler-allocated temporary stack slots.  */
00567 #   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
00568 #  endif
00569 # else
00570 #  define YYSTACK_ALLOC YYMALLOC
00571 #  define YYSTACK_FREE YYFREE
00572 #  ifndef YYSTACK_ALLOC_MAXIMUM
00573 #   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00574 #  endif
00575 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
00576        && ! ((defined YYMALLOC || defined malloc) \
00577              && (defined YYFREE || defined free)))
00578 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
00579 #   ifndef EXIT_SUCCESS
00580 #    define EXIT_SUCCESS 0
00581 #   endif
00582 #  endif
00583 #  ifndef YYMALLOC
00584 #   define YYMALLOC malloc
00585 #   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00586      || defined __cplusplus || defined _MSC_VER)
00587 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
00588 #   endif
00589 #  endif
00590 #  ifndef YYFREE
00591 #   define YYFREE free
00592 #   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
00593      || defined __cplusplus || defined _MSC_VER)
00594 void free (void *); /* INFRINGES ON USER NAME SPACE */
00595 #   endif
00596 #  endif
00597 # endif
00598 #endif /* ! defined agoverflow || YYERROR_VERBOSE */
00599 
00600 
00601 #if (! defined agoverflow \
00602      && (! defined __cplusplus \
00603          || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00604 
00605 /* A type that is properly aligned for any stack member.  */
00606 union agalloc
00607 {
00608   agtype_int16 agss_alloc;
00609   YYSTYPE agvs_alloc;
00610 };
00611 
00612 /* The size of the maximum gap between one aligned stack and the next.  */
00613 # define YYSTACK_GAP_MAXIMUM (sizeof (union agalloc) - 1)
00614 
00615 /* The size of an array large to enough to hold all stacks, each with
00616    N elements.  */
00617 # define YYSTACK_BYTES(N) \
00618      ((N) * (sizeof (agtype_int16) + sizeof (YYSTYPE)) \
00619       + YYSTACK_GAP_MAXIMUM)
00620 
00621 # define YYCOPY_NEEDED 1
00622 
00623 /* Relocate STACK from its old location to the new one.  The
00624    local variables YYSIZE and YYSTACKSIZE give the old and new number of
00625    elements in the stack, and YYPTR gives the new location of the
00626    stack.  Advance YYPTR to a properly aligned location for the next
00627    stack.  */
00628 # define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
00629     do                                                                  \
00630       {                                                                 \
00631         YYSIZE_T agnewbytes;                                            \
00632         YYCOPY (&agptr->Stack_alloc, Stack, agsize);                    \
00633         Stack = &agptr->Stack_alloc;                                    \
00634         agnewbytes = agstacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00635         agptr += agnewbytes / sizeof (*agptr);                          \
00636       }                                                                 \
00637     while (YYID (0))
00638 
00639 #endif
00640 
00641 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
00642 /* Copy COUNT objects from FROM to TO.  The source and destination do
00643    not overlap.  */
00644 # ifndef YYCOPY
00645 #  if defined __GNUC__ && 1 < __GNUC__
00646 #   define YYCOPY(To, From, Count) \
00647       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00648 #  else
00649 #   define YYCOPY(To, From, Count)              \
00650       do                                        \
00651         {                                       \
00652           YYSIZE_T agi;                         \
00653           for (agi = 0; agi < (Count); agi++)   \
00654             (To)[agi] = (From)[agi];            \
00655         }                                       \
00656       while (YYID (0))
00657 #  endif
00658 # endif
00659 #endif /* !YYCOPY_NEEDED */
00660 
00661 /* YYFINAL -- State number of the termination state.  */
00662 #define YYFINAL  9
00663 /* YYLAST -- Last index in YYTABLE.  */
00664 #define YYLAST   80
00665 
00666 /* YYNTOKENS -- Number of terminals.  */
00667 #define YYNTOKENS  21
00668 /* YYNNTS -- Number of nonterminals.  */
00669 #define YYNNTS  37
00670 /* YYNRULES -- Number of rules.  */
00671 #define YYNRULES  68
00672 /* YYNRULES -- Number of states.  */
00673 #define YYNSTATES  90
00674 
00675 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
00676 #define YYUNDEFTOK  2
00677 #define YYMAXUTOK   266
00678 
00679 #define YYTRANSLATE(YYX)                                                \
00680   ((unsigned int) (YYX) <= YYMAXUTOK ? agtranslate[YYX] : YYUNDEFTOK)
00681 
00682 /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
00683 static const agtype_uint8 agtranslate[] =
00684 {
00685        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00686        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00687        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00688        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00689        2,     2,     2,    20,    14,     2,     2,     2,     2,     2,
00690        2,     2,     2,     2,     2,     2,     2,     2,    19,    18,
00691        2,    17,     2,     2,     2,     2,     2,     2,     2,     2,
00692        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00693        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00694        2,    15,     2,    16,     2,     2,     2,     2,     2,     2,
00695        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00696        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00697        2,     2,     2,    12,     2,    13,     2,     2,     2,     2,
00698        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00699        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00700        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00701        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00702        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00703        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00704        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00705        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00706        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00707        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00708        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00709        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
00710        2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
00711        5,     6,     7,     8,     9,    10,    11
00712 };
00713 
00714 #if YYDEBUG
00715 /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
00716    YYRHS.  */
00717 static const agtype_uint8 agprhs[] =
00718 {
00719        0,     0,     3,     4,    11,    13,    14,    16,    17,    19,
00720       22,    24,    27,    29,    31,    33,    37,    38,    39,    41,
00721       45,    48,    49,    51,    55,    57,    59,    61,    62,    64,
00722       67,    69,    72,    74,    76,    78,    80,    82,    85,    87,
00723       90,    92,    93,    96,   101,   102,   106,   107,   108,   114,
00724      115,   116,   122,   125,   126,   131,   134,   135,   140,   145,
00725      146,   152,   153,   158,   160,   163,   165,   167,   169
00726 };
00727 
00728 /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
00729 static const agtype_int8 agrhs[] =
00730 {
00731       22,     0,    -1,    -1,    25,    24,    23,    12,    34,    13,
00732       -1,     1,    -1,    -1,    56,    -1,    -1,     3,    -1,     5,
00733        3,    -1,     4,    -1,     5,     4,    -1,     3,    -1,     6,
00734       -1,     7,    -1,    33,    28,    27,    -1,    -1,    -1,    14,
00735       -1,    15,    27,    16,    -1,    30,    29,    -1,    -1,    30,
00736       -1,    56,    17,    56,    -1,    32,    -1,    56,    -1,    35,
00737       -1,    -1,    36,    -1,    35,    36,    -1,    37,    -1,    37,
00738       18,    -1,     1,    -1,    42,    -1,    44,    -1,    38,    -1,
00739       52,    -1,    26,    29,    -1,    32,    -1,    40,    41,    -1,
00740       56,    -1,    -1,    19,    56,    -1,    19,    56,    19,    56,
00741       -1,    -1,    39,    43,    31,    -1,    -1,    -1,    39,    45,
00742       49,    46,    31,    -1,    -1,    -1,    52,    47,    49,    48,
00743       31,    -1,     8,    39,    -1,    -1,     8,    39,    50,    49,
00744       -1,     8,    52,    -1,    -1,     8,    52,    51,    49,    -1,
00745       55,    12,    34,    13,    -1,    -1,    11,    12,    53,    34,
00746       13,    -1,    -1,    12,    54,    34,    13,    -1,    55,    -1,
00747       11,    56,    -1,     9,    -1,    57,    -1,    10,    -1,    57,
00748       20,    10,    -1
00749 };
00750 
00751 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
00752 static const agtype_uint16 agrline[] =
00753 {
00754        0,   327,   327,   326,   330,   336,   339,   339,   342,   344,
00755      346,   348,   352,   354,   356,   360,   361,   364,   365,   368,
00756      371,   372,   375,   378,   382,   383,   387,   388,   391,   392,
00757      395,   396,   397,   400,   401,   402,   403,   406,   408,   412,
00758      422,   425,   426,   427,   431,   430,   437,   439,   436,   444,
00759      446,   443,   452,   454,   453,   456,   459,   458,   464,   465,
00760      465,   466,   466,   467,   470,   480,   481,   484,   485
00761 };
00762 #endif
00763 
00764 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00765 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
00766    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
00767 static const char *const agtname[] =
00768 {
00769   "$end", "error", "$undefined", "T_graph", "T_digraph", "T_strict",
00770   "T_node", "T_edge", "T_edgeop", "T_symbol", "T_qsymbol", "T_subgraph",
00771   "'{'", "'}'", "','", "'['", "']'", "'='", "';'", "':'", "'+'", "$accept",
00772   "file", "$@1", "optgraphname", "graph_type", "attr_class",
00773   "inside_attr_list", "optcomma", "attr_list", "rec_attr_list",
00774   "opt_attr_list", "attr_set", "iattr_set", "stmt_list", "stmt_list1",
00775   "stmt", "stmt1", "attr_stmt", "node_id", "node_name", "node_port",
00776   "node_stmt", "$@2", "edge_stmt", "$@3", "$@4", "$@5", "$@6", "edgeRHS",
00777   "$@7", "$@8", "subg_stmt", "$@9", "$@10", "subg_hdr", "symbol",
00778   "qsymbol", 0
00779 };
00780 #endif
00781 
00782 # ifdef YYPRINT
00783 /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
00784    token YYLEX-NUM.  */
00785 static const agtype_uint16 agtoknum[] =
00786 {
00787        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
00788      265,   266,   123,   125,    44,    91,    93,    61,    59,    58,
00789       43
00790 };
00791 # endif
00792 
00793 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
00794 static const agtype_uint8 agr1[] =
00795 {
00796        0,    21,    23,    22,    22,    22,    24,    24,    25,    25,
00797       25,    25,    26,    26,    26,    27,    27,    28,    28,    29,
00798       30,    30,    31,    32,    33,    33,    34,    34,    35,    35,
00799       36,    36,    36,    37,    37,    37,    37,    38,    38,    39,
00800       40,    41,    41,    41,    43,    42,    45,    46,    44,    47,
00801       48,    44,    49,    50,    49,    49,    51,    49,    52,    53,
00802       52,    54,    52,    52,    55,    56,    56,    57,    57
00803 };
00804 
00805 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
00806 static const agtype_uint8 agr2[] =
00807 {
00808        0,     2,     0,     6,     1,     0,     1,     0,     1,     2,
00809        1,     2,     1,     1,     1,     3,     0,     0,     1,     3,
00810        2,     0,     1,     3,     1,     1,     1,     0,     1,     2,
00811        1,     2,     1,     1,     1,     1,     1,     2,     1,     2,
00812        1,     0,     2,     4,     0,     3,     0,     0,     5,     0,
00813        0,     5,     2,     0,     4,     2,     0,     4,     4,     0,
00814        5,     0,     4,     1,     2,     1,     1,     1,     3
00815 };
00816 
00817 /* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
00818    Performed when YYTABLE doesn't specify something else to do.  Zero
00819    means the default is an error.  */
00820 static const agtype_uint8 agdefact[] =
00821 {
00822        0,     4,     8,    10,     0,     0,     7,     9,    11,     1,
00823       65,    67,     2,     6,    66,     0,     0,     0,    68,    32,
00824       12,    13,    14,     0,    61,     0,    38,     0,     0,    28,
00825       30,    35,    44,    41,    33,    34,    36,    63,    40,    59,
00826       64,     0,    16,    37,     3,    29,    31,    21,     0,     0,
00827       39,     0,     0,     0,     0,     0,     0,    24,    17,    25,
00828       22,    45,     0,    47,    42,    50,     0,    23,     0,    62,
00829       19,    18,    16,    20,    52,    55,    40,    21,     0,    21,
00830       58,    60,    15,     0,     0,    48,    43,    51,    54,    57
00831 };
00832 
00833 /* YYDEFGOTO[NTERM-NUM].  */
00834 static const agtype_int8 agdefgoto[] =
00835 {
00836       -1,     5,    15,    12,     6,    25,    56,    72,    43,    60,
00837       61,    26,    58,    27,    28,    29,    30,    31,    32,    33,
00838       50,    34,    47,    35,    48,    77,    51,    79,    63,    83,
00839       84,    36,    54,    41,    37,    38,    14
00840 };
00841 
00842 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
00843    STATE-NUM.  */
00844 #define YYPACT_NINF -68
00845 static const agtype_int8 agpact[] =
00846 {
00847        4,   -68,   -68,   -68,    27,     6,    44,   -68,   -68,   -68,
00848      -68,   -68,   -68,   -68,    -9,     8,    25,    12,   -68,   -68,
00849      -68,   -68,   -68,    29,   -68,    22,   -68,    31,    39,   -68,
00850       37,   -68,    49,    40,   -68,   -68,    50,    48,    45,   -68,
00851      -68,    12,    44,   -68,   -68,   -68,   -68,   -68,    53,    44,
00852      -68,    53,    12,    44,    12,    51,    47,   -68,    54,    45,
00853       22,   -68,    17,   -68,    46,   -68,    56,   -68,    57,   -68,
00854      -68,   -68,    44,   -68,    59,    63,   -68,   -68,    44,   -68,
00855      -68,   -68,   -68,    53,    53,   -68,   -68,   -68,   -68,   -68
00856 };
00857 
00858 /* YYPGOTO[NTERM-NUM].  */
00859 static const agtype_int8 agpgoto[] =
00860 {
00861      -68,   -68,   -68,   -68,   -68,   -68,     1,   -68,    14,   -68,
00862      -67,   -40,   -68,   -38,   -68,    52,   -68,   -68,    13,   -68,
00863      -68,   -68,   -68,   -68,   -68,   -68,   -68,   -68,   -50,   -68,
00864      -68,    15,   -68,   -68,   -68,    -6,   -68
00865 };
00866 
00867 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
00868    positive, shift that token.  If negative, reduce the rule which
00869    number is the opposite.  If YYTABLE_NINF, syntax error.  */
00870 #define YYTABLE_NINF -57
00871 static const agtype_int8 agtable[] =
00872 {
00873       13,    65,    57,    55,    -5,     1,     9,     2,     3,     4,
00874       85,    16,    87,    19,    66,    20,    68,    40,    21,    22,
00875       17,    10,    11,    23,    24,   -27,    10,    11,    23,    24,
00876        7,     8,    57,    88,    89,    18,    59,    42,    10,    11,
00877       19,    39,    20,    64,    44,    21,    22,    67,    10,    11,
00878       23,    24,   -26,    10,    11,    46,    76,   -46,   -49,    49,
00879       52,    62,    53,    70,    69,    78,    59,   -53,    71,    80,
00880       81,   -56,    86,    82,    73,    74,     0,    75,     0,     0,
00881       45
00882 };
00883 
00884 #define agpact_value_is_default(agstate) \
00885   ((agstate) == (-68))
00886 
00887 #define agtable_value_is_error(agtable_value) \
00888   YYID (0)
00889 
00890 static const agtype_int8 agcheck[] =
00891 {
00892        6,    51,    42,    41,     0,     1,     0,     3,     4,     5,
00893       77,    20,    79,     1,    52,     3,    54,    23,     6,     7,
00894       12,     9,    10,    11,    12,    13,     9,    10,    11,    12,
00895        3,     4,    72,    83,    84,    10,    42,    15,     9,    10,
00896        1,    12,     3,    49,    13,     6,     7,    53,     9,    10,
00897       11,    12,    13,     9,    10,    18,    62,     8,     8,    19,
00898       12,     8,    17,    16,    13,    19,    72,     8,    14,    13,
00899       13,     8,    78,    72,    60,    62,    -1,    62,    -1,    -1,
00900       28
00901 };
00902 
00903 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
00904    symbol of state STATE-NUM.  */
00905 static const agtype_uint8 agstos[] =
00906 {
00907        0,     1,     3,     4,     5,    22,    25,     3,     4,     0,
00908        9,    10,    24,    56,    57,    23,    20,    12,    10,     1,
00909        3,     6,     7,    11,    12,    26,    32,    34,    35,    36,
00910       37,    38,    39,    40,    42,    44,    52,    55,    56,    12,
00911       56,    54,    15,    29,    13,    36,    18,    43,    45,    19,
00912       41,    47,    12,    17,    53,    34,    27,    32,    33,    56,
00913       30,    31,     8,    49,    56,    49,    34,    56,    34,    13,
00914       16,    14,    28,    29,    39,    52,    56,    46,    19,    48,
00915       13,    13,    27,    50,    51,    31,    56,    31,    49,    49
00916 };
00917 
00918 #define agerrok         (agerrstatus = 0)
00919 #define agclearin       (agchar = YYEMPTY)
00920 #define YYEMPTY         (-2)
00921 #define YYEOF           0
00922 
00923 #define YYACCEPT        goto agacceptlab
00924 #define YYABORT         goto agabortlab
00925 #define YYERROR         goto agerrorlab
00926 
00927 
00928 /* Like YYERROR except do call agerror.  This remains here temporarily
00929    to ease the transition to the new meaning of YYERROR, for GCC.
00930    Once GCC version 2 has supplanted version 1, this can go.  However,
00931    YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
00932    in Bison 2.4.2's NEWS entry, where a plan to phase it out is
00933    discussed.  */
00934 
00935 #define YYFAIL          goto agerrlab
00936 #if defined YYFAIL
00937   /* This is here to suppress warnings from the GCC cpp's
00938      -Wunused-macros.  Normally we don't worry about that warning, but
00939      some users do, and we want to make it easy for users to remove
00940      YYFAIL uses, which will produce warnings from Bison 2.5.  */
00941 #endif
00942 
00943 #define YYRECOVERING()  (!!agerrstatus)
00944 
00945 #define YYBACKUP(Token, Value)                                  \
00946 do                                                              \
00947   if (agchar == YYEMPTY && aglen == 1)                          \
00948     {                                                           \
00949       agchar = (Token);                                         \
00950       aglval = (Value);                                         \
00951       YYPOPSTACK (1);                                           \
00952       goto agbackup;                                            \
00953     }                                                           \
00954   else                                                          \
00955     {                                                           \
00956       agerror (YY_("syntax error: cannot back up")); \
00957       YYERROR;                                                  \
00958     }                                                           \
00959 while (YYID (0))
00960 
00961 
00962 #define YYTERROR        1
00963 #define YYERRCODE       256
00964 
00965 
00966 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
00967    If N is 0, then set CURRENT to the empty location which ends
00968    the previous symbol: RHS[0] (always defined).  */
00969 
00970 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00971 #ifndef YYLLOC_DEFAULT
00972 # define YYLLOC_DEFAULT(Current, Rhs, N)                                \
00973     do                                                                  \
00974       if (YYID (N))                                                    \
00975         {                                                               \
00976           (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
00977           (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
00978           (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
00979           (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
00980         }                                                               \
00981       else                                                              \
00982         {                                                               \
00983           (Current).first_line   = (Current).last_line   =              \
00984             YYRHSLOC (Rhs, 0).last_line;                                \
00985           (Current).first_column = (Current).last_column =              \
00986             YYRHSLOC (Rhs, 0).last_column;                              \
00987         }                                                               \
00988     while (YYID (0))
00989 #endif
00990 
00991 
00992 /* This macro is provided for backward compatibility. */
00993 
00994 #ifndef YY_LOCATION_PRINT
00995 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00996 #endif
00997 
00998 
00999 /* YYLEX -- calling `aglex' with the right arguments.  */
01000 
01001 #ifdef YYLEX_PARAM
01002 # define YYLEX aglex (YYLEX_PARAM)
01003 #else
01004 # define YYLEX aglex ()
01005 #endif
01006 
01007 /* Enable debugging if requested.  */
01008 #if YYDEBUG
01009 
01010 # ifndef YYFPRINTF
01011 #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
01012 #  define YYFPRINTF fprintf
01013 # endif
01014 
01015 # define YYDPRINTF(Args)                        \
01016 do {                                            \
01017   if (agdebug)                                  \
01018     YYFPRINTF Args;                             \
01019 } while (YYID (0))
01020 
01021 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
01022 do {                                                                      \
01023   if (agdebug)                                                            \
01024     {                                                                     \
01025       YYFPRINTF (stderr, "%s ", Title);                                   \
01026       ag_symbol_print (stderr,                                            \
01027                   Type, Value); \
01028       YYFPRINTF (stderr, "\n");                                           \
01029     }                                                                     \
01030 } while (YYID (0))
01031 
01032 
01033 /*--------------------------------.
01034 | Print this symbol on YYOUTPUT.  |
01035 `--------------------------------*/
01036 
01037 /*ARGSUSED*/
01038 #if (defined __STDC__ || defined __C99__FUNC__ \
01039      || defined __cplusplus || defined _MSC_VER)
01040 static void
01041 ag_symbol_value_print (FILE *agoutput, int agtype, YYSTYPE const * const agvaluep)
01042 #else
01043 static void
01044 ag_symbol_value_print (agoutput, agtype, agvaluep)
01045     FILE *agoutput;
01046     int agtype;
01047     YYSTYPE const * const agvaluep;
01048 #endif
01049 {
01050   if (!agvaluep)
01051     return;
01052 # ifdef YYPRINT
01053   if (agtype < YYNTOKENS)
01054     YYPRINT (agoutput, agtoknum[agtype], *agvaluep);
01055 # else
01056   YYUSE (agoutput);
01057 # endif
01058   switch (agtype)
01059     {
01060       default:
01061         break;
01062     }
01063 }
01064 
01065 
01066 /*--------------------------------.
01067 | Print this symbol on YYOUTPUT.  |
01068 `--------------------------------*/
01069 
01070 #if (defined __STDC__ || defined __C99__FUNC__ \
01071      || defined __cplusplus || defined _MSC_VER)
01072 static void
01073 ag_symbol_print (FILE *agoutput, int agtype, YYSTYPE const * const agvaluep)
01074 #else
01075 static void
01076 ag_symbol_print (agoutput, agtype, agvaluep)
01077     FILE *agoutput;
01078     int agtype;
01079     YYSTYPE const * const agvaluep;
01080 #endif
01081 {
01082   if (agtype < YYNTOKENS)
01083     YYFPRINTF (agoutput, "token %s (", agtname[agtype]);
01084   else
01085     YYFPRINTF (agoutput, "nterm %s (", agtname[agtype]);
01086 
01087   ag_symbol_value_print (agoutput, agtype, agvaluep);
01088   YYFPRINTF (agoutput, ")");
01089 }
01090 
01091 /*------------------------------------------------------------------.
01092 | ag_stack_print -- Print the state stack from its BOTTOM up to its |
01093 | TOP (included).                                                   |
01094 `------------------------------------------------------------------*/
01095 
01096 #if (defined __STDC__ || defined __C99__FUNC__ \
01097      || defined __cplusplus || defined _MSC_VER)
01098 static void
01099 ag_stack_print (agtype_int16 *agbottom, agtype_int16 *agtop)
01100 #else
01101 static void
01102 ag_stack_print (agbottom, agtop)
01103     agtype_int16 *agbottom;
01104     agtype_int16 *agtop;
01105 #endif
01106 {
01107   YYFPRINTF (stderr, "Stack now");
01108   for (; agbottom <= agtop; agbottom++)
01109     {
01110       int agbot = *agbottom;
01111       YYFPRINTF (stderr, " %d", agbot);
01112     }
01113   YYFPRINTF (stderr, "\n");
01114 }
01115 
01116 # define YY_STACK_PRINT(Bottom, Top)                            \
01117 do {                                                            \
01118   if (agdebug)                                                  \
01119     ag_stack_print ((Bottom), (Top));                           \
01120 } while (YYID (0))
01121 
01122 
01123 /*------------------------------------------------.
01124 | Report that the YYRULE is going to be reduced.  |
01125 `------------------------------------------------*/
01126 
01127 #if (defined __STDC__ || defined __C99__FUNC__ \
01128      || defined __cplusplus || defined _MSC_VER)
01129 static void
01130 ag_reduce_print (YYSTYPE *agvsp, int agrule)
01131 #else
01132 static void
01133 ag_reduce_print (agvsp, agrule)
01134     YYSTYPE *agvsp;
01135     int agrule;
01136 #endif
01137 {
01138   int agnrhs = agr2[agrule];
01139   int agi;
01140   unsigned long int aglno = agrline[agrule];
01141   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01142              agrule - 1, aglno);
01143   /* The symbols being reduced.  */
01144   for (agi = 0; agi < agnrhs; agi++)
01145     {
01146       YYFPRINTF (stderr, "   $%d = ", agi + 1);
01147       ag_symbol_print (stderr, agrhs[agprhs[agrule] + agi],
01148                        &(agvsp[(agi + 1) - (agnrhs)])
01149                                        );
01150       YYFPRINTF (stderr, "\n");
01151     }
01152 }
01153 
01154 # define YY_REDUCE_PRINT(Rule)          \
01155 do {                                    \
01156   if (agdebug)                          \
01157     ag_reduce_print (agvsp, Rule); \
01158 } while (YYID (0))
01159 
01160 /* Nonzero means print parse trace.  It is left uninitialized so that
01161    multiple parsers can coexist.  */
01162 int agdebug;
01163 #else /* !YYDEBUG */
01164 # define YYDPRINTF(Args)
01165 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01166 # define YY_STACK_PRINT(Bottom, Top)
01167 # define YY_REDUCE_PRINT(Rule)
01168 #endif /* !YYDEBUG */
01169 
01170 
01171 /* YYINITDEPTH -- initial size of the parser's stacks.  */
01172 #ifndef YYINITDEPTH
01173 # define YYINITDEPTH 200
01174 #endif
01175 
01176 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
01177    if the built-in stack extension method is used).
01178 
01179    Do not make this value too large; the results are undefined if
01180    YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
01181    evaluated with infinite-precision integer arithmetic.  */
01182 
01183 #ifndef YYMAXDEPTH
01184 # define YYMAXDEPTH 10000
01185 #endif
01186 
01187 
01188 #if YYERROR_VERBOSE
01189 
01190 # ifndef agstrlen
01191 #  if defined __GLIBC__ && defined _STRING_H
01192 #   define agstrlen strlen
01193 #  else
01194 /* Return the length of YYSTR.  */
01195 #if (defined __STDC__ || defined __C99__FUNC__ \
01196      || defined __cplusplus || defined _MSC_VER)
01197 static YYSIZE_T
01198 agstrlen (const char *agstr)
01199 #else
01200 static YYSIZE_T
01201 agstrlen (agstr)
01202     const char *agstr;
01203 #endif
01204 {
01205   YYSIZE_T aglen;
01206   for (aglen = 0; agstr[aglen]; aglen++)
01207     continue;
01208   return aglen;
01209 }
01210 #  endif
01211 # endif
01212 
01213 # ifndef agstpcpy
01214 #  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01215 #   define agstpcpy stpcpy
01216 #  else
01217 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
01218    YYDEST.  */
01219 #if (defined __STDC__ || defined __C99__FUNC__ \
01220      || defined __cplusplus || defined _MSC_VER)
01221 static char *
01222 agstpcpy (char *agdest, const char *agsrc)
01223 #else
01224 static char *
01225 agstpcpy (agdest, agsrc)
01226     char *agdest;
01227     const char *agsrc;
01228 #endif
01229 {
01230   char *agd = agdest;
01231   const char *ags = agsrc;
01232 
01233   while ((*agd++ = *ags++) != '\0')
01234     continue;
01235 
01236   return agd - 1;
01237 }
01238 #  endif
01239 # endif
01240 
01241 # ifndef agtnamerr
01242 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
01243    quotes and backslashes, so that it's suitable for agerror.  The
01244    heuristic is that double-quoting is unnecessary unless the string
01245    contains an apostrophe, a comma, or backslash (other than
01246    backslash-backslash).  YYSTR is taken from agtname.  If YYRES is
01247    null, do not copy; instead, return the length of what the result
01248    would have been.  */
01249 static YYSIZE_T
01250 agtnamerr (char *agres, const char *agstr)
01251 {
01252   if (*agstr == '"')
01253     {
01254       YYSIZE_T agn = 0;
01255       char const *agp = agstr;
01256 
01257       for (;;)
01258         switch (*++agp)
01259           {
01260           case '\'':
01261           case ',':
01262             goto do_not_strip_quotes;
01263 
01264           case '\\':
01265             if (*++agp != '\\')
01266               goto do_not_strip_quotes;
01267             /* Fall through.  */
01268           default:
01269             if (agres)
01270               agres[agn] = *agp;
01271             agn++;
01272             break;
01273 
01274           case '"':
01275             if (agres)
01276               agres[agn] = '\0';
01277             return agn;
01278           }
01279     do_not_strip_quotes: ;
01280     }
01281 
01282   if (! agres)
01283     return agstrlen (agstr);
01284 
01285   return agstpcpy (agres, agstr) - agres;
01286 }
01287 # endif
01288 
01289 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
01290    about the unexpected token YYTOKEN for the state stack whose top is
01291    YYSSP.
01292 
01293    Return 0 if *YYMSG was successfully written.  Return 1 if *YYMSG is
01294    not large enough to hold the message.  In that case, also set
01295    *YYMSG_ALLOC to the required number of bytes.  Return 2 if the
01296    required number of bytes is too large to store.  */
01297 static int
01298 agsyntax_error (YYSIZE_T *agmsg_alloc, char **agmsg,
01299                 agtype_int16 *agssp, int agtoken)
01300 {
01301   YYSIZE_T agsize0 = agtnamerr (0, agtname[agtoken]);
01302   YYSIZE_T agsize = agsize0;
01303   YYSIZE_T agsize1;
01304   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01305   /* Internationalized format string. */
01306   const char *agformat = 0;
01307   /* Arguments of agformat. */
01308   char const *agarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01309   /* Number of reported tokens (one for the "unexpected", one per
01310      "expected"). */
01311   int agcount = 0;
01312 
01313   /* There are many possibilities here to consider:
01314      - Assume YYFAIL is not used.  It's too flawed to consider.  See
01315        <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
01316        for details.  YYERROR is fine as it does not invoke this
01317        function.
01318      - If this state is a consistent state with a default action, then
01319        the only way this function was invoked is if the default action
01320        is an error action.  In that case, don't check for expected
01321        tokens because there are none.
01322      - The only way there can be no lookahead present (in agchar) is if
01323        this state is a consistent state with a default action.  Thus,
01324        detecting the absence of a lookahead is sufficient to determine
01325        that there is no unexpected or expected token to report.  In that
01326        case, just report a simple "syntax error".
01327      - Don't assume there isn't a lookahead just because this state is a
01328        consistent state with a default action.  There might have been a
01329        previous inconsistent state, consistent state with a non-default
01330        action, or user semantic action that manipulated agchar.
01331      - Of course, the expected token list depends on states to have
01332        correct lookahead information, and it depends on the parser not
01333        to perform extra reductions after fetching a lookahead from the
01334        scanner and before detecting a syntax error.  Thus, state merging
01335        (from LALR or IELR) and default reductions corrupt the expected
01336        token list.  However, the list is correct for canonical LR with
01337        one exception: it will still contain any token that will not be
01338        accepted due to an error action in a later state.
01339   */
01340   if (agtoken != YYEMPTY)
01341     {
01342       int agn = agpact[*agssp];
01343       agarg[agcount++] = agtname[agtoken];
01344       if (!agpact_value_is_default (agn))
01345         {
01346           /* Start YYX at -YYN if negative to avoid negative indexes in
01347              YYCHECK.  In other words, skip the first -YYN actions for
01348              this state because they are default actions.  */
01349           int agxbegin = agn < 0 ? -agn : 0;
01350           /* Stay within bounds of both agcheck and agtname.  */
01351           int agchecklim = YYLAST - agn + 1;
01352           int agxend = agchecklim < YYNTOKENS ? agchecklim : YYNTOKENS;
01353           int agx;
01354 
01355           for (agx = agxbegin; agx < agxend; ++agx)
01356             if (agcheck[agx + agn] == agx && agx != YYTERROR
01357                 && !agtable_value_is_error (agtable[agx + agn]))
01358               {
01359                 if (agcount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01360                   {
01361                     agcount = 1;
01362                     agsize = agsize0;
01363                     break;
01364                   }
01365                 agarg[agcount++] = agtname[agx];
01366                 agsize1 = agsize + agtnamerr (0, agtname[agx]);
01367                 if (! (agsize <= agsize1
01368                        && agsize1 <= YYSTACK_ALLOC_MAXIMUM))
01369                   return 2;
01370                 agsize = agsize1;
01371               }
01372         }
01373     }
01374 
01375   switch (agcount)
01376     {
01377 # define YYCASE_(N, S)                      \
01378       case N:                               \
01379         agformat = S;                       \
01380       break
01381       YYCASE_(0, YY_("syntax error"));
01382       YYCASE_(1, YY_("syntax error, unexpected %s"));
01383       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
01384       YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
01385       YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
01386       YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
01387 # undef YYCASE_
01388     }
01389 
01390   agsize1 = agsize + agstrlen (agformat);
01391   if (! (agsize <= agsize1 && agsize1 <= YYSTACK_ALLOC_MAXIMUM))
01392     return 2;
01393   agsize = agsize1;
01394 
01395   if (*agmsg_alloc < agsize)
01396     {
01397       *agmsg_alloc = 2 * agsize;
01398       if (! (agsize <= *agmsg_alloc
01399              && *agmsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
01400         *agmsg_alloc = YYSTACK_ALLOC_MAXIMUM;
01401       return 1;
01402     }
01403 
01404   /* Avoid sprintf, as that infringes on the user's name space.
01405      Don't have undefined behavior even if the translation
01406      produced a string with the wrong number of "%s"s.  */
01407   {
01408     char *agp = *agmsg;
01409     int agi = 0;
01410     while ((*agp = *agformat) != '\0')
01411       if (*agp == '%' && agformat[1] == 's' && agi < agcount)
01412         {
01413           agp += agtnamerr (agp, agarg[agi++]);
01414           agformat += 2;
01415         }
01416       else
01417         {
01418           agp++;
01419           agformat++;
01420         }
01421   }
01422   return 0;
01423 }
01424 #endif /* YYERROR_VERBOSE */
01425 
01426 /*-----------------------------------------------.
01427 | Release the memory associated to this symbol.  |
01428 `-----------------------------------------------*/
01429 
01430 /*ARGSUSED*/
01431 #if (defined __STDC__ || defined __C99__FUNC__ \
01432      || defined __cplusplus || defined _MSC_VER)
01433 static void
01434 agdestruct (const char *agmsg, int agtype, YYSTYPE *agvaluep)
01435 #else
01436 static void
01437 agdestruct (agmsg, agtype, agvaluep)
01438     const char *agmsg;
01439     int agtype;
01440     YYSTYPE *agvaluep;
01441 #endif
01442 {
01443   YYUSE (agvaluep);
01444 
01445   if (!agmsg)
01446     agmsg = "Deleting";
01447   YY_SYMBOL_PRINT (agmsg, agtype, agvaluep, aglocationp);
01448 
01449   switch (agtype)
01450     {
01451 
01452       default:
01453         break;
01454     }
01455 }
01456 
01457 
01458 /* Prevent warnings from -Wmissing-prototypes.  */
01459 #ifdef YYPARSE_PARAM
01460 #if defined __STDC__ || defined __cplusplus
01461 int agparse (void *YYPARSE_PARAM);
01462 #else
01463 int agparse ();
01464 #endif
01465 #else /* ! YYPARSE_PARAM */
01466 #if defined __STDC__ || defined __cplusplus
01467 int agparse (void);
01468 #else
01469 int agparse ();
01470 #endif
01471 #endif /* ! YYPARSE_PARAM */
01472 
01473 
01474 /* The lookahead symbol.  */
01475 int agchar;
01476 
01477 /* The semantic value of the lookahead symbol.  */
01478 YYSTYPE aglval;
01479 
01480 /* Number of syntax errors so far.  */
01481 int agnerrs;
01482 
01483 
01484 /*----------.
01485 | agparse.  |
01486 `----------*/
01487 
01488 #ifdef YYPARSE_PARAM
01489 #if (defined __STDC__ || defined __C99__FUNC__ \
01490      || defined __cplusplus || defined _MSC_VER)
01491 int
01492 agparse (void *YYPARSE_PARAM)
01493 #else
01494 int
01495 agparse (YYPARSE_PARAM)
01496     void *YYPARSE_PARAM;
01497 #endif
01498 #else /* ! YYPARSE_PARAM */
01499 #if (defined __STDC__ || defined __C99__FUNC__ \
01500      || defined __cplusplus || defined _MSC_VER)
01501 int
01502 agparse (void)
01503 #else
01504 int
01505 agparse ()
01506 
01507 #endif
01508 #endif
01509 {
01510     int agstate;
01511     /* Number of tokens to shift before error messages enabled.  */
01512     int agerrstatus;
01513 
01514     /* The stacks and their tools:
01515        `agss': related to states.
01516        `agvs': related to semantic values.
01517 
01518        Refer to the stacks thru separate pointers, to allow agoverflow
01519        to reallocate them elsewhere.  */
01520 
01521     /* The state stack.  */
01522     agtype_int16 agssa[YYINITDEPTH];
01523     agtype_int16 *agss;
01524     agtype_int16 *agssp;
01525 
01526     /* The semantic value stack.  */
01527     YYSTYPE agvsa[YYINITDEPTH];
01528     YYSTYPE *agvs;
01529     YYSTYPE *agvsp;
01530 
01531     YYSIZE_T agstacksize;
01532 
01533   int agn;
01534   int agresult;
01535   /* Lookahead token as an internal (translated) token number.  */
01536   int agtoken;
01537   /* The variables used to return semantic value and location from the
01538      action routines.  */
01539   YYSTYPE agval;
01540 
01541 #if YYERROR_VERBOSE
01542   /* Buffer for error messages, and its allocated size.  */
01543   char agmsgbuf[128];
01544   char *agmsg = agmsgbuf;
01545   YYSIZE_T agmsg_alloc = sizeof agmsgbuf;
01546 #endif
01547 
01548 #define YYPOPSTACK(N)   (agvsp -= (N), agssp -= (N))
01549 
01550   /* The number of symbols on the RHS of the reduced rule.
01551      Keep to zero when no symbol should be popped.  */
01552   int aglen = 0;
01553 
01554   agtoken = 0;
01555   agss = agssa;
01556   agvs = agvsa;
01557   agstacksize = YYINITDEPTH;
01558 
01559   YYDPRINTF ((stderr, "Starting parse\n"));
01560 
01561   agstate = 0;
01562   agerrstatus = 0;
01563   agnerrs = 0;
01564   agchar = YYEMPTY; /* Cause a token to be read.  */
01565 
01566   /* Initialize stack pointers.
01567      Waste one element of value and location stack
01568      so that they stay on the same level as the state stack.
01569      The wasted elements are never initialized.  */
01570   agssp = agss;
01571   agvsp = agvs;
01572 
01573   goto agsetstate;
01574 
01575 /*------------------------------------------------------------.
01576 | agnewstate -- Push a new state, which is found in agstate.  |
01577 `------------------------------------------------------------*/
01578  agnewstate:
01579   /* In all cases, when you get here, the value and location stacks
01580      have just been pushed.  So pushing a state here evens the stacks.  */
01581   agssp++;
01582 
01583  agsetstate:
01584   *agssp = agstate;
01585 
01586   if (agss + agstacksize - 1 <= agssp)
01587     {
01588       /* Get the current used size of the three stacks, in elements.  */
01589       YYSIZE_T agsize = agssp - agss + 1;
01590 
01591 #ifdef agoverflow
01592       {
01593         /* Give user a chance to reallocate the stack.  Use copies of
01594            these so that the &'s don't force the real ones into
01595            memory.  */
01596         YYSTYPE *agvs1 = agvs;
01597         agtype_int16 *agss1 = agss;
01598 
01599         /* Each stack pointer address is followed by the size of the
01600            data in use in that stack, in bytes.  This used to be a
01601            conditional around just the two extra args, but that might
01602            be undefined if agoverflow is a macro.  */
01603         agoverflow (YY_("memory exhausted"),
01604                     &agss1, agsize * sizeof (*agssp),
01605                     &agvs1, agsize * sizeof (*agvsp),
01606                     &agstacksize);
01607 
01608         agss = agss1;
01609         agvs = agvs1;
01610       }
01611 #else /* no agoverflow */
01612 # ifndef YYSTACK_RELOCATE
01613       goto agexhaustedlab;
01614 # else
01615       /* Extend the stack our own way.  */
01616       if (YYMAXDEPTH <= agstacksize)
01617         goto agexhaustedlab;
01618       agstacksize *= 2;
01619       if (YYMAXDEPTH < agstacksize)
01620         agstacksize = YYMAXDEPTH;
01621 
01622       {
01623         agtype_int16 *agss1 = agss;
01624         union agalloc *agptr =
01625           (union agalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (agstacksize));
01626         if (! agptr)
01627           goto agexhaustedlab;
01628         YYSTACK_RELOCATE (agss_alloc, agss);
01629         YYSTACK_RELOCATE (agvs_alloc, agvs);
01630 #  undef YYSTACK_RELOCATE
01631         if (agss1 != agssa)
01632           YYSTACK_FREE (agss1);
01633       }
01634 # endif
01635 #endif /* no agoverflow */
01636 
01637       agssp = agss + agsize - 1;
01638       agvsp = agvs + agsize - 1;
01639 
01640       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01641                   (unsigned long int) agstacksize));
01642 
01643       if (agss + agstacksize - 1 <= agssp)
01644         YYABORT;
01645     }
01646 
01647   YYDPRINTF ((stderr, "Entering state %d\n", agstate));
01648 
01649   if (agstate == YYFINAL)
01650     YYACCEPT;
01651 
01652   goto agbackup;
01653 
01654 /*-----------.
01655 | agbackup.  |
01656 `-----------*/
01657 agbackup:
01658 
01659   /* Do appropriate processing given the current state.  Read a
01660      lookahead token if we need one and don't already have one.  */
01661 
01662   /* First try to decide what to do without reference to lookahead token.  */
01663   agn = agpact[agstate];
01664   if (agpact_value_is_default (agn))
01665     goto agdefault;
01666 
01667   /* Not known => get a lookahead token if don't already have one.  */
01668 
01669   /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol.  */
01670   if (agchar == YYEMPTY)
01671     {
01672       YYDPRINTF ((stderr, "Reading a token: "));
01673       agchar = YYLEX;
01674     }
01675 
01676   if (agchar <= YYEOF)
01677     {
01678       agchar = agtoken = YYEOF;
01679       YYDPRINTF ((stderr, "Now at end of input.\n"));
01680     }
01681   else
01682     {
01683       agtoken = YYTRANSLATE (agchar);
01684       YY_SYMBOL_PRINT ("Next token is", agtoken, &aglval, &aglloc);
01685     }
01686 
01687   /* If the proper action on seeing token YYTOKEN is to reduce or to
01688      detect an error, take that action.  */
01689   agn += agtoken;
01690   if (agn < 0 || YYLAST < agn || agcheck[agn] != agtoken)
01691     goto agdefault;
01692   agn = agtable[agn];
01693   if (agn <= 0)
01694     {
01695       if (agtable_value_is_error (agn))
01696         goto agerrlab;
01697       agn = -agn;
01698       goto agreduce;
01699     }
01700 
01701   /* Count tokens shifted since error; after three, turn off error
01702      status.  */
01703   if (agerrstatus)
01704     agerrstatus--;
01705 
01706   /* Shift the lookahead token.  */
01707   YY_SYMBOL_PRINT ("Shifting", agtoken, &aglval, &aglloc);
01708 
01709   /* Discard the shifted token.  */
01710   agchar = YYEMPTY;
01711 
01712   agstate = agn;
01713   *++agvsp = aglval;
01714 
01715   goto agnewstate;
01716 
01717 
01718 /*-----------------------------------------------------------.
01719 | agdefault -- do the default action for the current state.  |
01720 `-----------------------------------------------------------*/
01721 agdefault:
01722   agn = agdefact[agstate];
01723   if (agn == 0)
01724     goto agerrlab;
01725   goto agreduce;
01726 
01727 
01728 /*-----------------------------.
01729 | agreduce -- Do a reduction.  |
01730 `-----------------------------*/
01731 agreduce:
01732   /* agn is the number of a rule to reduce with.  */
01733   aglen = agr2[agn];
01734 
01735   /* If YYLEN is nonzero, implement the default value of the action:
01736      `$$ = $1'.
01737 
01738      Otherwise, the following line sets YYVAL to garbage.
01739      This behavior is undocumented and Bison
01740      users should not rely upon it.  Assigning to YYVAL
01741      unconditionally makes the parser a bit smaller, and it avoids a
01742      GCC warning that YYVAL may be used uninitialized.  */
01743   agval = agvsp[1-aglen];
01744 
01745 
01746   YY_REDUCE_PRINT (agn);
01747   switch (agn)
01748     {
01749         case 2:
01750 
01751 /* Line 1806 of yacc.c  */
01752 #line 327 "../../lib/graph/parser.y"
01753     {if (begin_graph((agvsp[(2) - (2)].str))) YYABORT; agstrfree((agvsp[(2) - (2)].str));}
01754     break;
01755 
01756   case 3:
01757 
01758 /* Line 1806 of yacc.c  */
01759 #line 329 "../../lib/graph/parser.y"
01760     {AG.accepting_state = TRUE; if (!end_graph()) YYABORT;}
01761     break;
01762 
01763   case 4:
01764 
01765 /* Line 1806 of yacc.c  */
01766 #line 331 "../../lib/graph/parser.y"
01767     {
01768                                         if (AG.parsed_g)
01769                                                 agclose(AG.parsed_g);
01770                                         AG.parsed_g = NULL;
01771                                 }
01772     break;
01773 
01774   case 5:
01775 
01776 /* Line 1806 of yacc.c  */
01777 #line 336 "../../lib/graph/parser.y"
01778     {AG.parsed_g = NULL;}
01779     break;
01780 
01781   case 6:
01782 
01783 /* Line 1806 of yacc.c  */
01784 #line 339 "../../lib/graph/parser.y"
01785     {(agval.str)=(agvsp[(1) - (1)].str);}
01786     break;
01787 
01788   case 7:
01789 
01790 /* Line 1806 of yacc.c  */
01791 #line 339 "../../lib/graph/parser.y"
01792     {(agval.str)=0;}
01793     break;
01794 
01795   case 8:
01796 
01797 /* Line 1806 of yacc.c  */
01798 #line 343 "../../lib/graph/parser.y"
01799     {Agraph_type = AGRAPH; AG.edge_op = "--";}
01800     break;
01801 
01802   case 9:
01803 
01804 /* Line 1806 of yacc.c  */
01805 #line 345 "../../lib/graph/parser.y"
01806     {Agraph_type = AGRAPHSTRICT; AG.edge_op = "--";}
01807     break;
01808 
01809   case 10:
01810 
01811 /* Line 1806 of yacc.c  */
01812 #line 347 "../../lib/graph/parser.y"
01813     {Agraph_type = AGDIGRAPH; AG.edge_op = "->";}
01814     break;
01815 
01816   case 11:
01817 
01818 /* Line 1806 of yacc.c  */
01819 #line 349 "../../lib/graph/parser.y"
01820     {Agraph_type = AGDIGRAPHSTRICT; AG.edge_op = "->";}
01821     break;
01822 
01823   case 12:
01824 
01825 /* Line 1806 of yacc.c  */
01826 #line 353 "../../lib/graph/parser.y"
01827     {Current_class = TAG_GRAPH;}
01828     break;
01829 
01830   case 13:
01831 
01832 /* Line 1806 of yacc.c  */
01833 #line 355 "../../lib/graph/parser.y"
01834     {Current_class = TAG_NODE; N = G->proto->n;}
01835     break;
01836 
01837   case 14:
01838 
01839 /* Line 1806 of yacc.c  */
01840 #line 357 "../../lib/graph/parser.y"
01841     {Current_class = TAG_EDGE; E = G->proto->e;}
01842     break;
01843 
01844   case 23:
01845 
01846 /* Line 1806 of yacc.c  */
01847 #line 379 "../../lib/graph/parser.y"
01848     {attr_set((agvsp[(1) - (3)].str),(agvsp[(3) - (3)].str)); agstrfree((agvsp[(1) - (3)].str)); agstrfree((agvsp[(3) - (3)].str));}
01849     break;
01850 
01851   case 25:
01852 
01853 /* Line 1806 of yacc.c  */
01854 #line 384 "../../lib/graph/parser.y"
01855     {attr_set((agvsp[(1) - (1)].str),"true"); agstrfree((agvsp[(1) - (1)].str)); }
01856     break;
01857 
01858   case 32:
01859 
01860 /* Line 1806 of yacc.c  */
01861 #line 397 "../../lib/graph/parser.y"
01862     {agerror("syntax error, statement skipped");}
01863     break;
01864 
01865   case 36:
01866 
01867 /* Line 1806 of yacc.c  */
01868 #line 403 "../../lib/graph/parser.y"
01869     {}
01870     break;
01871 
01872   case 37:
01873 
01874 /* Line 1806 of yacc.c  */
01875 #line 407 "../../lib/graph/parser.y"
01876     {Current_class = TAG_GRAPH; /* reset */}
01877     break;
01878 
01879   case 38:
01880 
01881 /* Line 1806 of yacc.c  */
01882 #line 409 "../../lib/graph/parser.y"
01883     {Current_class = TAG_GRAPH;}
01884     break;
01885 
01886   case 39:
01887 
01888 /* Line 1806 of yacc.c  */
01889 #line 413 "../../lib/graph/parser.y"
01890     {
01891                                         objport_t               rv;
01892                                         rv.obj = (agvsp[(1) - (2)].n);
01893                                         rv.port = Port;
01894                                         Port = NULL;
01895                                         (agval.obj) = rv;
01896                                 }
01897     break;
01898 
01899   case 40:
01900 
01901 /* Line 1806 of yacc.c  */
01902 #line 422 "../../lib/graph/parser.y"
01903     {(agval.n) = bind_node((agvsp[(1) - (1)].str)); agstrfree((agvsp[(1) - (1)].str));}
01904     break;
01905 
01906   case 42:
01907 
01908 /* Line 1806 of yacc.c  */
01909 #line 426 "../../lib/graph/parser.y"
01910     { Port=(agvsp[(2) - (2)].str);}
01911     break;
01912 
01913   case 43:
01914 
01915 /* Line 1806 of yacc.c  */
01916 #line 427 "../../lib/graph/parser.y"
01917     {Port=concat3((agvsp[(2) - (4)].str),":",(agvsp[(4) - (4)].str));agstrfree((agvsp[(2) - (4)].str)); agstrfree((agvsp[(4) - (4)].str));}
01918     break;
01919 
01920   case 44:
01921 
01922 /* Line 1806 of yacc.c  */
01923 #line 431 "../../lib/graph/parser.y"
01924     {Current_class = TAG_NODE; N = (Agnode_t*)((agvsp[(1) - (1)].obj).obj);}
01925     break;
01926 
01927   case 45:
01928 
01929 /* Line 1806 of yacc.c  */
01930 #line 433 "../../lib/graph/parser.y"
01931     {agstrfree((agvsp[(1) - (3)].obj).port);Current_class = TAG_GRAPH; /* reset */}
01932     break;
01933 
01934   case 46:
01935 
01936 /* Line 1806 of yacc.c  */
01937 #line 437 "../../lib/graph/parser.y"
01938     {begin_edgestmt((agvsp[(1) - (1)].obj));}
01939     break;
01940 
01941   case 47:
01942 
01943 /* Line 1806 of yacc.c  */
01944 #line 439 "../../lib/graph/parser.y"
01945     { E = SP->subg->proto->e;
01946                                   Current_class = TAG_EDGE; }
01947     break;
01948 
01949   case 48:
01950 
01951 /* Line 1806 of yacc.c  */
01952 #line 442 "../../lib/graph/parser.y"
01953     {if(end_edgestmt()) YYABORT;}
01954     break;
01955 
01956   case 49:
01957 
01958 /* Line 1806 of yacc.c  */
01959 #line 444 "../../lib/graph/parser.y"
01960     {begin_edgestmt((agvsp[(1) - (1)].obj));}
01961     break;
01962 
01963   case 50:
01964 
01965 /* Line 1806 of yacc.c  */
01966 #line 446 "../../lib/graph/parser.y"
01967     { E = SP->subg->proto->e;
01968                                   Current_class = TAG_EDGE; }
01969     break;
01970 
01971   case 51:
01972 
01973 /* Line 1806 of yacc.c  */
01974 #line 449 "../../lib/graph/parser.y"
01975     {if(end_edgestmt()) YYABORT;}
01976     break;
01977 
01978   case 52:
01979 
01980 /* Line 1806 of yacc.c  */
01981 #line 452 "../../lib/graph/parser.y"
01982     {mid_edgestmt((agvsp[(2) - (2)].obj));}
01983     break;
01984 
01985   case 53:
01986 
01987 /* Line 1806 of yacc.c  */
01988 #line 454 "../../lib/graph/parser.y"
01989     {mid_edgestmt((agvsp[(2) - (2)].obj));}
01990     break;
01991 
01992   case 55:
01993 
01994 /* Line 1806 of yacc.c  */
01995 #line 457 "../../lib/graph/parser.y"
01996     {mid_edgestmt((agvsp[(2) - (2)].obj));}
01997     break;
01998 
01999   case 56:
02000 
02001 /* Line 1806 of yacc.c  */
02002 #line 459 "../../lib/graph/parser.y"
02003     {mid_edgestmt((agvsp[(2) - (2)].obj));}
02004     break;
02005 
02006   case 58:
02007 
02008 /* Line 1806 of yacc.c  */
02009 #line 464 "../../lib/graph/parser.y"
02010     {(agval.obj) = pop_gobj(); if (!(agval.obj).obj) YYABORT;}
02011     break;
02012 
02013   case 59:
02014 
02015 /* Line 1806 of yacc.c  */
02016 #line 465 "../../lib/graph/parser.y"
02017     { if(anonsubg()) YYABORT; }
02018     break;
02019 
02020   case 60:
02021 
02022 /* Line 1806 of yacc.c  */
02023 #line 465 "../../lib/graph/parser.y"
02024     {(agval.obj) = pop_gobj();  if (!(agval.obj).obj) YYABORT;}
02025     break;
02026 
02027   case 61:
02028 
02029 /* Line 1806 of yacc.c  */
02030 #line 466 "../../lib/graph/parser.y"
02031     { if(anonsubg()) YYABORT; }
02032     break;
02033 
02034   case 62:
02035 
02036 /* Line 1806 of yacc.c  */
02037 #line 466 "../../lib/graph/parser.y"
02038     {(agval.obj) = pop_gobj();  if (!(agval.obj).obj) YYABORT;}
02039     break;
02040 
02041   case 63:
02042 
02043 /* Line 1806 of yacc.c  */
02044 #line 467 "../../lib/graph/parser.y"
02045     {subgraph_warn(); (agval.obj) = pop_gobj();  if (!(agval.obj).obj) YYABORT;}
02046     break;
02047 
02048   case 64:
02049 
02050 /* Line 1806 of yacc.c  */
02051 #line 471 "../../lib/graph/parser.y"
02052     { Agraph_t   *subg;
02053                                 if ((subg = agfindsubg(AG.parsed_g,(agvsp[(2) - (2)].str)))) aginsert(G,subg);
02054                                 else subg = agsubg(G,(agvsp[(2) - (2)].str)); 
02055                                 push_subg(subg);
02056                                 In_decl = FALSE;
02057                                 agstrfree((agvsp[(2) - (2)].str));
02058                                 }
02059     break;
02060 
02061   case 65:
02062 
02063 /* Line 1806 of yacc.c  */
02064 #line 480 "../../lib/graph/parser.y"
02065     {(agval.str) = (agvsp[(1) - (1)].str); }
02066     break;
02067 
02068   case 66:
02069 
02070 /* Line 1806 of yacc.c  */
02071 #line 481 "../../lib/graph/parser.y"
02072     {(agval.str) = (agvsp[(1) - (1)].str); }
02073     break;
02074 
02075   case 67:
02076 
02077 /* Line 1806 of yacc.c  */
02078 #line 484 "../../lib/graph/parser.y"
02079     {(agval.str) = (agvsp[(1) - (1)].str); }
02080     break;
02081 
02082   case 68:
02083 
02084 /* Line 1806 of yacc.c  */
02085 #line 485 "../../lib/graph/parser.y"
02086     {(agval.str) = concat((agvsp[(1) - (3)].str),(agvsp[(3) - (3)].str)); agstrfree((agvsp[(1) - (3)].str)); agstrfree((agvsp[(3) - (3)].str));}
02087     break;
02088 
02089 
02090 
02091 /* Line 1806 of yacc.c  */
02092 #line 2093 "y.tab.c"
02093       default: break;
02094     }
02095   /* User semantic actions sometimes alter agchar, and that requires
02096      that agtoken be updated with the new translation.  We take the
02097      approach of translating immediately before every use of agtoken.
02098      One alternative is translating here after every semantic action,
02099      but that translation would be missed if the semantic action invokes
02100      YYABORT, YYACCEPT, or YYERROR immediately after altering agchar or
02101      if it invokes YYBACKUP.  In the case of YYABORT or YYACCEPT, an
02102      incorrect destructor might then be invoked immediately.  In the
02103      case of YYERROR or YYBACKUP, subsequent parser actions might lead
02104      to an incorrect destructor call or verbose syntax error message
02105      before the lookahead is translated.  */
02106   YY_SYMBOL_PRINT ("-> $$ =", agr1[agn], &agval, &agloc);
02107 
02108   YYPOPSTACK (aglen);
02109   aglen = 0;
02110   YY_STACK_PRINT (agss, agssp);
02111 
02112   *++agvsp = agval;
02113 
02114   /* Now `shift' the result of the reduction.  Determine what state
02115      that goes to, based on the state we popped back to and the rule
02116      number reduced by.  */
02117 
02118   agn = agr1[agn];
02119 
02120   agstate = agpgoto[agn - YYNTOKENS] + *agssp;
02121   if (0 <= agstate && agstate <= YYLAST && agcheck[agstate] == *agssp)
02122     agstate = agtable[agstate];
02123   else
02124     agstate = agdefgoto[agn - YYNTOKENS];
02125 
02126   goto agnewstate;
02127 
02128 
02129 /*------------------------------------.
02130 | agerrlab -- here on detecting error |
02131 `------------------------------------*/
02132 agerrlab:
02133   /* Make sure we have latest lookahead translation.  See comments at
02134      user semantic actions for why this is necessary.  */
02135   agtoken = agchar == YYEMPTY ? YYEMPTY : YYTRANSLATE (agchar);
02136 
02137   /* If not already recovering from an error, report this error.  */
02138   if (!agerrstatus)
02139     {
02140       ++agnerrs;
02141 #if ! YYERROR_VERBOSE
02142       agerror (YY_("syntax error"));
02143 #else
02144 # define YYSYNTAX_ERROR agsyntax_error (&agmsg_alloc, &agmsg, \
02145                                         agssp, agtoken)
02146       {
02147         char const *agmsgp = YY_("syntax error");
02148         int agsyntax_error_status;
02149         agsyntax_error_status = YYSYNTAX_ERROR;
02150         if (agsyntax_error_status == 0)
02151           agmsgp = agmsg;
02152         else if (agsyntax_error_status == 1)
02153           {
02154             if (agmsg != agmsgbuf)
02155               YYSTACK_FREE (agmsg);
02156             agmsg = (char *) YYSTACK_ALLOC (agmsg_alloc);
02157             if (!agmsg)
02158               {
02159                 agmsg = agmsgbuf;
02160                 agmsg_alloc = sizeof agmsgbuf;
02161                 agsyntax_error_status = 2;
02162               }
02163             else
02164               {
02165                 agsyntax_error_status = YYSYNTAX_ERROR;
02166                 agmsgp = agmsg;
02167               }
02168           }
02169         agerror (agmsgp);
02170         if (agsyntax_error_status == 2)
02171           goto agexhaustedlab;
02172       }
02173 # undef YYSYNTAX_ERROR
02174 #endif
02175     }
02176 
02177 
02178 
02179   if (agerrstatus == 3)
02180     {
02181       /* If just tried and failed to reuse lookahead token after an
02182          error, discard it.  */
02183 
02184       if (agchar <= YYEOF)
02185         {
02186           /* Return failure if at end of input.  */
02187           if (agchar == YYEOF)
02188             YYABORT;
02189         }
02190       else
02191         {
02192           agdestruct ("Error: discarding",
02193                       agtoken, &aglval);
02194           agchar = YYEMPTY;
02195         }
02196     }
02197 
02198   /* Else will try to reuse lookahead token after shifting the error
02199      token.  */
02200   goto agerrlab1;
02201 
02202 
02203 /*---------------------------------------------------.
02204 | agerrorlab -- error raised explicitly by YYERROR.  |
02205 `---------------------------------------------------*/
02206 agerrorlab:
02207 
02208   /* Pacify compilers like GCC when the user code never invokes
02209      YYERROR and the label agerrorlab therefore never appears in user
02210      code.  */
02211   if (/*CONSTCOND*/ 0)
02212      goto agerrorlab;
02213 
02214   /* Do not reclaim the symbols of the rule which action triggered
02215      this YYERROR.  */
02216   YYPOPSTACK (aglen);
02217   aglen = 0;
02218   YY_STACK_PRINT (agss, agssp);
02219   agstate = *agssp;
02220   goto agerrlab1;
02221 
02222 
02223 /*-------------------------------------------------------------.
02224 | agerrlab1 -- common code for both syntax error and YYERROR.  |
02225 `-------------------------------------------------------------*/
02226 agerrlab1:
02227   agerrstatus = 3;      /* Each real token shifted decrements this.  */
02228 
02229   for (;;)
02230     {
02231       agn = agpact[agstate];
02232       if (!agpact_value_is_default (agn))
02233         {
02234           agn += YYTERROR;
02235           if (0 <= agn && agn <= YYLAST && agcheck[agn] == YYTERROR)
02236             {
02237               agn = agtable[agn];
02238               if (0 < agn)
02239                 break;
02240             }
02241         }
02242 
02243       /* Pop the current state because it cannot handle the error token.  */
02244       if (agssp == agss)
02245         YYABORT;
02246 
02247 
02248       agdestruct ("Error: popping",
02249                   agstos[agstate], agvsp);
02250       YYPOPSTACK (1);
02251       agstate = *agssp;
02252       YY_STACK_PRINT (agss, agssp);
02253     }
02254 
02255   *++agvsp = aglval;
02256 
02257 
02258   /* Shift the error token.  */
02259   YY_SYMBOL_PRINT ("Shifting", agstos[agn], agvsp, aglsp);
02260 
02261   agstate = agn;
02262   goto agnewstate;
02263 
02264 
02265 /*-------------------------------------.
02266 | agacceptlab -- YYACCEPT comes here.  |
02267 `-------------------------------------*/
02268 agacceptlab:
02269   agresult = 0;
02270   goto agreturn;
02271 
02272 /*-----------------------------------.
02273 | agabortlab -- YYABORT comes here.  |
02274 `-----------------------------------*/
02275 agabortlab:
02276   agresult = 1;
02277   goto agreturn;
02278 
02279 #if !defined(agoverflow) || YYERROR_VERBOSE
02280 /*-------------------------------------------------.
02281 | agexhaustedlab -- memory exhaustion comes here.  |
02282 `-------------------------------------------------*/
02283 agexhaustedlab:
02284   agerror (YY_("memory exhausted"));
02285   agresult = 2;
02286   /* Fall through.  */
02287 #endif
02288 
02289 agreturn:
02290   if (agchar != YYEMPTY)
02291     {
02292       /* Make sure we have latest lookahead translation.  See comments at
02293          user semantic actions for why this is necessary.  */
02294       agtoken = YYTRANSLATE (agchar);
02295       agdestruct ("Cleanup: discarding lookahead",
02296                   agtoken, &aglval);
02297     }
02298   /* Do not reclaim the symbols of the rule which action triggered
02299      this YYABORT or YYACCEPT.  */
02300   YYPOPSTACK (aglen);
02301   YY_STACK_PRINT (agss, agssp);
02302   while (agssp != agss)
02303     {
02304       agdestruct ("Cleanup: popping",
02305                   agstos[*agssp], agvsp);
02306       YYPOPSTACK (1);
02307     }
02308 #ifndef agoverflow
02309   if (agss != agssa)
02310     YYSTACK_FREE (agss);
02311 #endif
02312 #if YYERROR_VERBOSE
02313   if (agmsg != agmsgbuf)
02314     YYSTACK_FREE (agmsg);
02315 #endif
02316   /* Make sure YYID is used.  */
02317   return YYID (agresult);
02318 }
02319 
02320 
02321 
02322 /* Line 2067 of yacc.c  */
02323 #line 487 "../../lib/graph/parser.y"
02324 
02325 #ifdef UNUSED
02326 /* grammar allowing port variants */
02327 /* at present, these are not used, so we remove them from the grammar */
02328 /* NOTE: If used, these should be rewritten to take into account the */
02329 /* move away from using ':' in the string and that symbols come from */
02330 /* agstrdup and need to be freed. */
02331 node_port       :       /* empty */
02332                 |       port_location 
02333                 |       port_angle                      /* undocumented */
02334                 |       port_angle port_location        /* undocumented */
02335                 |       port_location port_angle        /* undocumented */
02336                 ;
02337 
02338 port_location   :       ':' symbol {strcat(Port,":"); strcat(Port,$2);}
02339                 |       ':' '(' symbol {Symbol = strdup($3);} ',' symbol ')'
02340                                 {       char buf[SMALLBUF];
02341                                         sprintf(buf,":(%s,%s)",Symbol,$6);
02342                                         strcat(Port,buf); free(Symbol);
02343                                 }
02344                 ;
02345 
02346 port_angle      :       '@' symbol
02347                                 {       char buf[SMALLBUF];
02348                                         sprintf(buf,"@%s",$2);
02349                                         strcat(Port,buf);
02350                                 }
02351                 ;
02352 
02353 #endif
02354