From 89c3a20acf72aae606ee1e3e6dea86992a1749f7 Mon Sep 17 00:00:00 2001 From: ccremers Date: Sat, 6 Jan 2007 14:45:29 +0000 Subject: [PATCH] - Many cleanups to make -Wall happy. Next up is pedantic... --- src/arachne.c | 33 +- src/arachne.h | 4 + src/binding.c | 18 +- src/claim.c | 7 + src/color.h | 3 + src/compiler.c | 5 +- src/cost.c | 3 + src/dotout.c | 2 +- src/heuristic.c | 6 +- src/intruderknowledge.c | 2 +- src/knowledge.c | 1 + src/knowledge.h | 1 - src/main.c | 4 +- src/parser.c | 1262 ++++++++++----------- src/parser.h | 58 +- src/parser.y | 2 + src/prune_bounds.c | 7 +- src/prune_theorems.c | 8 +- src/role.c | 1 + src/scanner.c | 2346 +++++++++++++++++++-------------------- src/specialterm.c | 1 + src/specialterm.h | 2 + src/states.c | 1 + src/switches.c | 1 - src/symbol.c | 1 + src/system.c | 2 +- src/system.h | 1 + src/tac.c | 3 + src/term.c | 7 +- src/termlist.c | 3 + src/xmlout.c | 3 +- 31 files changed, 1871 insertions(+), 1927 deletions(-) diff --git a/src/arachne.c b/src/arachne.c index e9af35c..0b0f9ae 100644 --- a/src/arachne.c +++ b/src/arachne.c @@ -42,6 +42,8 @@ #include "arachne.h" #include "hidelevel.h" #include "depend.h" +#include "xmlout.h" +#include "heuristic.h" extern int *graph; extern int nodes; @@ -70,7 +72,6 @@ static FILE *attack_stream; */ int iterate (); -void printSemiState (); /* * Program code @@ -81,7 +82,6 @@ void arachneInit (const System mysys) { Roledef rd; - Termlist tl, know0; void add_event (int event, Term message) { @@ -666,7 +666,6 @@ create_decryptor (const Term term, const Term key) if (term != NULL && isTermEncrypt (term)) { Roledef rd; - Term tempkey; int run; #ifdef DEBUG @@ -692,15 +691,13 @@ create_decryptor (const Term term, const Term key) return run; } - else - { - globalError++; - eprintf ("Term for which a decryptor instance is requested: "); - termPrint (term); - eprintf ("\n"); - error - ("Trying to build a decryptor instance for a non-encrypted term."); - } + + globalError++; + eprintf ("Term for which a decryptor instance is requested: "); + termPrint (term); + eprintf ("\n"); + error ("Trying to build a decryptor instance for a non-encrypted term."); + return -1; } //! Get the priority level of a key that is needed for a term (typical pk/sk distinction) @@ -1085,7 +1082,6 @@ printSemiState () { int run; int open; - List bl; int binding_state_print (void *dt) { @@ -2237,7 +2233,7 @@ iterate_buffer_attacks (void) } //! Arachne single claim test -int +void arachneClaimTest (Claimlist cl) { // others we simply test... @@ -2377,10 +2373,7 @@ arachneClaim (Claimlist cl) } return true; } - else - { - return false; - } + return false; } @@ -2389,6 +2382,8 @@ arachneClaim (Claimlist cl) * For this test, we manually set up some stuff. * * But later, this will just iterate over all claims. + * + * @TODO what does it return? And is that -1 valid, if nothing is tested? */ int arachne () @@ -2433,7 +2428,7 @@ arachne () if (switches.runs == 0) { // No real checking. - return; + return -1; } if (sys->maxruns > 0) diff --git a/src/arachne.h b/src/arachne.h index e45e2c3..02c9105 100644 --- a/src/arachne.h +++ b/src/arachne.h @@ -12,5 +12,9 @@ int isTriviallyKnownAtArachne (const System sys, const Term t, const int run, const int index); int isTriviallyKnownAfterArachne (const System sys, const Term t, const int run, const int index); +void arachneOutputAttack (); +void printSemiState (); +int countIntruderActions (); +void role_name_print (const int run); #endif diff --git a/src/binding.c b/src/binding.c index 6196b60..8eb7980 100644 --- a/src/binding.c +++ b/src/binding.c @@ -14,6 +14,7 @@ #include "arachne.h" #include "switches.h" #include "depend.h" +#include "error.h" #ifndef OSXHOST #include #endif @@ -178,6 +179,8 @@ goal_unbind (const Binding b) //! Bind a goal as a dummy (block) /** * Especially made for tuple expansion + * + * @TODO Weird that this returns a value (always true, otherwise error) */ int binding_block (Binding b) @@ -187,13 +190,14 @@ binding_block (Binding b) b->blocked = true; return true; } - else - { - error ("Trying to block a goal again."); - } + error ("Trying to block a goal again."); + return false; } //! Unblock a binding +/* + * @TODO Weird that this returns a value (always true, otherwise error) + */ int binding_unblock (Binding b) { @@ -202,10 +206,8 @@ binding_unblock (Binding b) b->blocked = false; return true; } - else - { - error ("Trying to unblock a non-blocked goal."); - } + error ("Trying to unblock a non-blocked goal."); + return false; } diff --git a/src/claim.c b/src/claim.c index 12eac7a..de2bcf6 100644 --- a/src/claim.c +++ b/src/claim.c @@ -18,6 +18,8 @@ #include "specialterm.h" #include "switches.h" #include "color.h" +#include "cost.h" +#include "timer.h" //! When none of the runs match #define MATCH_NONE 0 @@ -39,6 +41,10 @@ extern int attack_leastcost; // Debugging the NI-SYNCH checks //#define OKIDEBUG +// Forward declaration +int oki_nisynch (const System sys, const int trace_index, + const Termmap role_to_run, const Termmap label_to_index); + /* * Validity checks for claims * @@ -367,6 +373,7 @@ oki_nisynch (const System sys, const int trace_index, * Exception: no claim, no send, no read, what is it? */ error ("Unrecognized event type in claim scanner at %i.", trace_index); + return 0; } /* diff --git a/src/color.h b/src/color.h index 78bf7ae..d174ed8 100644 --- a/src/color.h +++ b/src/color.h @@ -6,4 +6,7 @@ extern char *COLOR_Red; extern char *COLOR_Green; extern char *COLOR_Bold; +void colorInit (void); +void colorDone (void); + #endif diff --git a/src/compiler.c b/src/compiler.c index 76b27fb..e265bc1 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -16,6 +16,7 @@ #include "hidelevel.h" #include "debug.h" #include "intruderknowledge.h" +#include "error.h" /* Simple sys pointer as a global. Yields cleaner code although it's against programming standards. @@ -438,7 +439,6 @@ claimCreate (const System sys, const Protocol protocol, const Role role, const Term claim, Term label, const Term msg) { Claimlist cl; - Term labeltuple; /* generate full unique label */ /* is the label empty or used? */ @@ -556,6 +556,7 @@ claimCreate (const System sys, const Protocol protocol, const Role role, claimvars = claimvars->next; } } + return cl; } //! Parse a communication event tc of type event, and add a role definition event for it. @@ -1390,7 +1391,6 @@ compute_prec_sets (const System sys) int size; // temp constant: rolecount * roleeventmax int rowsize; int r1, r2, ev1, ev2; // some counters - int i, j; Claimlist cl; // Assist: compute index from role, lev @@ -1583,7 +1583,6 @@ compute_prec_sets (const System sys) cl = sys->claimlist; while (cl != NULL) { - Term t; Roledef rd; Term label; int claim_index; diff --git a/src/cost.c b/src/cost.c index 71daa85..cf0d5e2 100644 --- a/src/cost.c +++ b/src/cost.c @@ -8,6 +8,8 @@ */ #include "switches.h" #include "system.h" +#include "binding.h" +#include "error.h" #include //************************************************************************ @@ -68,4 +70,5 @@ attackCost (const System sys) return cost; } error ("Unknown pruning method (cost function not found)"); + return 0; } diff --git a/src/dotout.c b/src/dotout.c index 5f1cf3d..6966c93 100644 --- a/src/dotout.c +++ b/src/dotout.c @@ -7,6 +7,7 @@ #include "depend.h" #include "type.h" #include "debug.h" +#include "error.h" extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c extern Role I_M; // Same here. @@ -1645,7 +1646,6 @@ void dotSemiState (const System mysys) { static int attack_number = 0; - int run; Protocol p; int *ranks; int maxrank; diff --git a/src/heuristic.c b/src/heuristic.c index 5b2ef85..e95f547 100644 --- a/src/heuristic.c +++ b/src/heuristic.c @@ -7,12 +7,15 @@ */ #include +#include #include "binding.h" #include "system.h" #include "specialterm.h" #include "switches.h" #include "hidelevel.h" +#include "arachne.h" +#include "error.h" //! Check whether a binding (goal) is selectable int @@ -211,8 +214,6 @@ float weighHidelevel (const System sys, const Term t, const float massknow, const float massprot) { - unsigned int hl; - switch (hidelevelFlag (sys, t)) { case HLFLAG_NONE: @@ -253,6 +254,7 @@ term_constcount (const System sys, Term t) n++; } } + return 1; } n = 0; diff --git a/src/intruderknowledge.c b/src/intruderknowledge.c index 8fa5a07..b548092 100644 --- a/src/intruderknowledge.c +++ b/src/intruderknowledge.c @@ -125,7 +125,7 @@ initialIntruderKnowledge (const System sys) * Hack. Enumerating is not always good (or even desirable). * If some I knows sk(I), sk should not be in the intruder knowledge. * But for hash(I), we typically would have h; but if it is never used differently, it would suffice. - * To sommarize, the operational semantics definition is perfectly fine, but maybe a bit strict sometimes. + * To summarize, the operational semantics definition is perfectly fine, but maybe a bit strict sometimes. * * The hack is that if function application: */ diff --git a/src/knowledge.c b/src/knowledge.c index 69a15ff..674f9d7 100644 --- a/src/knowledge.c +++ b/src/knowledge.c @@ -10,6 +10,7 @@ #include "knowledge.h" #include "system.h" #include "debug.h" +#include "error.h" /* * Knowledge stuff diff --git a/src/knowledge.h b/src/knowledge.h index 6353c71..c40c7cd 100644 --- a/src/knowledge.h +++ b/src/knowledge.h @@ -56,7 +56,6 @@ Termlist knowledgeNew (const Knowledge oldk, const Knowledge newk); //! Harnass macro for recursive procedures. #define mindwipe(k,recurse) \ Termlist tl; \ - Term oldsubst; \ int flag; \ if (k != NULL && k->vars != NULL) { \ tl = k->vars; \ diff --git a/src/main.c b/src/main.c index 9910da7..ddfab86 100644 --- a/src/main.c +++ b/src/main.c @@ -53,6 +53,8 @@ #include "color.h" #include "error.h" #include "claim.h" +#include "arachne.h" +#include "xmlout.h" //! The global system state pointer System sys; @@ -75,7 +77,6 @@ int modelCheck (const System sys); int main (int argc, char **argv) { - int nerrors; int exitcode = EXIT_NOATTACK; /* initialize symbols */ @@ -217,7 +218,6 @@ main (int argc, char **argv) /* memory clean up? */ strings_cleanup (); -exit: return exitcode; } diff --git a/src/parser.c b/src/parser.c index e1f306f..b7131a4 100644 --- a/src/parser.c +++ b/src/parser.c @@ -65,28 +65,27 @@ # 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 @@ -118,11 +117,12 @@ enum yytokentype #include "pheading.h" /* #include "lex.yy.c" */ #include "tac.h" +#include "error.h" -struct tacnode *spdltac; +struct tacnode* spdltac; -int yyerror (char *s); -int yylex (void); +int yyerror(char *s); +int yylex(void); @@ -146,17 +146,17 @@ int yylex (void); #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 13 "parser.y" +#line 14 "parser.y" { - char *str; - struct tacnode *tac; - Symbol symb; - int value; + 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 */ +#line 158 "parser.c" + YYSTYPE; +# define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif @@ -167,7 +167,7 @@ YYSTYPE; /* Line 216 of yacc.c. */ -#line 170 "parser.c" +#line 171 "parser.c" #ifdef short # undef short @@ -207,7 +207,7 @@ typedef short int yytype_int16; # 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 */ +# include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int @@ -219,7 +219,7 @@ typedef short int yytype_int16; #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 @@ -232,7 +232,7 @@ typedef short int yytype_int16; #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else -# define YYUSE(e) /* empty */ +# define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ @@ -246,7 +246,7 @@ YYID (int i) #else static int YYID (i) - int i; + int i; #endif { return i; @@ -262,17 +262,17 @@ YYID (i) # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif @@ -289,7 +289,7 @@ YYID (i) 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 2006 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC @@ -300,7 +300,7 @@ YYID (i) # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif @@ -309,14 +309,14 @@ YYID (i) # define YYMALLOC malloc # 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 */ +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) -void free (void *); /* INFRINGES ON USER NAME SPACE */ +void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif @@ -332,7 +332,7 @@ union yyalloc { 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) @@ -401,86 +401,91 @@ union yyalloc ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -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 +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 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 +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 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 +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 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 +static const yytype_uint16 yyrline[] = +{ + 0, 70, 70, 75, 76, 80, 86, 93, 101, 107, + 114, 115, 117, 121, 133, 134, 139, 140, 145, 146, + 148, 150, 154, 161, 168, 177, 185, 192, 199, 206, + 212, 218, 226, 229, 237, 241, 249, 253, 259, 264, + 265, 270, 278, 280, 286, 290, 296, 298, 302, 304, + 308 }; #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[] = { +static const char *const yytname[] = +{ "$end", "error", "$undefined", "ID", "PROTOCOL", "ROLE", "READT", "SENDT", "CLAIMT", "VAR", "CONST", "RUN", "SECRET", "COMPROMISED", "INVERSEKEYS", "UNTRUSTED", "USERTYPE", "SINGULAR", "FUNCTION", @@ -496,84 +501,91 @@ static const char *const yytname[] = { # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -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 +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 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 +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 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 +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 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 +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 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 +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 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 +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 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 +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 @@ -581,52 +593,55 @@ static const yytype_int8 yypgoto[] = { number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -19 -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 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 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 +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 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 +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) @@ -723,7 +738,7 @@ while (YYID (0)) #if YYDEBUG # ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ +# include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif @@ -749,18 +764,17 @@ do { \ | Print this symbol on YYOUTPUT. | `--------------------------------*/ - /*ARGSUSED*/ +/*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) +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else - static void +static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) - FILE *yyoutput; - int yytype; - YYSTYPE const *const yyvaluep; + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) @@ -773,8 +787,8 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) # endif switch (yytype) { - default: - break; + default: + break; } } @@ -786,13 +800,13 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_print (FILE * yyoutput, int yytype, YYSTYPE const *const yyvaluep) +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; + FILE *yyoutput; + int yytype; + YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) @@ -812,12 +826,12 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 * bottom, yytype_int16 * top) +yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; + yytype_int16 *bottom; + yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); @@ -840,12 +854,12 @@ do { \ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE * yyvsp, int yyrule) +yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) - YYSTYPE *yyvsp; - int yyrule; + YYSTYPE *yyvsp; + int yyrule; #endif { int yynrhs = yyr2[yyrule]; @@ -858,7 +872,8 @@ yy_reduce_print (yyvsp, yyrule) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], - &(yyvsp[(yyi + 1) - (yynrhs)])); + &(yyvsp[(yyi + 1) - (yynrhs)]) + ); fprintf (stderr, "\n"); } } @@ -895,8 +910,8 @@ int yydebug; #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif - + #if YYERROR_VERBOSE @@ -912,7 +927,7 @@ yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) - const char *yystr; + const char *yystr; #endif { YYSIZE_T yylen; @@ -936,8 +951,8 @@ yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) - char *yydest; - const char *yysrc; + char *yydest; + const char *yysrc; #endif { char *yyd = yydest; @@ -989,10 +1004,10 @@ 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; @@ -1011,7 +1026,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; - if (!(YYPACT_NINF < yyn && yyn <= YYLAST)) + if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { @@ -1020,19 +1035,18 @@ yysyntax_error (char *yyresult, int yystate, int yychar) YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; - enum - { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + 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"); + 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; @@ -1046,7 +1060,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. */ + YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ @@ -1075,7 +1089,7 @@ yysyntax_error (char *yyresult, int yystate, int yychar) yyprefix = yyor; } - yyf = YY_ (yyformat); + yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; @@ -1114,17 +1128,17 @@ yysyntax_error (char *yyresult, int yystate, int yychar) | Release the memory associated to this symbol. | `-----------------------------------------------*/ - /*ARGSUSED*/ +/*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) - static void -yydestruct (const char *yymsg, int yytype, YYSTYPE * yyvaluep) +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 { YYUSE (yyvaluep); @@ -1136,8 +1150,8 @@ yydestruct (yymsg, yytype, yyvaluep) switch (yytype) { - default: - break; + default: + break; } } @@ -1183,7 +1197,7 @@ yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) - void *YYPARSE_PARAM; + void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1193,10 +1207,11 @@ yyparse (void) #else int yyparse () + #endif #endif { - + int yystate; int yyn; int yyresult; @@ -1264,12 +1279,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. */ yyssp++; -yysetstate: + yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) @@ -1290,9 +1305,11 @@ yysetstate: 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; @@ -1312,7 +1329,7 @@ yysetstate: 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); @@ -1432,447 +1449,359 @@ 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: -#line 70 "parser.y" - { - spdltac = (yyvsp[(1) - (1)].tac);; - } - break; + case 2: +#line 71 "parser.y" + { spdltac = (yyvsp[(1) - (1)].tac); ;} + break; - case 3: -#line 74 "parser.y" - { - (yyval.tac) = NULL;; - } - break; + case 3: +#line 75 "parser.y" + { (yyval.tac) = NULL; ;} + break; - case 4: -#line 76 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 4: +#line 77 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 5: -#line 80 "parser.y" - { - Tac t = tacCreate (TAC_UNTRUSTED); - t->t1.tac = (yyvsp[(2) - (3)].tac); - (yyval.tac) = t; - ; - } - break; + case 5: +#line 81 "parser.y" + { + Tac t = tacCreate(TAC_UNTRUSTED); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ;} + break; - case 6: -#line 86 "parser.y" - { - Tac t = tacCreate (TAC_RUN); - t->t1.tac = (yyvsp[(2) - (6)].tac); - t->t2.tac = (yyvsp[(4) - (6)].tac); - (yyval.tac) = t; - ; - } - break; + case 6: +#line 87 "parser.y" + { + 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: -#line 93 "parser.y" - { - 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 7: +#line 94 "parser.y" + { + 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: -#line 101 "parser.y" - { - Tac t = tacCreate (TAC_USERTYPE); - t->t1.tac = (yyvsp[(2) - (3)].tac); - (yyval.tac) = t; - ; - } - break; + case 8: +#line 102 "parser.y" + { + Tac t = tacCreate(TAC_USERTYPE); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ;} + break; - case 9: -#line 107 "parser.y" - { - (yyval.tac) = (yyvsp[(1) - (1)].tac); - ; - } - break; + case 9: +#line 108 "parser.y" + { + (yyval.tac) = (yyvsp[(1) - (1)].tac); + ;} + break; - case 10: -#line 113 "parser.y" - { - (yyval.tac) = NULL;; - } - break; + case 10: +#line 114 "parser.y" + { (yyval.tac) = NULL; ;} + break; - case 11: -#line 115 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 11: +#line 116 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 12: -#line 117 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 12: +#line 118 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 13: -#line 121 "parser.y" - { - // 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 13: +#line 122 "parser.y" + { + // 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: -#line 132 "parser.y" - { - (yyval.value) = 0;; - } - break; + case 14: +#line 133 "parser.y" + { (yyval.value) = 0; ;} + break; - case 15: -#line 134 "parser.y" - { - (yyval.value) = 1;; - } - break; + case 15: +#line 135 "parser.y" + { (yyval.value) = 1; ;} + break; - case 16: -#line 138 "parser.y" - {; - } - break; + case 16: +#line 139 "parser.y" + { ;} + break; - case 17: -#line 140 "parser.y" - {; - } - break; + case 17: +#line 141 "parser.y" + { ;} + break; - case 18: -#line 144 "parser.y" - { - (yyval.tac) = NULL;; - } - break; + case 18: +#line 145 "parser.y" + { (yyval.tac) = NULL; ;} + break; - case 19: -#line 146 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 19: +#line 147 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 20: -#line 148 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 20: +#line 149 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 21: -#line 150 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (2)].tac), (yyvsp[(2) - (2)].tac));; - } - break; + case 21: +#line 151 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (2)].tac),(yyvsp[(2) - (2)].tac)); ;} + break; - case 22: -#line 154 "parser.y" - { - 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 22: +#line 155 "parser.y" + { 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: -#line 161 "parser.y" - { - 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 23: +#line 162 "parser.y" + { 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: -#line 169 "parser.y" - { - Tac t = tacCreate (TAC_CLAIM); - t->t1.sym = (yyvsp[(2) - (6)].symb); - t->t2.tac = (yyvsp[(4) - (6)].tac); - (yyval.tac) = t; - ; - } - break; + case 24: +#line 170 "parser.y" + { 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: -#line 177 "parser.y" - { - Tac t = tacCreate (TAC_ROLEREF); - t->t1.sym = (yyvsp[(1) - (3)].symb); - t->t2.sym = (yyvsp[(3) - (3)].symb); - (yyval.tac) = t; - ; - } - break; + case 25: +#line 178 "parser.y" + { 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: -#line 185 "parser.y" - { - Tac t = tacCreate (TAC_KNOWS); - t->t1.tac = (yyvsp[(2) - (3)].tac); - (yyval.tac) = t; - ; - } - break; + case 26: +#line 186 "parser.y" + { Tac t = tacCreate(TAC_KNOWS); + t->t1.tac = (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ;} + break; - case 27: -#line 192 "parser.y" - { - 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 27: +#line 193 "parser.y" + { 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: -#line 199 "parser.y" - { - 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 28: +#line 200 "parser.y" + { 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: -#line 206 "parser.y" - { - Tac t = tacCreate (TAC_SECRET); - t->t1.tac = (yyvsp[(2) - (4)].tac); - t->t2.tac = (yyvsp[(3) - (4)].tac); - (yyval.tac) = t; - ; - } - break; + case 29: +#line 207 "parser.y" + { 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: -#line 212 "parser.y" - { - Tac t = tacCreate (TAC_INVERSEKEYS); - t->t1.tac = (yyvsp[(3) - (7)].tac); - t->t2.tac = (yyvsp[(5) - (7)].tac); - (yyval.tac) = t; - ; - } - break; + case 30: +#line 213 "parser.y" + { 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: -#line 218 "parser.y" - { - Tac t = tacCreate (TAC_COMPROMISED); - t->t1.tac = (yyvsp[(2) - (3)].tac); - (yyval.tac) = t; - ; - } - break; + case 31: +#line 219 "parser.y" + { Tac t = tacCreate(TAC_COMPROMISED); + t->t1.tac= (yyvsp[(2) - (3)].tac); + (yyval.tac) = t; + ;} + break; - case 32: -#line 225 "parser.y" - { - (yyval.tac) = NULL; - ; - } - break; + case 32: +#line 226 "parser.y" + { + (yyval.tac) = NULL; + ;} + break; - case 33: -#line 229 "parser.y" - { - Tac t = tacCreate (TAC_SECRET); - (yyval.tac) = t; - ; - } - break; + case 33: +#line 230 "parser.y" + { + Tac t = tacCreate(TAC_SECRET); + (yyval.tac) = t; + ;} + break; - case 34: -#line 236 "parser.y" - { - Tac t = tacCreate (TAC_UNDEF); - (yyval.tac) = t; - ; - } - break; + case 34: +#line 237 "parser.y" + { + Tac t = tacCreate(TAC_UNDEF); + (yyval.tac) = t; + ;} + break; - case 35: -#line 241 "parser.y" - { - Tac t = tacCreate (TAC_STRING); - t->t1.sym = (yyvsp[(2) - (2)].symb); - (yyval.tac) = t; - ; - } - break; + case 35: +#line 242 "parser.y" + { Tac t = tacCreate(TAC_STRING); + t->t1.sym = (yyvsp[(2) - (2)].symb); + (yyval.tac) = t; + ;} + break; - case 36: -#line 248 "parser.y" - { - Tac t = tacCreate (TAC_UNDEF); - (yyval.tac) = t; - ; - } - break; + case 36: +#line 249 "parser.y" + { + Tac t = tacCreate(TAC_UNDEF); + (yyval.tac) = t; + ;} + break; - case 37: -#line 253 "parser.y" - { - (yyval.tac) = (yyvsp[(2) - (2)].tac); - ; - } - break; + case 37: +#line 254 "parser.y" + { + (yyval.tac) = (yyvsp[(2) - (2)].tac); + ;} + break; - case 38: -#line 259 "parser.y" - { - (yyval.symb) = (yyvsp[(2) - (2)].symb);; - } - break; + case 38: +#line 260 "parser.y" + { (yyval.symb) = (yyvsp[(2) - (2)].symb); ;} + break; - case 39: -#line 263 "parser.y" - { - (yyval.symb) = NULL;; - } - break; + case 39: +#line 264 "parser.y" + { (yyval.symb) = NULL; ;} + break; - case 40: -#line 265 "parser.y" - {; - } - break; + case 40: +#line 266 "parser.y" + { ;} + break; - case 41: -#line 270 "parser.y" - { - Tac t = tacCreate (TAC_STRING); - t->t1.sym = (yyvsp[(1) - (1)].symb); - (yyval.tac) = t; - ; - } - break; + case 41: +#line 271 "parser.y" + { + Tac t = tacCreate(TAC_STRING); + t->t1.sym = (yyvsp[(1) - (1)].symb); + (yyval.tac) = t; + ;} + break; - case 42: -#line 278 "parser.y" - {; - } - break; + case 42: +#line 279 "parser.y" + { ;} + break; - case 43: -#line 280 "parser.y" - { - 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 43: +#line 281 "parser.y" + { + 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: -#line 286 "parser.y" - { - (yyval.tac) = - tacJoin (TAC_ENCRYPT, tacTuple ((yyvsp[(2) - (4)].tac)), - (yyvsp[(4) - (4)].tac), NULL); - ; - } - break; + case 44: +#line 287 "parser.y" + { + (yyval.tac) = tacJoin(TAC_ENCRYPT,tacTuple((yyvsp[(2) - (4)].tac)),(yyvsp[(4) - (4)].tac),NULL); + ;} + break; - case 45: -#line 290 "parser.y" - { - (yyval.tac) = tacTuple ((yyvsp[(2) - (3)].tac)); - ; - } - break; + case 45: +#line 291 "parser.y" + { + (yyval.tac) = tacTuple((yyvsp[(2) - (3)].tac)); + ;} + break; - case 46: -#line 296 "parser.y" - {; - } - break; + case 46: +#line 297 "parser.y" + { ;} + break; - case 47: -#line 298 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (3)].tac), (yyvsp[(3) - (3)].tac));; - } - break; + case 47: +#line 299 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (3)].tac),(yyvsp[(3) - (3)].tac)); ;} + break; - case 48: -#line 302 "parser.y" - {; - } - break; + case 48: +#line 303 "parser.y" + { ;} + break; - case 49: -#line 304 "parser.y" - { - (yyval.tac) = - tacCat ((yyvsp[(1) - (3)].tac), (yyvsp[(3) - (3)].tac));; - } - break; + case 49: +#line 305 "parser.y" + { (yyval.tac) = tacCat((yyvsp[(1) - (3)].tac),(yyvsp[(3) - (3)].tac)); ;} + break; - case 50: -#line 308 "parser.y" - {; - } - break; + case 50: +#line 309 "parser.y" + { ;} + break; /* Line 1267 of yacc.c. */ -#line 1803 "parser.c" - default: - break; +#line 1804 "parser.c" + default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -1907,14 +1836,14 @@ yyerrlab: { ++yynerrs; #if ! YYERROR_VERBOSE - yyerror (YY_ ("syntax error")); + 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)) + if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); @@ -1935,7 +1864,7 @@ yyerrlab: } else { - yyerror (YY_ ("syntax error")); + yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } @@ -1948,7 +1877,7 @@ 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) { @@ -1958,7 +1887,8 @@ yyerrlab: } else { - yydestruct ("Error: discarding", yytoken, &yylval); + yydestruct ("Error: discarding", + yytoken, &yylval); yychar = YYEMPTY; } } @@ -1976,8 +1906,8 @@ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ - if ( /*CONSTCOND*/ 0) - goto yyerrorlab; + if (/*CONSTCOND*/ 0) + goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ @@ -1992,7 +1922,7 @@ yyerrorlab: | 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 (;;) { @@ -2013,7 +1943,8 @@ yyerrlab1: YYABORT; - yydestruct ("Error: popping", yystos[yystate], yyvsp); + yydestruct ("Error: popping", + yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2051,21 +1982,23 @@ 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); + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow @@ -2081,15 +2014,18 @@ yyreturn: } -#line 313 "parser.y" +#line 314 "parser.y" //! 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); + return 0; } + + + diff --git a/src/parser.h b/src/parser.h index ea8af46..610c24d 100644 --- a/src/parser.h +++ b/src/parser.h @@ -38,28 +38,27 @@ # 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 @@ -87,19 +86,20 @@ enum yytokentype #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 13 "parser.y" +#line 14 "parser.y" { - char *str; - struct tacnode *tac; - Symbol symb; - int value; + 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 */ + 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/parser.y b/src/parser.y index 964cbf1..c91382d 100644 --- a/src/parser.y +++ b/src/parser.y @@ -2,6 +2,7 @@ #include "pheading.h" /* #include "lex.yy.c" */ #include "tac.h" +#include "error.h" struct tacnode* spdltac; @@ -319,6 +320,7 @@ int yyerror(char *s) extern char *yytext; //!< defined and maintained in lex.c error ("%s at symbol '%s' on line %i.\n", s, yytext, yylineno); + return 0; } diff --git a/src/prune_bounds.c b/src/prune_bounds.c index 2b6ceed..0e7e93d 100644 --- a/src/prune_bounds.c +++ b/src/prune_bounds.c @@ -11,6 +11,10 @@ #include "termlist.h" #include "list.h" #include "switches.h" +#include "timer.h" +#include "arachne.h" +#include "system.h" +#include "cost.h" extern int attack_length; extern int attack_leastcost; @@ -27,9 +31,6 @@ extern int max_encryption_level; int prune_bounds (const System sys) { - Termlist tl; - List bl; - /* prune for time */ if (passed_time_limit ()) { diff --git a/src/prune_theorems.c b/src/prune_theorems.c index b8230d5..9acbbbf 100644 --- a/src/prune_theorems.c +++ b/src/prune_theorems.c @@ -13,6 +13,10 @@ #include "binding.h" #include "specialterm.h" #include "hidelevel.h" +#include "depend.h" +#include "arachne.h" +#include "error.h" +#include "type.h" extern Protocol INTRUDER; extern int proofDepth; @@ -106,9 +110,8 @@ correctLocalOrder (const System sys) globalError--; error ("Abort"); } - return true; - } + return true; } return iterateLocalToOther (sys, r1, checkTerm); @@ -162,7 +165,6 @@ initiatorAgentsType (const System sys) int prune_theorems (const System sys) { - Termlist tl; List bl; int run; diff --git a/src/role.c b/src/role.c index d7681ec..cc0c468 100644 --- a/src/role.c +++ b/src/role.c @@ -11,6 +11,7 @@ #include "knowledge.h" #include "system.h" #include "debug.h" +#include "error.h" #include "role.h" extern int protocolCount; // from system.c diff --git a/src/scanner.c b/src/scanner.c index 40e75aa..093ed97 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -50,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 */ @@ -91,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 @@ -166,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 \ @@ -203,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. */ + 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; - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; + int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via 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 @@ -300,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 @@ -361,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. @@ -381,166 +381,173 @@ 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; @@ -569,21 +576,20 @@ 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; @@ -615,7 +621,7 @@ int include_stack_ptr = 0; #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals (void); +static int yy_init_globals (void ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -623,28 +629,28 @@ static int yy_init_globals (void); #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 @@ -748,445 +754,458 @@ 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 764 "" - if (!(yy_init)) - { - (yy_init) = 1; + 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') + 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++; +; + } - yylineno++; - ; - } +do_action: /* This label is used only to access EOF actions. */ - do_action: /* This label is used only to access EOF actions. */ + switch ( yy_act ) + { /* beginning of action switch */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = (yy_hold_char); + yy_cp = (yy_last_accepting_cpos); + yy_current_state = (yy_last_accepting_state); + goto yy_find_action; - switch (yy_act) - { /* beginning of action switch */ - case 0: /* must back up */ - /* undo the effects of YY_DO_BEFORE_ACTION */ - *yy_cp = (yy_hold_char); - yy_cp = (yy_last_accepting_cpos); - yy_current_state = (yy_last_accepting_state); - goto yy_find_action; - - case 1: - YY_RULE_SETUP +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 +ECHO; + YY_BREAK #line 1077 "" - case YY_STATE_EOF (incl): - case YY_STATE_EOF (inclend): - yyterminate (); +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; - - /* 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(). - */ - if ((yy_c_buf_p) <= - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - 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; + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - 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. + /* 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_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + (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_act = YY_STATE_EOF (YY_START); - goto do_action; - } + /* 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; - else - { - if (!(yy_did_buffer_switch_on_eof)) - YY_NEW_FILE; - } - break; - } + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + yy_current_state = yy_get_previous_state( ); - yy_current_state = yy_get_previous_state (); + /* 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_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; + yy_next_state = yy_try_NUL_trans( yy_current_state ); - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + yy_bp = (yytext_ptr) + YY_MORE_ADJ; - yy_current_state = yy_get_previous_state (); + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + 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_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + 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; } - 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 * @@ -1195,158 +1214,157 @@ YY_DECL * 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; + register yy_state_type yy_current_state; + register char *yy_cp; + + yy_current_state = (yy_start); - yy_current_state = (yy_start); + 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]; + } - 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; + return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character @@ -1354,214 +1372,208 @@ yy_get_previous_state (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; + register char *yy_cp; + + yy_cp = (yy_c_buf_p); - yy_cp = (yy_c_buf_p); + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); + 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]; - 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]; + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; - while (source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf) - *--dest = *--source; + 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 += (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; + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } - if (yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2) - YY_FATAL_ERROR ("flex scanner push-back overflow"); + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; } - *--yy_cp = (char) c; - - if (c == '\n') - { - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; + (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; + int c; + + *(yy_c_buf_p) = (yy_hold_char); - *(yy_c_buf_p) = (yy_hold_char); + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; - if (*(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ((yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; + else + { /* need more input */ + int offset = (yy_c_buf_p) - (yytext_ptr); + ++(yy_c_buf_p); - else - { /* need more input */ - int offset = (yy_c_buf_p) - (yytext_ptr); - ++(yy_c_buf_p); + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ - switch (yy_get_next_buffer ()) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ + /* Reset buffer status. */ + yyrestart(yyin ); - /* Reset buffer status. */ - yyrestart (yyin); + /*FALLTHROUGH*/ - /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: - { - if (yywrap ()) - return EOF; + 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); - - if (c == '\n') + 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' ) + 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 ); + } - 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 (); + 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; - /* 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); + } - if (YY_CURRENT_BUFFER) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); - 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; + /* 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. @@ -1570,110 +1582,106 @@ 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; + 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()" ); - b = (YY_BUFFER_STATE) yyalloc (sizeof (struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR ("out of dynamic memory in yy_create_buffer()"); + b->yy_buf_size = size; - b->yy_buf_size = size; + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); + if ( ! b->yy_ch_buf ) + 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_is_our_buffer = 1; - b->yy_is_our_buffer = 1; + yy_init_buffer(b,file ); - yy_init_buffer (b, file); - - return b; + 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) - return; + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - if (b == YY_CURRENT_BUFFER) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + if ( b->yy_is_our_buffer ) + yyfree((void *) b->yy_ch_buf ); - if (b->yy_is_our_buffer) - yyfree ((void *) b->yy_ch_buf); - - yyfree ((void *) b); + 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; + int oerrno = errno; + + yy_flush_buffer(b ); - yy_flush_buffer (b); + b->yy_input_file = file; + b->yy_fill_buffer = 1; - 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; + /* 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 @@ -1682,97 +1690,92 @@ yy_flush_buffer (YY_BUFFER_STATE b) * @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; + int num_to_alloc; + + if (!(yy_buffer_stack)) { - if (!(yy_buffer_stack)) - { + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + 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; + } - /* 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 *)); + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - memset ((yy_buffer_stack), 0, - num_to_alloc * sizeof (struct yy_buffer_state *)); + /* Increase the buffer to prepare for a possible push. */ + int grow_size = 8 /* arbitrary grow size */; - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } + 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*) + ); - 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; - } + /* 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. @@ -1781,34 +1784,33 @@ 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; + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return 0; - if (size < 2 || - base[size - 2] != YY_END_OF_BUFFER_CHAR || - base[size - 1] != YY_END_OF_BUFFER_CHAR) - /* They forgot to leave room for the EOB's. */ - return 0; + b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b = (YY_BUFFER_STATE) yyalloc (sizeof (struct yy_buffer_state)); - if (!b) - YY_FATAL_ERROR ("out of dynamic memory in yy_scan_buffer()"); + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = 0; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; + yy_switch_to_buffer(b ); - yy_switch_to_buffer (b); - - return b; + return b; } /** Setup the input buffer state to scan a string. The next call to yylex() will @@ -1819,11 +1821,10 @@ yy_scan_buffer (char *base, yy_size_t size) * @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 *yystr) +YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { - - return yy_scan_bytes (yystr, strlen (yystr)); + + return yy_scan_bytes(yystr,strlen(yystr) ); } /** Setup the input buffer state to scan the given bytes. The next call to yylex() will @@ -1833,46 +1834,44 @@ yy_scan_string (yyconst char *yystr) * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE -yy_scan_bytes (yyconst char *yybytes, int _yybytes_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; + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int 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()" ); - /* 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()"); + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; - for (i = 0; i < _yybytes_len; ++i) - buf[i] = yybytes[i]; + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - buf[_yybytes_len] = buf[_yybytes_len + 1] = YY_END_OF_BUFFER_CHAR; + b = yy_scan_buffer(buf,n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - b = yy_scan_buffer (buf, n); - if (!b) - YY_FATAL_ERROR ("bad buffer in yy_scan_bytes()"); + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; - /* 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; + 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. */ @@ -1897,59 +1896,53 @@ 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 @@ -1958,84 +1951,77 @@ 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) +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. - */ + /* 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; + /* 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; + yyin = stdin; + yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; + /* 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(); + } - /* 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; - /* 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( ); - /* 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; + return 0; } /* @@ -2043,50 +2029,45 @@ 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" @@ -2095,58 +2076,54 @@ yyfree (void *ptr) -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; @@ -2160,3 +2137,4 @@ void mktext(void); // vim:ft=lex: + diff --git a/src/specialterm.c b/src/specialterm.c index 66d1e1d..9f9fd78 100644 --- a/src/specialterm.c +++ b/src/specialterm.c @@ -3,6 +3,7 @@ #include "term.h" #include "termlist.h" #include "compiler.h" +#include "error.h" /* * Some macros diff --git a/src/specialterm.h b/src/specialterm.h index 3a210d8..592fad4 100644 --- a/src/specialterm.h +++ b/src/specialterm.h @@ -3,6 +3,7 @@ #include "term.h" #include "termlist.h" +#include "system.h" /* * Some declarations in spercialterm.c @@ -25,6 +26,7 @@ extern Term CLAIM_Reachable; extern Termlist CLAIMS_dep_prec; +void specialTermInit (const System sys); int isTicketTerm (Term t); int hasTicketSubterm (Term t); diff --git a/src/states.c b/src/states.c index 2b8f628..df77028 100644 --- a/src/states.c +++ b/src/states.c @@ -1,4 +1,5 @@ #include "states.h" +#include "symbol.h" /* States counter operations * diff --git a/src/switches.c b/src/switches.c index 670098a..fd82d24 100644 --- a/src/switches.c +++ b/src/switches.c @@ -282,7 +282,6 @@ switcher (const int process, int index, int commandline) char **argv; char *arg_pointer; - int arg_index; //! Check whether there are still n options left int enough_arguments_left (const int n, char shortopt, char *longopt) diff --git a/src/symbol.c b/src/symbol.c index 88cba8e..5d71193 100644 --- a/src/symbol.c +++ b/src/symbol.c @@ -266,6 +266,7 @@ symbolNextFree (Symbol prefixsymbol) } error ("We ran out of numbers (%i) when trying to generate a fresh symbol.", n); + return NULL; } //! Fix all the unset keylevels diff --git a/src/system.c b/src/system.c index 2214403..709d6fb 100644 --- a/src/system.c +++ b/src/system.c @@ -10,6 +10,7 @@ #include "knowledge.h" #include "system.h" #include "debug.h" +#include "error.h" #include "role.h" #include "mgu.h" #include "switches.h" @@ -148,7 +149,6 @@ systemRuns (const System sys) void systemDone (const System sys) { - int run; int s; /* clear globals, which were defined in systemStart */ diff --git a/src/system.h b/src/system.h index 1879797..7ee3ac3 100644 --- a/src/system.h +++ b/src/system.h @@ -212,6 +212,7 @@ int selfResponder (const System sys, const int run); int selfResponders (const System sys); int selfInitiator (const System sys, const int run); int selfInitiators (const System sys); +int enoughAttacks (const System sys); //! Equality for run structure naming diff --git a/src/tac.c b/src/tac.c index 45f0bbe..39467c3 100644 --- a/src/tac.c +++ b/src/tac.c @@ -3,6 +3,7 @@ #include "tac.h" #include "memory.h" #include "switches.h" +#include "error.h" extern int yylineno; @@ -183,6 +184,8 @@ tacTuple (Tac taclist) error ("Unknown tupling mode (--tupling=%i)", switches.tupling); } } + // @TODO this should be considered an error + return NULL; } /* diff --git a/src/term.c b/src/term.c index 562dc9d..2198ee7 100644 --- a/src/term.c +++ b/src/term.c @@ -16,6 +16,7 @@ #include #include "term.h" #include "debug.h" +#include "error.h" #include "ctype.h" #include "specialterm.h" @@ -866,9 +867,6 @@ termDistance (Term t1, Term t2) int termOrder (Term t1, Term t2) { - char *name1; - char *name2; - t1 = deVar (t1); t2 = deVar (t2); if (isTermEqual (t1, t2)) @@ -938,6 +936,8 @@ termOrder (Term t1, Term t2) else return compR; } + // @TODO Should be considered an error + return 0; } //! Generic term iteration @@ -1177,7 +1177,6 @@ term_constrain_level (const Term term) { int vars; int structure; - int flag; void tcl_iterate (Term t) { diff --git a/src/termlist.c b/src/termlist.c index fa88383..dd748b3 100644 --- a/src/termlist.c +++ b/src/termlist.c @@ -3,6 +3,7 @@ #include "termlist.h" #include "specialterm.h" #include "debug.h" +#include "error.h" /* * Shared stuff @@ -912,6 +913,8 @@ termlist_to_tuple (Termlist tl) return termDuplicate (tl->term); } } + // @TODO Should be considered an error + return NULL; } //! Split a tuple term into termlist components. diff --git a/src/xmlout.c b/src/xmlout.c index 48ebe51..5068f2e 100644 --- a/src/xmlout.c +++ b/src/xmlout.c @@ -21,6 +21,7 @@ #include "specialterm.h" #include "claim.h" #include "dotout.h" +#include "type.h" #include "xmlout.h" @@ -614,8 +615,6 @@ xmlOutEvent (const System sys, Roledef rd, const int run, const int index) // Display any incoming bindings { - int incomingArrows; - int xmlBindingState (void *dt) { Binding b;