1 /* A Bison parser, made by GNU Bison 3.0.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
7 This program is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 /* As a special exception, you may create a larger work that contains
21 part or all of the Bison parser skeleton and distribute that work
22 under terms of your choice, so long as that work isn't itself a
23 parser generator using the skeleton or a modified version thereof
24 as a parser skeleton. Alternatively, if you modify or redistribute
25 the parser skeleton itself, you may (at your option) remove this
26 special exception, which will cause the skeleton and the resulting
27 Bison output files to be licensed under the GNU General Public
28 License without this special exception.
30 This special exception was added by the Free Software Foundation in
31 version 2.2 of Bison. */
33 /* C LALR(1) parser skeleton written by Richard Stallman, by
34 simplifying the original so-called "semantic" parser. */
36 /* All symbols defined below should begin with yy or YY, to avoid
37 infringing on user name space. This should be done even for local
38 variables, as they might otherwise be expanded by user macros.
39 There are some unavoidable exceptions within include files to
40 define necessary library symbols; they are noted "INFRINGES ON
41 USER NAME SPACE" below. */
43 /* Identify Bison output. */
47 #define YYBISON_VERSION "3.0.2"
50 #define YYSKELETON_NAME "yacc.c"
62 /* Substitute the variable and function names. */
63 #define yyparse xbt_automaton_parser_parse
64 #define yylex xbt_automaton_parser_lex
65 #define yyerror xbt_automaton_parser_error
66 #define yydebug xbt_automaton_parser_debug
67 #define yynerrs xbt_automaton_parser_nerrs
69 #define yylval xbt_automaton_parser_lval
70 #define yychar xbt_automaton_parser_char
72 /* Copy the first part of user declarations. */
73 #line 7 "parserPromela.yacc" /* yacc.c:339 */
75 #include "simgrid_config.h"
77 #define YY_NO_UNISTD_H /* hello Windows */
80 #include "automaton_lexer.yy.c"
81 #include <xbt/automaton.h>
83 void yyerror(const char *s);
86 #line 87 "parserPromela.tab.cacc" /* yacc.c:339 */
89 # if defined __cplusplus && 201103L <= __cplusplus
90 # define YY_NULLPTR nullptr
96 /* Enabling verbose error messages. */
97 #ifdef YYERROR_VERBOSE
98 # undef YYERROR_VERBOSE
99 # define YYERROR_VERBOSE 1
101 # define YYERROR_VERBOSE 0
104 /* In a future release of Bison, this section will be replaced
105 by #include "parserPromela.tab.hacc". */
106 #ifndef YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
107 # define YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
113 extern int xbt_automaton_parser_debug;
145 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
146 typedef union YYSTYPE YYSTYPE;
149 #line 20 "parserPromela.yacc" /* yacc.c:355 */
154 xbt_automaton_exp_label_t label;
156 #line 157 "parserPromela.tab.cacc" /* yacc.c:355 */
158 # define YYSTYPE_IS_TRIVIAL 1
159 # define YYSTYPE_IS_DECLARED 1
163 extern YYSTYPE xbt_automaton_parser_lval;
165 int xbt_automaton_parser_parse (void);
167 #endif /* !YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED */
169 /* Copy the second part of user declarations. */
171 #line 172 "parserPromela.tab.cacc" /* yacc.c:358 */
178 typedef YYTYPE_UINT8 yytype_uint8;
180 typedef unsigned char yytype_uint8;
184 typedef YYTYPE_INT8 yytype_int8;
186 typedef signed char yytype_int8;
190 typedef YYTYPE_UINT16 yytype_uint16;
192 typedef unsigned short int yytype_uint16;
196 typedef YYTYPE_INT16 yytype_int16;
198 typedef short int yytype_int16;
202 # ifdef __SIZE_TYPE__
203 # define YYSIZE_T __SIZE_TYPE__
204 # elif defined size_t
205 # define YYSIZE_T size_t
206 # elif ! defined YYSIZE_T
207 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
208 # define YYSIZE_T size_t
210 # define YYSIZE_T unsigned int
214 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
217 # if defined YYENABLE_NLS && YYENABLE_NLS
219 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
220 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
224 # define YY_(Msgid) Msgid
229 # if (defined __GNUC__ \
230 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
231 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
232 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
234 # define YY_ATTRIBUTE(Spec) /* empty */
238 #ifndef YY_ATTRIBUTE_PURE
239 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
242 #ifndef YY_ATTRIBUTE_UNUSED
243 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
246 #if !defined _Noreturn \
247 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
248 # if defined _MSC_VER && 1200 <= _MSC_VER
249 # define _Noreturn __declspec (noreturn)
251 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
255 /* Suppress unused-variable warnings by "using" E. */
256 #if ! defined lint || defined __GNUC__
257 # define YYUSE(E) ((void) (E))
259 # define YYUSE(E) /* empty */
262 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
263 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
264 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
265 _Pragma ("GCC diagnostic push") \
266 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
267 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
268 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
269 _Pragma ("GCC diagnostic pop")
271 # define YY_INITIAL_VALUE(Value) Value
273 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
274 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
275 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
277 #ifndef YY_INITIAL_VALUE
278 # define YY_INITIAL_VALUE(Value) /* Nothing. */
282 #if ! defined yyoverflow || YYERROR_VERBOSE
284 /* The parser invokes alloca or malloc; define the necessary symbols. */
286 # ifdef YYSTACK_USE_ALLOCA
287 # if YYSTACK_USE_ALLOCA
289 # define YYSTACK_ALLOC __builtin_alloca
290 # elif defined __BUILTIN_VA_ARG_INCR
291 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
293 # define YYSTACK_ALLOC __alloca
294 # elif defined _MSC_VER
295 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
296 # define alloca _alloca
298 # define YYSTACK_ALLOC alloca
299 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
300 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
301 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
302 # ifndef EXIT_SUCCESS
303 # define EXIT_SUCCESS 0
310 # ifdef YYSTACK_ALLOC
311 /* Pacify GCC's 'empty if-body' warning. */
312 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
313 # ifndef YYSTACK_ALLOC_MAXIMUM
314 /* The OS might guarantee only one guard page at the bottom of the stack,
315 and a page size can be as small as 4096 bytes. So we cannot safely
316 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
317 to allow for a few compiler-allocated temporary stack slots. */
318 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
321 # define YYSTACK_ALLOC YYMALLOC
322 # define YYSTACK_FREE YYFREE
323 # ifndef YYSTACK_ALLOC_MAXIMUM
324 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
326 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
327 && ! ((defined YYMALLOC || defined malloc) \
328 && (defined YYFREE || defined free)))
329 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
330 # ifndef EXIT_SUCCESS
331 # define EXIT_SUCCESS 0
335 # define YYMALLOC malloc
336 # if ! defined malloc && ! defined EXIT_SUCCESS
337 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
342 # if ! defined free && ! defined EXIT_SUCCESS
343 void free (void *); /* INFRINGES ON USER NAME SPACE */
347 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
350 #if (! defined yyoverflow \
351 && (! defined __cplusplus \
352 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
354 /* A type that is properly aligned for any stack member. */
357 yytype_int16 yyss_alloc;
361 /* The size of the maximum gap between one aligned stack and the next. */
362 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
364 /* The size of an array large to enough to hold all stacks, each with
366 # define YYSTACK_BYTES(N) \
367 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
368 + YYSTACK_GAP_MAXIMUM)
370 # define YYCOPY_NEEDED 1
372 /* Relocate STACK from its old location to the new one. The
373 local variables YYSIZE and YYSTACKSIZE give the old and new number of
374 elements in the stack, and YYPTR gives the new location of the
375 stack. Advance YYPTR to a properly aligned location for the next
377 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
380 YYSIZE_T yynewbytes; \
381 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
382 Stack = &yyptr->Stack_alloc; \
383 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
384 yyptr += yynewbytes / sizeof (*yyptr); \
390 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
391 /* Copy COUNT objects from SRC to DST. The source and destination do
394 # if defined __GNUC__ && 1 < __GNUC__
395 # define YYCOPY(Dst, Src, Count) \
396 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
398 # define YYCOPY(Dst, Src, Count) \
402 for (yyi = 0; yyi < (Count); yyi++) \
403 (Dst)[yyi] = (Src)[yyi]; \
408 #endif /* !YYCOPY_NEEDED */
410 /* YYFINAL -- State number of the termination state. */
412 /* YYLAST -- Last index in YYTABLE. */
415 /* YYNTOKENS -- Number of terminals. */
417 /* YYNNTS -- Number of nonterminals. */
419 /* YYNRULES -- Number of rules. */
421 /* YYNSTATES -- Number of states. */
424 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
425 by yylex, with out-of-bounds checking. */
427 #define YYMAXUTOK 277
429 #define YYTRANSLATE(YYX) \
430 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
432 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
433 as returned by yylex, without out-of-bounds checking. */
434 static const yytype_uint8 yytranslate[] =
436 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
437 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
438 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
439 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
440 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
441 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
442 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
443 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
444 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
446 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
447 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
448 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
449 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
450 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
451 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
452 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
453 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
454 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
455 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
456 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
457 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
458 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
459 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
460 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
461 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
462 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
463 15, 16, 17, 18, 19, 20, 21, 22
467 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
468 static const yytype_uint8 yyrline[] =
470 0, 57, 57, 60, 61, 61, 64, 65, 68, 69,
475 #if YYDEBUG || YYERROR_VERBOSE || 0
476 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
477 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
478 static const char *const yytname[] =
480 "$end", "error", "$undefined", "NEVER", "IF", "FI", "IMPLIES", "GOTO",
481 "AND", "OR", "NOT", "LEFT_PAR", "RIGHT_PAR", "CASE", "COLON",
482 "SEMI_COLON", "CASE_TRUE", "LEFT_BRACE", "RIGHT_BRACE", "LITT_ENT",
483 "LITT_CHAINE", "LITT_REEL", "ID", "$accept", "automaton", "stateseq",
484 "$@1", "option", "exp", YY_NULLPTR
489 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
490 (internal) symbol number NUM (which must be that of a token). */
491 static const yytype_uint16 yytoknum[] =
493 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
494 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
499 #define YYPACT_NINF -16
501 #define yypact_value_is_default(Yystate) \
502 (!!((Yystate) == (-16)))
504 #define YYTABLE_NINF -1
506 #define yytable_value_is_error(Yytable_value) \
509 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
511 static const yytype_int8 yypact[] =
513 0, -15, 10, -13, -16, 2, 1, -16, -16, 16,
514 8, -10, 17, -10, -10, -16, -16, 9, 11, -16,
515 -1, 18, -10, -10, -13, -16, 5, -16, -16, -16,
519 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
520 Performed when YYTABLE does not specify something else to do. Zero
521 means the default is an error. */
522 static const yytype_uint8 yydefact[] =
524 0, 0, 0, 3, 1, 0, 0, 4, 2, 0,
525 6, 0, 0, 0, 0, 12, 13, 0, 0, 11,
526 0, 0, 0, 0, 3, 8, 0, 10, 9, 5,
530 /* YYPGOTO[NTERM-NUM]. */
531 static const yytype_int8 yypgoto[] =
533 -16, -16, 4, -16, -7, -9
536 /* YYDEFGOTO[NTERM-NUM]. */
537 static const yytype_int8 yydefgoto[] =
542 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
543 positive, shift that token. If negative, reduce the rule whose
544 number is the opposite. If YYTABLE_NINF, syntax error. */
545 static const yytype_uint8 yytable[] =
547 13, 14, 3, 1, 19, 20, 15, 22, 23, 5,
548 4, 25, 16, 27, 28, 21, 7, 22, 23, 8,
549 10, 11, 18, 31, 0, 26, 24, 30, 29
552 static const yytype_int8 yycheck[] =
554 10, 11, 17, 3, 13, 14, 16, 8, 9, 22,
555 0, 12, 22, 22, 23, 6, 14, 8, 9, 18,
556 4, 13, 5, 30, -1, 7, 15, 22, 24
559 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
560 symbol of state STATE-NUM. */
561 static const yytype_uint8 yystos[] =
563 0, 3, 24, 17, 0, 22, 25, 14, 18, 26,
564 4, 13, 27, 10, 11, 16, 22, 28, 5, 28,
565 28, 6, 8, 9, 15, 12, 7, 28, 28, 25,
569 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
570 static const yytype_uint8 yyr1[] =
572 0, 23, 24, 25, 26, 25, 27, 27, 28, 28,
576 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
577 static const yytype_uint8 yyr2[] =
579 0, 2, 4, 0, 0, 8, 0, 6, 3, 3,
584 #define yyerrok (yyerrstatus = 0)
585 #define yyclearin (yychar = YYEMPTY)
589 #define YYACCEPT goto yyacceptlab
590 #define YYABORT goto yyabortlab
591 #define YYERROR goto yyerrorlab
594 #define YYRECOVERING() (!!yyerrstatus)
596 #define YYBACKUP(Token, Value) \
598 if (yychar == YYEMPTY) \
602 YYPOPSTACK (yylen); \
608 yyerror (YY_("syntax error: cannot back up")); \
613 /* Error token number */
615 #define YYERRCODE 256
619 /* Enable debugging if requested. */
623 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
624 # define YYFPRINTF fprintf
627 # define YYDPRINTF(Args) \
633 /* This macro is provided for backward compatibility. */
634 #ifndef YY_LOCATION_PRINT
635 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
639 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
643 YYFPRINTF (stderr, "%s ", Title); \
644 yy_symbol_print (stderr, \
646 YYFPRINTF (stderr, "\n"); \
651 /*----------------------------------------.
652 | Print this symbol's value on YYOUTPUT. |
653 `----------------------------------------*/
656 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
658 FILE *yyo = yyoutput;
663 if (yytype < YYNTOKENS)
664 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
670 /*--------------------------------.
671 | Print this symbol on YYOUTPUT. |
672 `--------------------------------*/
675 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
677 YYFPRINTF (yyoutput, "%s %s (",
678 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
680 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
681 YYFPRINTF (yyoutput, ")");
684 /*------------------------------------------------------------------.
685 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
687 `------------------------------------------------------------------*/
690 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
692 YYFPRINTF (stderr, "Stack now");
693 for (; yybottom <= yytop; yybottom++)
695 int yybot = *yybottom;
696 YYFPRINTF (stderr, " %d", yybot);
698 YYFPRINTF (stderr, "\n");
701 # define YY_STACK_PRINT(Bottom, Top) \
704 yy_stack_print ((Bottom), (Top)); \
708 /*------------------------------------------------.
709 | Report that the YYRULE is going to be reduced. |
710 `------------------------------------------------*/
713 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
715 unsigned long int yylno = yyrline[yyrule];
716 int yynrhs = yyr2[yyrule];
718 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
720 /* The symbols being reduced. */
721 for (yyi = 0; yyi < yynrhs; yyi++)
723 YYFPRINTF (stderr, " $%d = ", yyi + 1);
724 yy_symbol_print (stderr,
725 yystos[yyssp[yyi + 1 - yynrhs]],
726 &(yyvsp[(yyi + 1) - (yynrhs)])
728 YYFPRINTF (stderr, "\n");
732 # define YY_REDUCE_PRINT(Rule) \
735 yy_reduce_print (yyssp, yyvsp, Rule); \
738 /* Nonzero means print parse trace. It is left uninitialized so that
739 multiple parsers can coexist. */
742 # define YYDPRINTF(Args)
743 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
744 # define YY_STACK_PRINT(Bottom, Top)
745 # define YY_REDUCE_PRINT(Rule)
746 #endif /* !YYDEBUG */
749 /* YYINITDEPTH -- initial size of the parser's stacks. */
751 # define YYINITDEPTH 200
754 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
755 if the built-in stack extension method is used).
757 Do not make this value too large; the results are undefined if
758 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
759 evaluated with infinite-precision integer arithmetic. */
762 # define YYMAXDEPTH 10000
769 # if defined __GLIBC__ && defined _STRING_H
770 # define yystrlen strlen
772 /* Return the length of YYSTR. */
774 yystrlen (const char *yystr)
777 for (yylen = 0; yystr[yylen]; yylen++)
785 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
786 # define yystpcpy stpcpy
788 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
791 yystpcpy (char *yydest, const char *yysrc)
794 const char *yys = yysrc;
796 while ((*yyd++ = *yys++) != '\0')
805 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
806 quotes and backslashes, so that it's suitable for yyerror. The
807 heuristic is that double-quoting is unnecessary unless the string
808 contains an apostrophe, a comma, or backslash (other than
809 backslash-backslash). YYSTR is taken from yytname. If YYRES is
810 null, do not copy; instead, return the length of what the result
813 yytnamerr (char *yyres, const char *yystr)
818 char const *yyp = yystr;
825 goto do_not_strip_quotes;
829 goto do_not_strip_quotes;
842 do_not_strip_quotes: ;
846 return yystrlen (yystr);
848 return yystpcpy (yyres, yystr) - yyres;
852 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
853 about the unexpected token YYTOKEN for the state stack whose top is
856 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
857 not large enough to hold the message. In that case, also set
858 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
859 required number of bytes is too large to store. */
861 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
862 yytype_int16 *yyssp, int yytoken)
864 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
865 YYSIZE_T yysize = yysize0;
866 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
867 /* Internationalized format string. */
868 const char *yyformat = YY_NULLPTR;
869 /* Arguments of yyformat. */
870 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
871 /* Number of reported tokens (one for the "unexpected", one per
875 /* There are many possibilities here to consider:
876 - If this state is a consistent state with a default action, then
877 the only way this function was invoked is if the default action
878 is an error action. In that case, don't check for expected
879 tokens because there are none.
880 - The only way there can be no lookahead present (in yychar) is if
881 this state is a consistent state with a default action. Thus,
882 detecting the absence of a lookahead is sufficient to determine
883 that there is no unexpected or expected token to report. In that
884 case, just report a simple "syntax error".
885 - Don't assume there isn't a lookahead just because this state is a
886 consistent state with a default action. There might have been a
887 previous inconsistent state, consistent state with a non-default
888 action, or user semantic action that manipulated yychar.
889 - Of course, the expected token list depends on states to have
890 correct lookahead information, and it depends on the parser not
891 to perform extra reductions after fetching a lookahead from the
892 scanner and before detecting a syntax error. Thus, state merging
893 (from LALR or IELR) and default reductions corrupt the expected
894 token list. However, the list is correct for canonical LR with
895 one exception: it will still contain any token that will not be
896 accepted due to an error action in a later state.
898 if (yytoken != YYEMPTY)
900 int yyn = yypact[*yyssp];
901 yyarg[yycount++] = yytname[yytoken];
902 if (!yypact_value_is_default (yyn))
904 /* Start YYX at -YYN if negative to avoid negative indexes in
905 YYCHECK. In other words, skip the first -YYN actions for
906 this state because they are default actions. */
907 int yyxbegin = yyn < 0 ? -yyn : 0;
908 /* Stay within bounds of both yycheck and yytname. */
909 int yychecklim = YYLAST - yyn + 1;
910 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
913 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
914 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
915 && !yytable_value_is_error (yytable[yyx + yyn]))
917 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
923 yyarg[yycount++] = yytname[yyx];
925 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
926 if (! (yysize <= yysize1
927 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
937 # define YYCASE_(N, S) \
941 YYCASE_(0, YY_("syntax error"));
942 YYCASE_(1, YY_("syntax error, unexpected %s"));
943 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
944 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
945 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
946 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
951 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
952 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
957 if (*yymsg_alloc < yysize)
959 *yymsg_alloc = 2 * yysize;
960 if (! (yysize <= *yymsg_alloc
961 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
962 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
966 /* Avoid sprintf, as that infringes on the user's name space.
967 Don't have undefined behavior even if the translation
968 produced a string with the wrong number of "%s"s. */
972 while ((*yyp = *yyformat) != '\0')
973 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
975 yyp += yytnamerr (yyp, yyarg[yyi++]);
986 #endif /* YYERROR_VERBOSE */
988 /*-----------------------------------------------.
989 | Release the memory associated to this symbol. |
990 `-----------------------------------------------*/
993 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
998 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1000 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1002 YY_IGNORE_MAYBE_UNINITIALIZED_END
1008 /* The lookahead symbol. */
1011 /* The semantic value of the lookahead symbol. */
1013 /* Number of syntax errors so far. */
1025 /* Number of tokens to shift before error messages enabled. */
1028 /* The stacks and their tools:
1029 'yyss': related to states.
1030 'yyvs': related to semantic values.
1032 Refer to the stacks through separate pointers, to allow yyoverflow
1033 to reallocate them elsewhere. */
1035 /* The state stack. */
1036 yytype_int16 yyssa[YYINITDEPTH];
1038 yytype_int16 *yyssp;
1040 /* The semantic value stack. */
1041 YYSTYPE yyvsa[YYINITDEPTH];
1045 YYSIZE_T yystacksize;
1049 /* Lookahead token as an internal (translated) token number. */
1051 /* The variables used to return semantic value and location from the
1056 /* Buffer for error messages, and its allocated size. */
1058 char *yymsg = yymsgbuf;
1059 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1062 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1064 /* The number of symbols on the RHS of the reduced rule.
1065 Keep to zero when no symbol should be popped. */
1068 yyssp = yyss = yyssa;
1069 yyvsp = yyvs = yyvsa;
1070 yystacksize = YYINITDEPTH;
1072 YYDPRINTF ((stderr, "Starting parse\n"));
1077 yychar = YYEMPTY; /* Cause a token to be read. */
1080 /*------------------------------------------------------------.
1081 | yynewstate -- Push a new state, which is found in yystate. |
1082 `------------------------------------------------------------*/
1084 /* In all cases, when you get here, the value and location stacks
1085 have just been pushed. So pushing a state here evens the stacks. */
1091 if (yyss + yystacksize - 1 <= yyssp)
1093 /* Get the current used size of the three stacks, in elements. */
1094 YYSIZE_T yysize = yyssp - yyss + 1;
1098 /* Give user a chance to reallocate the stack. Use copies of
1099 these so that the &'s don't force the real ones into
1101 YYSTYPE *yyvs1 = yyvs;
1102 yytype_int16 *yyss1 = yyss;
1104 /* Each stack pointer address is followed by the size of the
1105 data in use in that stack, in bytes. This used to be a
1106 conditional around just the two extra args, but that might
1107 be undefined if yyoverflow is a macro. */
1108 yyoverflow (YY_("memory exhausted"),
1109 &yyss1, yysize * sizeof (*yyssp),
1110 &yyvs1, yysize * sizeof (*yyvsp),
1116 #else /* no yyoverflow */
1117 # ifndef YYSTACK_RELOCATE
1118 goto yyexhaustedlab;
1120 /* Extend the stack our own way. */
1121 if (YYMAXDEPTH <= yystacksize)
1122 goto yyexhaustedlab;
1124 if (YYMAXDEPTH < yystacksize)
1125 yystacksize = YYMAXDEPTH;
1128 yytype_int16 *yyss1 = yyss;
1129 union yyalloc *yyptr =
1130 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1132 goto yyexhaustedlab;
1133 YYSTACK_RELOCATE (yyss_alloc, yyss);
1134 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1135 # undef YYSTACK_RELOCATE
1137 YYSTACK_FREE (yyss1);
1140 #endif /* no yyoverflow */
1142 yyssp = yyss + yysize - 1;
1143 yyvsp = yyvs + yysize - 1;
1145 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1146 (unsigned long int) yystacksize));
1148 if (yyss + yystacksize - 1 <= yyssp)
1152 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1154 if (yystate == YYFINAL)
1164 /* Do appropriate processing given the current state. Read a
1165 lookahead token if we need one and don't already have one. */
1167 /* First try to decide what to do without reference to lookahead token. */
1168 yyn = yypact[yystate];
1169 if (yypact_value_is_default (yyn))
1172 /* Not known => get a lookahead token if don't already have one. */
1174 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1175 if (yychar == YYEMPTY)
1177 YYDPRINTF ((stderr, "Reading a token: "));
1181 if (yychar <= YYEOF)
1183 yychar = yytoken = YYEOF;
1184 YYDPRINTF ((stderr, "Now at end of input.\n"));
1188 yytoken = YYTRANSLATE (yychar);
1189 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1192 /* If the proper action on seeing token YYTOKEN is to reduce or to
1193 detect an error, take that action. */
1195 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1200 if (yytable_value_is_error (yyn))
1206 /* Count tokens shifted since error; after three, turn off error
1211 /* Shift the lookahead token. */
1212 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1214 /* Discard the shifted token. */
1218 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1220 YY_IGNORE_MAYBE_UNINITIALIZED_END
1225 /*-----------------------------------------------------------.
1226 | yydefault -- do the default action for the current state. |
1227 `-----------------------------------------------------------*/
1229 yyn = yydefact[yystate];
1235 /*-----------------------------.
1236 | yyreduce -- Do a reduction. |
1237 `-----------------------------*/
1239 /* yyn is the number of a rule to reduce with. */
1242 /* If YYLEN is nonzero, implement the default value of the action:
1245 Otherwise, the following line sets YYVAL to garbage.
1246 This behavior is undocumented and Bison
1247 users should not rely upon it. Assigning to YYVAL
1248 unconditionally makes the parser a bit smaller, and it avoids a
1249 GCC warning that YYVAL may be used uninitialized. */
1250 yyval = yyvsp[1-yylen];
1253 YY_REDUCE_PRINT (yyn);
1257 #line 61 "parserPromela.yacc" /* yacc.c:1646 */
1258 { new_state((yyvsp[-1].string), 1);}
1259 #line 1260 "parserPromela.tab.cacc" /* yacc.c:1646 */
1263 #line 65 "parserPromela.yacc" /* yacc.c:1646 */
1264 { new_transition((yyvsp[-1].string), (yyvsp[-4].label));}
1265 #line 1266 "parserPromela.tab.cacc" /* yacc.c:1646 */
1269 #line 68 "parserPromela.yacc" /* yacc.c:1646 */
1270 { (yyval.label) = (yyvsp[-1].label); }
1271 #line 1272 "parserPromela.tab.cacc" /* yacc.c:1646 */
1275 #line 69 "parserPromela.yacc" /* yacc.c:1646 */
1276 { (yyval.label) = new_label(0, (yyvsp[-2].label), (yyvsp[0].label)); }
1277 #line 1278 "parserPromela.tab.cacc" /* yacc.c:1646 */
1281 #line 70 "parserPromela.yacc" /* yacc.c:1646 */
1282 { (yyval.label) = new_label(1, (yyvsp[-2].label), (yyvsp[0].label)); }
1283 #line 1284 "parserPromela.tab.cacc" /* yacc.c:1646 */
1287 #line 71 "parserPromela.yacc" /* yacc.c:1646 */
1288 { (yyval.label) = new_label(2, (yyvsp[0].label)); }
1289 #line 1290 "parserPromela.tab.cacc" /* yacc.c:1646 */
1293 #line 72 "parserPromela.yacc" /* yacc.c:1646 */
1294 { (yyval.label) = new_label(4); }
1295 #line 1296 "parserPromela.tab.cacc" /* yacc.c:1646 */
1299 #line 73 "parserPromela.yacc" /* yacc.c:1646 */
1300 { (yyval.label) = new_label(3, (yyvsp[0].string)); }
1301 #line 1302 "parserPromela.tab.cacc" /* yacc.c:1646 */
1305 #line 1306 "parserPromela.tab.cacc" /* yacc.c:1646 */
1308 /* User semantic actions sometimes alter yychar, and that requires
1309 that yytoken be updated with the new translation. We take the
1310 approach of translating immediately before every use of yytoken.
1311 One alternative is translating here after every semantic action,
1312 but that translation would be missed if the semantic action invokes
1313 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1314 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1315 incorrect destructor might then be invoked immediately. In the
1316 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1317 to an incorrect destructor call or verbose syntax error message
1318 before the lookahead is translated. */
1319 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1323 YY_STACK_PRINT (yyss, yyssp);
1327 /* Now 'shift' the result of the reduction. Determine what state
1328 that goes to, based on the state we popped back to and the rule
1329 number reduced by. */
1333 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1334 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1335 yystate = yytable[yystate];
1337 yystate = yydefgoto[yyn - YYNTOKENS];
1342 /*--------------------------------------.
1343 | yyerrlab -- here on detecting error. |
1344 `--------------------------------------*/
1346 /* Make sure we have latest lookahead translation. See comments at
1347 user semantic actions for why this is necessary. */
1348 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1350 /* If not already recovering from an error, report this error. */
1354 #if ! YYERROR_VERBOSE
1355 yyerror (YY_("syntax error"));
1357 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1360 char const *yymsgp = YY_("syntax error");
1361 int yysyntax_error_status;
1362 yysyntax_error_status = YYSYNTAX_ERROR;
1363 if (yysyntax_error_status == 0)
1365 else if (yysyntax_error_status == 1)
1367 if (yymsg != yymsgbuf)
1368 YYSTACK_FREE (yymsg);
1369 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1373 yymsg_alloc = sizeof yymsgbuf;
1374 yysyntax_error_status = 2;
1378 yysyntax_error_status = YYSYNTAX_ERROR;
1383 if (yysyntax_error_status == 2)
1384 goto yyexhaustedlab;
1386 # undef YYSYNTAX_ERROR
1392 if (yyerrstatus == 3)
1394 /* If just tried and failed to reuse lookahead token after an
1395 error, discard it. */
1397 if (yychar <= YYEOF)
1399 /* Return failure if at end of input. */
1400 if (yychar == YYEOF)
1405 yydestruct ("Error: discarding",
1411 /* Else will try to reuse lookahead token after shifting the error
1416 /*---------------------------------------------------.
1417 | yyerrorlab -- error raised explicitly by YYERROR. |
1418 `---------------------------------------------------*/
1421 /* Pacify compilers like GCC when the user code never invokes
1422 YYERROR and the label yyerrorlab therefore never appears in user
1424 if (/*CONSTCOND*/ 0)
1427 /* Do not reclaim the symbols of the rule whose action triggered
1431 YY_STACK_PRINT (yyss, yyssp);
1436 /*-------------------------------------------------------------.
1437 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1438 `-------------------------------------------------------------*/
1440 yyerrstatus = 3; /* Each real token shifted decrements this. */
1444 yyn = yypact[yystate];
1445 if (!yypact_value_is_default (yyn))
1448 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1456 /* Pop the current state because it cannot handle the error token. */
1461 yydestruct ("Error: popping",
1462 yystos[yystate], yyvsp);
1465 YY_STACK_PRINT (yyss, yyssp);
1468 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1470 YY_IGNORE_MAYBE_UNINITIALIZED_END
1473 /* Shift the error token. */
1474 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1480 /*-------------------------------------.
1481 | yyacceptlab -- YYACCEPT comes here. |
1482 `-------------------------------------*/
1487 /*-----------------------------------.
1488 | yyabortlab -- YYABORT comes here. |
1489 `-----------------------------------*/
1494 #if !defined yyoverflow || YYERROR_VERBOSE
1495 /*-------------------------------------------------.
1496 | yyexhaustedlab -- memory exhaustion comes here. |
1497 `-------------------------------------------------*/
1499 yyerror (YY_("memory exhausted"));
1505 if (yychar != YYEMPTY)
1507 /* Make sure we have latest lookahead translation. See comments at
1508 user semantic actions for why this is necessary. */
1509 yytoken = YYTRANSLATE (yychar);
1510 yydestruct ("Cleanup: discarding lookahead",
1513 /* Do not reclaim the symbols of the rule whose action triggered
1514 this YYABORT or YYACCEPT. */
1516 YY_STACK_PRINT (yyss, yyssp);
1517 while (yyssp != yyss)
1519 yydestruct ("Cleanup: popping",
1520 yystos[*yyssp], yyvsp);
1525 YYSTACK_FREE (yyss);
1528 if (yymsg != yymsgbuf)
1529 YYSTACK_FREE (yymsg);
1533 #line 76 "parserPromela.yacc" /* yacc.c:1906 */
1538 void yyerror(const char *s){
1539 fprintf (stderr, "%s\n", s);