From 8d66dc48fd5c49ab8c8c56073d8252eb08a5fb40 Mon Sep 17 00:00:00 2001 From: ccremers Date: Tue, 5 Dec 2006 10:10:17 +0000 Subject: [PATCH] - Fixed intruder generated value displays. --- src/arachne.c | 3 + src/dotout.c | 129 ++- src/parser.c | 1834 +++++++++++++++++++++----------------- src/parser.h | 92 +- src/scanner.c | 2365 +++++++++++++++++++++++++------------------------ src/term.c | 6 +- src/term.h | 4 +- 7 files changed, 2384 insertions(+), 2049 deletions(-) diff --git a/src/arachne.c b/src/arachne.c index 7ef9fdf..e9af35c 100644 --- a/src/arachne.c +++ b/src/arachne.c @@ -1740,6 +1740,9 @@ createNewTermGeneric (Termlist tl, Term t) memcpy (newterm, t, sizeof (struct term)); TermRunid (newterm) = freenumber; + /* The type of the new term should be that of the parent! */ + newterm->stype = termlistAppend (NULL, t); + /* return */ return termlistPrepend (tl, newterm); } diff --git a/src/dotout.c b/src/dotout.c index c33b3aa..5f1cf3d 100644 --- a/src/dotout.c +++ b/src/dotout.c @@ -5,6 +5,7 @@ #include "arachne.h" #include "binding.h" #include "depend.h" +#include "type.h" #include "debug.h" extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c @@ -63,8 +64,29 @@ static System sys = NULL; * code */ +//! Is this term chosen by the intruder? +int +isIntruderChoice (const Term t) +{ + if (realTermLeaf (t)) + { + if (TermRunid (t) >= sys->maxruns) + { + // Chosen by intruder + // However, if it is a rolename, this is not really what we mean + if (!(t->roleVar || isAgentType (t->stype))) + { + // Not a role variable, and chosen by the intruder: that's it + return true; + } + } + } + return false; +} + +//! Print the run identifier in some meaningful way void -printVisualRun (int rid) +printVisualRunID (int rid) { int run; int displayi; @@ -99,11 +121,20 @@ printVisualRun (int rid) } else { - // >= sys->maxruns means intruder choice - eprintf ("Intruder%i", (rid - sys->maxruns + 1)); + eprintf ("%i", (rid - sys->maxruns + 1)); } } +void +printVisualRun (const Term t) +{ + if (isIntruderChoice (t)) + { + eprintf ("Intruder"); + } + printVisualRunID (TermRunid (t)); +} + //! Remap term stuff void termPrintRemap (const Term t) @@ -113,12 +144,16 @@ termPrintRemap (const Term t) //! Remap term list void -termlistPrintRemap (Termlist tl) +termlistPrintRemap (Termlist tl, char *sep) { while (tl != NULL) { - termPrintRemap(tl->term); + termPrintRemap (tl->term); tl = tl->next; + if (tl != NULL) + { + eprintf ("%s", sep); + } } } @@ -1263,7 +1298,7 @@ printRunExplanation (const System sys, const int run, int hadcontent; eprintf ("Run "); - printVisualRun (run); + printVisualRunID (run); eprintf (runrolesep); // Print first line @@ -1700,57 +1735,55 @@ dotSemiState (const System mysys) from_intruder_count = drawAllBindings (sys); // Third, the intruder node (if needed) - { - /* - * Stupid brute analysis, can probably be done much more efficient, but - * this is not a timing critical bit, so we just do it like this. - */ - Termlist found; - List bl; + { + /* + * Stupid brute analysis, can probably be done much more efficient, but + * this is not a timing critical bit, so we just do it like this. + */ + Termlist found; + List bl; - // collect the intruder-generated constants - found = NULL; - for (bl = sys->bindings; bl != NULL; bl = bl->next) - { - Binding b; + // collect the intruder-generated constants + found = NULL; + for (bl = sys->bindings; bl != NULL; bl = bl->next) + { + Binding b; - b = (Binding) bl->data; - if (!b->blocked) - { - int addsubterms(Term t) + b = (Binding) bl->data; + if (!b->blocked) + { + int addsubterms (Term t) { - if (TermRunid(t) >= sys->maxruns) + if (isIntruderChoice (t)) { - // >= sys->maxruns means intruder choice - found = termlistAddNew(found, t); + found = termlistAddNew (found, t); } return true; } - term_iterate_open_leaves(b->term, addsubterms); - } - } + term_iterate_open_leaves (b->term, addsubterms); + } + } - // now maybe we draw the node - if ((from_intruder_count > 0) || (found != NULL)) - { - eprintf - ("\tintruder [\n"); - eprintf ("\t\tlabel=\""); - eprintf ("Initial intruder knowledge"); - if (found != NULL) - { - eprintf ("\\n"); - eprintf ("The intruder generates: "); - termlistPrintRemap (found); - } - eprintf ("\",\n"); - eprintf ("\t\tstyle=filled,fillcolor=\""); - printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS); - eprintf ("\"\n\t];\n"); - } - termlistDelete(found); - } + // now maybe we draw the node + if ((from_intruder_count > 0) || (found != NULL)) + { + eprintf ("\tintruder [\n"); + eprintf ("\t\tlabel=\""); + eprintf ("Initial intruder knowledge"); + if (found != NULL) + { + eprintf ("\\n"); + eprintf ("The intruder generates: "); + termlistPrintRemap (found, ", "); + } + eprintf ("\",\n"); + eprintf ("\t\tstyle=filled,fillcolor=\""); + printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS); + eprintf ("\"\n\t];\n"); + } + termlistDelete (found); + } // eprintf ("\t};\n"); diff --git a/src/parser.c b/src/parser.c index f04be9a..e1f306f 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 @@ -18,13 +20,21 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. -/* Written by Richard Stallman by simplifying the original so called - ``semantic'' parser. */ + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton 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 @@ -37,7 +47,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.1" +#define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,27 +65,28 @@ # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ - enum yytokentype { - ID = 258, - PROTOCOL = 259, - ROLE = 260, - READT = 261, - SENDT = 262, - CLAIMT = 263, - VAR = 264, - CONST = 265, - RUN = 266, - SECRET = 267, - COMPROMISED = 268, - INVERSEKEYS = 269, - UNTRUSTED = 270, - USERTYPE = 271, - SINGULAR = 272, - FUNCTION = 273, - HASHFUNCTION = 274, - KNOWS = 275, - TRUSTED = 276 - }; +enum yytokentype +{ + ID = 258, + PROTOCOL = 259, + ROLE = 260, + READT = 261, + SENDT = 262, + CLAIMT = 263, + VAR = 264, + CONST = 265, + RUN = 266, + SECRET = 267, + COMPROMISED = 268, + INVERSEKEYS = 269, + UNTRUSTED = 270, + USERTYPE = 271, + SINGULAR = 272, + FUNCTION = 273, + HASHFUNCTION = 274, + KNOWS = 275, + TRUSTED = 276 +}; #endif /* Tokens. */ #define ID 258 @@ -108,10 +119,10 @@ /* #include "lex.yy.c" */ #include "tac.h" -struct tacnode* spdltac; +struct tacnode *spdltac; -int yyerror(char *s); -int yylex(void); +int yyerror (char *s); +int yylex (void); @@ -133,17 +144,19 @@ int yylex(void); # define YYTOKEN_TABLE 0 #endif -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE #line 13 "parser.y" -typedef union YYSTYPE { - char* str; - struct tacnode* tac; - Symbol symb; - int value; -} YYSTYPE; -/* Line 196 of yacc.c. */ -#line 146 "parser.c" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +{ + char *str; + struct tacnode *tac; + Symbol symb; + int value; +} +/* Line 193 of yacc.c. */ +#line 157 "parser.c" +YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif @@ -153,27 +166,60 @@ typedef union YYSTYPE { /* Copy the second part of user declarations. */ -/* Line 219 of yacc.c. */ -#line 158 "parser.c" +/* Line 216 of yacc.c. */ +#line 170 "parser.c" -#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) -# define YYSIZE_T __SIZE_TYPE__ +#ifdef short +# undef short #endif -#if ! defined (YYSIZE_T) && defined (size_t) -# define YYSIZE_T size_t + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; #endif -#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#elif (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +typedef signed char yytype_int8; +#else +typedef short int yytype_int8; #endif -#if ! defined (YYSIZE_T) -# define YYSIZE_T unsigned int + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; #endif +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif @@ -182,7 +228,32 @@ typedef union YYSTYPE { # endif #endif -#if ! defined (yyoverflow) || YYERROR_VERBOSE +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(e) ((void) (e)) +#else +# define YYUSE(e) /* empty */ +#endif + +/* Identity function, used to suppress warnings about constant conditions. */ +#ifndef lint +# define YYID(n) (n) +#else +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static int +YYID (int i) +#else +static int +YYID (i) + int i; +#endif +{ + return i; +} +#endif + +#if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -190,66 +261,78 @@ typedef union YYSTYPE { # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if defined (__STDC__) || defined (__cplusplus) -# include /* INFRINGES ON USER NAME SPACE */ -# define YYINCLUDED_STDLIB_H +# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif -# ifdef __cplusplus -extern "C" { +# if (defined __cplusplus && ! defined _STDLIB_H \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef _STDLIB_H +# define _STDLIB_H 1 +# endif # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ - && (defined (__STDC__) || defined (__cplusplus))) -void free (void *); /* INFRINGES ON USER NAME SPACE */ +# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif -# ifdef __cplusplus -} -# endif # endif -#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ -#if (! defined (yyoverflow) \ - && (! defined (__cplusplus) \ - || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - short int yyss; + yytype_int16 yyss; YYSTYPE yyvs; - }; +}; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) @@ -257,13 +340,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined (__GNUC__) && 1 < __GNUC__ +# if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -274,7 +357,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (0) + while (YYID (0)) # endif # endif @@ -292,28 +375,22 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (0) + while (YYID (0)) #endif -#if defined (__STDC__) || defined (__cplusplus) - typedef signed char yysigned_char; -#else - typedef short int yysigned_char; -#endif - -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 28 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 114 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 31 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 23 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 50 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 121 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -324,91 +401,86 @@ union yyalloc ((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, - 23, 24, 2, 2, 28, 2, 27, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 29, 22, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 30, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 25, 2, 26, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21 +static const yytype_uint8 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, + 23, 24, 2, 2, 28, 2, 27, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 29, 22, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 30, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 25, 2, 26, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const unsigned char yyprhs[] = -{ - 0, 0, 3, 5, 6, 9, 13, 20, 30, 34, - 36, 37, 40, 43, 51, 52, 54, 55, 57, 58, - 61, 64, 67, 74, 81, 88, 92, 96, 102, 108, - 113, 121, 125, 126, 128, 129, 132, 133, 136, 139, - 140, 142, 144, 146, 151, 156, 160, 162, 166, 168, - 172 +static const yytype_uint8 yyprhs[] = { + 0, 0, 3, 5, 6, 9, 13, 20, 30, 34, + 36, 37, 40, 43, 51, 52, 54, 55, 57, 58, + 61, 64, 67, 74, 81, 88, 92, 96, 102, 108, + 113, 121, 125, 126, 128, 129, 132, 133, 136, 139, + 140, 142, 144, 146, 151, 156, 160, 162, 166, 168, + 172 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yysigned_char yyrhs[] = -{ - 32, 0, -1, 33, -1, -1, 34, 33, -1, 15, - 51, 22, -1, 11, 41, 23, 51, 24, 22, -1, - 4, 3, 23, 51, 24, 25, 35, 26, 38, -1, - 16, 51, 22, -1, 43, -1, -1, 36, 35, -1, - 43, 35, -1, 37, 5, 3, 25, 39, 26, 38, - -1, -1, 17, -1, -1, 22, -1, -1, 40, 39, - -1, 43, 39, -1, 42, 39, -1, 6, 47, 23, - 51, 24, 22, -1, 7, 47, 23, 51, 24, 22, - -1, 8, 48, 23, 51, 24, 22, -1, 3, 27, - 3, -1, 20, 51, 22, -1, 44, 10, 52, 45, - 22, -1, 44, 9, 52, 46, 22, -1, 12, 52, - 45, 22, -1, 14, 23, 50, 28, 50, 24, 22, - -1, 13, 51, 22, -1, -1, 12, -1, -1, 29, - 3, -1, -1, 29, 52, -1, 30, 3, -1, -1, - 47, -1, 3, -1, 49, -1, 3, 23, 51, 24, - -1, 25, 51, 26, 53, -1, 23, 51, 24, -1, - 50, -1, 50, 28, 51, -1, 49, -1, 49, 28, - 52, -1, 50, -1 +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const yytype_int8 yyrhs[] = { + 32, 0, -1, 33, -1, -1, 34, 33, -1, 15, + 51, 22, -1, 11, 41, 23, 51, 24, 22, -1, + 4, 3, 23, 51, 24, 25, 35, 26, 38, -1, + 16, 51, 22, -1, 43, -1, -1, 36, 35, -1, + 43, 35, -1, 37, 5, 3, 25, 39, 26, 38, + -1, -1, 17, -1, -1, 22, -1, -1, 40, 39, + -1, 43, 39, -1, 42, 39, -1, 6, 47, 23, + 51, 24, 22, -1, 7, 47, 23, 51, 24, 22, + -1, 8, 48, 23, 51, 24, 22, -1, 3, 27, + 3, -1, 20, 51, 22, -1, 44, 10, 52, 45, + 22, -1, 44, 9, 52, 46, 22, -1, 12, 52, + 45, 22, -1, 14, 23, 50, 28, 50, 24, 22, + -1, 13, 51, 22, -1, -1, 12, -1, -1, 29, + 3, -1, -1, 29, 52, -1, 30, 3, -1, -1, + 47, -1, 3, -1, 49, -1, 3, 23, 51, 24, + -1, 25, 51, 26, 53, -1, 23, 51, 24, -1, + 50, -1, 50, 28, 51, -1, 49, -1, 49, 28, + 52, -1, 50, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const unsigned short int yyrline[] = -{ - 0, 69, 69, 74, 75, 79, 85, 92, 100, 106, - 113, 114, 116, 120, 132, 133, 138, 139, 144, 145, - 147, 149, 153, 160, 167, 176, 184, 191, 198, 205, - 211, 217, 225, 228, 236, 240, 248, 252, 258, 263, - 264, 269, 277, 279, 285, 289, 295, 297, 301, 303, - 307 +static const yytype_uint16 yyrline[] = { + 0, 69, 69, 74, 75, 79, 85, 92, 100, 106, + 113, 114, 116, 120, 132, 133, 138, 139, 144, 145, + 147, 149, 153, 160, 167, 176, 184, 191, 198, 205, + 211, 217, 225, 228, 236, 240, 248, 252, 258, 263, + 264, 269, 277, 279, 285, 289, 295, 297, 301, 303, + 307 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = { "$end", "error", "$undefined", "ID", "PROTOCOL", "ROLE", "READT", "SENDT", "CLAIMT", "VAR", "CONST", "RUN", "SECRET", "COMPROMISED", "INVERSEKEYS", "UNTRUSTED", "USERTYPE", "SINGULAR", "FUNCTION", @@ -424,91 +496,84 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const unsigned short int yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 59, 40, 41, 123, 125, 46, 44, 58, - 95 +static const yytype_uint16 yytoknum[] = { + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 59, 40, 41, 123, 125, 46, 44, 58, + 95 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const unsigned char yyr1[] = -{ - 0, 31, 32, 33, 33, 34, 34, 34, 34, 34, - 35, 35, 35, 36, 37, 37, 38, 38, 39, 39, - 39, 39, 40, 40, 40, 41, 42, 43, 43, 43, - 43, 43, 44, 44, 45, 45, 46, 46, 47, 48, - 48, 49, 50, 50, 50, 50, 51, 51, 52, 52, - 53 +static const yytype_uint8 yyr1[] = { + 0, 31, 32, 33, 33, 34, 34, 34, 34, 34, + 35, 35, 35, 36, 37, 37, 38, 38, 39, 39, + 39, 39, 40, 40, 40, 41, 42, 43, 43, 43, + 43, 43, 44, 44, 45, 45, 46, 46, 47, 48, + 48, 49, 50, 50, 50, 50, 51, 51, 52, 52, + 53 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const unsigned char yyr2[] = -{ - 0, 2, 1, 0, 2, 3, 6, 9, 3, 1, - 0, 2, 2, 7, 0, 1, 0, 1, 0, 2, - 2, 2, 6, 6, 6, 3, 3, 5, 5, 4, - 7, 3, 0, 1, 0, 2, 0, 2, 2, 0, - 1, 1, 1, 4, 4, 3, 1, 3, 1, 3, - 1 +static const yytype_uint8 yyr2[] = { + 0, 2, 1, 0, 2, 3, 6, 9, 3, 1, + 0, 2, 2, 7, 0, 1, 0, 1, 0, 2, + 2, 2, 6, 6, 6, 3, 3, 5, 5, 4, + 7, 3, 0, 1, 0, 2, 0, 2, 2, 0, + 1, 1, 1, 4, 4, 3, 1, 3, 1, 3, + 1 }; /* 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[] = -{ - 32, 0, 0, 33, 0, 0, 0, 0, 0, 2, - 32, 9, 0, 0, 0, 0, 41, 48, 34, 41, - 0, 0, 42, 46, 0, 0, 0, 0, 1, 4, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 5, 8, 36, 34, 0, 25, - 0, 49, 35, 29, 0, 45, 0, 47, 0, 0, - 0, 0, 0, 0, 43, 50, 44, 0, 37, 28, - 27, 32, 6, 0, 15, 0, 32, 0, 32, 30, - 16, 11, 0, 12, 17, 7, 0, 32, 0, 0, - 39, 0, 0, 32, 32, 32, 0, 0, 0, 40, - 0, 0, 16, 19, 21, 20, 38, 0, 0, 0, - 26, 13, 0, 0, 0, 0, 0, 0, 22, 23, - 24 +static const yytype_uint8 yydefact[] = { + 32, 0, 0, 33, 0, 0, 0, 0, 0, 2, + 32, 9, 0, 0, 0, 0, 41, 48, 34, 41, + 0, 0, 42, 46, 0, 0, 0, 0, 1, 4, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 31, 0, 5, 8, 36, 34, 0, 25, + 0, 49, 35, 29, 0, 45, 0, 47, 0, 0, + 0, 0, 0, 0, 43, 50, 44, 0, 37, 28, + 27, 32, 6, 0, 15, 0, 32, 0, 32, 30, + 16, 11, 0, 12, 17, 7, 0, 32, 0, 0, + 39, 0, 0, 32, 32, 32, 0, 0, 0, 40, + 0, 0, 16, 19, 21, 20, 38, 0, 0, 0, + 26, 13, 0, 0, 0, 0, 0, 0, 22, 23, + 24 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yysigned_char yydefgoto[] = -{ - -1, 8, 9, 10, 75, 76, 77, 85, 92, 93, - 15, 94, 95, 12, 37, 60, 97, 100, 22, 23, - 24, 18, 66 +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int8 yydefgoto[] = { + -1, 8, 9, 10, 75, 76, 77, 85, 92, 93, + 15, 94, 95, 12, 37, 60, 97, 100, 22, 23, + 24, 18, 66 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -85 -static const yysigned_char yypact[] = -{ - 75, 1, 10, 17, 0, -1, 0, 0, 24, -85, - 75, -85, 9, 4, 15, 8, -85, 16, 7, 14, - 0, 0, -85, 18, 21, 0, 28, 29, -85, -85, - 17, 17, 0, 50, 0, 17, 52, 32, 0, 36, - 30, 0, -85, 38, -85, -85, 39, 7, 43, -85, - 45, -85, -85, -85, 46, -85, 0, -85, 0, 17, - 54, 59, 47, 60, -85, -85, -85, 68, -85, -85, - -85, 35, -85, 61, -85, 48, 35, 79, 35, -85, - 71, -85, 91, -85, -85, -85, 70, 51, 66, 66, - 66, 0, 72, 51, 51, 51, 94, 76, 77, -85, - 81, 83, 71, -85, -85, -85, -85, 0, 0, 0, - -85, -85, 82, 84, 85, 88, 89, 90, -85, -85, - -85 +static const yytype_int8 yypact[] = { + 75, 1, 10, 17, 0, -1, 0, 0, 24, -85, + 75, -85, 9, 4, 15, 8, -85, 16, 7, 14, + 0, 0, -85, 18, 21, 0, 28, 29, -85, -85, + 17, 17, 0, 50, 0, 17, 52, 32, 0, 36, + 30, 0, -85, 38, -85, -85, 39, 7, 43, -85, + 45, -85, -85, -85, 46, -85, 0, -85, 0, 17, + 54, 59, 47, 60, -85, -85, -85, 68, -85, -85, + -85, 35, -85, 61, -85, 48, 35, 79, 35, -85, + 71, -85, 91, -85, -85, -85, 70, 51, 66, 66, + 66, 0, 72, 51, 51, 51, 94, 76, 77, -85, + 81, 83, 71, -85, -85, -85, -85, 0, 0, 0, + -85, -85, 82, 84, 85, 88, 89, 90, -85, -85, + -85 }; /* YYPGOTO[NTERM-NUM]. */ -static const yysigned_char yypgoto[] = -{ - -85, -85, 97, -85, -71, -85, -85, 11, -84, -85, - -85, -85, 2, -85, 67, -85, -60, -85, 3, -17, - -6, -14, -85 +static const yytype_int8 yypgoto[] = { + -85, -85, 97, -85, -71, -85, -85, 11, -84, -85, + -85, -85, 2, -85, 67, -85, -60, -85, 3, -17, + -6, -14, -85 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -516,55 +581,52 @@ static const yysigned_char yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -19 -static const yysigned_char yytable[] = -{ - 26, 27, 11, 19, 13, 81, 17, 83, 43, 103, - 104, 105, 11, 14, 39, 40, 46, 47, 30, 31, - 16, 51, 25, 20, 28, 21, 48, 32, 50, 98, - 99, 34, 54, 17, 17, 57, 36, 38, 17, 65, - -14, 67, 33, 42, 35, 68, 41, 3, 4, 5, - 44, 45, 74, 49, 53, 52, 56, 88, 89, 90, - 55, -10, 17, 3, 4, 5, 58, 62, 59, 63, - 64, 91, 71, 78, 80, -3, 69, -18, 78, 1, - 78, 70, 72, 79, 82, 101, 2, 3, 4, 5, - 6, 7, 73, 84, 86, 87, 96, 106, 102, 107, - 108, 112, 113, 114, 109, 110, 115, 29, 116, 117, - 118, 119, 120, 111, 61 +static const yytype_int8 yytable[] = { + 26, 27, 11, 19, 13, 81, 17, 83, 43, 103, + 104, 105, 11, 14, 39, 40, 46, 47, 30, 31, + 16, 51, 25, 20, 28, 21, 48, 32, 50, 98, + 99, 34, 54, 17, 17, 57, 36, 38, 17, 65, + -14, 67, 33, 42, 35, 68, 41, 3, 4, 5, + 44, 45, 74, 49, 53, 52, 56, 88, 89, 90, + 55, -10, 17, 3, 4, 5, 58, 62, 59, 63, + 64, 91, 71, 78, 80, -3, 69, -18, 78, 1, + 78, 70, 72, 79, 82, 101, 2, 3, 4, 5, + 6, 7, 73, 84, 86, 87, 96, 106, 102, 107, + 108, 112, 113, 114, 109, 110, 115, 29, 116, 117, + 118, 119, 120, 111, 61 }; -static const unsigned char yycheck[] = -{ - 6, 7, 0, 3, 3, 76, 3, 78, 25, 93, - 94, 95, 10, 3, 20, 21, 30, 31, 9, 10, - 3, 35, 23, 23, 0, 25, 32, 23, 34, 89, - 90, 23, 38, 30, 31, 41, 29, 23, 35, 56, - 5, 58, 27, 22, 28, 59, 28, 12, 13, 14, - 22, 22, 17, 3, 22, 3, 26, 6, 7, 8, - 24, 26, 59, 12, 13, 14, 28, 24, 29, 24, - 24, 20, 25, 71, 26, 0, 22, 26, 76, 4, - 78, 22, 22, 22, 5, 91, 11, 12, 13, 14, - 15, 16, 24, 22, 3, 25, 30, 3, 26, 23, - 23, 107, 108, 109, 23, 22, 24, 10, 24, 24, - 22, 22, 22, 102, 47 +static const yytype_uint8 yycheck[] = { + 6, 7, 0, 3, 3, 76, 3, 78, 25, 93, + 94, 95, 10, 3, 20, 21, 30, 31, 9, 10, + 3, 35, 23, 23, 0, 25, 32, 23, 34, 89, + 90, 23, 38, 30, 31, 41, 29, 23, 35, 56, + 5, 58, 27, 22, 28, 59, 28, 12, 13, 14, + 22, 22, 17, 3, 22, 3, 26, 6, 7, 8, + 24, 26, 59, 12, 13, 14, 28, 24, 29, 24, + 24, 20, 25, 71, 26, 0, 22, 26, 76, 4, + 78, 22, 22, 22, 5, 91, 11, 12, 13, 14, + 15, 16, 24, 22, 3, 25, 30, 3, 26, 23, + 23, 107, 108, 109, 23, 22, 24, 10, 24, 24, + 22, 22, 22, 102, 47 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const unsigned char yystos[] = -{ - 0, 4, 11, 12, 13, 14, 15, 16, 32, 33, - 34, 43, 44, 3, 3, 41, 3, 49, 52, 3, - 23, 25, 49, 50, 51, 23, 51, 51, 0, 33, - 9, 10, 23, 27, 23, 28, 29, 45, 23, 51, - 51, 28, 22, 50, 22, 22, 52, 52, 51, 3, - 51, 52, 3, 22, 51, 24, 26, 51, 28, 29, - 46, 45, 24, 24, 24, 50, 53, 50, 52, 22, - 22, 25, 22, 24, 17, 35, 36, 37, 43, 22, - 26, 35, 5, 35, 22, 38, 3, 25, 6, 7, - 8, 20, 39, 40, 42, 43, 30, 47, 47, 47, - 48, 51, 26, 39, 39, 39, 3, 23, 23, 23, - 22, 38, 51, 51, 51, 24, 24, 24, 22, 22, - 22 +static const yytype_uint8 yystos[] = { + 0, 4, 11, 12, 13, 14, 15, 16, 32, 33, + 34, 43, 44, 3, 3, 41, 3, 49, 52, 3, + 23, 25, 49, 50, 51, 23, 51, 51, 0, 33, + 9, 10, 23, 27, 23, 28, 29, 45, 23, 51, + 51, 28, 22, 50, 22, 22, 52, 52, 51, 3, + 51, 52, 3, 22, 51, 24, 26, 51, 28, 29, + 46, 45, 24, 24, 24, 50, 53, 50, 52, 22, + 22, 25, 22, 24, 17, 35, 36, 37, 43, 22, + 26, 35, 5, 35, 22, 38, 3, 25, 6, 7, + 8, 20, 39, 40, 42, 43, 30, 47, 47, 47, + 48, 51, 26, 39, 39, 39, 3, 23, 23, 23, + 22, 38, 51, 51, 51, 24, 24, 24, 22, 22, + 22 }; #define yyerrok (yyerrstatus = 0) @@ -592,7 +654,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK; \ + YYPOPSTACK (1); \ goto yybackup; \ } \ else \ @@ -600,7 +662,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (0) +while (YYID (0)) #define YYTERROR 1 @@ -615,7 +677,7 @@ while (0) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (N) \ + if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -629,7 +691,7 @@ while (0) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (0) + while (YYID (0)) #endif @@ -641,8 +703,8 @@ while (0) # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -661,7 +723,7 @@ while (0) #if YYDEBUG # ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif @@ -669,36 +731,97 @@ while (0) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (0) +} while (YYID (0)) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yysymprint (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (YYID (0)) + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + + /*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) + static void +yy_symbol_value_print (FILE * yyoutput, int yytype, + YYSTYPE const *const yyvaluep) +#else + static void +yy_symbol_value_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const *const yyvaluep; +#endif +{ + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# else + YYUSE (yyoutput); +# endif + switch (yytype) + { + default: + break; + } +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +static void +yy_symbol_print (FILE * yyoutput, int yytype, YYSTYPE const *const yyvaluep) +#else +static void +yy_symbol_print (yyoutput, yytype, yyvaluep) + FILE *yyoutput; + int yytype; + YYSTYPE const *const yyvaluep; +#endif +{ + if (yytype < YYNTOKENS) + YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); + else + YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); + + yy_symbol_value_print (yyoutput, yytype, yyvaluep); + YYFPRINTF (yyoutput, ")"); +} /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (short int *bottom, short int *top) +yy_stack_print (yytype_int16 * bottom, yytype_int16 * top) #else static void yy_stack_print (bottom, top) - short int *bottom; - short int *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); - for (/* Nothing. */; bottom <= top; ++bottom) + for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } @@ -707,37 +830,44 @@ yy_stack_print (bottom, top) do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ -} while (0) +} while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (int yyrule) +yy_reduce_print (YYSTYPE * yyvsp, int yyrule) #else static void -yy_reduce_print (yyrule) - int yyrule; +yy_reduce_print (yyvsp, yyrule) + YYSTYPE *yyvsp; + int yyrule; #endif { + int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", - yyrule - 1, yylno); - /* Print the symbols being reduced, and their result. */ - for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) - YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); - YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); + YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + fprintf (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + &(yyvsp[(yyi + 1) - (yynrhs)])); + fprintf (stderr, "\n"); + } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ - yy_reduce_print (Rule); \ -} while (0) + yy_reduce_print (yyvsp, Rule); \ +} while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ @@ -765,48 +895,50 @@ int yydebug; #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif - + #if YYERROR_VERBOSE # ifndef yystrlen -# if defined (__GLIBC__) && defined (_STRING_H) +# if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -# if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) -# else +#else +static YYSIZE_T yystrlen (yystr) const char *yystr; -# endif +#endif { - const char *yys = yystr; - - while (*yys++ != '\0') + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) continue; - - return yys - yystr - 1; + return yylen; } # endif # endif # ifndef yystpcpy -# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) +# 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. */ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) static char * -# if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) -# else +#else +static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; -# endif +#endif { char *yyd = yydest; const char *yys = yysrc; @@ -832,7 +964,7 @@ yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { - size_t yyn = 0; + YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) @@ -857,75 +989,145 @@ yytnamerr (char *yyres, const char *yystr) yyres[yyn] = '\0'; return yyn; } - do_not_strip_quotes: ; + do_not_strip_quotes:; } - if (! yyres) + if (!yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif -#endif /* YYERROR_VERBOSE */ +/* Copy into YYRESULT an error message about the unexpected token + YYCHAR while in state YYSTATE. Return the number of bytes copied, + including the terminating null byte. If YYRESULT is null, do not + copy anything; just return the number of bytes that would be + copied. As a special case, return 0 if an ordinary "syntax error" + message will do. Return YYSIZE_MAXIMUM if overflow occurs during + size calculation. */ +static YYSIZE_T +yysyntax_error (char *yyresult, int yystate, int yychar) +{ + int yyn = yypact[yystate]; + if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) + return 0; + else + { + int yytype = YYTRANSLATE (yychar); + YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); + YYSIZE_T yysize = yysize0; + YYSIZE_T yysize1; + int yysize_overflow = 0; + enum + { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; + int yyx; + +# if 0 + /* This is so xgettext sees the translatable formats that are + constructed on the fly. */ + YY_ ("syntax error, unexpected %s"); + YY_ ("syntax error, unexpected %s, expecting %s"); + YY_ ("syntax error, unexpected %s, expecting %s or %s"); + YY_ ("syntax error, unexpected %s, expecting %s or %s or %s"); + YY_ ("syntax error, unexpected %s, expecting %s or %s or %s or %s"); +# endif + char *yyfmt; + char const *yyf; + static char const yyunexpected[] = "syntax error, unexpected %s"; + static char const yyexpecting[] = ", expecting %s"; + static char const yyor[] = " or %s"; + char yyformat[sizeof yyunexpected + + sizeof yyexpecting - 1 + + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) + * (sizeof yyor - 1))]; + char const *yyprefix = yyexpecting; + + /* Start YYX at -YYN if negative to avoid negative indexes in + YYCHECK. */ + int yyxbegin = yyn < 0 ? -yyn : 0; + + /* Stay within bounds of both yycheck and yytname. */ + int yychecklim = YYLAST - yyn + 1; + int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; + int yycount = 1; + + yyarg[0] = yytname[yytype]; + yyfmt = yystpcpy (yyformat, yyunexpected); + + for (yyx = yyxbegin; yyx < yyxend; ++yyx) + if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) + { + if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) + { + yycount = 1; + yysize = yysize0; + yyformat[sizeof yyunexpected - 1] = '\0'; + break; + } + yyarg[yycount++] = yytname[yyx]; + yysize1 = yysize + yytnamerr (0, yytname[yyx]); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + yyfmt = yystpcpy (yyfmt, yyprefix); + yyprefix = yyor; + } + + yyf = YY_ (yyformat); + yysize1 = yysize + yystrlen (yyf); + yysize_overflow |= (yysize1 < yysize); + yysize = yysize1; + + if (yysize_overflow) + return YYSIZE_MAXIMUM; + + if (yyresult) + { + /* Avoid sprintf, as that infringes on the user's name space. + Don't have undefined behavior even if the translation + produced a string with the wrong number of "%s"s. */ + char *yyp = yyresult; + int yyi = 0; + while ((*yyp = *yyf) != '\0') + { + if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) + { + yyp += yytnamerr (yyp, yyarg[yyi++]); + yyf += 2; + } + else + { + yyp++; + yyf++; + } + } + } + return yysize; + } +} +#endif /* YYERROR_VERBOSE */ -#if YYDEBUG -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -#if defined (__STDC__) || defined (__cplusplus) -static void -yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) -#else -static void -yysymprint (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE *yyvaluep; -#endif -{ - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; - - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); - - -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - switch (yytype) - { - default: - break; - } - YYFPRINTF (yyoutput, ")"); -} - -#endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ -#if defined (__STDC__) || defined (__cplusplus) -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) + /*ARGSUSED*/ +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) + static void +yydestruct (const char *yymsg, int yytype, YYSTYPE * yyvaluep) #else -static void + static void yydestruct (yymsg, yytype, yyvaluep) - const char *yymsg; - int yytype; - YYSTYPE *yyvaluep; + const char *yymsg; + int yytype; + YYSTYPE *yyvaluep; #endif { - /* Pacify ``unused variable'' warnings. */ - (void) yyvaluep; + YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; @@ -934,8 +1136,8 @@ yydestruct (yymsg, yytype, yyvaluep) switch (yytype) { - default: - break; + default: + break; } } @@ -943,13 +1145,13 @@ yydestruct (yymsg, yytype, yyvaluep) /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); -# else +#else int yyparse (); -# endif +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); @@ -974,24 +1176,27 @@ int yynerrs; `----------*/ #ifdef YYPARSE_PARAM -# if defined (__STDC__) || defined (__cplusplus) -int yyparse (void *YYPARSE_PARAM) -# else -int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; -# endif +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) +int +yyparse (void *YYPARSE_PARAM) +#else +int +yyparse (YYPARSE_PARAM) + void *YYPARSE_PARAM; +#endif #else /* ! YYPARSE_PARAM */ -#if defined (__STDC__) || defined (__cplusplus) +#if (defined __STDC__ || defined __C99__FUNC__ \ + || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () - ; #endif #endif { - + int yystate; int yyn; int yyresult; @@ -999,6 +1204,12 @@ yyparse () int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; +#if YYERROR_VERBOSE + /* Buffer for error messages, and its allocated size. */ + char yymsgbuf[128]; + char *yymsg = yymsgbuf; + YYSIZE_T yymsg_alloc = sizeof yymsgbuf; +#endif /* Three stacks and their tools: `yyss': related to states, @@ -1009,9 +1220,9 @@ yyparse () to reallocate them elsewhere. */ /* The state stack. */ - short int yyssa[YYINITDEPTH]; - short int *yyss = yyssa; - short int *yyssp; + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss = yyssa; + yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; @@ -1020,7 +1231,7 @@ yyparse () -#define YYPOPSTACK (yyvsp--, yyssp--) +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; @@ -1029,9 +1240,9 @@ yyparse () YYSTYPE yyval; - /* When reducing, the number of symbols on the RHS of the reduced - rule. */ - int yylen; + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); @@ -1053,13 +1264,12 @@ yyparse () /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +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. - */ + have just been pushed. So pushing a state here evens the stacks. */ yyssp++; - yysetstate: +yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) @@ -1069,22 +1279,20 @@ yyparse () #ifdef yyoverflow { - /* Give user a chance to reallocate the stack. Use copies of + /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), + yyoverflow (YY_ ("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - - &yystacksize); + &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; @@ -1101,10 +1309,10 @@ yyparse () yystacksize = YYMAXDEPTH; { - short int *yyss1 = yyss; + yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) + if (!yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); @@ -1136,12 +1344,10 @@ yyparse () `-----------*/ yybackup: -/* Do appropriate processing given the current state. */ -/* Read a look-ahead token if we need one and don't already have one. */ -/* yyresume: */ + /* Do appropriate processing given the current state. Read a + look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ - yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; @@ -1183,22 +1389,21 @@ yybackup: if (yyn == YYFINAL) YYACCEPT; - /* Shift the look-ahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the token being shifted unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; - - *++yyvsp = yylval; - - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; + /* Shift the look-ahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + + /* Discard the shifted token unless it is eof. */ + if (yychar != YYEOF) + yychar = YYEMPTY; + yystate = yyn; + *++yyvsp = yylval; + goto yynewstate; @@ -1227,366 +1432,452 @@ yyreduce: 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]; + yyval = yyvsp[1 - yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { - case 2: + case 2: #line 70 "parser.y" - { spdltac = (yyvsp[0].tac); ;} - break; + { + spdltac = (yyvsp[(1) - (1)].tac);; + } + break; - case 3: + case 3: #line 74 "parser.y" - { (yyval.tac) = NULL; ;} - break; + { + (yyval.tac) = NULL;; + } + break; - case 4: + case 4: #line 76 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 5: + case 5: #line 80 "parser.y" - { - Tac t = tacCreate(TAC_UNTRUSTED); - t->t1.tac = (yyvsp[-1].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_UNTRUSTED); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ; + } + break; - case 6: + case 6: #line 86 "parser.y" - { - Tac t = tacCreate(TAC_RUN); - t->t1.tac = (yyvsp[-4].tac); - t->t2.tac = (yyvsp[-2].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_RUN); + t->t1.tac = (yyvsp[(2) - (6)].tac); + t->t2.tac = (yyvsp[(4) - (6)].tac); + (yyval.tac) = t; + ; + } + break; - case 7: + case 7: #line 93 "parser.y" - { - Tac t = tacCreate(TAC_PROTOCOL); - t->t1.sym = (yyvsp[-7].symb); - t->t2.tac = (yyvsp[-2].tac); - t->t3.tac = (yyvsp[-5].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_PROTOCOL); + t->t1.sym = (yyvsp[(2) - (9)].symb); + t->t2.tac = (yyvsp[(7) - (9)].tac); + t->t3.tac = (yyvsp[(4) - (9)].tac); + (yyval.tac) = t; + ; + } + break; - case 8: + case 8: #line 101 "parser.y" - { - Tac t = tacCreate(TAC_USERTYPE); - t->t1.tac = (yyvsp[-1].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_USERTYPE); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ; + } + break; - case 9: + case 9: #line 107 "parser.y" - { - (yyval.tac) = (yyvsp[0].tac); - ;} - break; + { + (yyval.tac) = (yyvsp[(1) - (1)].tac); + ; + } + break; - case 10: + case 10: #line 113 "parser.y" - { (yyval.tac) = NULL; ;} - break; + { + (yyval.tac) = NULL;; + } + break; - case 11: + case 11: #line 115 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 12: + case 12: #line 117 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 13: + case 13: #line 121 "parser.y" - { - // TODO process singular (0/1) - Tac t = tacCreate(TAC_ROLE); - t->t1.sym = (yyvsp[-4].symb); - t->t2.tac = (yyvsp[-2].tac); - t->t3.value = (yyvsp[-6].value); - (yyval.tac) = t; - ;} - break; + { + // TODO process singular (0/1) + Tac t = tacCreate (TAC_ROLE); + t->t1.sym = (yyvsp[(3) - (7)].symb); + t->t2.tac = (yyvsp[(5) - (7)].tac); + t->t3.value = (yyvsp[(1) - (7)].value); + (yyval.tac) = t; + ; + } + break; - case 14: + case 14: #line 132 "parser.y" - { (yyval.value) = 0; ;} - break; + { + (yyval.value) = 0;; + } + break; - case 15: + case 15: #line 134 "parser.y" - { (yyval.value) = 1; ;} - break; + { + (yyval.value) = 1;; + } + break; - case 16: + case 16: #line 138 "parser.y" - { ;} - break; + {; + } + break; - case 17: + case 17: #line 140 "parser.y" - { ;} - break; + {; + } + break; - case 18: + case 18: #line 144 "parser.y" - { (yyval.tac) = NULL; ;} - break; + { + (yyval.tac) = NULL;; + } + break; - case 19: + case 19: #line 146 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 20: + case 20: #line 148 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 21: + case 21: #line 150 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-1].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; + } + break; - case 22: + case 22: #line 154 "parser.y" - { Tac t = tacCreate(TAC_READ); - t->t1.sym = (yyvsp[-4].symb); - /* TODO test here: tac2 should have at least 3 elements */ - t->t2.tac = (yyvsp[-2].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_READ); + t->t1.sym = (yyvsp[(2) - (6)].symb); + /* TODO test here: tac2 should have at least 3 elements */ + t->t2.tac = (yyvsp[(4) - (6)].tac); + (yyval.tac) = t; + ; + } + break; - case 23: + case 23: #line 161 "parser.y" - { Tac t = tacCreate(TAC_SEND); - t->t1.sym = (yyvsp[-4].symb); - /* TODO test here: tac2 should have at least 3 elements */ - t->t2.tac = (yyvsp[-2].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_SEND); + t->t1.sym = (yyvsp[(2) - (6)].symb); + /* TODO test here: tac2 should have at least 3 elements */ + t->t2.tac = (yyvsp[(4) - (6)].tac); + (yyval.tac) = t; + ; + } + break; - case 24: + case 24: #line 169 "parser.y" - { Tac t = tacCreate(TAC_CLAIM); - t->t1.sym = (yyvsp[-4].symb); - t->t2.tac = (yyvsp[-2].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_CLAIM); + t->t1.sym = (yyvsp[(2) - (6)].symb); + t->t2.tac = (yyvsp[(4) - (6)].tac); + (yyval.tac) = t; + ; + } + break; - case 25: + case 25: #line 177 "parser.y" - { Tac t = tacCreate(TAC_ROLEREF); - t->t1.sym = (yyvsp[-2].symb); - t->t2.sym = (yyvsp[0].symb); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_ROLEREF); + t->t1.sym = (yyvsp[(1) - (3)].symb); + t->t2.sym = (yyvsp[(3) - (3)].symb); + (yyval.tac) = t; + ; + } + break; - case 26: + case 26: #line 185 "parser.y" - { Tac t = tacCreate(TAC_KNOWS); - t->t1.tac = (yyvsp[-1].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_KNOWS); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ; + } + break; - case 27: + case 27: #line 192 "parser.y" - { Tac t = tacCreate(TAC_CONST); - t->t1.tac = (yyvsp[-2].tac); - t->t2.tac = (yyvsp[-1].tac); - t->t3.tac = (yyvsp[-4].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_CONST); + t->t1.tac = (yyvsp[(3) - (5)].tac); + t->t2.tac = (yyvsp[(4) - (5)].tac); + t->t3.tac = (yyvsp[(1) - (5)].tac); + (yyval.tac) = t; + ; + } + break; - case 28: + case 28: #line 199 "parser.y" - { Tac t = tacCreate(TAC_VAR); - t->t1.tac = (yyvsp[-2].tac); - t->t2.tac = (yyvsp[-1].tac); - t->t3.tac = (yyvsp[-4].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_VAR); + t->t1.tac = (yyvsp[(3) - (5)].tac); + t->t2.tac = (yyvsp[(4) - (5)].tac); + t->t3.tac = (yyvsp[(1) - (5)].tac); + (yyval.tac) = t; + ; + } + break; - case 29: + case 29: #line 206 "parser.y" - { Tac t = tacCreate(TAC_SECRET); - t->t1.tac = (yyvsp[-2].tac); - t->t2.tac = (yyvsp[-1].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_SECRET); + t->t1.tac = (yyvsp[(2) - (4)].tac); + t->t2.tac = (yyvsp[(3) - (4)].tac); + (yyval.tac) = t; + ; + } + break; - case 30: + case 30: #line 212 "parser.y" - { Tac t = tacCreate(TAC_INVERSEKEYS); - t->t1.tac = (yyvsp[-4].tac); - t->t2.tac = (yyvsp[-2].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_INVERSEKEYS); + t->t1.tac = (yyvsp[(3) - (7)].tac); + t->t2.tac = (yyvsp[(5) - (7)].tac); + (yyval.tac) = t; + ; + } + break; - case 31: + case 31: #line 218 "parser.y" - { Tac t = tacCreate(TAC_COMPROMISED); - t->t1.tac= (yyvsp[-1].tac); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_COMPROMISED); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ; + } + break; - case 32: + case 32: #line 225 "parser.y" - { - (yyval.tac) = NULL; - ;} - break; + { + (yyval.tac) = NULL; + ; + } + break; - case 33: + case 33: #line 229 "parser.y" - { - Tac t = tacCreate(TAC_SECRET); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_SECRET); + (yyval.tac) = t; + ; + } + break; - case 34: + case 34: #line 236 "parser.y" - { - Tac t = tacCreate(TAC_UNDEF); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_UNDEF); + (yyval.tac) = t; + ; + } + break; - case 35: + case 35: #line 241 "parser.y" - { Tac t = tacCreate(TAC_STRING); - t->t1.sym = (yyvsp[0].symb); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_STRING); + t->t1.sym = (yyvsp[(2) - (2)].symb); + (yyval.tac) = t; + ; + } + break; - case 36: + case 36: #line 248 "parser.y" - { - Tac t = tacCreate(TAC_UNDEF); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_UNDEF); + (yyval.tac) = t; + ; + } + break; - case 37: + case 37: #line 253 "parser.y" - { - (yyval.tac) = (yyvsp[0].tac); - ;} - break; + { + (yyval.tac) = (yyvsp[(2) - (2)].tac); + ; + } + break; - case 38: + case 38: #line 259 "parser.y" - { (yyval.symb) = (yyvsp[0].symb); ;} - break; + { + (yyval.symb) = (yyvsp[(2) - (2)].symb);; + } + break; - case 39: + case 39: #line 263 "parser.y" - { (yyval.symb) = NULL; ;} - break; + { + (yyval.symb) = NULL;; + } + break; - case 40: + case 40: #line 265 "parser.y" - { ;} - break; + {; + } + break; - case 41: + case 41: #line 270 "parser.y" - { - Tac t = tacCreate(TAC_STRING); - t->t1.sym = (yyvsp[0].symb); - (yyval.tac) = t; - ;} - break; + { + Tac t = tacCreate (TAC_STRING); + t->t1.sym = (yyvsp[(1) - (1)].symb); + (yyval.tac) = t; + ; + } + break; - case 42: + case 42: #line 278 "parser.y" - { ;} - break; + {; + } + break; - case 43: + case 43: #line 280 "parser.y" - { - Tac t = tacCreate(TAC_STRING); - t->t1.sym = (yyvsp[-3].symb); - (yyval.tac) = tacJoin(TAC_ENCRYPT,tacTuple((yyvsp[-1].tac)),t,NULL); - ;} - break; + { + Tac t = tacCreate (TAC_STRING); + t->t1.sym = (yyvsp[(1) - (4)].symb); + (yyval.tac) = + tacJoin (TAC_ENCRYPT, tacTuple ((yyvsp[(3) - (4)].tac)), t, NULL); + ; + } + break; - case 44: + case 44: #line 286 "parser.y" - { - (yyval.tac) = tacJoin(TAC_ENCRYPT,tacTuple((yyvsp[-2].tac)),(yyvsp[0].tac),NULL); - ;} - break; + { + (yyval.tac) = + tacJoin (TAC_ENCRYPT, tacTuple ((yyvsp[(2) - (4)].tac)), + (yyvsp[(4) - (4)].tac), NULL); + ; + } + break; - case 45: + case 45: #line 290 "parser.y" - { - (yyval.tac) = tacTuple((yyvsp[-1].tac)); - ;} - break; + { + (yyval.tac) = tacTuple ((yyvsp[(2) - (3)].tac)); + ; + } + break; - case 46: + case 46: #line 296 "parser.y" - { ;} - break; + {; + } + break; - case 47: + case 47: #line 298 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-2].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (3)].tac), (yyvsp[(3) - (3)].tac));; + } + break; - case 48: + case 48: #line 302 "parser.y" - { ;} - break; + {; + } + break; - case 49: + case 49: #line 304 "parser.y" - { (yyval.tac) = tacCat((yyvsp[-2].tac),(yyvsp[0].tac)); ;} - break; + { + (yyval.tac) = + tacCat ((yyvsp[(1) - (3)].tac), (yyvsp[(3) - (3)].tac));; + } + break; - case 50: + case 50: #line 308 "parser.y" - { ;} - break; + {; + } + break; - default: break; +/* Line 1267 of yacc.c. */ +#line 1803 "parser.c" + default: + break; } + YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); -/* Line 1126 of yacc.c. */ -#line 1585 "parser.c" - - yyvsp -= yylen; - yyssp -= yylen; - - + YYPOPSTACK (yylen); + yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; @@ -1615,110 +1906,41 @@ yyerrlab: if (!yyerrstatus) { ++yynerrs; -#if YYERROR_VERBOSE - yyn = yypact[yystate]; - - if (YYPACT_NINF < yyn && yyn < YYLAST) - { - int yytype = YYTRANSLATE (yychar); - YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); - YYSIZE_T yysize = yysize0; - YYSIZE_T yysize1; - int yysize_overflow = 0; - char *yymsg = 0; -# define YYERROR_VERBOSE_ARGS_MAXIMUM 5 - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - int yyx; - -#if 0 - /* This is so xgettext sees the translatable formats that are - constructed on the fly. */ - YY_("syntax error, unexpected %s"); - YY_("syntax error, unexpected %s, expecting %s"); - YY_("syntax error, unexpected %s, expecting %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s"); - YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); -#endif - char *yyfmt; - char const *yyf; - static char const yyunexpected[] = "syntax error, unexpected %s"; - static char const yyexpecting[] = ", expecting %s"; - static char const yyor[] = " or %s"; - char yyformat[sizeof yyunexpected - + sizeof yyexpecting - 1 - + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) - * (sizeof yyor - 1))]; - char const *yyprefix = yyexpecting; - - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yycount = 1; - - yyarg[0] = yytname[yytype]; - yyfmt = yystpcpy (yyformat, yyunexpected); - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - yyformat[sizeof yyunexpected - 1] = '\0'; - break; - } - yyarg[yycount++] = yytname[yyx]; - yysize1 = yysize + yytnamerr (0, yytname[yyx]); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - yyfmt = yystpcpy (yyfmt, yyprefix); - yyprefix = yyor; - } - - yyf = YY_(yyformat); - yysize1 = yysize + yystrlen (yyf); - yysize_overflow |= yysize1 < yysize; - yysize = yysize1; - - if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) - yymsg = (char *) YYSTACK_ALLOC (yysize); - if (yymsg) - { - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - char *yyp = yymsg; - int yyi = 0; - while ((*yyp = *yyf)) - { - if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyf += 2; - } - else - { - yyp++; - yyf++; - } - } - yyerror (yymsg); +#if ! YYERROR_VERBOSE + yyerror (YY_ ("syntax error")); +#else + { + YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); + if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) + { + YYSIZE_T yyalloc = 2 * yysize; + if (!(yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) + yyalloc = YYSTACK_ALLOC_MAXIMUM; + if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); - } - else - { - yyerror (YY_("syntax error")); + yymsg = (char *) YYSTACK_ALLOC (yyalloc); + if (yymsg) + yymsg_alloc = yyalloc; + else + { + yymsg = yymsgbuf; + yymsg_alloc = sizeof yymsgbuf; + } + } + + if (0 < yysize && yysize <= yymsg_alloc) + { + (void) yysyntax_error (yymsg, yystate, yychar); + yyerror (yymsg); + } + else + { + yyerror (YY_ ("syntax error")); + if (yysize != 0) goto yyexhaustedlab; - } - } - else -#endif /* YYERROR_VERBOSE */ - yyerror (YY_("syntax error")); + } + } +#endif } @@ -1726,14 +1948,14 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) - { + { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; - } + } else { yydestruct ("Error: discarding", yytoken, &yylval); @@ -1754,11 +1976,14 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if (0) - goto yyerrorlab; + if ( /*CONSTCOND*/ 0) + goto yyerrorlab; -yyvsp -= yylen; - yyssp -= yylen; + /* Do not reclaim the symbols of the rule which action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; @@ -1767,7 +1992,7 @@ yyvsp -= yylen; | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { @@ -1789,7 +2014,7 @@ yyerrlab1: yydestruct ("Error: popping", yystos[yystate], yyvsp); - YYPOPSTACK; + YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } @@ -1800,7 +2025,7 @@ yyerrlab1: *++yyvsp = yylval; - /* Shift the error token. */ + /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; @@ -1826,26 +2051,33 @@ yyabortlab: | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: - yyerror (YY_("memory exhausted")); + yyerror (YY_ ("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); + yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); + /* Do not reclaim the symbols of the rule which action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK; + yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); + YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif - return yyresult; +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + /* Make sure YYID is used. */ + return YYID (yyresult); } @@ -1853,13 +2085,11 @@ yyreturn: //! error handler routing -int yyerror(char *s) +int +yyerror (char *s) { - extern int yylineno; //!< defined and maintained in lex.c - extern char *yytext; //!< defined and maintained in lex.c - - error ("%s at symbol '%s' on line %i.\n", s, yytext, yylineno); + extern int yylineno; //!< defined and maintained in lex.c + extern char *yytext; //!< defined and maintained in lex.c + + error ("%s at symbol '%s' on line %i.\n", s, yytext, yylineno); } - - - diff --git a/src/parser.h b/src/parser.h index a7baa6a..ea8af46 100644 --- a/src/parser.h +++ b/src/parser.h @@ -1,7 +1,9 @@ -/* A Bison parser, made by GNU Bison 2.1. */ +/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton parser for Yacc-like parsing with Bison, - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 + 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 @@ -18,37 +20,46 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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. */ +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ - enum yytokentype { - ID = 258, - PROTOCOL = 259, - ROLE = 260, - READT = 261, - SENDT = 262, - CLAIMT = 263, - VAR = 264, - CONST = 265, - RUN = 266, - SECRET = 267, - COMPROMISED = 268, - INVERSEKEYS = 269, - UNTRUSTED = 270, - USERTYPE = 271, - SINGULAR = 272, - FUNCTION = 273, - HASHFUNCTION = 274, - KNOWS = 275, - TRUSTED = 276 - }; +enum yytokentype +{ + ID = 258, + PROTOCOL = 259, + ROLE = 260, + READT = 261, + SENDT = 262, + CLAIMT = 263, + VAR = 264, + CONST = 265, + RUN = 266, + SECRET = 267, + COMPROMISED = 268, + INVERSEKEYS = 269, + UNTRUSTED = 270, + USERTYPE = 271, + SINGULAR = 272, + FUNCTION = 273, + HASHFUNCTION = 274, + KNOWS = 275, + TRUSTED = 276 +}; #endif /* Tokens. */ #define ID 258 @@ -74,22 +85,21 @@ -#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +typedef union YYSTYPE #line 13 "parser.y" -typedef union YYSTYPE { - char* str; - struct tacnode* tac; - Symbol symb; - int value; -} YYSTYPE; -/* Line 1447 of yacc.c. */ -#line 87 "parser.h" -# define yystype YYSTYPE /* obsolescent; will be withdrawn */ +{ + char *str; + struct tacnode *tac; + Symbol symb; + int value; +} +/* Line 1529 of yacc.c. */ +#line 98 "parser.h" +YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yylval; - - - diff --git a/src/scanner.c b/src/scanner.c index df160fc..40e75aa 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -8,7 +8,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 31 +#define YY_FLEX_SUBMINOR_VERSION 33 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -30,7 +30,15 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L +#if __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; @@ -42,7 +50,7 @@ typedef uint32_t flex_uint32_t; 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 char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; #endif /* ! C99 */ @@ -83,14 +91,14 @@ typedef unsigned int flex_uint32_t; /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST -#else /* ! __cplusplus */ +#else /* ! __cplusplus */ #if __STDC__ #define YY_USE_CONST -#endif /* __STDC__ */ -#endif /* ! __cplusplus */ +#endif /* __STDC__ */ +#endif /* ! __cplusplus */ #ifdef YY_USE_CONST #define yyconst const @@ -134,6 +142,10 @@ typedef unsigned int flex_uint32_t; #define YY_BUF_SIZE 16384 #endif +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; @@ -154,14 +166,14 @@ extern FILE *yyin, *yyout; * a 5% performance hit in a non-yylineno scanner, because yy_act is * normally declared as a register variable-- so it is not worth it. */ - #define YY_LESS_LINENO(n) \ +#define YY_LESS_LINENO(n) \ do { \ int yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ if ( yytext[yyl] == '\n' )\ --yylineno;\ }while(0) - + /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ do \ @@ -191,72 +203,72 @@ typedef unsigned int yy_size_t; #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; - 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_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ - int yy_buffer_status; + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + 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 yyrestart()), so that the user can continue scanning by - * just pointing yyin 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 yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ #define YY_BUFFER_EOF_PENDING 2 - }; +}; #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. */ +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 @@ -280,7 +292,7 @@ int yyleng; /* 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_init = 0; /* 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 @@ -288,27 +300,27 @@ static int yy_start = 0; /* start state number */ */ static int yy_did_buffer_switch_on_eof; -void yyrestart (FILE *input_file ); -void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); -void yy_delete_buffer (YY_BUFFER_STATE b ); -void yy_flush_buffer (YY_BUFFER_STATE b ); -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state (void ); +void yyrestart (FILE * input_file); +void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer); +YY_BUFFER_STATE yy_create_buffer (FILE * file, int size); +void yy_delete_buffer (YY_BUFFER_STATE b); +void yy_flush_buffer (YY_BUFFER_STATE b); +void yypush_buffer_state (YY_BUFFER_STATE new_buffer); +void yypop_buffer_state (void); -static void yyensure_buffer_stack (void ); -static void yy_load_buffer_state (void ); -static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); +static void yyensure_buffer_stack (void); +static void yy_load_buffer_state (void); +static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file); #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) -YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); -YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); +YY_BUFFER_STATE yy_scan_buffer (char *base, yy_size_t size); +YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str); +YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes, int len); -void *yyalloc (yy_size_t ); -void *yyrealloc (void *,yy_size_t ); -void yyfree (void * ); +void *yyalloc (yy_size_t); +void *yyrealloc (void *, yy_size_t); +void yyfree (void *); #define yy_new_buffer yy_create_buffer @@ -349,10 +361,10 @@ int yylineno = 1; extern char *yytext; #define yytext_ptr yytext -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[] ); +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 yytext. @@ -369,173 +381,166 @@ static void yy_fatal_error (yyconst char msg[] ); /* 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[148] = - { 0, - 0, 0, 0, 0, 0, 0, 31, 29, 7, 6, - 28, 9, 29, 29, 28, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 3, 3, 2, 30, 4, - 7, 28, 9, 5, 8, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 3, 3, 2, 4, 8, 28, 28, 28, 28, - 28, 28, 28, 28, 28, 28, 28, 17, 28, 28, - 28, 28, 28, 28, 14, 28, 28, 28, 28, 28, - 28, 28, 28, 28, 12, 11, 28, 13, 28, 28, - 28, 28, 16, 28, 15, 28, 28, 28, 28, 26, +{ + flex_int32_t yy_verify; + flex_int32_t yy_nxt; +}; +static yyconst flex_int16_t yy_accept[148] = { 0, + 0, 0, 0, 0, 0, 0, 31, 29, 7, 6, + 28, 9, 29, 29, 28, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 3, 3, 2, 30, 4, + 7, 28, 9, 5, 8, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 3, 3, 2, 4, 8, 28, 28, 28, 28, + 28, 28, 28, 28, 28, 28, 28, 17, 28, 28, + 28, 28, 28, 28, 14, 28, 28, 28, 28, 28, + 28, 28, 28, 28, 12, 11, 28, 13, 28, 28, + 28, 28, 16, 28, 15, 28, 28, 28, 28, 26, - 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, - 28, 28, 18, 28, 28, 28, 28, 28, 28, 28, - 1, 28, 28, 28, 27, 28, 28, 28, 24, 28, - 28, 10, 23, 28, 22, 28, 28, 28, 20, 28, - 28, 28, 21, 28, 19, 25, 0 - } ; + 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, + 28, 28, 18, 28, 28, 28, 28, 28, 28, 28, + 1, 28, 28, 28, 27, 28, 28, 28, 24, 28, + 28, 10, 23, 28, 22, 28, 28, 28, 20, 28, + 28, 28, 21, 28, 19, 25, 0 +}; -static yyconst flex_int32_t yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 5, 6, 7, 1, 1, 1, 5, 1, - 1, 8, 1, 1, 5, 1, 9, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, - 1, 1, 1, 12, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, - 1, 1, 1, 5, 1, 1, 14, 15, 16, 17, +static yyconst flex_int32_t yy_ec[256] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 5, 6, 7, 1, 1, 1, 5, 1, + 1, 8, 1, 1, 5, 1, 9, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 1, 11, 1, + 1, 1, 1, 12, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 1, 1, 1, 5, 1, 1, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 15, 23, 24, 25, 26, - 27, 28, 15, 29, 30, 31, 32, 33, 34, 15, - 35, 15, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 18, 19, 20, 21, 22, 15, 23, 24, 25, 26, + 27, 28, 15, 29, 30, 31, 32, 33, 34, 15, + 35, 15, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 +}; -static yyconst flex_int32_t yy_meta[36] = - { 0, - 1, 1, 2, 1, 3, 4, 1, 1, 1, 3, - 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3 - } ; +static yyconst flex_int32_t yy_meta[36] = { 0, + 1, 1, 2, 1, 3, 4, 1, 1, 1, 3, + 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3 +}; -static yyconst flex_int16_t yy_base[154] = - { 0, - 0, 0, 34, 35, 176, 175, 180, 183, 40, 43, - 0, 0, 30, 0, 24, 147, 164, 151, 150, 146, - 31, 32, 145, 26, 159, 0, 51, 183, 183, 161, - 57, 0, 0, 183, 0, 157, 39, 144, 139, 39, - 141, 140, 152, 141, 138, 50, 137, 130, 130, 142, - 130, 0, 65, 183, 183, 0, 136, 129, 126, 139, - 133, 129, 134, 117, 119, 132, 130, 0, 118, 129, - 125, 114, 114, 113, 0, 116, 111, 108, 107, 118, - 104, 106, 104, 106, 0, 0, 114, 0, 99, 99, - 97, 97, 0, 100, 0, 104, 93, 107, 93, 0, +static yyconst flex_int16_t yy_base[154] = { 0, + 0, 0, 34, 35, 176, 175, 180, 183, 40, 43, + 0, 0, 30, 0, 24, 147, 164, 151, 150, 146, + 31, 32, 145, 26, 159, 0, 51, 183, 183, 161, + 57, 0, 0, 183, 0, 157, 39, 144, 139, 39, + 141, 140, 152, 141, 138, 50, 137, 130, 130, 142, + 130, 0, 65, 183, 183, 0, 136, 129, 126, 139, + 133, 129, 134, 117, 119, 132, 130, 0, 118, 129, + 125, 114, 114, 113, 0, 116, 111, 108, 107, 118, + 104, 106, 104, 106, 0, 0, 114, 0, 99, 99, + 97, 97, 0, 100, 0, 104, 93, 107, 93, 0, - 106, 90, 96, 101, 88, 82, 91, 88, 88, 95, - 94, 84, 0, 96, 92, 77, 79, 84, 79, 88, - 0, 80, 78, 72, 0, 82, 81, 68, 0, 66, - 78, 0, 0, 76, 0, 68, 53, 39, 0, 56, - 43, 39, 0, 42, 0, 0, 183, 76, 80, 59, - 84, 88, 91 - } ; + 106, 90, 96, 101, 88, 82, 91, 88, 88, 95, + 94, 84, 0, 96, 92, 77, 79, 84, 79, 88, + 0, 80, 78, 72, 0, 82, 81, 68, 0, 66, + 78, 0, 0, 76, 0, 68, 53, 39, 0, 56, + 43, 39, 0, 42, 0, 0, 183, 76, 80, 59, + 84, 88, 91 +}; -static yyconst flex_int16_t yy_def[154] = - { 0, - 147, 1, 148, 148, 149, 149, 147, 147, 147, 147, - 150, 151, 147, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 152, 152, 147, 147, 147, - 147, 150, 151, 147, 153, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 152, 152, 147, 147, 153, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, +static yyconst flex_int16_t yy_def[154] = { 0, + 147, 1, 148, 148, 149, 149, 147, 147, 147, 147, + 150, 151, 147, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 152, 152, 147, 147, 147, + 147, 150, 151, 147, 153, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 152, 152, 147, 147, 153, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 0, 147, 147, 147, - 147, 147, 147 - } ; + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, + 150, 150, 150, 150, 150, 150, 0, 147, 147, 147, + 147, 147, 147 +}; -static yyconst flex_int16_t yy_nxt[219] = - { 0, - 8, 9, 10, 9, 11, 8, 12, 8, 13, 11, - 8, 14, 11, 11, 11, 15, 11, 11, 16, 11, - 17, 18, 19, 11, 11, 11, 11, 20, 21, 22, - 23, 24, 25, 11, 11, 27, 27, 34, 35, 28, - 28, 31, 31, 31, 31, 31, 31, 36, 43, 46, - 37, 49, 53, 47, 62, 50, 54, 44, 31, 31, - 31, 32, 45, 58, 59, 69, 53, 146, 145, 144, - 54, 63, 143, 142, 141, 70, 26, 26, 26, 26, - 29, 29, 29, 29, 33, 140, 33, 33, 52, 52, - 52, 56, 139, 56, 56, 138, 137, 136, 135, 134, +static yyconst flex_int16_t yy_nxt[219] = { 0, + 8, 9, 10, 9, 11, 8, 12, 8, 13, 11, + 8, 14, 11, 11, 11, 15, 11, 11, 16, 11, + 17, 18, 19, 11, 11, 11, 11, 20, 21, 22, + 23, 24, 25, 11, 11, 27, 27, 34, 35, 28, + 28, 31, 31, 31, 31, 31, 31, 36, 43, 46, + 37, 49, 53, 47, 62, 50, 54, 44, 31, 31, + 31, 32, 45, 58, 59, 69, 53, 146, 145, 144, + 54, 63, 143, 142, 141, 70, 26, 26, 26, 26, + 29, 29, 29, 29, 33, 140, 33, 33, 52, 52, + 52, 56, 139, 56, 56, 138, 137, 136, 135, 134, - 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, - 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, - 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, - 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, - 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, - 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, - 73, 72, 71, 68, 67, 66, 65, 64, 61, 60, - 57, 55, 51, 48, 42, 41, 40, 39, 38, 147, - 30, 30, 7, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, + 123, 122, 121, 120, 119, 118, 117, 116, 115, 114, + 113, 112, 111, 110, 109, 108, 107, 106, 105, 104, + 103, 102, 101, 100, 99, 98, 97, 96, 95, 94, + 93, 92, 91, 90, 89, 88, 87, 86, 85, 84, + 83, 82, 81, 80, 79, 78, 77, 76, 75, 74, + 73, 72, 71, 68, 67, 66, 65, 64, 61, 60, + 57, 55, 51, 48, 42, 41, 40, 39, 38, 147, + 30, 30, 7, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147 - } ; + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147 +}; -static yyconst flex_int16_t yy_chk[219] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 3, 4, 13, 13, 3, - 4, 9, 9, 9, 10, 10, 10, 15, 21, 22, - 15, 24, 27, 22, 40, 24, 27, 21, 31, 31, - 31, 150, 21, 37, 37, 46, 53, 144, 142, 141, - 53, 40, 140, 138, 137, 46, 148, 148, 148, 148, - 149, 149, 149, 149, 151, 136, 151, 151, 152, 152, - 152, 153, 134, 153, 153, 131, 130, 128, 127, 126, +static yyconst flex_int16_t yy_chk[219] = { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 3, 4, 13, 13, 3, + 4, 9, 9, 9, 10, 10, 10, 15, 21, 22, + 15, 24, 27, 22, 40, 24, 27, 21, 31, 31, + 31, 150, 21, 37, 37, 46, 53, 144, 142, 141, + 53, 40, 140, 138, 137, 46, 148, 148, 148, 148, + 149, 149, 149, 149, 151, 136, 151, 151, 152, 152, + 152, 153, 134, 153, 153, 131, 130, 128, 127, 126, - 124, 123, 122, 120, 119, 118, 117, 116, 115, 114, - 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, - 102, 101, 99, 98, 97, 96, 94, 92, 91, 90, - 89, 87, 84, 83, 82, 81, 80, 79, 78, 77, - 76, 74, 73, 72, 71, 70, 69, 67, 66, 65, - 64, 63, 62, 61, 60, 59, 58, 57, 51, 50, - 49, 48, 47, 45, 44, 43, 42, 41, 39, 38, - 36, 30, 25, 23, 20, 19, 18, 17, 16, 7, - 6, 5, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 124, 123, 122, 120, 119, 118, 117, 116, 115, 114, + 112, 111, 110, 109, 108, 107, 106, 105, 104, 103, + 102, 101, 99, 98, 97, 96, 94, 92, 91, 90, + 89, 87, 84, 83, 82, 81, 80, 79, 78, 77, + 76, 74, 73, 72, 71, 70, 69, 67, 66, 65, + 64, 63, 62, 61, 60, 59, 58, 57, 51, 50, + 49, 48, 47, 45, 44, 43, 42, 41, 39, 38, + 36, 30, 25, 23, 20, 19, 18, 17, 16, 7, + 6, 5, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147 - } ; + 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, + 147, 147, 147, 147, 147, 147, 147, 147 +}; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[31] = - { 0, -0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; +static yyconst flex_int32_t yy_rule_can_match_eol[31] = { 0, + 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, +}; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; @@ -564,20 +569,21 @@ char *yytext; /* tokens for language */ #include "parser.h" -void mkname(char *name); -void mkval(void); -void mktext(void); +void mkname (char *name); +void mkval (void); +void mktext (void); -int yyerror(char *s); +int yyerror (char *s); -Symbol mkstring(char *name); +Symbol mkstring (char *name); -struct stringlist { - char* string; - struct stringlist* next; +struct stringlist +{ + char *string; + struct stringlist *next; }; -typedef struct stringlist* Stringlist; +typedef struct stringlist *Stringlist; static Stringlist allocatedStrings = NULL; @@ -591,7 +597,7 @@ int mylineno = 0; #define MAX_INCLUDE_DEPTH 10 YY_BUFFER_STATE include_stack[MAX_INCLUDE_DEPTH]; int include_stack_ptr = 0; -#line 595 "" +#line 607 "" #define INITIAL 0 #define incl 1 @@ -609,34 +615,36 @@ int include_stack_ptr = 0; #define YY_EXTRA_TYPE void * #endif +static int yy_init_globals (void); + /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap (void ); +extern "C" int yywrap (void); #else -extern int yywrap (void ); +extern int yywrap (void); #endif #endif - static void yyunput (int c,char *buf_ptr ); - +static void yyunput (int c, char *buf_ptr); + #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ); +static void yy_flex_strncpy (char *, yyconst char *, int); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ); +static int yy_flex_strlen (yyconst char *); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus -static int yyinput (void ); +static int yyinput (void); #else -static int input (void ); +static int input (void); #endif #endif @@ -740,458 +748,445 @@ extern int yylex (void); */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; - + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; + #line 61 "scanner.l" -#line 750 "" +#line 764 "" - if ( (yy_init) ) - { - (yy_init) = 0; + if (!(yy_init)) + { + (yy_init) = 1; #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 ( ! yyin ) - yyin = stdin; + if (!yyin) + yyin = stdin; - if ( ! yyout ) - yyout = stdout; + if (!yyout) + yyout = stdout; - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } + if (!YY_CURRENT_BUFFER) + { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer (yyin, YY_BUF_SIZE); + } - yy_load_buffer_state( ); - } + yy_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 yytext. */ - *yy_cp = (yy_hold_char); + /* Support of yytext. */ + *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_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 >= 148 ) - 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] != 183 ); + 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 >= 148) + 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] != 183); -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_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_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } + if (yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act]) + { + int yyl; + for (yyl = 0; yyl < yyleng; ++yyl) + if (yytext[yyl] == '\n') -do_action: /* This label is used only to access EOF actions. */ + yylineno++; + ; + } - 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; + do_action: /* This label is used only to access EOF actions. */ -case 1: -YY_RULE_SETUP + 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 62 "scanner.l" -BEGIN(incl); - YY_BREAK -case 2: -YY_RULE_SETUP + BEGIN (incl); + YY_BREAK case 2:YY_RULE_SETUP #line 63 "scanner.l" /* eat the whitespace */ - YY_BREAK -case 3: + YY_BREAK case 3: /* rule 3 can match eol */ -YY_RULE_SETUP + YY_RULE_SETUP #line 64 "scanner.l" -{ /* got the include file name */ - if ( include_stack_ptr >= MAX_INCLUDE_DEPTH ) - { - printfstderr( "Includes nested too deeply" ); - exit( 1 ); - } - - include_stack[include_stack_ptr++] = - YY_CURRENT_BUFFER; - - /* try to open, using scytherdirs environment variable as well. */ - yyin = openFileSearch (yytext, NULL); - - if (! yyin) - { - error ("could not open include file %s.", yytext); - } - - yy_switch_to_buffer(yy_create_buffer(yyin,YY_BUF_SIZE ) ); - - BEGIN(INITIAL); - } - YY_BREAK -case 4: -YY_RULE_SETUP + { /* got the include file name */ + if (include_stack_ptr >= MAX_INCLUDE_DEPTH) + { + printfstderr ("Includes nested too deeply"); + exit (1); + } + + include_stack[include_stack_ptr++] = YY_CURRENT_BUFFER; + + /* try to open, using scytherdirs environment variable as well. */ + yyin = openFileSearch (yytext, NULL); + + if (!yyin) + { + error ("could not open include file %s.", yytext); + } + + yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE)); + + BEGIN (INITIAL); + } + YY_BREAK case 4:YY_RULE_SETUP #line 88 "scanner.l" -{ /* eat the closing things */ - BEGIN(INITIAL); - } - YY_BREAK -case YY_STATE_EOF(INITIAL): + { /* eat the closing things */ + BEGIN (INITIAL); + } + YY_BREAK case YY_STATE_EOF (INITIAL): #line 92 "scanner.l" -{ - if ( --include_stack_ptr < 0 ) - { - yyterminate(); - } + { + if (--include_stack_ptr < 0) + { + yyterminate (); + } - else - { - yy_delete_buffer(YY_CURRENT_BUFFER ); - yy_switch_to_buffer(include_stack[include_stack_ptr] ); - BEGIN(inclend); - } - } - YY_BREAK -case 5: -YY_RULE_SETUP + else + { + yy_delete_buffer (YY_CURRENT_BUFFER); + yy_switch_to_buffer (include_stack[include_stack_ptr]); + BEGIN (inclend); + } + } + YY_BREAK case 5:YY_RULE_SETUP #line 107 "scanner.l" -{ - register int c; + { + register int c; - for ( ; ; ) - { - while ( (c = input()) != '*' && c != '\n' && c != EOF ) - ; /* eat up text of comment */ + for (;;) + { + while ((c = input ()) != '*' && c != '\n' && c != EOF) + ; /* eat up text of comment */ - if ( c == '*' ) - { - while ( (c = input()) == '*' ) - ; - if ( c == '/' ) - break; /* found the end */ - } + if (c == '*') + { + while ((c = input ()) == '*') + ; + if (c == '/') + break; /* found the end */ + } - if (c == '\n') - mylineno++; + if (c == '\n') + mylineno++; - if ( c == EOF ) - { - yyerror( "EOF in comment" ); - break; - } - } - } - YY_BREAK -case 6: + if (c == EOF) + { + yyerror ("EOF in comment"); + break; + } + } + } + YY_BREAK case 6: /* rule 6 can match eol */ -YY_RULE_SETUP + YY_RULE_SETUP #line 134 "scanner.l" -{ mylineno++; } - YY_BREAK -case 7: + { + mylineno++; + } + YY_BREAK case 7: /* rule 7 can match eol */ -YY_RULE_SETUP + YY_RULE_SETUP #line 135 "scanner.l" -{ } - YY_BREAK -case 8: -YY_RULE_SETUP + { + } + YY_BREAK case 8:YY_RULE_SETUP #line 136 "scanner.l" -{ } - YY_BREAK -case 9: -YY_RULE_SETUP + { + } + YY_BREAK case 9:YY_RULE_SETUP #line 137 "scanner.l" -{ } - YY_BREAK -case 10: -YY_RULE_SETUP + { + } + YY_BREAK case 10:YY_RULE_SETUP #line 139 "scanner.l" -{ return PROTOCOL; } - YY_BREAK -case 11: -YY_RULE_SETUP + { + return PROTOCOL; + } + YY_BREAK case 11:YY_RULE_SETUP #line 140 "scanner.l" -{ return ROLE; } - YY_BREAK -case 12: -YY_RULE_SETUP + { + return ROLE; + } + YY_BREAK case 12:YY_RULE_SETUP #line 141 "scanner.l" -{ return READT; } - YY_BREAK -case 13: -YY_RULE_SETUP + { + return READT; + } + YY_BREAK case 13:YY_RULE_SETUP #line 142 "scanner.l" -{ return SENDT; } - YY_BREAK -case 14: -YY_RULE_SETUP + { + return SENDT; + } + YY_BREAK case 14:YY_RULE_SETUP #line 143 "scanner.l" -{ return VAR; } - YY_BREAK -case 15: -YY_RULE_SETUP + { + return VAR; + } + YY_BREAK case 15:YY_RULE_SETUP #line 144 "scanner.l" -{ return CONST; } - YY_BREAK -case 16: -YY_RULE_SETUP + { + return CONST; + } + YY_BREAK case 16:YY_RULE_SETUP #line 145 "scanner.l" -{ return CLAIMT; } - YY_BREAK -case 17: -YY_RULE_SETUP + { + return CLAIMT; + } + YY_BREAK case 17:YY_RULE_SETUP #line 146 "scanner.l" -{ return RUN; } - YY_BREAK -case 18: -YY_RULE_SETUP + { + return RUN; + } + YY_BREAK case 18:YY_RULE_SETUP #line 147 "scanner.l" -{ return SECRET; } - YY_BREAK -case 19: -YY_RULE_SETUP + { + return SECRET; + } + YY_BREAK case 19:YY_RULE_SETUP #line 148 "scanner.l" -{ return INVERSEKEYS; } - YY_BREAK -case 20: -YY_RULE_SETUP + { + return INVERSEKEYS; + } + YY_BREAK case 20:YY_RULE_SETUP #line 149 "scanner.l" -{ return UNTRUSTED; } - YY_BREAK -case 21: -YY_RULE_SETUP + { + return UNTRUSTED; + } + YY_BREAK case 21:YY_RULE_SETUP #line 150 "scanner.l" -{ return COMPROMISED; } - YY_BREAK -case 22: -YY_RULE_SETUP + { + return COMPROMISED; + } + YY_BREAK case 22:YY_RULE_SETUP #line 151 "scanner.l" -{ return USERTYPE; } - YY_BREAK -case 23: -YY_RULE_SETUP + { + return USERTYPE; + } + YY_BREAK case 23:YY_RULE_SETUP #line 152 "scanner.l" -{ return SINGULAR; } - YY_BREAK -case 24: -YY_RULE_SETUP + { + return SINGULAR; + } + YY_BREAK case 24:YY_RULE_SETUP #line 153 "scanner.l" -{ return FUNCTION; } - YY_BREAK -case 25: -YY_RULE_SETUP + { + return FUNCTION; + } + YY_BREAK case 25:YY_RULE_SETUP #line 154 "scanner.l" -{ return HASHFUNCTION; } - YY_BREAK -case 26: -YY_RULE_SETUP + { + return HASHFUNCTION; + } + YY_BREAK case 26:YY_RULE_SETUP #line 155 "scanner.l" -{ return KNOWS; } - YY_BREAK -case 27: -YY_RULE_SETUP + { + return KNOWS; + } + YY_BREAK case 27:YY_RULE_SETUP #line 156 "scanner.l" -{ return TRUSTED; } - YY_BREAK -case 28: -YY_RULE_SETUP + { + return TRUSTED; + } + YY_BREAK case 28:YY_RULE_SETUP #line 157 "scanner.l" -{ - yylval.symb = mkstring(yytext); - return ID; - } - YY_BREAK -case 29: -YY_RULE_SETUP + { + yylval.symb = mkstring (yytext); + return ID; + } + YY_BREAK case 29:YY_RULE_SETUP #line 161 "scanner.l" -{ return yytext[0]; } - YY_BREAK -case 30: -YY_RULE_SETUP + { + return yytext[0]; + } + YY_BREAK case 30:YY_RULE_SETUP #line 165 "scanner.l" -ECHO; - YY_BREAK -#line 1063 "" -case YY_STATE_EOF(incl): -case YY_STATE_EOF(inclend): - yyterminate(); + ECHO; + YY_BREAK +#line 1077 "" + case YY_STATE_EOF (incl): + case YY_STATE_EOF (inclend): + yyterminate (); 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; + { + /* 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 - - 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 yyin at a new source and called - * yylex(). 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 = yyin; - 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(). + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + 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 yyin at a new source and called + * yylex(). 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. */ - 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_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + /* 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_current_state = yy_get_previous_state( ); + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - /* 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_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). + */ + + yy_next_state = yy_try_NUL_trans (yy_current_state); + + 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; + } + + 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; + + if (yywrap ()) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, 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_next_state = yy_try_NUL_trans( yy_current_state ); + yy_act = YY_STATE_EOF (YY_START); + goto do_action; + } - yy_bp = (yytext_ptr) + YY_MORE_ADJ; + else + { + if (!(yy_did_buffer_switch_on_eof)) + YY_NEW_FILE; + } + break; + } - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } + yy_current_state = yy_get_previous_state (); - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, 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; + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } + yy_current_state = yy_get_previous_state (); - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - 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_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; + 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 yylex */ + YY_FATAL_ERROR + ("fatal flex scanner internal error--no action found"); + } /* end of action switch */ + } /* end of scanning one token */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -1200,157 +1195,158 @@ case YY_STATE_EOF(inclend): * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ -static int yy_get_next_buffer (void) +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; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_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_LVALUE->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_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; + } - 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) - (yytext_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_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; - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->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. */ - /* 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. */ - yyrealloc((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. */ + yyrealloc ((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_LVALUE->yy_buf_size - + number_to_move - 1; - } + } - 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_LVALUE->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_LVALUE->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; - yyrestart(yyin ); - } + if ((yy_n_chars) == 0) + { + if (number_to_move == YY_MORE_ADJ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart (yyin); + } - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->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_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; + (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; - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - return ret_val; + 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 (void) +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); + register yy_state_type yy_current_state; + register char *yy_cp; - 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 >= 148 ) - yy_c = yy_meta[(unsigned int) yy_c]; - } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - } + yy_current_state = (yy_start); - 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 >= 148) + 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 @@ -1358,208 +1354,214 @@ static int yy_get_next_buffer (void) * synopsis * next_state = yy_try_NUL_trans( current_state ); */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_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); + 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 >= 148 ) - 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 == 147); + 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 >= 148) + 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 == 147); - 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 ) +static void +yyunput (int c, register char *yy_bp) { - register char *yy_cp; - - yy_cp = (yy_c_buf_p); + register char *yy_cp; - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_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 yytext */ + *yy_cp = (yy_hold_char); - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; + 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]; - 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_LVALUE->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_LVALUE->yy_n_chars = + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; + if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) + YY_FATAL_ERROR ("flex scanner push-back overflow"); } - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + *--yy_cp = (char) c; + + if (c == '\n') + { + --yylineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; } #ifndef YY_NO_INPUT #ifdef __cplusplus - static int yyinput (void) +static int +yyinput (void) #else - static int input (void) +static int +input (void) #endif - { - int c; - - *(yy_c_buf_p) = (yy_hold_char); + int c; - 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'; + *(yy_c_buf_p) = (yy_hold_char); - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); + 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'; - 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. - */ + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - /* Reset buffer status. */ - yyrestart(yyin ); + 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. + */ - /*FALLTHROUGH*/ + /* Reset buffer status. */ + yyrestart (yyin); - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return EOF; + /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: + { + if (yywrap ()) + 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 yyinput(); + return yyinput (); #else - return input(); + return input (); #endif - } + } - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_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 yytext */ - (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 yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + if (c == '\n') - if ( c == '\n' ) - yylineno++; -; + ; - return c; + return c; } -#endif /* ifndef YY_NO_INPUT */ +#endif /* ifndef YY_NO_INPUT */ /** 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 yyrestart (FILE * input_file ) +void +yyrestart (FILE * input_file) { - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer(yyin,YY_BUF_SIZE ); - } - yy_init_buffer(YY_CURRENT_BUFFER,input_file ); - yy_load_buffer_state( ); + if (!YY_CURRENT_BUFFER) + { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = yy_create_buffer (yyin, YY_BUF_SIZE); + } + + yy_init_buffer (YY_CURRENT_BUFFER, input_file); + yy_load_buffer_state (); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +void +yy_switch_to_buffer (YY_BUFFER_STATE new_buffer) { - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - 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); - } + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if (YY_CURRENT_BUFFER == new_buffer) + return; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_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); + } - /* 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; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state (); + + /* 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; } -static void yy_load_buffer_state (void) +static void +yy_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; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); } /** Allocate and initialize an input buffer state. @@ -1568,106 +1570,110 @@ static void yy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +YY_BUFFER_STATE +yy_create_buffer (FILE * file, int size) { - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_BUFFER_STATE b; - b->yy_buf_size = size; + b = (YY_BUFFER_STATE) yyalloc (sizeof (struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR ("out of dynamic memory in yy_create_buffer()"); - /* 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 *) yyalloc(b->yy_buf_size + 2 ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + b->yy_buf_size = size; - b->yy_is_our_buffer = 1; + /* 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 *) yyalloc (b->yy_buf_size + 2); + if (!b->yy_ch_buf) + YY_FATAL_ERROR ("out of dynamic memory in yy_create_buffer()"); - yy_init_buffer(b,file ); + b->yy_is_our_buffer = 1; - return b; + yy_init_buffer (b, file); + + return b; } /** Destroy the buffer. * @param b a buffer created with yy_create_buffer() * */ - void yy_delete_buffer (YY_BUFFER_STATE b ) +void +yy_delete_buffer (YY_BUFFER_STATE b) { - - if ( ! b ) - return; - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if (!b) + return; - if ( b->yy_is_our_buffer ) - yyfree((void *) b->yy_ch_buf ); + if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - yyfree((void *) b ); + if (b->yy_is_our_buffer) + yyfree ((void *) b->yy_ch_buf); + + yyfree ((void *) b); } #ifndef __cplusplus -extern int isatty (int ); +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 yyrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - +static void +yy_init_buffer (YY_BUFFER_STATE b, FILE * file) { - int oerrno = errno; - - yy_flush_buffer(b ); + int oerrno = errno; - b->yy_input_file = file; - b->yy_fill_buffer = 1; + yy_flush_buffer (b); - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() 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; + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() 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; } - b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; - - errno = oerrno; + b->yy_is_interactive = file ? (isatty (fileno (file)) > 0) : 0; + + 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 yy_flush_buffer (YY_BUFFER_STATE b ) +void +yy_flush_buffer (YY_BUFFER_STATE b) { - if ( ! b ) - return; + if (!b) + return; - b->yy_n_chars = 0; + b->yy_n_chars = 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_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + /* 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_buf_pos = &b->yy_ch_buf[0]; + b->yy_buf_pos = &b->yy_ch_buf[0]; - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + if (b == YY_CURRENT_BUFFER) + yy_load_buffer_state (); } /** Pushes the new state onto the stack. The new state becomes @@ -1676,92 +1682,97 @@ extern int isatty (int ); * @param new_buffer The new state. * */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void +yypush_buffer_state (YY_BUFFER_STATE new_buffer) { - if (new_buffer == NULL) - return; + if (new_buffer == NULL) + return; - yyensure_buffer_stack(); + yyensure_buffer_stack (); - /* This block is copied from yy_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); - } + /* This block is copied from yy_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; + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; + /* copied from yy_switch_to_buffer. */ + yy_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 yypop_buffer_state (void) +void +yypop_buffer_state (void) { - if (!YY_CURRENT_BUFFER) - return; + if (!YY_CURRENT_BUFFER) + return; - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); + yy_delete_buffer (YY_CURRENT_BUFFER); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } + if (YY_CURRENT_BUFFER) + { + yy_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 yyensure_buffer_stack (void) +static void +yyensure_buffer_stack (void) { - int num_to_alloc; - - if (!(yy_buffer_stack)) { + int num_to_alloc; - /* 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. - */ - num_to_alloc = 1; - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (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; - } + if (!(yy_buffer_stack)) + { - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + /* 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. + */ + num_to_alloc = 1; + (yy_buffer_stack) = (struct yy_buffer_state **) yyalloc + (num_to_alloc * sizeof (struct yy_buffer_state *)); - /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + memset ((yy_buffer_stack), 0, + num_to_alloc * sizeof (struct yy_buffer_state *)); - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } - /* 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; - } + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1) + { + + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */ ; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state **) yyrealloc + ((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; + } } /** Setup the input buffer state to scan directly from a user-specified character buffer. @@ -1770,47 +1781,49 @@ static void yyensure_buffer_stack (void) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE +yy_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; + YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + 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_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_BUFFER_STATE) yyalloc (sizeof (struct yy_buffer_state)); + if (!b) + YY_FATAL_ERROR ("out of dynamic memory in yy_scan_buffer()"); - yy_switch_to_buffer(b ); + 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; - return b; + yy_switch_to_buffer (b); + + return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. - * @param str a NUL-terminated string to scan + * @param yystr 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 * yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) +YY_BUFFER_STATE +yy_scan_string (yyconst char *yystr) { - - return yy_scan_bytes(yy_str,strlen(yy_str) ); + + return yy_scan_bytes (yystr, strlen (yystr)); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -1820,44 +1833,46 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str ) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len ) +YY_BUFFER_STATE +yy_scan_bytes (yyconst char *yybytes, int _yybytes_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 *) yyalloc(n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; - for ( i = 0; i < len; ++i ) - buf[i] = bytes[i]; + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) yyalloc (n); + if (!buf) + YY_FATAL_ERROR ("out of dynamic memory in yy_scan_bytes()"); - buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; + for (i = 0; i < _yybytes_len; ++i) + buf[i] = yybytes[i]; - b = yy_scan_buffer(buf,n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; + b = yy_scan_buffer (buf, n); + if (!b) + YY_FATAL_ERROR ("bad buffer in yy_scan_bytes()"); - return b; + /* 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; } #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg ) +static void +yy_fatal_error (yyconst char *msg) { - (void) fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); + (void) fprintf (stderr, "%s\n", msg); + exit (YY_EXIT_FAILURE); } /* Redefine yyless() so it works in section 3 code. */ @@ -1882,53 +1897,59 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. * */ -int yyget_lineno (void) +int +yyget_lineno (void) { - - return yylineno; + + return yylineno; } /** Get the input stream. * */ -FILE *yyget_in (void) +FILE * +yyget_in (void) { - return yyin; + return yyin; } /** Get the output stream. * */ -FILE *yyget_out (void) +FILE * +yyget_out (void) { - return yyout; + return yyout; } /** Get the length of the current token. * */ -int yyget_leng (void) +int +yyget_leng (void) { - return yyleng; + return yyleng; } /** Get the current token. * */ -char *yyget_text (void) +char * +yyget_text (void) { - return yytext; + return yytext; } /** Set the current line number. * @param line_number * */ -void yyset_lineno (int line_number ) +void +yyset_lineno (int line_number) { - - yylineno = line_number; + + yylineno = line_number; } /** Set the input stream. This does not discard the current @@ -1937,42 +1958,84 @@ void yyset_lineno (int line_number ) * * @see yy_switch_to_buffer */ -void yyset_in (FILE * in_str ) +void +yyset_in (FILE * in_str) { - yyin = in_str ; + yyin = in_str; } -void yyset_out (FILE * out_str ) +void +yyset_out (FILE * out_str) { - yyout = out_str ; + yyout = out_str; } -int yyget_debug (void) +int +yyget_debug (void) { - return yy_flex_debug; + return yy_flex_debug; } -void yyset_debug (int bdebug ) +void +yyset_debug (int bdebug) { - yy_flex_debug = bdebug ; + yy_flex_debug = bdebug; +} + +static int +yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; + + (yy_buffer_stack) = 0; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = (char *) 0; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) +int +yylex_destroy (void) { - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; + /* Pop the buffer stack, destroying each element. */ + while (YY_CURRENT_BUFFER) + { + yy_delete_buffer (YY_CURRENT_BUFFER); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state (); + } - return 0; + /* Destroy the stack itself. */ + yyfree ((yy_buffer_stack)); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals (); + + return 0; } /* @@ -1980,113 +2043,110 @@ int yylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) +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]; + register int i; + for (i = 0; i < n; ++i) + s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s ) +static int +yy_flex_strlen (yyconst char *s) { - register int n; - for ( n = 0; s[n]; ++n ) - ; + register int n; + for (n = 0; s[n]; ++n) + ; - return n; + return n; } #endif -void *yyalloc (yy_size_t size ) +void * +yyalloc (yy_size_t size) { - return (void *) malloc( size ); + return (void *) malloc (size); } -void *yyrealloc (void * ptr, yy_size_t size ) +void * +yyrealloc (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 ); + /* 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 yyfree (void * ptr ) +void +yyfree (void *ptr) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free ((char *) ptr); /* see yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#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 165 "scanner.l" -Symbol mkstring(char *name) +Symbol +mkstring (char *name) { - Symbol t; - char* s; - Stringlist sl; - int len; + Symbol t; + char *s; + Stringlist sl; + int len; - if (( t = lookup(name)) != NULL) - { - return t; - } - // make new name - len = strlen(name); - s = (char *)malloc(len+1); - sl = (Stringlist) malloc(sizeof(struct stringlist)); - strncpy(s,name,len); - sl->next = allocatedStrings; - allocatedStrings = sl; - sl->string = s; - s[len] = EOS; + if ((t = lookup (name)) != NULL) + { + return t; + } + // make new name + len = strlen (name); + s = (char *) malloc (len + 1); + sl = (Stringlist) malloc (sizeof (struct stringlist)); + strncpy (s, name, len); + sl->next = allocatedStrings; + allocatedStrings = sl; + sl->string = s; + s[len] = EOS; - t = get_symb(); - t->lineno = yylineno; - t->type = T_UNDEF; - t->text = s; + t = get_symb (); + t->lineno = yylineno; + t->type = T_UNDEF; + t->text = s; - insert(t); - return t; + insert (t); + return t; } -void scanner_cleanup(void) +void +scanner_cleanup (void) { - yy_delete_buffer (YY_CURRENT_BUFFER); + yy_delete_buffer (YY_CURRENT_BUFFER); } -void strings_cleanup(void) +void +strings_cleanup (void) { - Stringlist sl; - while (allocatedStrings != NULL) - { - sl = allocatedStrings; - allocatedStrings = sl->next; - free(sl->string); - free(sl); - } + Stringlist sl; + while (allocatedStrings != NULL) + { + sl = allocatedStrings; + allocatedStrings = sl->next; + free (sl->string); + free (sl); + } } -int yywrap (void) +int +yywrap (void) { /* signal true to let lex know that nothing else is coming */ return 1; @@ -2100,4 +2160,3 @@ void mktext(void); // vim:ft=lex: - diff --git a/src/term.c b/src/term.c index 998f072..562dc9d 100644 --- a/src/term.c +++ b/src/term.c @@ -315,7 +315,7 @@ termInTerm (Term t, Term tsub) void termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup, char *righttup, char *leftenc, char *rightenc, - void (*callback) (int rid)) + void (*callback) (const Term t)) { #ifdef DEBUG if (!DEBUGL (4)) @@ -345,7 +345,7 @@ termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup, } else { - callback (TermRunid (term)); + callback (term); } } if (term->subst != NULL) @@ -404,7 +404,7 @@ termPrint (Term term) void termTuplePrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup, char *righttup, char *leftenc, char *rightenc, - void (*callback) (int rid)) + void (*callback) (const Term t)) { if (term == NULL) { diff --git a/src/term.h b/src/term.h index 0914c79..f5776e0 100644 --- a/src/term.h +++ b/src/term.h @@ -174,11 +174,11 @@ int termSubTerm (Term t, Term tsub); int termInTerm (Term t, Term tsub); void termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup, char *righttup, char *leftenc, char *rightenc, - void (*callback) (int rid)); + void (*callback) (const Term t)); void termPrint (Term term); void termTuplePrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup, char *righttup, char *leftenc, - char *rightenc, void (*callback) (int rid)); + char *rightenc, void (*callback) (const Term t)); void termTuplePrint (Term term); Term termDuplicate (const Term term); Term termNodeDuplicate (const Term term);