From 547cd77748eb24e0220b2e2cfb1bcb6bc691740b Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Mon, 26 Jan 2004 09:08:02 +0000 Subject: [PATCH] Regenerated bison/flex output. [SVN r21950] --- src/graphviz_digraph_lex.cpp | 2349 +++++++++++++++++-------------- src/graphviz_digraph_parser.cpp | 2235 ++++++++++++++++------------- src/graphviz_graph_lex.cpp | 2349 +++++++++++++++++-------------- src/graphviz_graph_parser.cpp | 2235 ++++++++++++++++------------- 4 files changed, 5088 insertions(+), 4080 deletions(-) diff --git a/src/graphviz_digraph_lex.cpp b/src/graphviz_digraph_lex.cpp index 180fa15d..c65fdf9b 100644 --- a/src/graphviz_digraph_lex.cpp +++ b/src/graphviz_digraph_lex.cpp @@ -1,57 +1,97 @@ -/* A lexical scanner generated by flex */ +#line 2 "graphviz_digraph_lex.cpp" -/* Scanner skeleton version: - * $Header$ - */ +#line 4 "graphviz_digraph_lex.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include -#ifdef _MSC_VER -#define YY_NEVER_INTERACTIVE 1 -#else -#include -#endif - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - +#include +#include #include -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -59,13 +99,6 @@ #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -80,218 +113,258 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE bgl_dir_restart( bgl_dir_in ) +#define YY_NEW_FILE bgl_dir_restart(bgl_dir_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int bgl_dir_leng; + extern FILE *bgl_dir_in, *bgl_dir_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up bgl_dir_text. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up bgl_dir_text again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up bgl_dir_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up bgl_dir_text again */ \ + } \ + while ( 0 ) -#define unput(c) yyunput( c, bgl_dir_text_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; +#endif - +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; + { + FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; - int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via bgl_dir_restart()), so that the user can continue scanning by - * just pointing bgl_dir_in at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via bgl_dir_restart()), so that the user can continue scanning by + * just pointing bgl_dir_in at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when bgl_dir_text is formed. */ static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int bgl_dir_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches +/* Flag which is used to allow bgl_dir_wrap()'s to do buffer switches * instead of setting up a fresh bgl_dir_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void bgl_dir_restart YY_PROTO(( FILE *input_file )); +void bgl_dir_restart (FILE *input_file ); +void bgl_dir__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE bgl_dir__create_buffer (FILE *file,int size ); +void bgl_dir__delete_buffer (YY_BUFFER_STATE b ); +void bgl_dir__flush_buffer (YY_BUFFER_STATE b ); +void bgl_dir_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void bgl_dir_pop_buffer_state (void ); -void bgl_dir_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void bgl_dir_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE bgl_dir_create_buffer YY_PROTO(( FILE *file, int size )); -void bgl_dir_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void bgl_dir_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void bgl_dir_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER bgl_dir_flush_buffer( yy_current_buffer ) +static void bgl_dir_ensure_buffer_stack (void ); +static void bgl_dir__load_buffer_state (void ); +static void bgl_dir__init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE bgl_dir_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE bgl_dir_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE bgl_dir_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER bgl_dir__flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE bgl_dir__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE bgl_dir__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE bgl_dir__scan_bytes (yyconst char *bytes,int len ); -#define yy_new_buffer bgl_dir_create_buffer +void *bgl_dir_alloc (yy_size_t ); +void *bgl_dir_realloc (void *,yy_size_t ); +void bgl_dir_free (void * ); + +#define yy_new_buffer bgl_dir__create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = bgl_dir_create_buffer( bgl_dir_in, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + bgl_dir_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + bgl_dir__create_buffer(bgl_dir_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = bgl_dir_create_buffer( bgl_dir_in, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! YY_CURRENT_BUFFER ){\ + bgl_dir_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + bgl_dir__create_buffer(bgl_dir_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* Begin user sect3 */ -#define yywrap() 1 +#define bgl_dir_wrap(n) 1 #define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *bgl_dir_in = (FILE *) 0, *bgl_dir_out = (FILE *) 0; -typedef int yy_state_type; -extern char *bgl_dir_text; -#define bgl_dir_text_ptr bgl_dir_text -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +typedef unsigned char YY_CHAR; + +FILE *bgl_dir_in = (FILE *) 0, *bgl_dir_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int bgl_dir_lineno; + +int bgl_dir_lineno = 1; + +extern char *bgl_dir_text; +#define yytext_ptr bgl_dir_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up bgl_dir_text. */ #define YY_DO_BEFORE_ACTION \ - bgl_dir_text_ptr = yy_bp; \ - bgl_dir_leng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yytext_ptr) = yy_bp; \ + bgl_dir_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 21 #define YY_END_OF_BUFFER 22 -static yyconst short int yy_accept[81] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[81] = { 0, 0, 0, 3, 3, 17, 17, 22, 20, 18, 19, 14, 20, 20, 20, 20, 20, 13, 13, 13, 13, @@ -303,7 +376,7 @@ static yyconst short int yy_accept[81] = 7, 13, 13, 13, 10, 13, 6, 13, 11, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -335,14 +408,14 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[31] = +static yyconst flex_int32_t yy_meta[31] = { 0, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, 1, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[90] = +static yyconst flex_int16_t yy_base[90] = { 0, 0, 0, 28, 29, 29, 32, 168, 169, 169, 169, 169, 164, 28, 34, 155, 42, 40, 154, 27, 42, @@ -355,7 +428,7 @@ static yyconst short int yy_base[90] = 129, 133, 137, 110, 141, 145, 149, 153, 54 } ; -static yyconst short int yy_def[90] = +static yyconst flex_int16_t yy_def[90] = { 0, 80, 1, 81, 81, 82, 82, 80, 80, 80, 80, 80, 83, 80, 80, 80, 80, 80, 84, 84, 84, @@ -368,7 +441,7 @@ static yyconst short int yy_def[90] = 80, 80, 80, 80, 80, 80, 80, 80, 80 } ; -static yyconst short int yy_nxt[200] = +static yyconst flex_int16_t yy_nxt[200] = { 0, 8, 9, 10, 11, 12, 8, 13, 14, 15, 16, 17, 8, 18, 18, 8, 18, 18, 18, 19, 20, @@ -394,7 +467,7 @@ static yyconst short int yy_nxt[200] = } ; -static yyconst short int yy_chk[200] = +static yyconst flex_int16_t yy_chk[200] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -423,6 +496,9 @@ static yyconst short int yy_chk[200] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int bgl_dir__flex_debug; +int bgl_dir__flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -431,9 +507,8 @@ static char *yy_last_accepting_cpos; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *bgl_dir_text; -#line 1 "graphviz_lex.l" -#define INITIAL 0 -#line 2 "graphviz_lex.l" +#line 1 "graphviz_lex.ll" +#line 2 "graphviz_lex.ll" //======================================================================= // Copyright 2001 University of Notre Dame. // Author: Lie-Quan Lee @@ -459,7 +534,29 @@ char *bgl_dir_text; // OR OTHER RIGHTS. //======================================================================= -#include "graphviz_parser.h" + +// Include this first, since it declares YYSTYPE which will +// be defined in "*parser.h" if not previosly declared here. + + +#include "yystype.h" +#define YY_DECL int bgl_dir_lex(YYSTYPE* lvalp) + +// When GRAPHVIZ_DIRECTED is declared it means Boost.Build is used. +// Headers for directed and undirected graphs are both generated, and +// have different names. +#ifdef GRAPHVIZ_DIRECTED + #if GRAPHVIZ_DIRECTED == 0 + #define yyerror bgl_undir_error + #include "graphviz_graph_parser.hpp" + #else + #define yyerror bgl_dir_error + #include "graphviz_digraph_parser.hpp" + #endif +#else + #error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 +#endif + #include #include @@ -469,13 +566,25 @@ static void begin_literal(); static void add_string(const char* str); static void end_literal(); -#include "yystype.h" -#define YY_DECL int bgl_dir_lex(YYSTYPE* lvalp) -#define Comment 1 + +#line 572 "graphviz_digraph_lex.cpp" + +#define INITIAL 0 +#define Comment 1 #define Literal 2 -#line 475 "lex.yy.c" +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif /* Macros after this point can all be overridden by user definitions in * section 1. @@ -483,65 +592,30 @@ static void end_literal(); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int bgl_dir_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int bgl_dir_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef bgl_dir_text_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int bgl_dir_input YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -550,7 +624,6 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -563,21 +636,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( bgl_dir_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( bgl_dir_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, bgl_dir_in )) == 0) \ - && ferror( bgl_dir_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( bgl_dir_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( bgl_dir_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, bgl_dir_in))==0 && ferror(bgl_dir_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(bgl_dir_in); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -598,12 +685,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int bgl_dir_lex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int bgl_dir_lex (void); + +#define YY_DECL int bgl_dir_lex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after bgl_dir_text and bgl_dir_leng * have been set up. @@ -618,1095 +711,1186 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; - register int yy_act; - -#line 51 "graphviz_lex.l" +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 71 "graphviz_lex.ll" -#line 629 "lex.yy.c" +#line 728 "graphviz_digraph_lex.cpp" - if ( yy_init ) - { - yy_init = 0; + if ( (yy_init) ) + { + (yy_init) = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! bgl_dir_in ) - bgl_dir_in = stdin; + if ( ! bgl_dir_in ) + bgl_dir_in = stdin; - if ( ! bgl_dir_out ) - bgl_dir_out = stdout; + if ( ! bgl_dir_out ) + bgl_dir_out = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - bgl_dir_create_buffer( bgl_dir_in, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + bgl_dir_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + bgl_dir__create_buffer(bgl_dir_in,YY_BUF_SIZE ); + } - bgl_dir_load_buffer_state(); - } + bgl_dir__load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of bgl_dir_text. */ - *yy_cp = yy_hold_char; + /* Support of bgl_dir_text. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 169 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 169 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; +do_action: /* This label is used only to access EOF actions. */ -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: YY_RULE_SETUP -#line 53 "graphviz_lex.l" +#line 73 "graphviz_lex.ll" { BEGIN Comment; } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP -#line 54 "graphviz_lex.l" +#line 74 "graphviz_lex.ll" { BEGIN INITIAL; } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP -#line 55 "graphviz_lex.l" +#line 75 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 4: -*yy_cp = yy_hold_char; /* undo effects of setting up bgl_dir_text */ -yy_c_buf_p = yy_cp -= 1; +*yy_cp = (yy_hold_char); /* undo effects of setting up bgl_dir_text */ +(yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up bgl_dir_text again */ YY_RULE_SETUP -#line 56 "graphviz_lex.l" +#line 76 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 5: -*yy_cp = yy_hold_char; /* undo effects of setting up bgl_dir_text */ -yy_c_buf_p = yy_cp -= 1; +*yy_cp = (yy_hold_char); /* undo effects of setting up bgl_dir_text */ +(yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up bgl_dir_text again */ YY_RULE_SETUP -#line 57 "graphviz_lex.l" +#line 77 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP -#line 58 "graphviz_lex.l" +#line 78 "graphviz_lex.ll" { return DIGRAPH_T; } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP -#line 59 "graphviz_lex.l" +#line 79 "graphviz_lex.ll" { return GRAPH_T; } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP -#line 60 "graphviz_lex.l" +#line 80 "graphviz_lex.ll" { return NODE_T; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP -#line 61 "graphviz_lex.l" +#line 81 "graphviz_lex.ll" { return EDGE_T; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP -#line 62 "graphviz_lex.l" +#line 82 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP -#line 63 "graphviz_lex.l" +#line 83 "graphviz_lex.ll" { return SUBGRAPH_T; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP -#line 64 "graphviz_lex.l" +#line 84 "graphviz_lex.ll" { return EDGEOP_T; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP -#line 65 "graphviz_lex.l" +#line 85 "graphviz_lex.ll" { lvalp->ptr = (void*)(new std::string(bgl_dir_text)); return ID_T; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP -#line 66 "graphviz_lex.l" +#line 86 "graphviz_lex.ll" { BEGIN Literal; begin_literal(); } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP -#line 67 "graphviz_lex.l" +#line 87 "graphviz_lex.ll" { BEGIN INITIAL; end_literal(); lvalp->ptr = (void*)(new std::string(literal)); return ID_T; } - YY_BREAK + YY_BREAK case 16: +/* rule 16 can match eol */ YY_RULE_SETUP -#line 68 "graphviz_lex.l" +#line 88 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 17: +/* rule 17 can match eol */ YY_RULE_SETUP -#line 69 "graphviz_lex.l" +#line 89 "graphviz_lex.ll" { add_string(bgl_dir_text); } - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP -#line 70 "graphviz_lex.l" +#line 90 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 19: +/* rule 19 can match eol */ YY_RULE_SETUP -#line 71 "graphviz_lex.l" +#line 91 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP -#line 72 "graphviz_lex.l" +#line 92 "graphviz_lex.ll" { return bgl_dir_text[0]; } - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP -#line 73 "graphviz_lex.l" +#line 93 "graphviz_lex.ll" ECHO; - YY_BREAK -#line 823 "lex.yy.c" + YY_BREAK +#line 925 "graphviz_digraph_lex.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(Comment): case YY_STATE_EOF(Literal): - yyterminate(); + yyterminate(); - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - bgl_dir_text_ptr) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed bgl_dir_in at a new source and called - * bgl_dir_lex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = bgl_dir_in; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed bgl_dir_in at a new source and called + * bgl_dir_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = bgl_dir_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_c_buf_p = bgl_dir_text_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = bgl_dir_text_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * bgl_dir_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = bgl_dir_text_ptr + YY_MORE_ADJ; + if ( bgl_dir_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * bgl_dir_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - bgl_dir_text_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = bgl_dir_text_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = bgl_dir_text_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of bgl_dir_lex */ + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of bgl_dir_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = bgl_dir_text_ptr; - register int number_to_move, i; - int ret_val; + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - bgl_dir_text_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + /* Try to read more data. */ - /* Try to read more data. */ + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - bgl_dir_text_ptr) - 1; + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + bgl_dir_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; - } + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - bgl_dir_restart( bgl_dir_in ); - } + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + bgl_dir_restart(bgl_dir_in ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - bgl_dir_text_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = bgl_dir_text_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + return yy_current_state; +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 80); - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 80); + return yy_is_jam ? 0 : yy_current_state; +} - return yy_is_jam ? 0 : yy_current_state; - } + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + /* undo effects of setting up bgl_dir_text */ + *yy_cp = (yy_hold_char); -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - /* undo effects of setting up bgl_dir_text */ - *yy_cp = yy_hold_char; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - bgl_dir_text_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + *--yy_cp = (char) c; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int bgl_dir_input() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; - else - { /* need more input */ - int offset = yy_c_buf_p - bgl_dir_text_ptr; - ++yy_c_buf_p; + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ - /* Reset buffer status. */ - bgl_dir_restart( bgl_dir_in ); + /* Reset buffer status. */ + bgl_dir_restart(bgl_dir_in ); - /* fall through */ + /*FALLTHROUGH*/ - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; + case EOB_ACT_END_OF_FILE: + { + if ( bgl_dir_wrap( ) ) + return EOF; - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return bgl_dir_input(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = bgl_dir_text_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve bgl_dir_text */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve bgl_dir_text */ + (yy_hold_char) = *++(yy_c_buf_p); + return c; +} +#endif /* ifndef YY_NO_INPUT */ - return c; - } +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void bgl_dir_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + bgl_dir_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + bgl_dir__create_buffer(bgl_dir_in,YY_BUF_SIZE ); + } + bgl_dir__init_buffer(YY_CURRENT_BUFFER,input_file ); + bgl_dir__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void bgl_dir_restart( FILE *input_file ) -#else -void bgl_dir_restart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = bgl_dir_create_buffer( bgl_dir_in, YY_BUF_SIZE ); +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void bgl_dir__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * bgl_dir_pop_buffer_state(); + * bgl_dir_push_buffer_state(new_buffer); + */ + bgl_dir_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; - bgl_dir_init_buffer( yy_current_buffer, input_file ); - bgl_dir_load_buffer_state(); - } + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + YY_CURRENT_BUFFER_LVALUE = new_buffer; + bgl_dir__load_buffer_state( ); -#ifdef YY_USE_PROTOS -void bgl_dir_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void bgl_dir_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; + /* We don't actually know whether we did this switch during + * EOF (bgl_dir_wrap()) processing, but the only time this flag + * is looked at is after bgl_dir_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } +static void bgl_dir__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + bgl_dir_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} - yy_current_buffer = new_buffer; - bgl_dir_load_buffer_state(); +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE bgl_dir__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) bgl_dir_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_dir__create_buffer()" ); - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } + b->yy_buf_size = size; + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) bgl_dir_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_dir__create_buffer()" ); -#ifdef YY_USE_PROTOS -void bgl_dir_load_buffer_state( void ) -#else -void bgl_dir_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - bgl_dir_text_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - bgl_dir_in = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + b->yy_is_our_buffer = 1; + bgl_dir__init_buffer(b,file ); -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_dir_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE bgl_dir_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; + return b; +} - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_dir_create_buffer()" ); +/** Destroy the buffer. + * @param b a buffer created with bgl_dir__create_buffer() + * + */ + void bgl_dir__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; - b->yy_buf_size = size; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_dir_create_buffer()" ); + if ( b->yy_is_our_buffer ) + bgl_dir_free((void *) b->yy_ch_buf ); - b->yy_is_our_buffer = 1; + bgl_dir_free((void *) b ); +} - bgl_dir_init_buffer( b, file ); +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a bgl_dir_restart() or at EOF. + */ + static void bgl_dir__init_buffer (YY_BUFFER_STATE b, FILE * file ) - return b; - } +{ + int oerrno = errno; + + bgl_dir__flush_buffer(b ); + b->yy_input_file = file; + b->yy_fill_buffer = 1; -#ifdef YY_USE_PROTOS -void bgl_dir_delete_buffer( YY_BUFFER_STATE b ) -#else -void bgl_dir_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; + /* If b is the current buffer, then bgl_dir__init_buffer was _probably_ + * called from bgl_dir_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void bgl_dir_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void bgl_dir_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - bgl_dir_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + + errno = oerrno; +} +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void bgl_dir__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; -#ifdef YY_USE_PROTOS -void bgl_dir_flush_buffer( YY_BUFFER_STATE b ) -#else -void bgl_dir_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_n_chars = 0; - { - if ( ! b ) - return; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_n_chars = 0; + b->yy_buf_pos = &b->yy_ch_buf[0]; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + bgl_dir__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void bgl_dir_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + bgl_dir_ensure_buffer_stack(); + + /* This block is copied from bgl_dir__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from bgl_dir__switch_to_buffer. */ + bgl_dir__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void bgl_dir_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + bgl_dir__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + bgl_dir__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void bgl_dir_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)bgl_dir_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } - b->yy_buf_pos = &b->yy_ch_buf[0]; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; - if ( b == yy_current_buffer ) - bgl_dir_load_buffer_state(); - } + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)bgl_dir_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_dir_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE bgl_dir_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE bgl_dir__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + b = (YY_BUFFER_STATE) bgl_dir_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_dir__scan_buffer()" ); - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_dir_scan_buffer()" ); + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + bgl_dir__switch_to_buffer(b ); - bgl_dir_switch_to_buffer( b ); + return b; +} - return b; - } -#endif +/** Setup the input buffer state to scan a string. The next call to bgl_dir_lex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * bgl_dir__scan_bytes() instead. + */ +YY_BUFFER_STATE bgl_dir__scan_string (yyconst char * yy_str ) +{ + + return bgl_dir__scan_bytes(yy_str,strlen(yy_str) ); +} +/** Setup the input buffer state to scan the given bytes. The next call to bgl_dir_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE bgl_dir__scan_bytes (yyconst char * bytes, int len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) bgl_dir_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_dir__scan_bytes()" ); -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_dir_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE bgl_dir_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - return bgl_dir_scan_bytes( yy_str, len ); - } -#endif + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + b = bgl_dir__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in bgl_dir__scan_bytes()" ); -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_dir_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE bgl_dir_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_dir_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = bgl_dir_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in bgl_dir_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif + return b; +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up bgl_dir_text. */ \ - bgl_dir_text[bgl_dir_leng] = yy_hold_char; \ - yy_c_buf_p = bgl_dir_text + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - bgl_dir_leng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up bgl_dir_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + bgl_dir_text[bgl_dir_leng] = (yy_hold_char); \ + (yy_c_buf_p) = bgl_dir_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + bgl_dir_leng = yyless_macro_arg; \ + } \ + while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int bgl_dir_get_lineno (void) +{ + + return bgl_dir_lineno; +} -#ifndef bgl_dir_text_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } +/** Get the input stream. + * + */ +FILE *bgl_dir_get_in (void) +{ + return bgl_dir_in; +} + +/** Get the output stream. + * + */ +FILE *bgl_dir_get_out (void) +{ + return bgl_dir_out; +} + +/** Get the length of the current token. + * + */ +int bgl_dir_get_leng (void) +{ + return bgl_dir_leng; +} + +/** Get the current token. + * + */ + +char *bgl_dir_get_text (void) +{ + return bgl_dir_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void bgl_dir_set_lineno (int line_number ) +{ + + bgl_dir_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see bgl_dir__switch_to_buffer + */ +void bgl_dir_set_in (FILE * in_str ) +{ + bgl_dir_in = in_str ; +} + +void bgl_dir_set_out (FILE * out_str ) +{ + bgl_dir_out = out_str ; +} + +int bgl_dir_get_debug (void) +{ + return bgl_dir__flex_debug; +} + +void bgl_dir_set_debug (int bdebug ) +{ + bgl_dir__flex_debug = bdebug ; +} + +/* bgl_dir_lex_destroy is for both reentrant and non-reentrant scanners. */ +int bgl_dir_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + bgl_dir__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + bgl_dir_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + bgl_dir_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; - } + return n; +} #endif +void *bgl_dir_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } +void *bgl_dir_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } +void bgl_dir_free (void * ptr ) +{ + free( (char *) ptr ); /* see bgl_dir_realloc() for (char *) cast */ +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +#define YYTABLES_NAME "yytables" -#if YY_MAIN -int main() - { - bgl_dir_lex(); - return 0; - } +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 73 "graphviz_lex.l" +#line 93 "graphviz_lex.ll" + @@ -1721,7 +1905,8 @@ void add_string(const char* str) { void end_literal() { } -void bgl_dir_error(char *str) +void yyerror(char *str) { std::cout << str << std::endl; } + diff --git a/src/graphviz_digraph_parser.cpp b/src/graphviz_digraph_parser.cpp index 615d1997..53e54ee7 100644 --- a/src/graphviz_digraph_parser.cpp +++ b/src/graphviz_digraph_parser.cpp @@ -1,25 +1,89 @@ +/* A Bison parser, made by GNU Bison 1.875a. */ -/* A Bison parser, made from graphviz_parser.y - by GNU Bison version 1.28 */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -#define YYBISON 1 /* Identify Bison output. */ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* If NAME_PREFIX is specified substitute the variables and functions + names. */ #define yyparse bgl_dir_parse -#define bgl_dir_lex bgl_dir_lex -#define bgl_dir_error bgl_dir_error -#define bgl_dir_lval bgl_dir_lval -#define bgl_dir_char bgl_dir_char -#define bgl_dir_debug bgl_dir_debug -#define bgl_dir_nerrs bgl_dir_nerrs -#define GRAPH_T 257 -#define NODE_T 258 -#define EDGE_T 259 -#define DIGRAPH_T 260 -#define EDGEOP_T 261 -#define SUBGRAPH_T 262 -#define ID_T 263 +#define yylex bgl_dir_lex +#define yyerror bgl_dir_error +#define yylval bgl_dir_lval +#define yychar bgl_dir_char +#define yydebug bgl_dir_debug +#define yynerrs bgl_dir_nerrs -#line 1 "graphviz_parser.y" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + GRAPH_T = 258, + NODE_T = 259, + EDGE_T = 260, + DIGRAPH_T = 261, + EDGEOP_T = 262, + SUBGRAPH_T = 263, + ID_T = 264 + }; +#endif +#define GRAPH_T 258 +#define NODE_T 259 +#define EDGE_T 260 +#define DIGRAPH_T 261 +#define EDGEOP_T 262 +#define SUBGRAPH_T 263 +#define ID_T 264 + + + + +/* Copy the first part of user declarations. */ +#line 1 "graphviz_parser.yy" //======================================================================= // Copyright 2001 University of Notre Dame. @@ -62,17 +126,25 @@ #include #endif -#ifndef GRAPHVIZ_GRAPH -#error Need to define the GRAPHVIZ_GRAPH macro to either GraphvizGraph or GraphvizDigraph. +#ifndef GRAPHVIZ_DIRECTED +#error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 #endif +#if GRAPHVIZ_DIRECTED == 0 +#define GRAPHVIZ_GRAPH boost::GraphvizGraph +#define yyrestart bgl_undir_restart +#else +#define GRAPHVIZ_GRAPH boost::GraphvizDigraph +#define yyrestart bgl_dir_restart +#endif + #define YYPARSE_PARAM g #include "yystype.h" - extern void bgl_dir_error(char* str); - extern void bgl_dir_restart(FILE* str); - extern int bgl_dir_lex(YYSTYPE* lvalp); + extern void yyerror(char* str); + extern void yyrestart(FILE* str); + extern int yylex(YYSTYPE* lvalp); enum AttrState {GRAPH_GRAPH_A, GRAPH_NODE_A, GRAPH_EDGE_A, NODE_A, EDGE_A}; @@ -102,7 +174,7 @@ static const std::string& get_graph_name(const Subgraph& g) { const boost::graph_property::type& - name = boost::get_property(g, boost::graph_name); + name = boost::get_property(g, boost::graph_name); return name; } @@ -119,7 +191,7 @@ //set the label of vertex, it could be overwritten later. boost::property_map::type - va = boost::get(boost::vertex_attribute, g); + va = boost::get(boost::vertex_attribute, g); va[v]["label"] = name; //add v into the map so next time we will find it. @@ -143,85 +215,85 @@ static void set_attribute(GraphvizAttrList& p, - const GraphvizAttrList& attr) { + const GraphvizAttrList& attr) { GraphvizAttrList::const_iterator i, end; for ( i=attr.begin(), end=attr.end(); i!=end; ++i) - p[i->first]=i->second; + p[i->first]=i->second; } static void set_attribute(Subgraph& g, - AttrState s, bool clear_attribute = true) { + AttrState s, bool clear_attribute = true) { typedef Subgraph Graph; switch ( s ) { case GRAPH_GRAPH_A: - { - boost::graph_property::type& - gga = boost::get_property(g, boost::graph_graph_attribute); - set_attribute(gga, attributes); - } - break; + { + boost::graph_property::type& + gga = boost::get_property(g, boost::graph_graph_attribute); + set_attribute(gga, attributes); + } + break; case GRAPH_NODE_A: - { - boost::graph_property::type& - gna = boost::get_property(g, boost::graph_vertex_attribute); - set_attribute(gna, attributes); - } - break; + { + boost::graph_property::type& + gna = boost::get_property(g, boost::graph_vertex_attribute); + set_attribute(gna, attributes); + } + break; case GRAPH_EDGE_A: - { - boost::graph_property::type& - gea = boost::get_property(g, boost::graph_edge_attribute); - set_attribute(gea, attributes); - } - break; + { + boost::graph_property::type& + gea = boost::get_property(g, boost::graph_edge_attribute); + set_attribute(gea, attributes); + } + break; case NODE_A: - { - boost::property_map::type - va = boost::get(boost::vertex_attribute, g); //va[v] - set_attribute(va[current_vertex], attributes); - } - break; + { + boost::property_map::type + va = boost::get(boost::vertex_attribute, g); //va[v] + set_attribute(va[current_vertex], attributes); + } + break; case EDGE_A: - { - boost::property_map::type - ea = boost::get(boost::edge_attribute, g); //ea[e] - set_attribute(ea[current_edge], attributes); - } - break; + { + boost::property_map::type + ea = boost::get(boost::edge_attribute, g); //ea[e] + set_attribute(ea[current_edge], attributes); + } + break; } if ( clear_attribute ) - attributes.clear(); + attributes.clear(); } static void add_edges(const Vertex& u, - const Vertex& v, GRAPHVIZ_GRAPH& g) { + const Vertex& v, GRAPHVIZ_GRAPH& g) { graphviz::current_edge = boost::add_edge(u, v, g).first; graphviz::set_attribute(g, EDGE_A, false); } static void add_edges(Subgraph* G1, Subgraph* G2, - GRAPHVIZ_GRAPH& g) { + GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j, m, n; for ( boost::tie(i, j) = boost::vertices(*G1); i != j; ++i) { - for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) { - graphviz::add_edges(G1->local_to_global(*i), - G2->local_to_global(*m), g); - } + for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) { + graphviz::add_edges(G1->local_to_global(*i), + G2->local_to_global(*m), g); + } } } static void add_edges(Subgraph* G, const Vertex& v, GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j; for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) { - graphviz::add_edges(G->local_to_global(*i), v, g); + graphviz::add_edges(G->local_to_global(*i), v, g); } } static void add_edges(const Vertex& u, Subgraph* G, GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j; for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) { - graphviz::add_edges(u, G->local_to_global(*i), g); + graphviz::add_edges(u, G->local_to_global(*i), g); } } @@ -232,7 +304,7 @@ char buf[256]; sprintf(buf, "default%i\0", i); ++i; - return string(buf); + return std::string(buf); #else std::stringstream out; out << "default" << i; @@ -244,587 +316,866 @@ static void set_graph_name(const std::string& name) { boost::graph_property::type& - gea = boost::get_property(*current_graph, boost::graph_name); + gea = boost::get_property(*current_graph, boost::graph_name); gea = name; } } //namespace detail { -#include -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 #endif - - -#define YYFINAL 66 -#define YYFLAG -32768 -#define YYNTBASE 18 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 263 ? yytranslate[x] : 45) - -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, 16, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 17, 12, 2, - 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 13, 2, 14, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 10, 2, 11, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 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, 3, 4, 5, 6, - 7, 8, 9 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 3, 7, 10, 12, 14, 16, 17, 20, 22, - 24, 25, 28, 31, 36, 38, 40, 42, 44, 48, - 52, 54, 56, 57, 59, 61, 63, 65, 67, 70, - 74, 75, 77, 79, 83, 87, 90, 92, 95, 97, - 99, 102, 103, 106, 109, 111 -}; - -static const short yyrhs[] = { 20, - 19, 0, 10, 23, 11, 0, 21, 22, 0, 3, - 0, 6, 0, 9, 0, 0, 23, 25, 0, 25, - 0, 12, 0, 0, 26, 24, 0, 31, 24, 0, - 27, 13, 28, 14, 0, 3, 0, 4, 0, 5, - 0, 29, 0, 28, 30, 29, 0, 9, 15, 9, - 0, 12, 0, 16, 0, 0, 33, 0, 37, 0, - 32, 0, 41, 0, 29, 0, 35, 34, 0, 13, - 28, 14, 0, 0, 9, 0, 36, 0, 9, 17, - 9, 0, 40, 39, 34, 0, 7, 40, 0, 38, - 0, 39, 38, 0, 35, 0, 41, 0, 43, 44, - 0, 0, 42, 19, 0, 8, 9, 0, 19, 0, - 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 246, 249, 252, 262, 262, 265, 265, 268, 268, 271, - 271, 274, 274, 278, 285, 286, 287, 290, 290, 293, - 303, 303, 303, 306, 306, 306, 306, 309, 317, 328, - 328, 331, 346, 349, 368, 413, 417, 417, 420, 429, - 440, 447, 457, 462, 483, 483 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","GRAPH_T", -"NODE_T","EDGE_T","DIGRAPH_T","EDGEOP_T","SUBGRAPH_T","ID_T","'{'","'}'","';'", -"'['","']'","'='","','","':'","graph","graph_body","graph_header","graph_type", -"graph_name","stmt_list","semicolon","stmt","attr_stmt","attr_header","attr_list", -"attr","attr_separator","compound_stmt","graph_attr","node_stmt","opt_attr", -"node_id","node_port","edge_stmt","edge_rhs_one","edge_rhs","edge_endpoint", -"subgraph","@1","subgraph_header","opt_graph_body", NULL -}; -#endif - -static const short yyr1[] = { 0, - 18, 19, 20, 21, 21, 22, 22, 23, 23, 24, - 24, 25, 25, 26, 27, 27, 27, 28, 28, 29, - 30, 30, 30, 31, 31, 31, 31, 32, 33, 34, - 34, 35, 35, 36, 37, 38, 39, 39, 40, 40, - 41, 42, 41, 43, 44, 44 -}; - -static const short yyr2[] = { 0, - 2, 3, 2, 1, 1, 1, 0, 2, 1, 1, - 0, 2, 2, 4, 1, 1, 1, 1, 3, 3, - 1, 1, 0, 1, 1, 1, 1, 1, 2, 3, - 0, 1, 1, 3, 3, 2, 1, 2, 1, 1, - 2, 0, 2, 2, 1, 0 -}; - -static const short yydefact[] = { 0, - 4, 5, 0, 7, 42, 1, 6, 3, 15, 16, - 17, 0, 32, 42, 9, 11, 0, 28, 11, 26, - 24, 31, 33, 25, 0, 27, 0, 46, 44, 0, - 0, 2, 8, 10, 12, 0, 13, 0, 29, 42, - 37, 31, 43, 45, 41, 20, 34, 0, 23, 18, - 23, 32, 39, 36, 40, 35, 38, 21, 14, 22, - 0, 30, 19, 0, 0, 0 -}; - -static const short yydefgoto[] = { 64, - 6, 3, 4, 8, 14, 35, 15, 16, 17, 49, - 18, 61, 19, 20, 21, 39, 22, 23, 24, 41, - 42, 25, 26, 27, 28, 45 -}; - -static const short yypact[] = { 23, --32768,-32768, -4, 6, 9,-32768,-32768,-32768,-32768,-32768, --32768, 18, 13, 0,-32768, 19, 21,-32768, 19,-32768, --32768, -6,-32768,-32768, 28, 29, -4, -4,-32768, 30, - 31,-32768,-32768,-32768,-32768, 32,-32768, 32,-32768, 24, --32768, 3,-32768,-32768,-32768,-32768,-32768, 27, 7,-32768, - 8, 26,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 32,-32768,-32768, 44, 45,-32768 -}; - -static const short yypgoto[] = {-32768, - 10,-32768,-32768,-32768,-32768, 33, 34,-32768,-32768, 11, - -36,-32768,-32768,-32768,-32768, 4, 14,-32768,-32768, 5, --32768, 15, 16,-32768,-32768,-32768 -}; - - -#define YYLAST 56 - - -static const short yytable[] = { 50, - -39, 50, 9, 10, 11, 5, 38, 12, 13, 40, - 32, 9, 10, 11, 7, 38, 12, 13, 58, 58, - 59, 62, 60, 60, 63, 1, 29, 30, 2, 31, - 34, 12, 52, 36, 40, -40, 43, 44, 46, 47, - 48, 30, 31, 65, 66, 56, 57, 33, 51, 0, - 0, 37, 0, 53, 54, 55 -}; - -static const short yycheck[] = { 36, - 7, 38, 3, 4, 5, 10, 13, 8, 9, 7, - 11, 3, 4, 5, 9, 13, 8, 9, 12, 12, - 14, 14, 16, 16, 61, 3, 9, 15, 6, 17, - 12, 8, 9, 13, 7, 7, 27, 28, 9, 9, - 9, 15, 17, 0, 0, 42, 42, 14, 38, -1, - -1, 19, -1, 40, 40, 40 -}; -#define YYPURE 1 - -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* 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. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 #else -#define YYSTACK_ALLOC malloc +# define YYERROR_VERBOSE 0 #endif -/* 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. */ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif -#define yyerrok (yyerrstatus = 0) -#define yyclearin (bgl_dir_char = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call bgl_dir_error. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. + + +/* Copy the second part of user declarations. */ + + +/* Line 214 of yacc.c. */ +#line 354 "graphviz_digraph_parser.cpp" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 6 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 58 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 18 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 28 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 47 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 66 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 264 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 17, 12, + 2, 15, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 13, 2, 14, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 10, 2, 11, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = +{ + 0, 0, 3, 6, 10, 13, 15, 17, 19, 20, + 23, 25, 27, 28, 31, 34, 39, 41, 43, 45, + 47, 51, 55, 57, 59, 60, 62, 64, 66, 68, + 70, 73, 77, 78, 80, 82, 86, 90, 93, 95, + 98, 100, 102, 105, 106, 109, 112, 114 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 19, 0, -1, 21, 20, -1, 10, 24, 11, -1, + 22, 23, -1, 3, -1, 6, -1, 9, -1, -1, + 24, 26, -1, 26, -1, 12, -1, -1, 27, 25, + -1, 32, 25, -1, 28, 13, 29, 14, -1, 3, + -1, 4, -1, 5, -1, 30, -1, 29, 31, 30, + -1, 9, 15, 9, -1, 12, -1, 16, -1, -1, + 34, -1, 38, -1, 33, -1, 42, -1, 30, -1, + 36, 35, -1, 13, 29, 14, -1, -1, 9, -1, + 37, -1, 9, 17, 9, -1, 41, 40, 35, -1, + 7, 41, -1, 39, -1, 40, 39, -1, 36, -1, + 42, -1, 44, 45, -1, -1, 43, 20, -1, 8, + 9, -1, 20, -1, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short yyrline[] = +{ + 0, 254, 254, 257, 260, 270, 270, 273, 273, 276, + 276, 279, 279, 282, 283, 286, 293, 294, 295, 298, + 298, 301, 311, 311, 311, 314, 314, 314, 314, 317, + 325, 336, 336, 339, 354, 357, 376, 421, 425, 425, + 428, 437, 448, 456, 456, 470, 491, 491 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "GRAPH_T", "NODE_T", "EDGE_T", "DIGRAPH_T", + "EDGEOP_T", "SUBGRAPH_T", "ID_T", "'{'", "'}'", "';'", "'['", "']'", + "'='", "','", "':'", "$accept", "graph", "graph_body", "graph_header", + "graph_type", "graph_name", "stmt_list", "semicolon", "stmt", + "attr_stmt", "attr_header", "attr_list", "attr", "attr_separator", + "compound_stmt", "graph_attr", "node_stmt", "opt_attr", "node_id", + "node_port", "edge_stmt", "edge_rhs_one", "edge_rhs", "edge_endpoint", + "subgraph", "@1", "subgraph_header", "opt_graph_body", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 123, 125, 59, 91, 93, 61, 44, 58 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 18, 19, 20, 21, 22, 22, 23, 23, 24, + 24, 25, 25, 26, 26, 27, 28, 28, 28, 29, + 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, + 34, 35, 35, 36, 36, 37, 38, 39, 40, 40, + 41, 41, 42, 43, 42, 44, 45, 45 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 3, 2, 1, 1, 1, 0, 2, + 1, 1, 0, 2, 2, 4, 1, 1, 1, 1, + 3, 3, 1, 1, 0, 1, 1, 1, 1, 1, + 2, 3, 0, 1, 1, 3, 3, 2, 1, 2, + 1, 1, 2, 0, 2, 2, 1, 0 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 0, 5, 6, 0, 0, 8, 1, 43, 2, 7, + 4, 16, 17, 18, 0, 33, 43, 10, 12, 0, + 29, 12, 27, 25, 32, 34, 26, 0, 28, 0, + 47, 45, 0, 0, 3, 9, 11, 13, 0, 14, + 0, 30, 43, 38, 32, 44, 46, 42, 21, 35, + 0, 24, 19, 24, 33, 40, 37, 41, 36, 39, + 22, 15, 23, 0, 31, 20 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = +{ + -1, 3, 8, 4, 5, 10, 16, 37, 17, 18, + 19, 51, 20, 63, 21, 22, 23, 41, 24, 25, + 26, 43, 44, 27, 28, 29, 30, 47 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -39 +static const yysigned_char yypact[] = +{ + 23, -39, -39, 6, 17, 22, -39, 9, -39, -39, + -39, -39, -39, -39, 27, 13, 0, -39, 25, 2, + -39, 25, -39, -39, -6, -39, -39, 31, 32, 17, + 17, -39, 33, 34, -39, -39, -39, -39, 35, -39, + 35, -39, 24, -39, 3, -39, -39, -39, -39, -39, + 26, 7, -39, 8, 28, -39, -39, -39, -39, -39, + -39, -39, -39, 35, -39, -39 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -39, -39, 5, -39, -39, -39, -39, 19, 30, -39, + -39, 10, -38, -39, -39, -39, -39, 4, 11, -39, + -39, 12, -39, 15, 16, -39, -39, -39 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -42 +static const yysigned_char yytable[] = +{ + 52, -40, 52, 11, 12, 13, 6, 40, 14, 15, + 42, 34, 11, 12, 13, 38, 40, 14, 15, 60, + 60, 61, 64, 62, 62, 65, 1, 7, 32, 2, + 33, 9, 14, 54, 45, 46, 31, 36, 42, -41, + 39, 32, 48, 49, 50, 33, 35, 0, 58, 0, + 53, 0, 0, 55, 0, 0, 59, 56, 57 +}; + +static const yysigned_char yycheck[] = +{ + 38, 7, 40, 3, 4, 5, 0, 13, 8, 9, + 7, 11, 3, 4, 5, 13, 13, 8, 9, 12, + 12, 14, 14, 16, 16, 63, 3, 10, 15, 6, + 17, 9, 8, 9, 29, 30, 9, 12, 7, 7, + 21, 15, 9, 9, 9, 17, 16, -1, 44, -1, + 40, -1, -1, 42, -1, -1, 44, 42, 42 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 3, 6, 19, 21, 22, 0, 10, 20, 9, + 23, 3, 4, 5, 8, 9, 24, 26, 27, 28, + 30, 32, 33, 34, 36, 37, 38, 41, 42, 43, + 44, 9, 15, 17, 11, 26, 12, 25, 13, 25, + 13, 35, 7, 39, 40, 20, 20, 45, 9, 9, + 9, 29, 30, 29, 9, 36, 41, 42, 35, 39, + 12, 14, 16, 31, 14, 30 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto 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 YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (bgl_dir_char == YYEMPTY && yylen == 1) \ - { bgl_dir_char = (token), bgl_dir_lval = (value); \ - bgl_dir_char1 = YYTRANSLATE (bgl_dir_char); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { bgl_dir_error ("syntax error: cannot back up"); YYERROR; } \ + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX bgl_dir_lex() +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX bgl_dir_lex(&bgl_dir_lval, &yylloc, YYLEX_PARAM) +# define YYLEX yylex (&yylval, YYLEX_PARAM) #else -#define YYLEX bgl_dir_lex(&bgl_dir_lval, &yylloc) +# define YYLEX yylex (&yylval) #endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX bgl_dir_lex(&bgl_dir_lval, YYLEX_PARAM) + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (cinluded). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short *bottom, short *top) #else -#define YYLEX bgl_dir_lex(&bgl_dir_lval) +static void +yy_stack_print (bottom, top) + short *bottom; + short *top; #endif -#endif /* not YYLSP_NEEDED */ +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 #endif -/* If nonreentrant, generate the variables here */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#ifndef YYPURE - -int bgl_dir_char; /* the lookahead symbol */ -YYSTYPE bgl_dir_lval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int bgl_dir_nerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int bgl_dir_debug; /* 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). */ + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 -#undef YYMAXDEPTH +# undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus +#if YYERROR_VERBOSE -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + register const char *yys = yystr; - while (i-- > 0) - *t++ = *f++; + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; } +# endif +# endif -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif { - register char *t = to; - register char *f = from; - register int i = count; + register char *yyd = yydest; + register const char *yys = yysrc; - while (i-- > 0) - *t++ = *f++; + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; } +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ -#endif -#endif -#line 217 "/usr/lib/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else -int yyparse (void); +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; #endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + /* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + register int yystate; register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int bgl_dir_char1 = 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; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int bgl_dir_char; - YYSTYPE bgl_dir_lval; - int bgl_dir_nerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; - bgl_dir_nerrs = 0; - bgl_dir_char = YYEMPTY; /* Cause a token to be read. */ + 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; + yyssp = yyss; 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: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; - if (yyssp >= yyss + yystacksize - 1) + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) { - /* 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; + YYSIZE_T yysize = 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 + { + /* 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; - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - bgl_dir_error("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) - YYABORT; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; } -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -833,238 +1184,218 @@ yynewstate: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ - /* bgl_dir_char is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (bgl_dir_char == YYEMPTY) + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Reading a token: "); -#endif - bgl_dir_char = YYLEX; + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; } - /* Convert token to internal form (in bgl_dir_char1) for indexing tables with */ - - if (bgl_dir_char <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - bgl_dir_char1 = 0; - bgl_dir_char = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - bgl_dir_char1 = YYTRANSLATE(bgl_dir_char); - -#if YYDEBUG != 0 - if (bgl_dir_debug) - { - fprintf (stderr, "Next token is %d (%s", bgl_dir_char, yytname[bgl_dir_char1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, bgl_dir_char, bgl_dir_lval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } - yyn += bgl_dir_char1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != bgl_dir_char1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* 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 <= 0) { - if (yyn == YYFLAG) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Shifting token %d (%s), ", bgl_dir_char, yytname[bgl_dir_char1]); -#endif + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ - if (bgl_dir_char != YYEOF) - bgl_dir_char = YYEMPTY; + if (yychar != YYEOF) + yychar = YYEMPTY; - *++yyvsp = bgl_dir_lval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + *++yyvsp = yylval; - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + + /* 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: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (bgl_dir_debug) + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) { - int i; + case 3: +#line 257 "graphviz_parser.yy" + {yyval.i=0;;} + break; - 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 2: -#line 249 "graphviz_parser.y" -{yyval.i=0;; - break;} -case 3: -#line 253 "graphviz_parser.y" -{ + case 4: +#line 261 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[0].ptr); graphviz::previous_graph = static_cast(g); graphviz::current_graph = static_cast(g); graphviz::set_graph_name(*name); delete name; - ; - break;} -case 6: -#line 265 "graphviz_parser.y" -{yyval.ptr = yyvsp[0].ptr; ; - break;} -case 7: -#line 265 "graphviz_parser.y" -{yyval.ptr=(void*)(new std::string("G")); ; - break;} -case 14: -#line 279 "graphviz_parser.y" -{ + ;} + break; + + case 7: +#line 273 "graphviz_parser.yy" + {yyval.ptr = yyvsp[0].ptr; ;} + break; + + case 8: +#line 273 "graphviz_parser.yy" + {yyval.ptr=(void*)(new std::string("G")); ;} + break; + + case 15: +#line 287 "graphviz_parser.yy" + { graphviz::set_attribute(*graphviz::current_graph, - graphviz::attribute_state); - ; - break;} -case 15: -#line 285 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_GRAPH_A; ; - break;} -case 16: -#line 286 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_NODE_A; ; - break;} -case 17: -#line 287 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_EDGE_A; ; - break;} -case 20: -#line 294 "graphviz_parser.y" -{ + graphviz::attribute_state); + ;} + break; + + case 16: +#line 293 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_GRAPH_A; ;} + break; + + case 17: +#line 294 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_NODE_A; ;} + break; + + case 18: +#line 295 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_EDGE_A; ;} + break; + + case 21: +#line 302 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[-2].ptr); std::string* value = static_cast(yyvsp[0].ptr); graphviz::attributes[*name] = *value; delete name; delete value; - ; - break;} -case 27: -#line 306 "graphviz_parser.y" -{ yyval.i = 0; ; - break;} -case 28: -#line 310 "graphviz_parser.y" -{ + ;} + break; + + case 28: +#line 314 "graphviz_parser.yy" + { yyval.i = 0; ;} + break; + + case 29: +#line 318 "graphviz_parser.yy" + { graphviz::set_attribute( *static_cast(graphviz::current_graph), - GRAPH_GRAPH_A); - ; - break;} -case 29: -#line 318 "graphviz_parser.y" -{ + GRAPH_GRAPH_A); + ;} + break; + + case 30: +#line 326 "graphviz_parser.yy" + { graphviz::Vertex* temp = static_cast(yyvsp[-1].ptr); graphviz::current_vertex = *temp; graphviz::set_attribute(*static_cast(YYPARSE_PARAM), - NODE_A); + NODE_A); delete temp; yyval.i = 0; - ; - break;} -case 30: -#line 328 "graphviz_parser.y" -{ yyval.i=0; ; - break;} -case 31: -#line 328 "graphviz_parser.y" -{ yyval.i=0; ; - break;} -case 32: -#line 332 "graphviz_parser.y" -{ + ;} + break; + + case 31: +#line 336 "graphviz_parser.yy" + { yyval.i=0; ;} + break; + + case 32: +#line 336 "graphviz_parser.yy" + { yyval.i=0; ;} + break; + + case 33: +#line 340 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[0].ptr); std::pair result = graphviz::lookup(*name); if (result.second) { graphviz::current_vertex = result.first->second; if (! graphviz::current_graph->is_root()) - boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph); + boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph); } else graphviz::current_vertex = graphviz::add_name(*name, *static_cast(YYPARSE_PARAM)) ; graphviz::Vertex* temp = new graphviz::Vertex(graphviz::current_vertex); yyval.ptr = (void *)temp; graphviz::attribute_state = NODE_A; delete name; - ; - break;} -case 33: -#line 346 "graphviz_parser.y" -{ yyval.ptr=yyvsp[0].ptr; ; - break;} -case 34: -#line 350 "graphviz_parser.y" -{ + ;} + break; + + case 34: +#line 354 "graphviz_parser.yy" + { yyval.ptr=yyvsp[0].ptr; ;} + break; + + case 35: +#line 358 "graphviz_parser.yy" + { //consider port as a special properties ?? --need work here std::string* name = static_cast(yyvsp[-2].ptr); std::string* port = static_cast(yyvsp[0].ptr); @@ -1079,37 +1410,38 @@ case 34: graphviz::attribute_state = NODE_A; delete name; delete port; - ; - break;} -case 35: -#line 369 "graphviz_parser.y" -{ + ;} + break; + + case 36: +#line 377 "graphviz_parser.yy" + { typedef std::pair* Ptr; Ptr source = static_cast(yyvsp[-2].ptr); for (std::vector::iterator it=graphviz::vlist.begin(); - it !=graphviz::vlist.end(); ++it) { + it !=graphviz::vlist.end(); ++it) { if ( source->second ) { - if ( (*it)->second ) - graphviz::add_edges(static_cast(source->first), - static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - else - graphviz::add_edges(static_cast(source->first), - *static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); + if ( (*it)->second ) + graphviz::add_edges(static_cast(source->first), + static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + else + graphviz::add_edges(static_cast(source->first), + *static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); } else { - graphviz::Vertex* temp = static_cast(source->first); - if ( (*it)->second ) - graphviz::add_edges(*temp, - static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - else - graphviz::add_edges(*temp, - *static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - delete temp; + graphviz::Vertex* temp = static_cast(source->first); + if ( (*it)->second ) + graphviz::add_edges(*temp, + static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + else + graphviz::add_edges(*temp, + *static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + delete temp; } delete source; @@ -1124,46 +1456,51 @@ case 35: graphviz::attributes.clear(); graphviz::vlist.clear(); - ; - break;} -case 36: -#line 414 "graphviz_parser.y" -{ graphviz::vlist.push_back(static_cast*>(yyvsp[0].ptr)); ; - break;} -case 39: -#line 421 "graphviz_parser.y" -{ + ;} + break; + + case 37: +#line 422 "graphviz_parser.yy" + { graphviz::vlist.push_back(static_cast*>(yyvsp[0].ptr)); ;} + break; + + case 40: +#line 429 "graphviz_parser.yy" + { std::pair* temp = new std::pair; temp->first = yyvsp[0].ptr; temp->second = false; yyval.ptr = (void*)temp; graphviz::attribute_state = EDGE_A; - ; - break;} -case 40: -#line 430 "graphviz_parser.y" -{ + ;} + break; + + case 41: +#line 438 "graphviz_parser.yy" + { std::pair* temp = new std::pair; temp->first = yyvsp[0].ptr; temp->second = true; yyval.ptr = (void*)temp; graphviz::attribute_state = EDGE_A; - ; - break;} -case 41: -#line 441 "graphviz_parser.y" -{ + ;} + break; + + case 42: +#line 449 "graphviz_parser.yy" + { if ( yyvsp[0].i ) graphviz::current_graph = &graphviz::current_graph->parent(); else graphviz::current_graph = graphviz::previous_graph; - ; - break;} -case 42: -#line 448 "graphviz_parser.y" -{ + ;} + break; + + case 43: +#line 456 "graphviz_parser.yy" + { graphviz::previous_graph = graphviz::current_graph; std::string name = graphviz::random_string(); graphviz::Subgraph* temp = graphviz::create_subgraph(name); @@ -1171,17 +1508,19 @@ case 42: graphviz::set_graph_name(name); yyval.ptr = (void *) graphviz::current_graph; - ; - break;} -case 43: -#line 457 "graphviz_parser.y" -{ + ;} + break; + + case 44: +#line 465 "graphviz_parser.yy" + { graphviz::current_graph = &graphviz::current_graph->parent(); - ; - break;} -case 44: -#line 463 "graphviz_parser.y" -{ + ;} + break; + + case 45: +#line 471 "graphviz_parser.yy" + { //lookup ID_T if it is already in the subgraph, //if it is not, add a new subgraph std::string* name = static_cast(yyvsp[0].ptr); @@ -1198,255 +1537,235 @@ case 44: yyval.ptr = (void *) graphviz::current_graph; delete name; - ; - break;} -case 45: -#line 483 "graphviz_parser.y" -{yyval.i = 1; ; - break;} -case 46: -#line 483 "graphviz_parser.y" -{ yyval.i = 0; ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/lib/bison.simple" + ;} + break; + + case 46: +#line 491 "graphviz_parser.yy" + {yyval.i = 1; ;} + break; + + case 47: +#line 491 "graphviz_parser.yy" + { yyval.i = 0; ;} + break; + + + } + +/* Line 999 of yacc.c. */ +#line 1558 "graphviz_digraph_parser.cpp" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG != 0 - if (bgl_dir_debug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++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. */ + /* 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 = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { - ++bgl_dir_nerrs; - -#ifdef YYERROR_VERBOSE + ++yynerrs; +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; - 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"); + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); - 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++; - } - } - bgl_dir_error(msg); - free(msg); - } - else - bgl_dir_error ("parse error; also virtual memory exceeded"); - } + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } else #endif /* YYERROR_VERBOSE */ - bgl_dir_error("parse error"); + yyerror ("syntax 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. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - /* return failure if at end of input */ - if (bgl_dir_char == YYEOF) - YYABORT; + /* Return failure if at end of input. */ + if (yychar == YYEOF) + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } -#if YYDEBUG != 0 - if (bgl_dir_debug) - fprintf(stderr, "Discarding token %d (%s).\n", bgl_dir_char, yytname[bgl_dir_char1]); -#endif + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; - bgl_dir_char = YYEMPTY; } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; - yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -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 (bgl_dir_debug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; + + YY_STACK_PRINT (yyss, yyssp); } -#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 (bgl_dir_debug) - fprintf(stderr, "Shifting error token, "); -#endif + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; - *++yyvsp = bgl_dir_lval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ #endif - } - return 1; + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; } -#line 485 "graphviz_parser.y" + + +#line 493 "graphviz_parser.yy" namespace boost { void read_graphviz(const std::string& filename, GRAPHVIZ_GRAPH& g) { FILE* file = fopen(filename.c_str(), "r"); - bgl_dir_restart(file); + yyrestart(file); void* in = static_cast(file); yyparse(static_cast(&g)); } void read_graphviz(FILE* file, GRAPHVIZ_GRAPH& g) { void* in = static_cast(file); - bgl_dir_restart(file); + yyrestart(file); yyparse(static_cast(&g)); } } + diff --git a/src/graphviz_graph_lex.cpp b/src/graphviz_graph_lex.cpp index ee3f9e55..27fc2b0a 100644 --- a/src/graphviz_graph_lex.cpp +++ b/src/graphviz_graph_lex.cpp @@ -1,57 +1,97 @@ -/* A lexical scanner generated by flex */ +#line 2 "graphviz_graph_lex.cpp" -/* Scanner skeleton version: - * $Header$ - */ +#line 4 "graphviz_graph_lex.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 31 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ #include -#ifdef _MSC_VER -#define YY_NEVER_INTERACTIVE 1 -#else -#include -#endif - - -/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ -#ifdef c_plusplus -#ifndef __cplusplus -#define __cplusplus -#endif -#endif - - -#ifdef __cplusplus - +#include +#include #include -/* Use prototypes in function declarations. */ -#define YY_USE_PROTOS +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ -#define YY_USE_PROTOS #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ - -#ifdef __TURBOC__ - #pragma warn -rch - #pragma warn -use -#include -#include -#define YY_USE_CONST -#define YY_USE_PROTOS -#endif +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -59,13 +99,6 @@ #define yyconst #endif - -#ifdef YY_USE_PROTOS -#define YY_PROTO(proto) proto -#else -#define YY_PROTO(proto) () -#endif - /* Returned upon end-of-file. */ #define YY_NULL 0 @@ -80,218 +113,258 @@ * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ -#define BEGIN yy_start = 1 + 2 * +#define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ -#define YY_START ((yy_start - 1) / 2) +#define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE bgl_undir_restart( bgl_undir_in ) +#define YY_NEW_FILE bgl_undir_restart(bgl_undir_in ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ +#ifndef YY_BUF_SIZE #define YY_BUF_SIZE 16384 +#endif +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif extern int bgl_undir_leng; + extern FILE *bgl_undir_in, *bgl_undir_out; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 -/* The funky do-while in the following #define is used to turn the definition - * int a single C statement (which needs a semi-colon terminator). This - * avoids problems with code like: - * - * if ( condition_holds ) - * yyless( 5 ); - * else - * do_something_else(); - * - * Prior to using the do-while the compiler would get upset at the - * "else" because it interpreted the "if" statement as being all - * done when it reached the ';' after the yyless() call. - */ - -/* Return all but the first 'n' matched characters back to the input stream. */ - + #define YY_LESS_LINENO(n) + +/* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up bgl_undir_text. */ \ - *yy_cp = yy_hold_char; \ - YY_RESTORE_YY_MORE_OFFSET \ - yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up bgl_undir_text again */ \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up bgl_undir_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up bgl_undir_text again */ \ + } \ + while ( 0 ) -#define unput(c) yyunput( c, bgl_undir_text_ptr ) +#define unput(c) yyunput( c, (yytext_ptr) ) /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T typedef unsigned int yy_size_t; +#endif - +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state - { - FILE *yy_input_file; + { + FILE *yy_input_file; - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - yy_size_t yy_buf_size; + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; - int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via bgl_undir_restart()), so that the user can continue scanning by - * just pointing bgl_undir_in at a new input file. - */ + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via bgl_undir_restart()), so that the user can continue scanning by + * just pointing bgl_undir_in at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; -static YY_BUFFER_STATE yy_current_buffer = 0; + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". + * + * Returns the top of the stack, or NULL. */ -#define YY_CURRENT_BUFFER yy_current_buffer +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] /* yy_hold_char holds the character lost when bgl_undir_text is formed. */ static char yy_hold_char; - -static int yy_n_chars; /* number of characters read into yy_ch_buf */ - - +static int yy_n_chars; /* number of characters read into yy_ch_buf */ int bgl_undir_leng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; -static int yy_init = 1; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ +static int yy_init = 1; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches +/* Flag which is used to allow bgl_undir_wrap()'s to do buffer switches * instead of setting up a fresh bgl_undir_in. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void bgl_undir_restart YY_PROTO(( FILE *input_file )); +void bgl_undir_restart (FILE *input_file ); +void bgl_undir__switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE bgl_undir__create_buffer (FILE *file,int size ); +void bgl_undir__delete_buffer (YY_BUFFER_STATE b ); +void bgl_undir__flush_buffer (YY_BUFFER_STATE b ); +void bgl_undir_push_buffer_state (YY_BUFFER_STATE new_buffer ); +void bgl_undir_pop_buffer_state (void ); -void bgl_undir_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); -void bgl_undir_load_buffer_state YY_PROTO(( void )); -YY_BUFFER_STATE bgl_undir_create_buffer YY_PROTO(( FILE *file, int size )); -void bgl_undir_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); -void bgl_undir_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); -void bgl_undir_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); -#define YY_FLUSH_BUFFER bgl_undir_flush_buffer( yy_current_buffer ) +static void bgl_undir_ensure_buffer_stack (void ); +static void bgl_undir__load_buffer_state (void ); +static void bgl_undir__init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE bgl_undir_scan_buffer YY_PROTO(( char *base, yy_size_t size )); -YY_BUFFER_STATE bgl_undir_scan_string YY_PROTO(( yyconst char *yy_str )); -YY_BUFFER_STATE bgl_undir_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); +#define YY_FLUSH_BUFFER bgl_undir__flush_buffer(YY_CURRENT_BUFFER ) -static void *yy_flex_alloc YY_PROTO(( yy_size_t )); -static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); -static void yy_flex_free YY_PROTO(( void * )); +YY_BUFFER_STATE bgl_undir__scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE bgl_undir__scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE bgl_undir__scan_bytes (yyconst char *bytes,int len ); -#define yy_new_buffer bgl_undir_create_buffer +void *bgl_undir_alloc (yy_size_t ); +void *bgl_undir_realloc (void *,yy_size_t ); +void bgl_undir_free (void * ); + +#define yy_new_buffer bgl_undir__create_buffer #define yy_set_interactive(is_interactive) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = bgl_undir_create_buffer( bgl_undir_in, YY_BUF_SIZE ); \ - yy_current_buffer->yy_is_interactive = is_interactive; \ - } + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + bgl_undir_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + bgl_undir__create_buffer(bgl_undir_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } #define yy_set_bol(at_bol) \ - { \ - if ( ! yy_current_buffer ) \ - yy_current_buffer = bgl_undir_create_buffer( bgl_undir_in, YY_BUF_SIZE ); \ - yy_current_buffer->yy_at_bol = at_bol; \ - } + { \ + if ( ! YY_CURRENT_BUFFER ){\ + bgl_undir_ensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + bgl_undir__create_buffer(bgl_undir_in,YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } -#define YY_AT_BOL() (yy_current_buffer->yy_at_bol) +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) +/* Begin user sect3 */ -#define yywrap() 1 +#define bgl_undir_wrap(n) 1 #define YY_SKIP_YYWRAP -typedef unsigned char YY_CHAR; -FILE *bgl_undir_in = (FILE *) 0, *bgl_undir_out = (FILE *) 0; -typedef int yy_state_type; -extern char *bgl_undir_text; -#define bgl_undir_text_ptr bgl_undir_text -static yy_state_type yy_get_previous_state YY_PROTO(( void )); -static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); -static int yy_get_next_buffer YY_PROTO(( void )); -static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); +typedef unsigned char YY_CHAR; + +FILE *bgl_undir_in = (FILE *) 0, *bgl_undir_out = (FILE *) 0; + +typedef int yy_state_type; + +extern int bgl_undir_lineno; + +int bgl_undir_lineno = 1; + +extern char *bgl_undir_text; +#define yytext_ptr bgl_undir_text + +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the * corresponding action - sets up bgl_undir_text. */ #define YY_DO_BEFORE_ACTION \ - bgl_undir_text_ptr = yy_bp; \ - bgl_undir_leng = (int) (yy_cp - yy_bp); \ - yy_hold_char = *yy_cp; \ - *yy_cp = '\0'; \ - yy_c_buf_p = yy_cp; + (yytext_ptr) = yy_bp; \ + bgl_undir_leng = (size_t) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; #define YY_NUM_RULES 21 #define YY_END_OF_BUFFER 22 -static yyconst short int yy_accept[81] = +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[81] = { 0, 0, 0, 3, 3, 17, 17, 22, 20, 18, 19, 14, 20, 20, 20, 20, 20, 13, 13, 13, 13, @@ -303,7 +376,7 @@ static yyconst short int yy_accept[81] = 7, 13, 13, 13, 10, 13, 6, 13, 11, 0 } ; -static yyconst int yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -335,14 +408,14 @@ static yyconst int yy_ec[256] = 1, 1, 1, 1, 1 } ; -static yyconst int yy_meta[31] = +static yyconst flex_int32_t yy_meta[31] = { 0, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 4, 1, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 } ; -static yyconst short int yy_base[90] = +static yyconst flex_int16_t yy_base[90] = { 0, 0, 0, 28, 29, 29, 32, 168, 169, 169, 169, 169, 164, 28, 34, 155, 42, 40, 154, 27, 42, @@ -355,7 +428,7 @@ static yyconst short int yy_base[90] = 129, 133, 137, 110, 141, 145, 149, 153, 54 } ; -static yyconst short int yy_def[90] = +static yyconst flex_int16_t yy_def[90] = { 0, 80, 1, 81, 81, 82, 82, 80, 80, 80, 80, 80, 83, 80, 80, 80, 80, 80, 84, 84, 84, @@ -368,7 +441,7 @@ static yyconst short int yy_def[90] = 80, 80, 80, 80, 80, 80, 80, 80, 80 } ; -static yyconst short int yy_nxt[200] = +static yyconst flex_int16_t yy_nxt[200] = { 0, 8, 9, 10, 11, 12, 8, 13, 14, 15, 16, 17, 8, 18, 18, 8, 18, 18, 18, 19, 20, @@ -394,7 +467,7 @@ static yyconst short int yy_nxt[200] = } ; -static yyconst short int yy_chk[200] = +static yyconst flex_int16_t yy_chk[200] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -423,6 +496,9 @@ static yyconst short int yy_chk[200] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; +extern int bgl_undir__flex_debug; +int bgl_undir__flex_debug = 0; + /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ @@ -431,9 +507,8 @@ static char *yy_last_accepting_cpos; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *bgl_undir_text; -#line 1 "graphviz_lex.l" -#define INITIAL 0 -#line 2 "graphviz_lex.l" +#line 1 "graphviz_lex.ll" +#line 2 "graphviz_lex.ll" //======================================================================= // Copyright 2001 University of Notre Dame. // Author: Lie-Quan Lee @@ -459,7 +534,29 @@ char *bgl_undir_text; // OR OTHER RIGHTS. //======================================================================= -#include "graphviz_parser.h" + +// Include this first, since it declares YYSTYPE which will +// be defined in "*parser.h" if not previosly declared here. + + +#include "yystype.h" +#define YY_DECL int bgl_undir_lex(YYSTYPE* lvalp) + +// When GRAPHVIZ_DIRECTED is declared it means Boost.Build is used. +// Headers for directed and undirected graphs are both generated, and +// have different names. +#ifdef GRAPHVIZ_DIRECTED + #if GRAPHVIZ_DIRECTED == 0 + #define yyerror bgl_undir_error + #include "graphviz_graph_parser.hpp" + #else + #define yyerror bgl_dir_error + #include "graphviz_digraph_parser.hpp" + #endif +#else + #error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 +#endif + #include #include @@ -469,13 +566,25 @@ static void begin_literal(); static void add_string(const char* str); static void end_literal(); -#include "yystype.h" -#define YY_DECL int bgl_undir_lex(YYSTYPE* lvalp) -#define Comment 1 + +#line 572 "graphviz_graph_lex.cpp" + +#define INITIAL 0 +#define Comment 1 #define Literal 2 -#line 475 "lex.yy.c" +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif /* Macros after this point can all be overridden by user definitions in * section 1. @@ -483,65 +592,30 @@ static void end_literal(); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap YY_PROTO(( void )); +extern "C" int bgl_undir_wrap (void ); #else -extern int yywrap YY_PROTO(( void )); +extern int bgl_undir_wrap (void ); #endif #endif -#ifndef YY_NO_UNPUT -static void yyunput YY_PROTO(( int c, char *buf_ptr )); -#endif - -#ifndef bgl_undir_text_ptr -static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); + static void yyunput (int c,char *buf_ptr ); + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen YY_PROTO(( yyconst char * )); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int bgl_undir_input YY_PROTO(( void )); +static int yyinput (void ); #else -static int input YY_PROTO(( void )); -#endif +static int input (void ); #endif -#if YY_STACK_USED -static int yy_start_stack_ptr = 0; -static int yy_start_stack_depth = 0; -static int *yy_start_stack = 0; -#ifndef YY_NO_PUSH_STATE -static void yy_push_state YY_PROTO(( int new_state )); -#endif -#ifndef YY_NO_POP_STATE -static void yy_pop_state YY_PROTO(( void )); -#endif -#ifndef YY_NO_TOP_STATE -static int yy_top_state YY_PROTO(( void )); -#endif - -#else -#define YY_NO_PUSH_STATE 1 -#define YY_NO_POP_STATE 1 -#define YY_NO_TOP_STATE 1 -#endif - -#ifdef YY_MALLOC_DECL -YY_MALLOC_DECL -#else -#if __STDC__ -#ifndef __cplusplus -#include -#endif -#else -/* Just try to get by without declaring the routines. This will fail - * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) - * or sizeof(void*) != sizeof(int). - */ -#endif #endif /* Amount of stuff to slurp up with each read. */ @@ -550,7 +624,6 @@ YY_MALLOC_DECL #endif /* Copy whatever the last rule matched to the standard output. */ - #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). @@ -563,21 +636,35 @@ YY_MALLOC_DECL */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ - if ( yy_current_buffer->yy_is_interactive ) \ - { \ - int c = '*', n; \ - for ( n = 0; n < max_size && \ - (c = getc( bgl_undir_in )) != EOF && c != '\n'; ++n ) \ - buf[n] = (char) c; \ - if ( c == '\n' ) \ - buf[n++] = (char) c; \ - if ( c == EOF && ferror( bgl_undir_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - result = n; \ - } \ - else if ( ((result = fread( buf, 1, max_size, bgl_undir_in )) == 0) \ - && ferror( bgl_undir_in ) ) \ - YY_FATAL_ERROR( "input in flex scanner failed" ); + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( bgl_undir_in )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( bgl_undir_in ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, bgl_undir_in))==0 && ferror(bgl_undir_in)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(bgl_undir_in); \ + } \ + }\ +\ + #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - @@ -598,12 +685,18 @@ YY_MALLOC_DECL #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif +/* end tables serialization structures and prototypes */ + /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL -#define YY_DECL int bgl_undir_lex YY_PROTO(( void )) -#endif +#define YY_DECL_IS_OURS 1 + +extern int bgl_undir_lex (void); + +#define YY_DECL int bgl_undir_lex (void) +#endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after bgl_undir_text and bgl_undir_leng * have been set up. @@ -618,1095 +711,1186 @@ YY_MALLOC_DECL #endif #define YY_RULE_SETUP \ - YY_USER_ACTION + YY_USER_ACTION +/** The main scanner function which does all the work. + */ YY_DECL - { - register yy_state_type yy_current_state; - register char *yy_cp = NULL, *yy_bp = NULL; - register int yy_act; - -#line 51 "graphviz_lex.l" +{ + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + +#line 71 "graphviz_lex.ll" -#line 629 "lex.yy.c" +#line 728 "graphviz_graph_lex.cpp" - if ( yy_init ) - { - yy_init = 0; + if ( (yy_init) ) + { + (yy_init) = 0; #ifdef YY_USER_INIT - YY_USER_INIT; + YY_USER_INIT; #endif - if ( ! yy_start ) - yy_start = 1; /* first start state */ + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ - if ( ! bgl_undir_in ) - bgl_undir_in = stdin; + if ( ! bgl_undir_in ) + bgl_undir_in = stdin; - if ( ! bgl_undir_out ) - bgl_undir_out = stdout; + if ( ! bgl_undir_out ) + bgl_undir_out = stdout; - if ( ! yy_current_buffer ) - yy_current_buffer = - bgl_undir_create_buffer( bgl_undir_in, YY_BUF_SIZE ); + if ( ! YY_CURRENT_BUFFER ) { + bgl_undir_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + bgl_undir__create_buffer(bgl_undir_in,YY_BUF_SIZE ); + } - bgl_undir_load_buffer_state(); - } + bgl_undir__load_buffer_state( ); + } - while ( 1 ) /* loops until end-of-file is reached */ - { - yy_cp = yy_c_buf_p; + while ( 1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); - /* Support of bgl_undir_text. */ - *yy_cp = yy_hold_char; + /* Support of bgl_undir_text. */ + *yy_cp = (yy_hold_char); - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; - yy_current_state = yy_start; + yy_current_state = (yy_start); yy_match: - do - { - register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - ++yy_cp; - } - while ( yy_base[yy_current_state] != 169 ); + do + { + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + ++yy_cp; + } + while ( yy_base[yy_current_state] != 169 ); yy_find_action: - yy_act = yy_accept[yy_current_state]; - if ( yy_act == 0 ) - { /* have to back up */ - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - yy_act = yy_accept[yy_current_state]; - } + yy_act = yy_accept[yy_current_state]; + if ( yy_act == 0 ) + { /* have to back up */ + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + yy_act = yy_accept[yy_current_state]; + } - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; +do_action: /* This label is used only to access EOF actions. */ -do_action: /* This label is used only to access EOF actions. */ - - - switch ( yy_act ) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = yy_hold_char; - yy_cp = yy_last_accepting_cpos; - yy_current_state = yy_last_accepting_state; - goto yy_find_action; + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; case 1: YY_RULE_SETUP -#line 53 "graphviz_lex.l" +#line 73 "graphviz_lex.ll" { BEGIN Comment; } - YY_BREAK + YY_BREAK case 2: YY_RULE_SETUP -#line 54 "graphviz_lex.l" +#line 74 "graphviz_lex.ll" { BEGIN INITIAL; } - YY_BREAK + YY_BREAK case 3: YY_RULE_SETUP -#line 55 "graphviz_lex.l" +#line 75 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 4: -*yy_cp = yy_hold_char; /* undo effects of setting up bgl_undir_text */ -yy_c_buf_p = yy_cp -= 1; +*yy_cp = (yy_hold_char); /* undo effects of setting up bgl_undir_text */ +(yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up bgl_undir_text again */ YY_RULE_SETUP -#line 56 "graphviz_lex.l" +#line 76 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 5: -*yy_cp = yy_hold_char; /* undo effects of setting up bgl_undir_text */ -yy_c_buf_p = yy_cp -= 1; +*yy_cp = (yy_hold_char); /* undo effects of setting up bgl_undir_text */ +(yy_c_buf_p) = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up bgl_undir_text again */ YY_RULE_SETUP -#line 57 "graphviz_lex.l" +#line 77 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 6: YY_RULE_SETUP -#line 58 "graphviz_lex.l" +#line 78 "graphviz_lex.ll" { return DIGRAPH_T; } - YY_BREAK + YY_BREAK case 7: YY_RULE_SETUP -#line 59 "graphviz_lex.l" +#line 79 "graphviz_lex.ll" { return GRAPH_T; } - YY_BREAK + YY_BREAK case 8: YY_RULE_SETUP -#line 60 "graphviz_lex.l" +#line 80 "graphviz_lex.ll" { return NODE_T; } - YY_BREAK + YY_BREAK case 9: YY_RULE_SETUP -#line 61 "graphviz_lex.l" +#line 81 "graphviz_lex.ll" { return EDGE_T; } - YY_BREAK + YY_BREAK case 10: YY_RULE_SETUP -#line 62 "graphviz_lex.l" +#line 82 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 11: YY_RULE_SETUP -#line 63 "graphviz_lex.l" +#line 83 "graphviz_lex.ll" { return SUBGRAPH_T; } - YY_BREAK + YY_BREAK case 12: YY_RULE_SETUP -#line 64 "graphviz_lex.l" +#line 84 "graphviz_lex.ll" { return EDGEOP_T; } - YY_BREAK + YY_BREAK case 13: YY_RULE_SETUP -#line 65 "graphviz_lex.l" +#line 85 "graphviz_lex.ll" { lvalp->ptr = (void*)(new std::string(bgl_undir_text)); return ID_T; } - YY_BREAK + YY_BREAK case 14: YY_RULE_SETUP -#line 66 "graphviz_lex.l" +#line 86 "graphviz_lex.ll" { BEGIN Literal; begin_literal(); } - YY_BREAK + YY_BREAK case 15: YY_RULE_SETUP -#line 67 "graphviz_lex.l" +#line 87 "graphviz_lex.ll" { BEGIN INITIAL; end_literal(); lvalp->ptr = (void*)(new std::string(literal)); return ID_T; } - YY_BREAK + YY_BREAK case 16: +/* rule 16 can match eol */ YY_RULE_SETUP -#line 68 "graphviz_lex.l" +#line 88 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 17: +/* rule 17 can match eol */ YY_RULE_SETUP -#line 69 "graphviz_lex.l" +#line 89 "graphviz_lex.ll" { add_string(bgl_undir_text); } - YY_BREAK + YY_BREAK case 18: YY_RULE_SETUP -#line 70 "graphviz_lex.l" +#line 90 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 19: +/* rule 19 can match eol */ YY_RULE_SETUP -#line 71 "graphviz_lex.l" +#line 91 "graphviz_lex.ll" ; - YY_BREAK + YY_BREAK case 20: YY_RULE_SETUP -#line 72 "graphviz_lex.l" +#line 92 "graphviz_lex.ll" { return bgl_undir_text[0]; } - YY_BREAK + YY_BREAK case 21: YY_RULE_SETUP -#line 73 "graphviz_lex.l" +#line 93 "graphviz_lex.ll" ECHO; - YY_BREAK -#line 823 "lex.yy.c" + YY_BREAK +#line 925 "graphviz_graph_lex.cpp" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(Comment): case YY_STATE_EOF(Literal): - yyterminate(); + yyterminate(); - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - bgl_undir_text_ptr) - 1; + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed bgl_undir_in at a new source and called - * bgl_undir_lex(). If so, then we have to assure - * consistency between yy_current_buffer and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yy_n_chars = yy_current_buffer->yy_n_chars; - yy_current_buffer->yy_input_file = bgl_undir_in; - yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; - } + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed bgl_undir_in at a new source and called + * bgl_undir_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = bgl_undir_in; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; - yy_c_buf_p = bgl_undir_text_ptr + yy_amount_of_matched_text; + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ - yy_next_state = yy_try_NUL_trans( yy_current_state ); + yy_next_state = yy_try_NUL_trans( yy_current_state ); - yy_bp = bgl_undir_text_ptr + YY_MORE_ADJ; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } - else - { - yy_cp = yy_c_buf_p; - goto yy_find_action; - } - } + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } - else switch ( yy_get_next_buffer() ) - { - case EOB_ACT_END_OF_FILE: - { - yy_did_buffer_switch_on_eof = 0; + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap() ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * bgl_undir_text, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yy_c_buf_p = bgl_undir_text_ptr + YY_MORE_ADJ; + if ( bgl_undir_wrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * bgl_undir_text, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } - else - { - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; - } - break; - } + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = - bgl_undir_text_ptr + yy_amount_of_matched_text; + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = bgl_undir_text_ptr + YY_MORE_ADJ; - goto yy_match; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; - case EOB_ACT_LAST_MATCH: - yy_c_buf_p = - &yy_current_buffer->yy_ch_buf[yy_n_chars]; + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_current_state = yy_get_previous_state(); + yy_current_state = yy_get_previous_state( ); - yy_cp = yy_c_buf_p; - yy_bp = bgl_undir_text_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of bgl_undir_lex */ + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of bgl_undir_lex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file */ +static int yy_get_next_buffer (void) +{ + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; + int ret_val; -static int yy_get_next_buffer() - { - register char *dest = yy_current_buffer->yy_ch_buf; - register char *source = bgl_undir_text_ptr; - register int number_to_move, i; - int ret_val; + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); - if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } - if ( yy_current_buffer->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( yy_c_buf_p - bgl_undir_text_ptr - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } + /* Try to read more data. */ - /* Try to read more data. */ + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; - /* First move last chars to start of buffer. */ - number_to_move = (int) (yy_c_buf_p - bgl_undir_text_ptr) - 1; + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - yy_current_buffer->yy_n_chars = yy_n_chars = 0; + else + { + size_t num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - else - { - int num_to_read = - yy_current_buffer->yy_buf_size - number_to_move - 1; + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ -#ifdef YY_USES_REJECT - YY_FATAL_ERROR( -"input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); -#else + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = yy_current_buffer; + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); - int yy_c_buf_p_offset = - (int) (yy_c_buf_p - b->yy_ch_buf); + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + bgl_undir_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = 0; - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yy_flex_realloc( (void *) b->yy_ch_buf, - b->yy_buf_size + 2 ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; - num_to_read = yy_current_buffer->yy_buf_size - - number_to_move - 1; -#endif - } + } - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; - /* Read in more data. */ - YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), - yy_n_chars, num_to_read ); + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); - yy_current_buffer->yy_n_chars = yy_n_chars; - } + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } - if ( yy_n_chars == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - bgl_undir_restart( bgl_undir_in ); - } + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + bgl_undir_restart(bgl_undir_in ); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - yy_current_buffer->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } - else - ret_val = EOB_ACT_CONTINUE_SCAN; + else + ret_val = EOB_ACT_CONTINUE_SCAN; - yy_n_chars += number_to_move; - yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; - yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - bgl_undir_text_ptr = &yy_current_buffer->yy_ch_buf[0]; - - return ret_val; - } + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + return ret_val; +} /* yy_get_previous_state - get the state just before the EOB char was reached */ -static yy_state_type yy_get_previous_state() - { - register yy_state_type yy_current_state; - register char *yy_cp; + static yy_state_type yy_get_previous_state (void) +{ + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = yy_start; - - for ( yy_cp = bgl_undir_text_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) - { - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } - - return yy_current_state; - } + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + } + return yy_current_state; +} /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis - * next_state = yy_try_NUL_trans( current_state ); + * next_state = yy_try_NUL_trans( current_state ); */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); -#ifdef YY_USE_PROTOS -static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) -#else -static yy_state_type yy_try_NUL_trans( yy_current_state ) -yy_state_type yy_current_state; -#endif - { - register int yy_is_jam; - register char *yy_cp = yy_c_buf_p; + register YY_CHAR yy_c = 1; + if ( yy_accept[yy_current_state] ) + { + (yy_last_accepting_state) = yy_current_state; + (yy_last_accepting_cpos) = yy_cp; + } + while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 81 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 80); - register YY_CHAR yy_c = 1; - if ( yy_accept[yy_current_state] ) - { - yy_last_accepting_state = yy_current_state; - yy_last_accepting_cpos = yy_cp; - } - while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) - { - yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 81 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 80); + return yy_is_jam ? 0 : yy_current_state; +} - return yy_is_jam ? 0 : yy_current_state; - } + static void yyunput (int c, register char * yy_bp ) +{ + register char *yy_cp; + + yy_cp = (yy_c_buf_p); + /* undo effects of setting up bgl_undir_text */ + *yy_cp = (yy_hold_char); -#ifndef YY_NO_UNPUT -#ifdef YY_USE_PROTOS -static void yyunput( int c, register char *yy_bp ) -#else -static void yyunput( c, yy_bp ) -int c; -register char *yy_bp; -#endif - { - register char *yy_cp = yy_c_buf_p; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + register int number_to_move = (yy_n_chars) + 2; + register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + register char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - /* undo effects of setting up bgl_undir_text */ - *yy_cp = yy_hold_char; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - register int number_to_move = yy_n_chars + 2; - register char *dest = &yy_current_buffer->yy_ch_buf[ - yy_current_buffer->yy_buf_size + 2]; - register char *source = - &yy_current_buffer->yy_ch_buf[number_to_move]; + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - while ( source > yy_current_buffer->yy_ch_buf ) - *--dest = *--source; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - yy_current_buffer->yy_n_chars = - yy_n_chars = yy_current_buffer->yy_buf_size; - - if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - - bgl_undir_text_ptr = yy_bp; - yy_hold_char = *yy_cp; - yy_c_buf_p = yy_cp; - } -#endif /* ifndef YY_NO_UNPUT */ + *--yy_cp = (char) c; + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} +#ifndef YY_NO_INPUT #ifdef __cplusplus -static int bgl_undir_input() + static int yyinput (void) #else -static int input() + static int input (void) #endif - { - int c; - *yy_c_buf_p = yy_hold_char; +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); - if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) - /* This was really a NUL. */ - *yy_c_buf_p = '\0'; + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; - else - { /* need more input */ - int offset = yy_c_buf_p - bgl_undir_text_ptr; - ++yy_c_buf_p; + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - switch ( yy_get_next_buffer() ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ - /* Reset buffer status. */ - bgl_undir_restart( bgl_undir_in ); + /* Reset buffer status. */ + bgl_undir_restart(bgl_undir_in ); - /* fall through */ + /*FALLTHROUGH*/ - case EOB_ACT_END_OF_FILE: - { - if ( yywrap() ) - return EOF; + case EOB_ACT_END_OF_FILE: + { + if ( bgl_undir_wrap( ) ) + return EOF; - if ( ! yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; #ifdef __cplusplus - return bgl_undir_input(); + return yyinput(); #else - return input(); + return input(); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - yy_c_buf_p = bgl_undir_text_ptr + offset; - break; - } - } - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } - c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ - *yy_c_buf_p = '\0'; /* preserve bgl_undir_text */ - yy_hold_char = *++yy_c_buf_p; + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve bgl_undir_text */ + (yy_hold_char) = *++(yy_c_buf_p); + return c; +} +#endif /* ifndef YY_NO_INPUT */ - return c; - } +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void bgl_undir_restart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + bgl_undir_ensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + bgl_undir__create_buffer(bgl_undir_in,YY_BUF_SIZE ); + } + bgl_undir__init_buffer(YY_CURRENT_BUFFER,input_file ); + bgl_undir__load_buffer_state( ); +} -#ifdef YY_USE_PROTOS -void bgl_undir_restart( FILE *input_file ) -#else -void bgl_undir_restart( input_file ) -FILE *input_file; -#endif - { - if ( ! yy_current_buffer ) - yy_current_buffer = bgl_undir_create_buffer( bgl_undir_in, YY_BUF_SIZE ); +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void bgl_undir__switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * bgl_undir_pop_buffer_state(); + * bgl_undir_push_buffer_state(new_buffer); + */ + bgl_undir_ensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; - bgl_undir_init_buffer( yy_current_buffer, input_file ); - bgl_undir_load_buffer_state(); - } + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + YY_CURRENT_BUFFER_LVALUE = new_buffer; + bgl_undir__load_buffer_state( ); -#ifdef YY_USE_PROTOS -void bgl_undir_switch_to_buffer( YY_BUFFER_STATE new_buffer ) -#else -void bgl_undir_switch_to_buffer( new_buffer ) -YY_BUFFER_STATE new_buffer; -#endif - { - if ( yy_current_buffer == new_buffer ) - return; + /* We don't actually know whether we did this switch during + * EOF (bgl_undir_wrap()) processing, but the only time this flag + * is looked at is after bgl_undir_wrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} - if ( yy_current_buffer ) - { - /* Flush out information for old buffer. */ - *yy_c_buf_p = yy_hold_char; - yy_current_buffer->yy_buf_pos = yy_c_buf_p; - yy_current_buffer->yy_n_chars = yy_n_chars; - } +static void bgl_undir__load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + bgl_undir_in = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} - yy_current_buffer = new_buffer; - bgl_undir_load_buffer_state(); +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE bgl_undir__create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) bgl_undir_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_undir__create_buffer()" ); - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - yy_did_buffer_switch_on_eof = 1; - } + b->yy_buf_size = size; + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) bgl_undir_alloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_undir__create_buffer()" ); -#ifdef YY_USE_PROTOS -void bgl_undir_load_buffer_state( void ) -#else -void bgl_undir_load_buffer_state() -#endif - { - yy_n_chars = yy_current_buffer->yy_n_chars; - bgl_undir_text_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; - bgl_undir_in = yy_current_buffer->yy_input_file; - yy_hold_char = *yy_c_buf_p; - } + b->yy_is_our_buffer = 1; + bgl_undir__init_buffer(b,file ); -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_undir_create_buffer( FILE *file, int size ) -#else -YY_BUFFER_STATE bgl_undir_create_buffer( file, size ) -FILE *file; -int size; -#endif - { - YY_BUFFER_STATE b; + return b; +} - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_undir_create_buffer()" ); +/** Destroy the buffer. + * @param b a buffer created with bgl_undir__create_buffer() + * + */ + void bgl_undir__delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; - b->yy_buf_size = size; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_undir_create_buffer()" ); + if ( b->yy_is_our_buffer ) + bgl_undir_free((void *) b->yy_ch_buf ); - b->yy_is_our_buffer = 1; + bgl_undir_free((void *) b ); +} - bgl_undir_init_buffer( b, file ); +#ifndef __cplusplus +extern int isatty (int ); +#endif /* __cplusplus */ + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a bgl_undir_restart() or at EOF. + */ + static void bgl_undir__init_buffer (YY_BUFFER_STATE b, FILE * file ) - return b; - } +{ + int oerrno = errno; + + bgl_undir__flush_buffer(b ); + b->yy_input_file = file; + b->yy_fill_buffer = 1; -#ifdef YY_USE_PROTOS -void bgl_undir_delete_buffer( YY_BUFFER_STATE b ) -#else -void bgl_undir_delete_buffer( b ) -YY_BUFFER_STATE b; -#endif - { - if ( ! b ) - return; + /* If b is the current buffer, then bgl_undir__init_buffer was _probably_ + * called from bgl_undir_restart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } - if ( b == yy_current_buffer ) - yy_current_buffer = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yy_flex_free( (void *) b->yy_ch_buf ); - - yy_flex_free( (void *) b ); - } - - - -#ifdef YY_USE_PROTOS -void bgl_undir_init_buffer( YY_BUFFER_STATE b, FILE *file ) -#else -void bgl_undir_init_buffer( b, file ) -YY_BUFFER_STATE b; -FILE *file; -#endif - - - { - bgl_undir_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - -#if YY_ALWAYS_INTERACTIVE - b->yy_is_interactive = 1; -#else -#if YY_NEVER_INTERACTIVE - b->yy_is_interactive = 0; -#else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; -#endif -#endif - } + + errno = oerrno; +} +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void bgl_undir__flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; -#ifdef YY_USE_PROTOS -void bgl_undir_flush_buffer( YY_BUFFER_STATE b ) -#else -void bgl_undir_flush_buffer( b ) -YY_BUFFER_STATE b; -#endif + b->yy_n_chars = 0; - { - if ( ! b ) - return; + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - b->yy_n_chars = 0; + b->yy_buf_pos = &b->yy_ch_buf[0]; - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + bgl_undir__load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void bgl_undir_push_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + bgl_undir_ensure_buffer_stack(); + + /* This block is copied from bgl_undir__switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from bgl_undir__switch_to_buffer. */ + bgl_undir__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void bgl_undir_pop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + bgl_undir__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + bgl_undir__load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void bgl_undir_ensure_buffer_stack (void) +{ + int num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state**)bgl_undir_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } - b->yy_buf_pos = &b->yy_ch_buf[0]; + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; - if ( b == yy_current_buffer ) - bgl_undir_load_buffer_state(); - } + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)bgl_undir_realloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} -#ifndef YY_NO_SCAN_BUFFER -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_undir_scan_buffer( char *base, yy_size_t size ) -#else -YY_BUFFER_STATE bgl_undir_scan_buffer( base, size ) -char *base; -yy_size_t size; -#endif - { - YY_BUFFER_STATE b; +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE bgl_undir__scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return 0; + b = (YY_BUFFER_STATE) bgl_undir_alloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_undir__scan_buffer()" ); - b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_undir_scan_buffer()" ); + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + bgl_undir__switch_to_buffer(b ); - bgl_undir_switch_to_buffer( b ); + return b; +} - return b; - } -#endif +/** Setup the input buffer state to scan a string. The next call to bgl_undir_lex() will + * scan from a @e copy of @a str. + * @param str a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * bgl_undir__scan_bytes() instead. + */ +YY_BUFFER_STATE bgl_undir__scan_string (yyconst char * yy_str ) +{ + + return bgl_undir__scan_bytes(yy_str,strlen(yy_str) ); +} +/** Setup the input buffer state to scan the given bytes. The next call to bgl_undir_lex() will + * scan from a @e copy of @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE bgl_undir__scan_bytes (yyconst char * bytes, int len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = len + 2; + buf = (char *) bgl_undir_alloc(n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in bgl_undir__scan_bytes()" ); -#ifndef YY_NO_SCAN_STRING -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_undir_scan_string( yyconst char *yy_str ) -#else -YY_BUFFER_STATE bgl_undir_scan_string( yy_str ) -yyconst char *yy_str; -#endif - { - int len; - for ( len = 0; yy_str[len]; ++len ) - ; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - return bgl_undir_scan_bytes( yy_str, len ); - } -#endif + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + b = bgl_undir__scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in bgl_undir__scan_bytes()" ); -#ifndef YY_NO_SCAN_BYTES -#ifdef YY_USE_PROTOS -YY_BUFFER_STATE bgl_undir_scan_bytes( yyconst char *bytes, int len ) -#else -YY_BUFFER_STATE bgl_undir_scan_bytes( bytes, len ) -yyconst char *bytes; -int len; -#endif - { - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - /* Get memory for full buffer, including space for trailing EOB's. */ - n = len + 2; - buf = (char *) yy_flex_alloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in bgl_undir_scan_bytes()" ); - - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; - - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; - - b = bgl_undir_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in bgl_undir_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; - } -#endif - - -#ifndef YY_NO_PUSH_STATE -#ifdef YY_USE_PROTOS -static void yy_push_state( int new_state ) -#else -static void yy_push_state( new_state ) -int new_state; -#endif - { - if ( yy_start_stack_ptr >= yy_start_stack_depth ) - { - yy_size_t new_size; - - yy_start_stack_depth += YY_START_STACK_INCR; - new_size = yy_start_stack_depth * sizeof( int ); - - if ( ! yy_start_stack ) - yy_start_stack = (int *) yy_flex_alloc( new_size ); - - else - yy_start_stack = (int *) yy_flex_realloc( - (void *) yy_start_stack, new_size ); - - if ( ! yy_start_stack ) - YY_FATAL_ERROR( - "out of memory expanding start-condition stack" ); - } - - yy_start_stack[yy_start_stack_ptr++] = YY_START; - - BEGIN(new_state); - } -#endif - - -#ifndef YY_NO_POP_STATE -static void yy_pop_state() - { - if ( --yy_start_stack_ptr < 0 ) - YY_FATAL_ERROR( "start-condition stack underflow" ); - - BEGIN(yy_start_stack[yy_start_stack_ptr]); - } -#endif - - -#ifndef YY_NO_TOP_STATE -static int yy_top_state() - { - return yy_start_stack[yy_start_stack_ptr - 1]; - } -#endif + return b; +} #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -#ifdef YY_USE_PROTOS -static void yy_fatal_error( yyconst char msg[] ) -#else -static void yy_fatal_error( msg ) -char msg[]; -#endif - { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); - } - - +static void yy_fatal_error (yyconst char* msg ) +{ + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ - do \ - { \ - /* Undo effects of setting up bgl_undir_text. */ \ - bgl_undir_text[bgl_undir_leng] = yy_hold_char; \ - yy_c_buf_p = bgl_undir_text + n; \ - yy_hold_char = *yy_c_buf_p; \ - *yy_c_buf_p = '\0'; \ - bgl_undir_leng = n; \ - } \ - while ( 0 ) + do \ + { \ + /* Undo effects of setting up bgl_undir_text. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + bgl_undir_text[bgl_undir_leng] = (yy_hold_char); \ + (yy_c_buf_p) = bgl_undir_text + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + bgl_undir_leng = yyless_macro_arg; \ + } \ + while ( 0 ) +/* Accessor methods (get/set functions) to struct members. */ -/* Internal utility routines. */ +/** Get the current line number. + * + */ +int bgl_undir_get_lineno (void) +{ + + return bgl_undir_lineno; +} -#ifndef bgl_undir_text_ptr -#ifdef YY_USE_PROTOS -static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) -#else -static void yy_flex_strncpy( s1, s2, n ) -char *s1; -yyconst char *s2; -int n; -#endif - { - register int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; - } +/** Get the input stream. + * + */ +FILE *bgl_undir_get_in (void) +{ + return bgl_undir_in; +} + +/** Get the output stream. + * + */ +FILE *bgl_undir_get_out (void) +{ + return bgl_undir_out; +} + +/** Get the length of the current token. + * + */ +int bgl_undir_get_leng (void) +{ + return bgl_undir_leng; +} + +/** Get the current token. + * + */ + +char *bgl_undir_get_text (void) +{ + return bgl_undir_text; +} + +/** Set the current line number. + * @param line_number + * + */ +void bgl_undir_set_lineno (int line_number ) +{ + + bgl_undir_lineno = line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param in_str A readable stream. + * + * @see bgl_undir__switch_to_buffer + */ +void bgl_undir_set_in (FILE * in_str ) +{ + bgl_undir_in = in_str ; +} + +void bgl_undir_set_out (FILE * out_str ) +{ + bgl_undir_out = out_str ; +} + +int bgl_undir_get_debug (void) +{ + return bgl_undir__flex_debug; +} + +void bgl_undir_set_debug (int bdebug ) +{ + bgl_undir__flex_debug = bdebug ; +} + +/* bgl_undir_lex_destroy is for both reentrant and non-reentrant scanners. */ +int bgl_undir_lex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + bgl_undir__delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + bgl_undir_pop_buffer_state(); + } + + /* Destroy the stack itself. */ + bgl_undir_free((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +{ + register int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} #endif #ifdef YY_NEED_STRLEN -#ifdef YY_USE_PROTOS -static int yy_flex_strlen( yyconst char *s ) -#else -static int yy_flex_strlen( s ) -yyconst char *s; -#endif - { - register int n; - for ( n = 0; s[n]; ++n ) - ; +static int yy_flex_strlen (yyconst char * s ) +{ + register int n; + for ( n = 0; s[n]; ++n ) + ; - return n; - } + return n; +} #endif +void *bgl_undir_alloc (yy_size_t size ) +{ + return (void *) malloc( size ); +} -#ifdef YY_USE_PROTOS -static void *yy_flex_alloc( yy_size_t size ) -#else -static void *yy_flex_alloc( size ) -yy_size_t size; -#endif - { - return (void *) malloc( size ); - } +void *bgl_undir_realloc (void * ptr, yy_size_t size ) +{ + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} -#ifdef YY_USE_PROTOS -static void *yy_flex_realloc( void *ptr, yy_size_t size ) -#else -static void *yy_flex_realloc( ptr, size ) -void *ptr; -yy_size_t size; -#endif - { - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return (void *) realloc( (char *) ptr, size ); - } +void bgl_undir_free (void * ptr ) +{ + free( (char *) ptr ); /* see bgl_undir_realloc() for (char *) cast */ +} -#ifdef YY_USE_PROTOS -static void yy_flex_free( void *ptr ) -#else -static void yy_flex_free( ptr ) -void *ptr; -#endif - { - free( ptr ); - } +#define YYTABLES_NAME "yytables" -#if YY_MAIN -int main() - { - bgl_undir_lex(); - return 0; - } +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL #endif -#line 73 "graphviz_lex.l" +#line 93 "graphviz_lex.ll" + @@ -1721,7 +1905,8 @@ void add_string(const char* str) { void end_literal() { } -void bgl_undir_error(char *str) +void yyerror(char *str) { std::cout << str << std::endl; } + diff --git a/src/graphviz_graph_parser.cpp b/src/graphviz_graph_parser.cpp index bda3a1a7..1c57b427 100644 --- a/src/graphviz_graph_parser.cpp +++ b/src/graphviz_graph_parser.cpp @@ -1,25 +1,89 @@ +/* A Bison parser, made by GNU Bison 1.875a. */ -/* A Bison parser, made from graphviz_parser.y - by GNU Bison version 1.28 */ +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -#define YYBISON 1 /* Identify Bison output. */ + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2, or (at your option) + any later version. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ + +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Using locations. */ +#define YYLSP_NEEDED 0 + +/* If NAME_PREFIX is specified substitute the variables and functions + names. */ #define yyparse bgl_undir_parse -#define bgl_undir_lex bgl_undir_lex -#define bgl_undir_error bgl_undir_error -#define bgl_undir_lval bgl_undir_lval -#define bgl_undir_char bgl_undir_char -#define bgl_undir_debug bgl_undir_debug -#define bgl_undir_nerrs bgl_undir_nerrs -#define GRAPH_T 257 -#define NODE_T 258 -#define EDGE_T 259 -#define DIGRAPH_T 260 -#define EDGEOP_T 261 -#define SUBGRAPH_T 262 -#define ID_T 263 +#define yylex bgl_undir_lex +#define yyerror bgl_undir_error +#define yylval bgl_undir_lval +#define yychar bgl_undir_char +#define yydebug bgl_undir_debug +#define yynerrs bgl_undir_nerrs -#line 1 "graphviz_parser.y" + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + GRAPH_T = 258, + NODE_T = 259, + EDGE_T = 260, + DIGRAPH_T = 261, + EDGEOP_T = 262, + SUBGRAPH_T = 263, + ID_T = 264 + }; +#endif +#define GRAPH_T 258 +#define NODE_T 259 +#define EDGE_T 260 +#define DIGRAPH_T 261 +#define EDGEOP_T 262 +#define SUBGRAPH_T 263 +#define ID_T 264 + + + + +/* Copy the first part of user declarations. */ +#line 1 "graphviz_parser.yy" //======================================================================= // Copyright 2001 University of Notre Dame. @@ -62,17 +126,25 @@ #include #endif -#ifndef GRAPHVIZ_GRAPH -#error Need to define the GRAPHVIZ_GRAPH macro to either GraphvizGraph or GraphvizDigraph. +#ifndef GRAPHVIZ_DIRECTED +#error Need to define the GRAPHVIZ_DIRECTED macro to either 0 or 1 #endif +#if GRAPHVIZ_DIRECTED == 0 +#define GRAPHVIZ_GRAPH boost::GraphvizGraph +#define yyrestart bgl_undir_restart +#else +#define GRAPHVIZ_GRAPH boost::GraphvizDigraph +#define yyrestart bgl_dir_restart +#endif + #define YYPARSE_PARAM g #include "yystype.h" - extern void bgl_undir_error(char* str); - extern void bgl_undir_restart(FILE* str); - extern int bgl_undir_lex(YYSTYPE* lvalp); + extern void yyerror(char* str); + extern void yyrestart(FILE* str); + extern int yylex(YYSTYPE* lvalp); enum AttrState {GRAPH_GRAPH_A, GRAPH_NODE_A, GRAPH_EDGE_A, NODE_A, EDGE_A}; @@ -102,7 +174,7 @@ static const std::string& get_graph_name(const Subgraph& g) { const boost::graph_property::type& - name = boost::get_property(g, boost::graph_name); + name = boost::get_property(g, boost::graph_name); return name; } @@ -119,7 +191,7 @@ //set the label of vertex, it could be overwritten later. boost::property_map::type - va = boost::get(boost::vertex_attribute, g); + va = boost::get(boost::vertex_attribute, g); va[v]["label"] = name; //add v into the map so next time we will find it. @@ -143,85 +215,85 @@ static void set_attribute(GraphvizAttrList& p, - const GraphvizAttrList& attr) { + const GraphvizAttrList& attr) { GraphvizAttrList::const_iterator i, end; for ( i=attr.begin(), end=attr.end(); i!=end; ++i) - p[i->first]=i->second; + p[i->first]=i->second; } static void set_attribute(Subgraph& g, - AttrState s, bool clear_attribute = true) { + AttrState s, bool clear_attribute = true) { typedef Subgraph Graph; switch ( s ) { case GRAPH_GRAPH_A: - { - boost::graph_property::type& - gga = boost::get_property(g, boost::graph_graph_attribute); - set_attribute(gga, attributes); - } - break; + { + boost::graph_property::type& + gga = boost::get_property(g, boost::graph_graph_attribute); + set_attribute(gga, attributes); + } + break; case GRAPH_NODE_A: - { - boost::graph_property::type& - gna = boost::get_property(g, boost::graph_vertex_attribute); - set_attribute(gna, attributes); - } - break; + { + boost::graph_property::type& + gna = boost::get_property(g, boost::graph_vertex_attribute); + set_attribute(gna, attributes); + } + break; case GRAPH_EDGE_A: - { - boost::graph_property::type& - gea = boost::get_property(g, boost::graph_edge_attribute); - set_attribute(gea, attributes); - } - break; + { + boost::graph_property::type& + gea = boost::get_property(g, boost::graph_edge_attribute); + set_attribute(gea, attributes); + } + break; case NODE_A: - { - boost::property_map::type - va = boost::get(boost::vertex_attribute, g); //va[v] - set_attribute(va[current_vertex], attributes); - } - break; + { + boost::property_map::type + va = boost::get(boost::vertex_attribute, g); //va[v] + set_attribute(va[current_vertex], attributes); + } + break; case EDGE_A: - { - boost::property_map::type - ea = boost::get(boost::edge_attribute, g); //ea[e] - set_attribute(ea[current_edge], attributes); - } - break; + { + boost::property_map::type + ea = boost::get(boost::edge_attribute, g); //ea[e] + set_attribute(ea[current_edge], attributes); + } + break; } if ( clear_attribute ) - attributes.clear(); + attributes.clear(); } static void add_edges(const Vertex& u, - const Vertex& v, GRAPHVIZ_GRAPH& g) { + const Vertex& v, GRAPHVIZ_GRAPH& g) { graphviz::current_edge = boost::add_edge(u, v, g).first; graphviz::set_attribute(g, EDGE_A, false); } static void add_edges(Subgraph* G1, Subgraph* G2, - GRAPHVIZ_GRAPH& g) { + GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j, m, n; for ( boost::tie(i, j) = boost::vertices(*G1); i != j; ++i) { - for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) { - graphviz::add_edges(G1->local_to_global(*i), - G2->local_to_global(*m), g); - } + for ( boost::tie(m, n) = boost::vertices(*G2); m != n; ++m) { + graphviz::add_edges(G1->local_to_global(*i), + G2->local_to_global(*m), g); + } } } static void add_edges(Subgraph* G, const Vertex& v, GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j; for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) { - graphviz::add_edges(G->local_to_global(*i), v, g); + graphviz::add_edges(G->local_to_global(*i), v, g); } } static void add_edges(const Vertex& u, Subgraph* G, GRAPHVIZ_GRAPH& g) { boost::graph_traits::vertex_iterator i, j; for ( boost::tie(i, j) = boost::vertices(*G); i != j; ++i) { - graphviz::add_edges(u, G->local_to_global(*i), g); + graphviz::add_edges(u, G->local_to_global(*i), g); } } @@ -232,7 +304,7 @@ char buf[256]; sprintf(buf, "default%i\0", i); ++i; - return string(buf); + return std::string(buf); #else std::stringstream out; out << "default" << i; @@ -244,587 +316,866 @@ static void set_graph_name(const std::string& name) { boost::graph_property::type& - gea = boost::get_property(*current_graph, boost::graph_name); + gea = boost::get_property(*current_graph, boost::graph_name); gea = name; } } //namespace detail { -#include -#ifndef __cplusplus -#ifndef __STDC__ -#define const -#endif + +/* Enabling traces. */ +#ifndef YYDEBUG +# define YYDEBUG 0 #endif - - -#define YYFINAL 66 -#define YYFLAG -32768 -#define YYNTBASE 18 - -#define YYTRANSLATE(x) ((unsigned)(x) <= 263 ? yytranslate[x] : 45) - -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, 16, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 17, 12, 2, - 15, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 13, 2, 14, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 10, 2, 11, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 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, 3, 4, 5, 6, - 7, 8, 9 -}; - -#if YYDEBUG != 0 -static const short yyprhs[] = { 0, - 0, 3, 7, 10, 12, 14, 16, 17, 20, 22, - 24, 25, 28, 31, 36, 38, 40, 42, 44, 48, - 52, 54, 56, 57, 59, 61, 63, 65, 67, 70, - 74, 75, 77, 79, 83, 87, 90, 92, 95, 97, - 99, 102, 103, 106, 109, 111 -}; - -static const short yyrhs[] = { 20, - 19, 0, 10, 23, 11, 0, 21, 22, 0, 3, - 0, 6, 0, 9, 0, 0, 23, 25, 0, 25, - 0, 12, 0, 0, 26, 24, 0, 31, 24, 0, - 27, 13, 28, 14, 0, 3, 0, 4, 0, 5, - 0, 29, 0, 28, 30, 29, 0, 9, 15, 9, - 0, 12, 0, 16, 0, 0, 33, 0, 37, 0, - 32, 0, 41, 0, 29, 0, 35, 34, 0, 13, - 28, 14, 0, 0, 9, 0, 36, 0, 9, 17, - 9, 0, 40, 39, 34, 0, 7, 40, 0, 38, - 0, 39, 38, 0, 35, 0, 41, 0, 43, 44, - 0, 0, 42, 19, 0, 8, 9, 0, 19, 0, - 0 -}; - -#endif - -#if YYDEBUG != 0 -static const short yyrline[] = { 0, - 246, 249, 252, 262, 262, 265, 265, 268, 268, 271, - 271, 274, 274, 278, 285, 286, 287, 290, 290, 293, - 303, 303, 303, 306, 306, 306, 306, 309, 317, 328, - 328, 331, 346, 349, 368, 413, 417, 417, 420, 429, - 440, 447, 457, 462, 483, 483 -}; -#endif - - -#if YYDEBUG != 0 || defined (YYERROR_VERBOSE) - -static const char * const yytname[] = { "$","error","$undefined.","GRAPH_T", -"NODE_T","EDGE_T","DIGRAPH_T","EDGEOP_T","SUBGRAPH_T","ID_T","'{'","'}'","';'", -"'['","']'","'='","','","':'","graph","graph_body","graph_header","graph_type", -"graph_name","stmt_list","semicolon","stmt","attr_stmt","attr_header","attr_list", -"attr","attr_separator","compound_stmt","graph_attr","node_stmt","opt_attr", -"node_id","node_port","edge_stmt","edge_rhs_one","edge_rhs","edge_endpoint", -"subgraph","@1","subgraph_header","opt_graph_body", NULL -}; -#endif - -static const short yyr1[] = { 0, - 18, 19, 20, 21, 21, 22, 22, 23, 23, 24, - 24, 25, 25, 26, 27, 27, 27, 28, 28, 29, - 30, 30, 30, 31, 31, 31, 31, 32, 33, 34, - 34, 35, 35, 36, 37, 38, 39, 39, 40, 40, - 41, 42, 41, 43, 44, 44 -}; - -static const short yyr2[] = { 0, - 2, 3, 2, 1, 1, 1, 0, 2, 1, 1, - 0, 2, 2, 4, 1, 1, 1, 1, 3, 3, - 1, 1, 0, 1, 1, 1, 1, 1, 2, 3, - 0, 1, 1, 3, 3, 2, 1, 2, 1, 1, - 2, 0, 2, 2, 1, 0 -}; - -static const short yydefact[] = { 0, - 4, 5, 0, 7, 42, 1, 6, 3, 15, 16, - 17, 0, 32, 42, 9, 11, 0, 28, 11, 26, - 24, 31, 33, 25, 0, 27, 0, 46, 44, 0, - 0, 2, 8, 10, 12, 0, 13, 0, 29, 42, - 37, 31, 43, 45, 41, 20, 34, 0, 23, 18, - 23, 32, 39, 36, 40, 35, 38, 21, 14, 22, - 0, 30, 19, 0, 0, 0 -}; - -static const short yydefgoto[] = { 64, - 6, 3, 4, 8, 14, 35, 15, 16, 17, 49, - 18, 61, 19, 20, 21, 39, 22, 23, 24, 41, - 42, 25, 26, 27, 28, 45 -}; - -static const short yypact[] = { 23, --32768,-32768, -4, 6, 9,-32768,-32768,-32768,-32768,-32768, --32768, 18, 13, 0,-32768, 19, 21,-32768, 19,-32768, --32768, -6,-32768,-32768, 28, 29, -4, -4,-32768, 30, - 31,-32768,-32768,-32768,-32768, 32,-32768, 32,-32768, 24, --32768, 3,-32768,-32768,-32768,-32768,-32768, 27, 7,-32768, - 8, 26,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 32,-32768,-32768, 44, 45,-32768 -}; - -static const short yypgoto[] = {-32768, - 10,-32768,-32768,-32768,-32768, 33, 34,-32768,-32768, 11, - -36,-32768,-32768,-32768,-32768, 4, 14,-32768,-32768, 5, --32768, 15, 16,-32768,-32768,-32768 -}; - - -#define YYLAST 56 - - -static const short yytable[] = { 50, - -39, 50, 9, 10, 11, 5, 38, 12, 13, 40, - 32, 9, 10, 11, 7, 38, 12, 13, 58, 58, - 59, 62, 60, 60, 63, 1, 29, 30, 2, 31, - 34, 12, 52, 36, 40, -40, 43, 44, 46, 47, - 48, 30, 31, 65, 66, 56, 57, 33, 51, 0, - 0, 37, 0, 53, 54, 55 -}; - -static const short yycheck[] = { 36, - 7, 38, 3, 4, 5, 10, 13, 8, 9, 7, - 11, 3, 4, 5, 9, 13, 8, 9, 12, 12, - 14, 14, 16, 16, 61, 3, 9, 15, 6, 17, - 12, 8, 9, 13, 7, 7, 27, 28, 9, 9, - 9, 15, 17, 0, 0, 42, 42, 14, 38, -1, - -1, 19, -1, 40, 40, 40 -}; -#define YYPURE 1 - -/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/lib/bison.simple" -/* This file comes from bison-1.28. */ - -/* Skeleton output parser for bison, - Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -/* As a special exception, when this file is copied by Bison into a - Bison output file, you may use that output file without restriction. - This special exception was added by the Free Software Foundation - in version 1.24 of Bison. */ - -/* 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. */ - -#ifndef YYSTACK_USE_ALLOCA -#ifdef alloca -#define YYSTACK_USE_ALLOCA -#else /* alloca not defined */ -#ifdef __GNUC__ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#else /* not GNU C. */ -#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) -#define YYSTACK_USE_ALLOCA -#include -#else /* not sparc */ -/* We think this test detects Watcom and Microsoft C. */ -/* This used to test MSDOS, but that is a bad idea - since that symbol is in the user namespace. */ -#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) -#if 0 /* No need for malloc.h, which pollutes the namespace; - instead, just don't use alloca. */ -#include -#endif -#else /* not MSDOS, or __TURBOC__ */ -#if defined(_AIX) -/* I don't know what this was needed for, but it pollutes the namespace. - So I turned it off. rms, 2 May 1997. */ -/* #include */ - #pragma alloca -#define YYSTACK_USE_ALLOCA -#else /* not MSDOS, or __TURBOC__, or _AIX */ -#if 0 -#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, - and on HPUX 10. Eventually we can turn this on. */ -#define YYSTACK_USE_ALLOCA -#define alloca __builtin_alloca -#endif /* __hpux */ -#endif -#endif /* not _AIX */ -#endif /* not MSDOS, or __TURBOC__ */ -#endif /* not sparc */ -#endif /* not GNU C */ -#endif /* alloca not defined */ -#endif /* YYSTACK_USE_ALLOCA not defined */ - -#ifdef YYSTACK_USE_ALLOCA -#define YYSTACK_ALLOC alloca +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 #else -#define YYSTACK_ALLOC malloc +# define YYERROR_VERBOSE 0 #endif -/* 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. */ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +typedef int YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +# define YYSTYPE_IS_DECLARED 1 +# define YYSTYPE_IS_TRIVIAL 1 +#endif -#define yyerrok (yyerrstatus = 0) -#define yyclearin (bgl_undir_char = YYEMPTY) -#define YYEMPTY -2 -#define YYEOF 0 -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrlab1 -/* Like YYERROR except do call bgl_undir_error. - This remains here temporarily to ease the - transition to the new meaning of YYERROR, for GCC. + + +/* Copy the second part of user declarations. */ + + +/* Line 214 of yacc.c. */ +#line 354 "graphviz_graph_parser.cpp" + +#if ! defined (yyoverflow) || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# if YYSTACK_USE_ALLOCA +# define YYSTACK_ALLOC alloca +# else +# ifndef YYSTACK_USE_ALLOCA +# if defined (alloca) || defined (_ALLOCA_H) +# define YYSTACK_ALLOC alloca +# else +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# else +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +# define YYSTACK_ALLOC malloc +# define YYSTACK_FREE free +# endif +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ + + +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + short yyss; + YYSTYPE yyvs; + }; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +/* Copy COUNT objects from FROM to TO. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if 1 < __GNUC__ +# define YYCOPY(To, From, Count) \ + __builtin_memcpy (To, From, (Count) * sizeof (*(From))) +# else +# define YYCOPY(To, From, Count) \ + do \ + { \ + register YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (To)[yyi] = (From)[yyi]; \ + } \ + while (0) +# endif +# endif + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack, Stack, yysize); \ + Stack = &yyptr->Stack; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short yysigned_char; +#endif + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 6 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 58 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 18 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 28 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 47 +/* YYNRULES -- Number of states. */ +#define YYNSTATES 66 + +/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 264 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +static const unsigned char yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 16, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 17, 12, + 2, 15, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 13, 2, 14, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 10, 2, 11, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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 +}; + +#if YYDEBUG +/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in + YYRHS. */ +static const unsigned char yyprhs[] = +{ + 0, 0, 3, 6, 10, 13, 15, 17, 19, 20, + 23, 25, 27, 28, 31, 34, 39, 41, 43, 45, + 47, 51, 55, 57, 59, 60, 62, 64, 66, 68, + 70, 73, 77, 78, 80, 82, 86, 90, 93, 95, + 98, 100, 102, 105, 106, 109, 112, 114 +}; + +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yysigned_char yyrhs[] = +{ + 19, 0, -1, 21, 20, -1, 10, 24, 11, -1, + 22, 23, -1, 3, -1, 6, -1, 9, -1, -1, + 24, 26, -1, 26, -1, 12, -1, -1, 27, 25, + -1, 32, 25, -1, 28, 13, 29, 14, -1, 3, + -1, 4, -1, 5, -1, 30, -1, 29, 31, 30, + -1, 9, 15, 9, -1, 12, -1, 16, -1, -1, + 34, -1, 38, -1, 33, -1, 42, -1, 30, -1, + 36, 35, -1, 13, 29, 14, -1, -1, 9, -1, + 37, -1, 9, 17, 9, -1, 41, 40, 35, -1, + 7, 41, -1, 39, -1, 40, 39, -1, 36, -1, + 42, -1, 44, 45, -1, -1, 43, 20, -1, 8, + 9, -1, 20, -1, -1 +}; + +/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +static const unsigned short yyrline[] = +{ + 0, 254, 254, 257, 260, 270, 270, 273, 273, 276, + 276, 279, 279, 282, 283, 286, 293, 294, 295, 298, + 298, 301, 311, 311, 311, 314, 314, 314, 314, 317, + 325, 336, 336, 339, 354, 357, 376, 421, 425, 425, + 428, 437, 448, 456, 456, 470, 491, 491 +}; +#endif + +#if YYDEBUG || YYERROR_VERBOSE +/* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "$end", "error", "$undefined", "GRAPH_T", "NODE_T", "EDGE_T", "DIGRAPH_T", + "EDGEOP_T", "SUBGRAPH_T", "ID_T", "'{'", "'}'", "';'", "'['", "']'", + "'='", "','", "':'", "$accept", "graph", "graph_body", "graph_header", + "graph_type", "graph_name", "stmt_list", "semicolon", "stmt", + "attr_stmt", "attr_header", "attr_list", "attr", "attr_separator", + "compound_stmt", "graph_attr", "node_stmt", "opt_attr", "node_id", + "node_port", "edge_stmt", "edge_rhs_one", "edge_rhs", "edge_endpoint", + "subgraph", "@1", "subgraph_header", "opt_graph_body", 0 +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to + token YYLEX-NUM. */ +static const unsigned short yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 123, 125, 59, 91, 93, 61, 44, 58 +}; +# endif + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const unsigned char yyr1[] = +{ + 0, 18, 19, 20, 21, 22, 22, 23, 23, 24, + 24, 25, 25, 26, 26, 27, 28, 28, 28, 29, + 29, 30, 31, 31, 31, 32, 32, 32, 32, 33, + 34, 35, 35, 36, 36, 37, 38, 39, 40, 40, + 41, 41, 42, 43, 42, 44, 45, 45 +}; + +/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ +static const unsigned char yyr2[] = +{ + 0, 2, 2, 3, 2, 1, 1, 1, 0, 2, + 1, 1, 0, 2, 2, 4, 1, 1, 1, 1, + 3, 3, 1, 1, 0, 1, 1, 1, 1, 1, + 2, 3, 0, 1, 1, 3, 3, 2, 1, 2, + 1, 1, 2, 0, 2, 2, 1, 0 +}; + +/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state + STATE-NUM when YYTABLE doesn't specify something else to do. Zero + means the default is an error. */ +static const unsigned char yydefact[] = +{ + 0, 5, 6, 0, 0, 8, 1, 43, 2, 7, + 4, 16, 17, 18, 0, 33, 43, 10, 12, 0, + 29, 12, 27, 25, 32, 34, 26, 0, 28, 0, + 47, 45, 0, 0, 3, 9, 11, 13, 0, 14, + 0, 30, 43, 38, 32, 44, 46, 42, 21, 35, + 0, 24, 19, 24, 33, 40, 37, 41, 36, 39, + 22, 15, 23, 0, 31, 20 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yysigned_char yydefgoto[] = +{ + -1, 3, 8, 4, 5, 10, 16, 37, 17, 18, + 19, 51, 20, 63, 21, 22, 23, 41, 24, 25, + 26, 43, 44, 27, 28, 29, 30, 47 +}; + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +#define YYPACT_NINF -39 +static const yysigned_char yypact[] = +{ + 23, -39, -39, 6, 17, 22, -39, 9, -39, -39, + -39, -39, -39, -39, 27, 13, 0, -39, 25, 2, + -39, 25, -39, -39, -6, -39, -39, 31, 32, 17, + 17, -39, 33, 34, -39, -39, -39, -39, 35, -39, + 35, -39, 24, -39, 3, -39, -39, -39, -39, -39, + 26, 7, -39, 8, 28, -39, -39, -39, -39, -39, + -39, -39, -39, 35, -39, -39 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yysigned_char yypgoto[] = +{ + -39, -39, 5, -39, -39, -39, -39, 19, 30, -39, + -39, 10, -38, -39, -39, -39, -39, 4, 11, -39, + -39, 12, -39, 15, 16, -39, -39, -39 +}; + +/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule which + number is the opposite. If zero, do what YYDEFACT says. + If YYTABLE_NINF, syntax error. */ +#define YYTABLE_NINF -42 +static const yysigned_char yytable[] = +{ + 52, -40, 52, 11, 12, 13, 6, 40, 14, 15, + 42, 34, 11, 12, 13, 38, 40, 14, 15, 60, + 60, 61, 64, 62, 62, 65, 1, 7, 32, 2, + 33, 9, 14, 54, 45, 46, 31, 36, 42, -41, + 39, 32, 48, 49, 50, 33, 35, 0, 58, 0, + 53, 0, 0, 55, 0, 0, 59, 56, 57 +}; + +static const yysigned_char yycheck[] = +{ + 38, 7, 40, 3, 4, 5, 0, 13, 8, 9, + 7, 11, 3, 4, 5, 13, 13, 8, 9, 12, + 12, 14, 14, 16, 16, 63, 3, 10, 15, 6, + 17, 9, 8, 9, 29, 30, 9, 12, 7, 7, + 21, 15, 9, 9, 9, 17, 16, -1, 44, -1, + 40, -1, -1, 42, -1, -1, 44, 42, 42 +}; + +/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const unsigned char yystos[] = +{ + 0, 3, 6, 19, 21, 22, 0, 10, 20, 9, + 23, 3, 4, 5, 8, 9, 24, 26, 27, 28, + 30, 32, 33, 34, 36, 37, 38, 41, 42, 43, + 44, 9, 15, 17, 11, 26, 12, 25, 13, 25, + 13, 35, 7, 39, 40, 20, 20, 45, 9, 9, + 9, 29, 30, 29, 9, 36, 41, 42, 35, 39, + 12, 14, 16, 31, 14, 30 +}; + +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ +#endif +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t +#endif +#if ! defined (YYSIZE_T) +# if defined (__STDC__) || defined (__cplusplus) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# endif +#endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int +#endif + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto 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 YYFAIL goto yyerrlab + #define YYRECOVERING() (!!yyerrstatus) -#define YYBACKUP(token, value) \ -do \ - if (bgl_undir_char == YYEMPTY && yylen == 1) \ - { bgl_undir_char = (token), bgl_undir_lval = (value); \ - bgl_undir_char1 = YYTRANSLATE (bgl_undir_char); \ - YYPOPSTACK; \ - goto yybackup; \ - } \ - else \ - { bgl_undir_error ("syntax error: cannot back up"); YYERROR; } \ + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY && yylen == 1) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + yytoken = YYTRANSLATE (yychar); \ + YYPOPSTACK; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror ("syntax error: cannot back up");\ + YYERROR; \ + } \ while (0) -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 -#ifndef YYPURE -#define YYLEX bgl_undir_lex() +/* YYLLOC_DEFAULT -- Compute the default location (before the actions + are run). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + Current.first_line = Rhs[1].first_line; \ + Current.first_column = Rhs[1].first_column; \ + Current.last_line = Rhs[N].last_line; \ + Current.last_column = Rhs[N].last_column; #endif -#ifdef YYPURE -#ifdef YYLSP_NEEDED +/* YYLEX -- calling `yylex' with the right arguments. */ + #ifdef YYLEX_PARAM -#define YYLEX bgl_undir_lex(&bgl_undir_lval, &yylloc, YYLEX_PARAM) +# define YYLEX yylex (&yylval, YYLEX_PARAM) #else -#define YYLEX bgl_undir_lex(&bgl_undir_lval, &yylloc) +# define YYLEX yylex (&yylval) #endif -#else /* not YYLSP_NEEDED */ -#ifdef YYLEX_PARAM -#define YYLEX bgl_undir_lex(&bgl_undir_lval, YYLEX_PARAM) + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + +# define YYDSYMPRINT(Args) \ +do { \ + if (yydebug) \ + yysymprint Args; \ +} while (0) + +# define YYDSYMPRINTF(Title, Token, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yysymprint (stderr, \ + Token, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (cinluded). | +`------------------------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_stack_print (short *bottom, short *top) #else -#define YYLEX bgl_undir_lex(&bgl_undir_lval) +static void +yy_stack_print (bottom, top) + short *bottom; + short *top; #endif -#endif /* not YYLSP_NEEDED */ +{ + YYFPRINTF (stderr, "Stack now"); + for (/* Nothing. */; bottom <= top; ++bottom) + YYFPRINTF (stderr, " %d", *bottom); + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yy_reduce_print (int yyrule) +#else +static void +yy_reduce_print (yyrule) + int yyrule; +#endif +{ + int yyi; + unsigned int yylineno = yyrline[yyrule]; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", + yyrule - 1, yylineno); + /* Print the symbols being reduced, and their result. */ + for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) + YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); + YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) +# define YYDSYMPRINT(Args) +# define YYDSYMPRINTF(Title, Token, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 #endif -/* If nonreentrant, generate the variables here */ +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). -#ifndef YYPURE - -int bgl_undir_char; /* the lookahead symbol */ -YYSTYPE bgl_undir_lval; /* the semantic value of the */ - /* lookahead symbol */ - -#ifdef YYLSP_NEEDED -YYLTYPE yylloc; /* location data for the lookahead */ - /* symbol */ -#endif - -int bgl_undir_nerrs; /* number of parse errors so far */ -#endif /* not YYPURE */ - -#if YYDEBUG != 0 -int bgl_undir_debug; /* 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). */ + Do not make this value too large; the results are undefined if + SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 -#undef YYMAXDEPTH +# undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH -#define YYMAXDEPTH 10000 +# define YYMAXDEPTH 10000 #endif + -/* Define __yy_memcpy. Note that the size argument - should be passed with type unsigned int, because that is what the non-GCC - definitions require. With GCC, __builtin_memcpy takes an arg - of type size_t, but it can handle unsigned int. */ -#if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ -#define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) -#else /* not GNU C or C++ */ -#ifndef __cplusplus +#if YYERROR_VERBOSE -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (to, from, count) - char *to; - char *from; - unsigned int count; +# ifndef yystrlen +# if defined (__GLIBC__) && defined (_STRING_H) +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +# if defined (__STDC__) || defined (__cplusplus) +yystrlen (const char *yystr) +# else +yystrlen (yystr) + const char *yystr; +# endif { - register char *f = from; - register char *t = to; - register int i = count; + register const char *yys = yystr; - while (i-- > 0) - *t++ = *f++; + while (*yys++ != '\0') + continue; + + return yys - yystr - 1; } +# endif +# endif -#else /* __cplusplus */ - -/* This is the most reliable way to avoid incompatibilities - in available built-in functions on various systems. */ -static void -__yy_memcpy (char *to, char *from, unsigned int count) +# ifndef yystpcpy +# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +# if defined (__STDC__) || defined (__cplusplus) +yystpcpy (char *yydest, const char *yysrc) +# else +yystpcpy (yydest, yysrc) + char *yydest; + const char *yysrc; +# endif { - register char *t = to; - register char *f = from; - register int i = count; + register char *yyd = yydest; + register const char *yys = yysrc; - while (i-- > 0) - *t++ = *f++; + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; } +# endif +# endif + +#endif /* !YYERROR_VERBOSE */ -#endif -#endif -#line 217 "/usr/lib/bison.simple" -/* The user can define YYPARSE_PARAM as the name of an argument to be passed - into yyparse. The argument should have type void *. - It should actually point to an object. - Grammar actions can access the variable by casting it - to the proper pointer type. */ +#if YYDEBUG +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ -#ifdef YYPARSE_PARAM -#ifdef __cplusplus -#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM -#define YYPARSE_PARAM_DECL -#else /* not __cplusplus */ -#define YYPARSE_PARAM_ARG YYPARSE_PARAM -#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; -#endif /* not __cplusplus */ -#else /* not YYPARSE_PARAM */ -#define YYPARSE_PARAM_ARG -#define YYPARSE_PARAM_DECL -#endif /* not YYPARSE_PARAM */ - -/* Prevent warning if -Wstrict-prototypes. */ -#ifdef __GNUC__ -#ifdef YYPARSE_PARAM -int yyparse (void *); +#if defined (__STDC__) || defined (__cplusplus) +static void +yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else -int yyparse (void); +static void +yysymprint (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE *yyvaluep; #endif -#endif - -int -yyparse(YYPARSE_PARAM_ARG) - YYPARSE_PARAM_DECL { + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + if (yytype < YYNTOKENS) + { + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); +# ifdef YYPRINT + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + } + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + switch (yytype) + { + default: + break; + } + YYFPRINTF (yyoutput, ")"); +} + +#endif /* ! YYDEBUG */ +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +#if defined (__STDC__) || defined (__cplusplus) +static void +yydestruct (int yytype, YYSTYPE *yyvaluep) +#else +static void +yydestruct (yytype, yyvaluep) + int yytype; + YYSTYPE *yyvaluep; +#endif +{ + /* Pacify ``unused variable'' warnings. */ + (void) yyvaluep; + + switch (yytype) + { + + default: + break; + } +} + + +/* Prevent warnings from -Wmissing-prototypes. */ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM); +# else +int yyparse (); +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int yyparse (void); +#else +int yyparse (); +#endif +#endif /* ! YYPARSE_PARAM */ + + + + + + +/*----------. +| yyparse. | +`----------*/ + +#ifdef YYPARSE_PARAM +# if defined (__STDC__) || defined (__cplusplus) +int yyparse (void *YYPARSE_PARAM) +# else +int yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +# endif +#else /* ! YYPARSE_PARAM */ +#if defined (__STDC__) || defined (__cplusplus) +int +yyparse (void) +#else +int +yyparse () + +#endif +#endif +{ + /* The lookahead symbol. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; + +/* Number of syntax errors so far. */ +int yynerrs; + register int yystate; register int yyn; + int yyresult; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + /* Lookahead token as an internal (translated) token number. */ + int yytoken = 0; + + /* Three stacks and their tools: + `yyss': related to states, + `yyvs': related to semantic values, + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + short yyssa[YYINITDEPTH]; + short *yyss = yyssa; register short *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; - int yyerrstatus; /* number of tokens to shift before error messages enabled */ - int bgl_undir_char1 = 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; - int yyfree_stacks = 0; + YYSIZE_T yystacksize = YYINITDEPTH; -#ifdef YYPURE - int bgl_undir_char; - YYSTYPE bgl_undir_lval; - int bgl_undir_nerrs; -#ifdef YYLSP_NEEDED - YYLTYPE yylloc; -#endif -#endif + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; - YYSTYPE yyval; /* the variable used to return */ - /* semantic values from the action */ - /* routines */ + /* When reducing, the number of symbols on the RHS of the reduced + rule. */ int yylen; -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Starting parse\n"); -#endif + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; - bgl_undir_nerrs = 0; - bgl_undir_char = YYEMPTY; /* Cause a token to be read. */ + 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; + yyssp = yyss; 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: + goto yysetstate; - *++yyssp = yystate; +/*------------------------------------------------------------. +| yynewstate -- Push a new state, which is found in yystate. | +`------------------------------------------------------------*/ + yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. so pushing a state here evens the stacks. + */ + yyssp++; - if (yyssp >= yyss + yystacksize - 1) + yysetstate: + *yyssp = yystate; + + if (yyss + yystacksize - 1 <= yyssp) { - /* 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; + YYSIZE_T yysize = 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 + { + /* 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; - yyss = yyss1; yyvs = yyvs1; -#ifdef YYLSP_NEEDED - yyls = yyls1; -#endif + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow ("parser stack overflow", + &yyss1, yysize * sizeof (*yyssp), + &yyvs1, yysize * sizeof (*yyvsp), + + &yystacksize); + + yyss = yyss1; + yyvs = yyvs1; + } #else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + goto yyoverflowlab; +# else /* Extend the stack our own way. */ - if (yystacksize >= YYMAXDEPTH) - { - bgl_undir_error("parser stack overflow"); - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 2; - } + if (YYMAXDEPTH <= yystacksize) + goto yyoverflowlab; yystacksize *= 2; - if (yystacksize > YYMAXDEPTH) - yystacksize = YYMAXDEPTH; -#ifndef YYSTACK_USE_ALLOCA - yyfree_stacks = 1; -#endif - yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); - __yy_memcpy ((char *)yyss, (char *)yyss1, - size * (unsigned int) sizeof (*yyssp)); - yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); - __yy_memcpy ((char *)yyvs, (char *)yyvs1, - size * (unsigned int) sizeof (*yyvsp)); -#ifdef YYLSP_NEEDED - yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); - __yy_memcpy ((char *)yyls, (char *)yyls1, - size * (unsigned int) sizeof (*yylsp)); -#endif + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + short *yyss1 = yyss; + union yyalloc *yyptr = + (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + if (! yyptr) + goto yyoverflowlab; + YYSTACK_RELOCATE (yyss); + YYSTACK_RELOCATE (yyvs); + +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif #endif /* no yyoverflow */ - yyssp = yyss + size - 1; - yyvsp = yyvs + size - 1; -#ifdef YYLSP_NEEDED - yylsp = yyls + size - 1; -#endif + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Stack size increased to %d\n", yystacksize); -#endif - if (yyssp >= yyss + yystacksize - 1) - YYABORT; + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; } -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Entering state %d\n", yystate); -#endif + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; - yybackup: + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ @@ -833,238 +1184,218 @@ yynewstate: /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; - if (yyn == YYFLAG) + if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ - /* bgl_undir_char is either YYEMPTY or YYEOF - or a valid token in external form. */ - - if (bgl_undir_char == YYEMPTY) + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + if (yychar == YYEMPTY) { -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Reading a token: "); -#endif - bgl_undir_char = YYLEX; + YYDPRINTF ((stderr, "Reading a token: ")); + yychar = YYLEX; } - /* Convert token to internal form (in bgl_undir_char1) for indexing tables with */ - - if (bgl_undir_char <= 0) /* This means end of input. */ + if (yychar <= YYEOF) { - bgl_undir_char1 = 0; - bgl_undir_char = YYEOF; /* Don't call YYLEX any more */ - -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Now at end of input.\n"); -#endif + yychar = yytoken = YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); } else { - bgl_undir_char1 = YYTRANSLATE(bgl_undir_char); - -#if YYDEBUG != 0 - if (bgl_undir_debug) - { - fprintf (stderr, "Next token is %d (%s", bgl_undir_char, yytname[bgl_undir_char1]); - /* Give the individual parser a way to print the precise meaning - of a token, for further debugging info. */ -#ifdef YYPRINT - YYPRINT (stderr, bgl_undir_char, bgl_undir_lval); -#endif - fprintf (stderr, ")\n"); - } -#endif + yytoken = YYTRANSLATE (yychar); + YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } - yyn += bgl_undir_char1; - if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != bgl_undir_char1) + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; - yyn = yytable[yyn]; - - /* 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 <= 0) { - if (yyn == YYFLAG) - goto yyerrlab; + if (yyn == 0 || yyn == YYTABLE_NINF) + goto yyerrlab; yyn = -yyn; goto yyreduce; } - else if (yyn == 0) - goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ - -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Shifting token %d (%s), ", bgl_undir_char, yytname[bgl_undir_char1]); -#endif + YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ - if (bgl_undir_char != YYEOF) - bgl_undir_char = YYEMPTY; + if (yychar != YYEOF) + yychar = YYEMPTY; - *++yyvsp = bgl_undir_lval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif + *++yyvsp = yylval; - /* count tokens shifted since error; after three, turn off error status. */ - if (yyerrstatus) yyerrstatus--; + + /* 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: +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; + goto yyreduce; -/* Do a reduction. yyn is the number of a rule to reduce with. */ + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ yyreduce: + /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; - if (yylen > 0) - yyval = yyvsp[1-yylen]; /* implement default value of the action */ -#if YYDEBUG != 0 - if (bgl_undir_debug) + /* If YYLEN is nonzero, implement the default value of the action: + `$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) { - int i; + case 3: +#line 257 "graphviz_parser.yy" + {yyval.i=0;;} + break; - 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 2: -#line 249 "graphviz_parser.y" -{yyval.i=0;; - break;} -case 3: -#line 253 "graphviz_parser.y" -{ + case 4: +#line 261 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[0].ptr); graphviz::previous_graph = static_cast(g); graphviz::current_graph = static_cast(g); graphviz::set_graph_name(*name); delete name; - ; - break;} -case 6: -#line 265 "graphviz_parser.y" -{yyval.ptr = yyvsp[0].ptr; ; - break;} -case 7: -#line 265 "graphviz_parser.y" -{yyval.ptr=(void*)(new std::string("G")); ; - break;} -case 14: -#line 279 "graphviz_parser.y" -{ + ;} + break; + + case 7: +#line 273 "graphviz_parser.yy" + {yyval.ptr = yyvsp[0].ptr; ;} + break; + + case 8: +#line 273 "graphviz_parser.yy" + {yyval.ptr=(void*)(new std::string("G")); ;} + break; + + case 15: +#line 287 "graphviz_parser.yy" + { graphviz::set_attribute(*graphviz::current_graph, - graphviz::attribute_state); - ; - break;} -case 15: -#line 285 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_GRAPH_A; ; - break;} -case 16: -#line 286 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_NODE_A; ; - break;} -case 17: -#line 287 "graphviz_parser.y" -{ graphviz::attribute_state = GRAPH_EDGE_A; ; - break;} -case 20: -#line 294 "graphviz_parser.y" -{ + graphviz::attribute_state); + ;} + break; + + case 16: +#line 293 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_GRAPH_A; ;} + break; + + case 17: +#line 294 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_NODE_A; ;} + break; + + case 18: +#line 295 "graphviz_parser.yy" + { graphviz::attribute_state = GRAPH_EDGE_A; ;} + break; + + case 21: +#line 302 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[-2].ptr); std::string* value = static_cast(yyvsp[0].ptr); graphviz::attributes[*name] = *value; delete name; delete value; - ; - break;} -case 27: -#line 306 "graphviz_parser.y" -{ yyval.i = 0; ; - break;} -case 28: -#line 310 "graphviz_parser.y" -{ + ;} + break; + + case 28: +#line 314 "graphviz_parser.yy" + { yyval.i = 0; ;} + break; + + case 29: +#line 318 "graphviz_parser.yy" + { graphviz::set_attribute( *static_cast(graphviz::current_graph), - GRAPH_GRAPH_A); - ; - break;} -case 29: -#line 318 "graphviz_parser.y" -{ + GRAPH_GRAPH_A); + ;} + break; + + case 30: +#line 326 "graphviz_parser.yy" + { graphviz::Vertex* temp = static_cast(yyvsp[-1].ptr); graphviz::current_vertex = *temp; graphviz::set_attribute(*static_cast(YYPARSE_PARAM), - NODE_A); + NODE_A); delete temp; yyval.i = 0; - ; - break;} -case 30: -#line 328 "graphviz_parser.y" -{ yyval.i=0; ; - break;} -case 31: -#line 328 "graphviz_parser.y" -{ yyval.i=0; ; - break;} -case 32: -#line 332 "graphviz_parser.y" -{ + ;} + break; + + case 31: +#line 336 "graphviz_parser.yy" + { yyval.i=0; ;} + break; + + case 32: +#line 336 "graphviz_parser.yy" + { yyval.i=0; ;} + break; + + case 33: +#line 340 "graphviz_parser.yy" + { std::string* name = static_cast(yyvsp[0].ptr); std::pair result = graphviz::lookup(*name); if (result.second) { graphviz::current_vertex = result.first->second; if (! graphviz::current_graph->is_root()) - boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph); + boost::add_vertex(graphviz::current_vertex, *graphviz::current_graph); } else graphviz::current_vertex = graphviz::add_name(*name, *static_cast(YYPARSE_PARAM)) ; graphviz::Vertex* temp = new graphviz::Vertex(graphviz::current_vertex); yyval.ptr = (void *)temp; graphviz::attribute_state = NODE_A; delete name; - ; - break;} -case 33: -#line 346 "graphviz_parser.y" -{ yyval.ptr=yyvsp[0].ptr; ; - break;} -case 34: -#line 350 "graphviz_parser.y" -{ + ;} + break; + + case 34: +#line 354 "graphviz_parser.yy" + { yyval.ptr=yyvsp[0].ptr; ;} + break; + + case 35: +#line 358 "graphviz_parser.yy" + { //consider port as a special properties ?? --need work here std::string* name = static_cast(yyvsp[-2].ptr); std::string* port = static_cast(yyvsp[0].ptr); @@ -1079,37 +1410,38 @@ case 34: graphviz::attribute_state = NODE_A; delete name; delete port; - ; - break;} -case 35: -#line 369 "graphviz_parser.y" -{ + ;} + break; + + case 36: +#line 377 "graphviz_parser.yy" + { typedef std::pair* Ptr; Ptr source = static_cast(yyvsp[-2].ptr); for (std::vector::iterator it=graphviz::vlist.begin(); - it !=graphviz::vlist.end(); ++it) { + it !=graphviz::vlist.end(); ++it) { if ( source->second ) { - if ( (*it)->second ) - graphviz::add_edges(static_cast(source->first), - static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - else - graphviz::add_edges(static_cast(source->first), - *static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); + if ( (*it)->second ) + graphviz::add_edges(static_cast(source->first), + static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + else + graphviz::add_edges(static_cast(source->first), + *static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); } else { - graphviz::Vertex* temp = static_cast(source->first); - if ( (*it)->second ) - graphviz::add_edges(*temp, - static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - else - graphviz::add_edges(*temp, - *static_cast((*it)->first), - *static_cast(YYPARSE_PARAM)); - delete temp; + graphviz::Vertex* temp = static_cast(source->first); + if ( (*it)->second ) + graphviz::add_edges(*temp, + static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + else + graphviz::add_edges(*temp, + *static_cast((*it)->first), + *static_cast(YYPARSE_PARAM)); + delete temp; } delete source; @@ -1124,46 +1456,51 @@ case 35: graphviz::attributes.clear(); graphviz::vlist.clear(); - ; - break;} -case 36: -#line 414 "graphviz_parser.y" -{ graphviz::vlist.push_back(static_cast*>(yyvsp[0].ptr)); ; - break;} -case 39: -#line 421 "graphviz_parser.y" -{ + ;} + break; + + case 37: +#line 422 "graphviz_parser.yy" + { graphviz::vlist.push_back(static_cast*>(yyvsp[0].ptr)); ;} + break; + + case 40: +#line 429 "graphviz_parser.yy" + { std::pair* temp = new std::pair; temp->first = yyvsp[0].ptr; temp->second = false; yyval.ptr = (void*)temp; graphviz::attribute_state = EDGE_A; - ; - break;} -case 40: -#line 430 "graphviz_parser.y" -{ + ;} + break; + + case 41: +#line 438 "graphviz_parser.yy" + { std::pair* temp = new std::pair; temp->first = yyvsp[0].ptr; temp->second = true; yyval.ptr = (void*)temp; graphviz::attribute_state = EDGE_A; - ; - break;} -case 41: -#line 441 "graphviz_parser.y" -{ + ;} + break; + + case 42: +#line 449 "graphviz_parser.yy" + { if ( yyvsp[0].i ) graphviz::current_graph = &graphviz::current_graph->parent(); else graphviz::current_graph = graphviz::previous_graph; - ; - break;} -case 42: -#line 448 "graphviz_parser.y" -{ + ;} + break; + + case 43: +#line 456 "graphviz_parser.yy" + { graphviz::previous_graph = graphviz::current_graph; std::string name = graphviz::random_string(); graphviz::Subgraph* temp = graphviz::create_subgraph(name); @@ -1171,17 +1508,19 @@ case 42: graphviz::set_graph_name(name); yyval.ptr = (void *) graphviz::current_graph; - ; - break;} -case 43: -#line 457 "graphviz_parser.y" -{ + ;} + break; + + case 44: +#line 465 "graphviz_parser.yy" + { graphviz::current_graph = &graphviz::current_graph->parent(); - ; - break;} -case 44: -#line 463 "graphviz_parser.y" -{ + ;} + break; + + case 45: +#line 471 "graphviz_parser.yy" + { //lookup ID_T if it is already in the subgraph, //if it is not, add a new subgraph std::string* name = static_cast(yyvsp[0].ptr); @@ -1198,255 +1537,235 @@ case 44: yyval.ptr = (void *) graphviz::current_graph; delete name; - ; - break;} -case 45: -#line 483 "graphviz_parser.y" -{yyval.i = 1; ; - break;} -case 46: -#line 483 "graphviz_parser.y" -{ yyval.i = 0; ; - break;} -} - /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/lib/bison.simple" + ;} + break; + + case 46: +#line 491 "graphviz_parser.yy" + {yyval.i = 1; ;} + break; + + case 47: +#line 491 "graphviz_parser.yy" + { yyval.i = 0; ;} + break; + + + } + +/* Line 999 of yacc.c. */ +#line 1558 "graphviz_graph_parser.cpp" yyvsp -= yylen; yyssp -= yylen; -#ifdef YYLSP_NEEDED - yylsp -= yylen; -#endif -#if YYDEBUG != 0 - if (bgl_undir_debug) - { - short *ssp1 = yyss - 1; - fprintf (stderr, "state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); - } -#endif + + YY_STACK_PRINT (yyss, yyssp); *++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. */ + /* 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 = yypgoto[yyn - YYNTOKENS] + *yyssp; + if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else - yystate = yydefgoto[yyn - YYNTBASE]; + yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; -yyerrlab: /* here on detecting error */ - if (! yyerrstatus) - /* If not already recovering from an error, report this error. */ +/*------------------------------------. +| yyerrlab -- here on detecting error | +`------------------------------------*/ +yyerrlab: + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) { - ++bgl_undir_nerrs; - -#ifdef YYERROR_VERBOSE + ++yynerrs; +#if YYERROR_VERBOSE yyn = yypact[yystate]; - if (yyn > YYFLAG && yyn < YYLAST) - { - int size = 0; - char *msg; - int x, count; + if (YYPACT_NINF < yyn && yyn < YYLAST) + { + YYSIZE_T yysize = 0; + int yytype = YYTRANSLATE (yychar); + char *yymsg; + int yyx, yycount; - 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"); + yycount = 0; + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + yysize += yystrlen (yytname[yyx]) + 15, yycount++; + yysize += yystrlen ("syntax error, unexpected ") + 1; + yysize += yystrlen (yytname[yytype]); + yymsg = (char *) YYSTACK_ALLOC (yysize); + if (yymsg != 0) + { + char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); + yyp = yystpcpy (yyp, yytname[yytype]); - 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++; - } - } - bgl_undir_error(msg); - free(msg); - } - else - bgl_undir_error ("parse error; also virtual memory exceeded"); - } + if (yycount < 5) + { + yycount = 0; + for (yyx = yyn < 0 ? -yyn : 0; + yyx < (int) (sizeof (yytname) / sizeof (char *)); + yyx++) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + const char *yyq = ! yycount ? ", expecting " : " or "; + yyp = yystpcpy (yyp, yyq); + yyp = yystpcpy (yyp, yytname[yyx]); + yycount++; + } + } + yyerror (yymsg); + YYSTACK_FREE (yymsg); + } + else + yyerror ("syntax error; also virtual memory exhausted"); + } else #endif /* YYERROR_VERBOSE */ - bgl_undir_error("parse error"); + yyerror ("syntax 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. */ + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ - /* return failure if at end of input */ - if (bgl_undir_char == YYEOF) - YYABORT; + /* Return failure if at end of input. */ + if (yychar == YYEOF) + { + /* Pop the error token. */ + YYPOPSTACK; + /* Pop the rest of the stack. */ + while (yyss < yyssp) + { + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[*yyssp], yyvsp); + YYPOPSTACK; + } + YYABORT; + } -#if YYDEBUG != 0 - if (bgl_undir_debug) - fprintf(stderr, "Discarding token %d (%s).\n", bgl_undir_char, yytname[bgl_undir_char1]); -#endif + YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); + yydestruct (yytoken, &yylval); + yychar = YYEMPTY; - bgl_undir_char = YYEMPTY; } - /* Else will try to reuse lookahead token - after shifting the error token. */ + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; - yyerrstatus = 3; /* Each real token shifted decrements this */ - goto yyerrhandle; +/*----------------------------------------------------. +| yyerrlab1 -- error raised explicitly by an action. | +`----------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ -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 (bgl_undir_debug) + for (;;) { - short *ssp1 = yyss - 1; - fprintf (stderr, "Error: state stack now"); - while (ssp1 != yyssp) - fprintf (stderr, " %d", *++ssp1); - fprintf (stderr, "\n"); + yyn = yypact[yystate]; + if (yyn != YYPACT_NINF) + { + yyn += YYTERROR; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); + yydestruct (yystos[yystate], yyvsp); + yyvsp--; + yystate = *--yyssp; + + YY_STACK_PRINT (yyss, yyssp); } -#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 (bgl_undir_debug) - fprintf(stderr, "Shifting error token, "); -#endif + YYDPRINTF ((stderr, "Shifting error token, ")); + + *++yyvsp = yylval; - *++yyvsp = bgl_undir_lval; -#ifdef YYLSP_NEEDED - *++yylsp = yylloc; -#endif yystate = yyn; goto yynewstate; - yyacceptlab: - /* YYACCEPT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); -#endif - } - return 0; - yyabortlab: - /* YYABORT comes here. */ - if (yyfree_stacks) - { - free (yyss); - free (yyvs); -#ifdef YYLSP_NEEDED - free (yyls); +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#ifndef yyoverflow +/*----------------------------------------------. +| yyoverflowlab -- parser overflow comes here. | +`----------------------------------------------*/ +yyoverflowlab: + yyerror ("parser stack overflow"); + yyresult = 2; + /* Fall through. */ #endif - } - return 1; + +yyreturn: +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + return yyresult; } -#line 485 "graphviz_parser.y" + + +#line 493 "graphviz_parser.yy" namespace boost { void read_graphviz(const std::string& filename, GRAPHVIZ_GRAPH& g) { FILE* file = fopen(filename.c_str(), "r"); - bgl_undir_restart(file); + yyrestart(file); void* in = static_cast(file); yyparse(static_cast(&g)); } void read_graphviz(FILE* file, GRAPHVIZ_GRAPH& g) { void* in = static_cast(file); - bgl_undir_restart(file); + yyrestart(file); yyparse(static_cast(&g)); } } +