1 /* A Bison parser, made by GNU Bison 3.0.4. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015 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.4"
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
149 #line 20 "parserPromela.yacc" /* yacc.c:355 */
154 xbt_automaton_exp_label_t label;
156 #line 157 "parserPromela.tab.cacc" /* yacc.c:355 */
159 typedef union YYSTYPE YYSTYPE;
160 # define YYSTYPE_IS_TRIVIAL 1
161 # define YYSTYPE_IS_DECLARED 1
165 extern YYSTYPE xbt_automaton_parser_lval;
167 int xbt_automaton_parser_parse (void);
169 #endif /* !YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED */
171 /* Copy the second part of user declarations. */
173 #line 174 "parserPromela.tab.cacc" /* yacc.c:358 */
180 typedef YYTYPE_UINT8 yytype_uint8;
182 typedef unsigned char yytype_uint8;
186 typedef YYTYPE_INT8 yytype_int8;
188 typedef signed char yytype_int8;
192 typedef YYTYPE_UINT16 yytype_uint16;
194 typedef unsigned short int yytype_uint16;
198 typedef YYTYPE_INT16 yytype_int16;
200 typedef short int yytype_int16;
204 # ifdef __SIZE_TYPE__
205 # define YYSIZE_T __SIZE_TYPE__
206 # elif defined size_t
207 # define YYSIZE_T size_t
208 # elif ! defined YYSIZE_T
209 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
210 # define YYSIZE_T size_t
212 # define YYSIZE_T unsigned int
216 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
219 # if defined YYENABLE_NLS && YYENABLE_NLS
221 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
222 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
226 # define YY_(Msgid) Msgid
231 # if (defined __GNUC__ \
232 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
233 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
234 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
236 # define YY_ATTRIBUTE(Spec) /* empty */
240 #ifndef YY_ATTRIBUTE_PURE
241 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
244 #ifndef YY_ATTRIBUTE_UNUSED
245 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
248 #if !defined _Noreturn \
249 && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
250 # if defined _MSC_VER && 1200 <= _MSC_VER
251 # define _Noreturn __declspec (noreturn)
253 # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
257 /* Suppress unused-variable warnings by "using" E. */
258 #if ! defined lint || defined __GNUC__
259 # define YYUSE(E) ((void) (E))
261 # define YYUSE(E) /* empty */
264 #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
265 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
266 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
267 _Pragma ("GCC diagnostic push") \
268 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
269 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
270 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
271 _Pragma ("GCC diagnostic pop")
273 # define YY_INITIAL_VALUE(Value) Value
275 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
276 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
277 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
279 #ifndef YY_INITIAL_VALUE
280 # define YY_INITIAL_VALUE(Value) /* Nothing. */
284 #if ! defined yyoverflow || YYERROR_VERBOSE
286 /* The parser invokes alloca or malloc; define the necessary symbols. */
288 # ifdef YYSTACK_USE_ALLOCA
289 # if YYSTACK_USE_ALLOCA
291 # define YYSTACK_ALLOC __builtin_alloca
292 # elif defined __BUILTIN_VA_ARG_INCR
293 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
295 # define YYSTACK_ALLOC __alloca
296 # elif defined _MSC_VER
297 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
298 # define alloca _alloca
300 # define YYSTACK_ALLOC alloca
301 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
302 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
303 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
304 # ifndef EXIT_SUCCESS
305 # define EXIT_SUCCESS 0
312 # ifdef YYSTACK_ALLOC
313 /* Pacify GCC's 'empty if-body' warning. */
314 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
315 # ifndef YYSTACK_ALLOC_MAXIMUM
316 /* The OS might guarantee only one guard page at the bottom of the stack,
317 and a page size can be as small as 4096 bytes. So we cannot safely
318 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
319 to allow for a few compiler-allocated temporary stack slots. */
320 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
323 # define YYSTACK_ALLOC YYMALLOC
324 # define YYSTACK_FREE YYFREE
325 # ifndef YYSTACK_ALLOC_MAXIMUM
326 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
328 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
329 && ! ((defined YYMALLOC || defined malloc) \
330 && (defined YYFREE || defined free)))
331 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
332 # ifndef EXIT_SUCCESS
333 # define EXIT_SUCCESS 0
337 # define YYMALLOC malloc
338 # if ! defined malloc && ! defined EXIT_SUCCESS
339 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
344 # if ! defined free && ! defined EXIT_SUCCESS
345 void free (void *); /* INFRINGES ON USER NAME SPACE */
349 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
352 #if (! defined yyoverflow \
353 && (! defined __cplusplus \
354 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
356 /* A type that is properly aligned for any stack member. */
359 yytype_int16 yyss_alloc;
363 /* The size of the maximum gap between one aligned stack and the next. */
364 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
366 /* The size of an array large to enough to hold all stacks, each with
368 # define YYSTACK_BYTES(N) \
369 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
370 + YYSTACK_GAP_MAXIMUM)
372 # define YYCOPY_NEEDED 1
374 /* Relocate STACK from its old location to the new one. The
375 local variables YYSIZE and YYSTACKSIZE give the old and new number of
376 elements in the stack, and YYPTR gives the new location of the
377 stack. Advance YYPTR to a properly aligned location for the next
379 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
382 YYSIZE_T yynewbytes; \
383 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
384 Stack = &yyptr->Stack_alloc; \
385 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
386 yyptr += yynewbytes / sizeof (*yyptr); \
392 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
393 /* Copy COUNT objects from SRC to DST. The source and destination do
396 # if defined __GNUC__ && 1 < __GNUC__
397 # define YYCOPY(Dst, Src, Count) \
398 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
400 # define YYCOPY(Dst, Src, Count) \
404 for (yyi = 0; yyi < (Count); yyi++) \
405 (Dst)[yyi] = (Src)[yyi]; \
410 #endif /* !YYCOPY_NEEDED */
412 /* YYFINAL -- State number of the termination state. */
414 /* YYLAST -- Last index in YYTABLE. */
417 /* YYNTOKENS -- Number of terminals. */
419 /* YYNNTS -- Number of nonterminals. */
421 /* YYNRULES -- Number of rules. */
423 /* YYNSTATES -- Number of states. */
426 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
427 by yylex, with out-of-bounds checking. */
429 #define YYMAXUTOK 277
431 #define YYTRANSLATE(YYX) \
432 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
434 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
435 as returned by yylex, without out-of-bounds checking. */
436 static const yytype_uint8 yytranslate[] =
438 0, 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, 2, 2, 2, 2,
462 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
463 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
464 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
465 15, 16, 17, 18, 19, 20, 21, 22
469 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
470 static const yytype_uint8 yyrline[] =
472 0, 57, 57, 60, 61, 61, 64, 65, 68, 69,
477 #if YYDEBUG || YYERROR_VERBOSE || 0
478 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
479 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
480 static const char *const yytname[] =
482 "$end", "error", "$undefined", "NEVER", "IF", "FI", "IMPLIES", "GOTO",
483 "AND", "OR", "NOT", "LEFT_PAR", "RIGHT_PAR", "CASE", "COLON",
484 "SEMI_COLON", "CASE_TRUE", "LEFT_BRACE", "RIGHT_BRACE", "LITT_ENT",
485 "LITT_CHAINE", "LITT_REEL", "ID", "$accept", "automaton", "stateseq",
486 "$@1", "option", "exp", YY_NULLPTR
491 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
492 (internal) symbol number NUM (which must be that of a token). */
493 static const yytype_uint16 yytoknum[] =
495 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
496 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
501 #define YYPACT_NINF -16
503 #define yypact_value_is_default(Yystate) \
504 (!!((Yystate) == (-16)))
506 #define YYTABLE_NINF -1
508 #define yytable_value_is_error(Yytable_value) \
511 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
513 static const yytype_int8 yypact[] =
515 0, -15, 10, -13, -16, 2, 1, -16, -16, 16,
516 8, -10, 17, -10, -10, -16, -16, 9, 11, -16,
517 -1, 18, -10, -10, -13, -16, 5, -16, -16, -16,
521 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
522 Performed when YYTABLE does not specify something else to do. Zero
523 means the default is an error. */
524 static const yytype_uint8 yydefact[] =
526 0, 0, 0, 3, 1, 0, 0, 4, 2, 0,
527 6, 0, 0, 0, 0, 12, 13, 0, 0, 11,
528 0, 0, 0, 0, 3, 8, 0, 10, 9, 5,
532 /* YYPGOTO[NTERM-NUM]. */
533 static const yytype_int8 yypgoto[] =
535 -16, -16, 4, -16, -7, -9
538 /* YYDEFGOTO[NTERM-NUM]. */
539 static const yytype_int8 yydefgoto[] =
544 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
545 positive, shift that token. If negative, reduce the rule whose
546 number is the opposite. If YYTABLE_NINF, syntax error. */
547 static const yytype_uint8 yytable[] =
549 13, 14, 3, 1, 19, 20, 15, 22, 23, 5,
550 4, 25, 16, 27, 28, 21, 7, 22, 23, 8,
551 10, 11, 18, 31, 0, 26, 24, 30, 29
554 static const yytype_int8 yycheck[] =
556 10, 11, 17, 3, 13, 14, 16, 8, 9, 22,
557 0, 12, 22, 22, 23, 6, 14, 8, 9, 18,
558 4, 13, 5, 30, -1, 7, 15, 22, 24
561 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
562 symbol of state STATE-NUM. */
563 static const yytype_uint8 yystos[] =
565 0, 3, 24, 17, 0, 22, 25, 14, 18, 26,
566 4, 13, 27, 10, 11, 16, 22, 28, 5, 28,
567 28, 6, 8, 9, 15, 12, 7, 28, 28, 25,
571 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
572 static const yytype_uint8 yyr1[] =
574 0, 23, 24, 25, 26, 25, 27, 27, 28, 28,
578 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
579 static const yytype_uint8 yyr2[] =
581 0, 2, 4, 0, 0, 8, 0, 6, 3, 3,
586 #define yyerrok (yyerrstatus = 0)
587 #define yyclearin (yychar = YYEMPTY)
591 #define YYACCEPT goto yyacceptlab
592 #define YYABORT goto yyabortlab
593 #define YYERROR goto yyerrorlab
596 #define YYRECOVERING() (!!yyerrstatus)
598 #define YYBACKUP(Token, Value) \
600 if (yychar == YYEMPTY) \
604 YYPOPSTACK (yylen); \
610 yyerror (YY_("syntax error: cannot back up")); \
615 /* Error token number */
617 #define YYERRCODE 256
621 /* Enable debugging if requested. */
625 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
626 # define YYFPRINTF fprintf
629 # define YYDPRINTF(Args) \
635 /* This macro is provided for backward compatibility. */
636 #ifndef YY_LOCATION_PRINT
637 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
641 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
645 YYFPRINTF (stderr, "%s ", Title); \
646 yy_symbol_print (stderr, \
648 YYFPRINTF (stderr, "\n"); \
653 /*----------------------------------------.
654 | Print this symbol's value on YYOUTPUT. |
655 `----------------------------------------*/
658 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
660 FILE *yyo = yyoutput;
665 if (yytype < YYNTOKENS)
666 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
672 /*--------------------------------.
673 | Print this symbol on YYOUTPUT. |
674 `--------------------------------*/
677 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
679 YYFPRINTF (yyoutput, "%s %s (",
680 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
682 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
683 YYFPRINTF (yyoutput, ")");
686 /*------------------------------------------------------------------.
687 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
689 `------------------------------------------------------------------*/
692 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
694 YYFPRINTF (stderr, "Stack now");
695 for (; yybottom <= yytop; yybottom++)
697 int yybot = *yybottom;
698 YYFPRINTF (stderr, " %d", yybot);
700 YYFPRINTF (stderr, "\n");
703 # define YY_STACK_PRINT(Bottom, Top) \
706 yy_stack_print ((Bottom), (Top)); \
710 /*------------------------------------------------.
711 | Report that the YYRULE is going to be reduced. |
712 `------------------------------------------------*/
715 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
717 unsigned long int yylno = yyrline[yyrule];
718 int yynrhs = yyr2[yyrule];
720 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
722 /* The symbols being reduced. */
723 for (yyi = 0; yyi < yynrhs; yyi++)
725 YYFPRINTF (stderr, " $%d = ", yyi + 1);
726 yy_symbol_print (stderr,
727 yystos[yyssp[yyi + 1 - yynrhs]],
728 &(yyvsp[(yyi + 1) - (yynrhs)])
730 YYFPRINTF (stderr, "\n");
734 # define YY_REDUCE_PRINT(Rule) \
737 yy_reduce_print (yyssp, yyvsp, Rule); \
740 /* Nonzero means print parse trace. It is left uninitialized so that
741 multiple parsers can coexist. */
744 # define YYDPRINTF(Args)
745 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
746 # define YY_STACK_PRINT(Bottom, Top)
747 # define YY_REDUCE_PRINT(Rule)
748 #endif /* !YYDEBUG */
751 /* YYINITDEPTH -- initial size of the parser's stacks. */
753 # define YYINITDEPTH 200
756 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
757 if the built-in stack extension method is used).
759 Do not make this value too large; the results are undefined if
760 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
761 evaluated with infinite-precision integer arithmetic. */
764 # define YYMAXDEPTH 10000
771 # if defined __GLIBC__ && defined _STRING_H
772 # define yystrlen strlen
774 /* Return the length of YYSTR. */
776 yystrlen (const char *yystr)
779 for (yylen = 0; yystr[yylen]; yylen++)
787 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
788 # define yystpcpy stpcpy
790 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
793 yystpcpy (char *yydest, const char *yysrc)
796 const char *yys = yysrc;
798 while ((*yyd++ = *yys++) != '\0')
807 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
808 quotes and backslashes, so that it's suitable for yyerror. The
809 heuristic is that double-quoting is unnecessary unless the string
810 contains an apostrophe, a comma, or backslash (other than
811 backslash-backslash). YYSTR is taken from yytname. If YYRES is
812 null, do not copy; instead, return the length of what the result
815 yytnamerr (char *yyres, const char *yystr)
820 char const *yyp = yystr;
827 goto do_not_strip_quotes;
831 goto do_not_strip_quotes;
844 do_not_strip_quotes: ;
848 return yystrlen (yystr);
850 return yystpcpy (yyres, yystr) - yyres;
854 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
855 about the unexpected token YYTOKEN for the state stack whose top is
858 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
859 not large enough to hold the message. In that case, also set
860 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
861 required number of bytes is too large to store. */
863 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
864 yytype_int16 *yyssp, int yytoken)
866 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
867 YYSIZE_T yysize = yysize0;
868 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
869 /* Internationalized format string. */
870 const char *yyformat = YY_NULLPTR;
871 /* Arguments of yyformat. */
872 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
873 /* Number of reported tokens (one for the "unexpected", one per
877 /* There are many possibilities here to consider:
878 - If this state is a consistent state with a default action, then
879 the only way this function was invoked is if the default action
880 is an error action. In that case, don't check for expected
881 tokens because there are none.
882 - The only way there can be no lookahead present (in yychar) is if
883 this state is a consistent state with a default action. Thus,
884 detecting the absence of a lookahead is sufficient to determine
885 that there is no unexpected or expected token to report. In that
886 case, just report a simple "syntax error".
887 - Don't assume there isn't a lookahead just because this state is a
888 consistent state with a default action. There might have been a
889 previous inconsistent state, consistent state with a non-default
890 action, or user semantic action that manipulated yychar.
891 - Of course, the expected token list depends on states to have
892 correct lookahead information, and it depends on the parser not
893 to perform extra reductions after fetching a lookahead from the
894 scanner and before detecting a syntax error. Thus, state merging
895 (from LALR or IELR) and default reductions corrupt the expected
896 token list. However, the list is correct for canonical LR with
897 one exception: it will still contain any token that will not be
898 accepted due to an error action in a later state.
900 if (yytoken != YYEMPTY)
902 int yyn = yypact[*yyssp];
903 yyarg[yycount++] = yytname[yytoken];
904 if (!yypact_value_is_default (yyn))
906 /* Start YYX at -YYN if negative to avoid negative indexes in
907 YYCHECK. In other words, skip the first -YYN actions for
908 this state because they are default actions. */
909 int yyxbegin = yyn < 0 ? -yyn : 0;
910 /* Stay within bounds of both yycheck and yytname. */
911 int yychecklim = YYLAST - yyn + 1;
912 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
915 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
916 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
917 && !yytable_value_is_error (yytable[yyx + yyn]))
919 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
925 yyarg[yycount++] = yytname[yyx];
927 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
928 if (! (yysize <= yysize1
929 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
939 # define YYCASE_(N, S) \
943 YYCASE_(0, YY_("syntax error"));
944 YYCASE_(1, YY_("syntax error, unexpected %s"));
945 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
946 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
947 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
948 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
953 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
954 if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
959 if (*yymsg_alloc < yysize)
961 *yymsg_alloc = 2 * yysize;
962 if (! (yysize <= *yymsg_alloc
963 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
964 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
968 /* Avoid sprintf, as that infringes on the user's name space.
969 Don't have undefined behavior even if the translation
970 produced a string with the wrong number of "%s"s. */
974 while ((*yyp = *yyformat) != '\0')
975 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
977 yyp += yytnamerr (yyp, yyarg[yyi++]);
988 #endif /* YYERROR_VERBOSE */
990 /*-----------------------------------------------.
991 | Release the memory associated to this symbol. |
992 `-----------------------------------------------*/
995 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1000 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1002 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1004 YY_IGNORE_MAYBE_UNINITIALIZED_END
1010 /* The lookahead symbol. */
1013 /* The semantic value of the lookahead symbol. */
1015 /* Number of syntax errors so far. */
1027 /* Number of tokens to shift before error messages enabled. */
1030 /* The stacks and their tools:
1031 'yyss': related to states.
1032 'yyvs': related to semantic values.
1034 Refer to the stacks through separate pointers, to allow yyoverflow
1035 to reallocate them elsewhere. */
1037 /* The state stack. */
1038 yytype_int16 yyssa[YYINITDEPTH];
1040 yytype_int16 *yyssp;
1042 /* The semantic value stack. */
1043 YYSTYPE yyvsa[YYINITDEPTH];
1047 YYSIZE_T yystacksize;
1051 /* Lookahead token as an internal (translated) token number. */
1053 /* The variables used to return semantic value and location from the
1058 /* Buffer for error messages, and its allocated size. */
1060 char *yymsg = yymsgbuf;
1061 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1064 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1066 /* The number of symbols on the RHS of the reduced rule.
1067 Keep to zero when no symbol should be popped. */
1070 yyssp = yyss = yyssa;
1071 yyvsp = yyvs = yyvsa;
1072 yystacksize = YYINITDEPTH;
1074 YYDPRINTF ((stderr, "Starting parse\n"));
1079 yychar = YYEMPTY; /* Cause a token to be read. */
1082 /*------------------------------------------------------------.
1083 | yynewstate -- Push a new state, which is found in yystate. |
1084 `------------------------------------------------------------*/
1086 /* In all cases, when you get here, the value and location stacks
1087 have just been pushed. So pushing a state here evens the stacks. */
1093 if (yyss + yystacksize - 1 <= yyssp)
1095 /* Get the current used size of the three stacks, in elements. */
1096 YYSIZE_T yysize = yyssp - yyss + 1;
1100 /* Give user a chance to reallocate the stack. Use copies of
1101 these so that the &'s don't force the real ones into
1103 YYSTYPE *yyvs1 = yyvs;
1104 yytype_int16 *yyss1 = yyss;
1106 /* Each stack pointer address is followed by the size of the
1107 data in use in that stack, in bytes. This used to be a
1108 conditional around just the two extra args, but that might
1109 be undefined if yyoverflow is a macro. */
1110 yyoverflow (YY_("memory exhausted"),
1111 &yyss1, yysize * sizeof (*yyssp),
1112 &yyvs1, yysize * sizeof (*yyvsp),
1118 #else /* no yyoverflow */
1119 # ifndef YYSTACK_RELOCATE
1120 goto yyexhaustedlab;
1122 /* Extend the stack our own way. */
1123 if (YYMAXDEPTH <= yystacksize)
1124 goto yyexhaustedlab;
1126 if (YYMAXDEPTH < yystacksize)
1127 yystacksize = YYMAXDEPTH;
1130 yytype_int16 *yyss1 = yyss;
1131 union yyalloc *yyptr =
1132 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1134 goto yyexhaustedlab;
1135 YYSTACK_RELOCATE (yyss_alloc, yyss);
1136 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1137 # undef YYSTACK_RELOCATE
1139 YYSTACK_FREE (yyss1);
1142 #endif /* no yyoverflow */
1144 yyssp = yyss + yysize - 1;
1145 yyvsp = yyvs + yysize - 1;
1147 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1148 (unsigned long int) yystacksize));
1150 if (yyss + yystacksize - 1 <= yyssp)
1154 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1156 if (yystate == YYFINAL)
1166 /* Do appropriate processing given the current state. Read a
1167 lookahead token if we need one and don't already have one. */
1169 /* First try to decide what to do without reference to lookahead token. */
1170 yyn = yypact[yystate];
1171 if (yypact_value_is_default (yyn))
1174 /* Not known => get a lookahead token if don't already have one. */
1176 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1177 if (yychar == YYEMPTY)
1179 YYDPRINTF ((stderr, "Reading a token: "));
1183 if (yychar <= YYEOF)
1185 yychar = yytoken = YYEOF;
1186 YYDPRINTF ((stderr, "Now at end of input.\n"));
1190 yytoken = YYTRANSLATE (yychar);
1191 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1194 /* If the proper action on seeing token YYTOKEN is to reduce or to
1195 detect an error, take that action. */
1197 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1202 if (yytable_value_is_error (yyn))
1208 /* Count tokens shifted since error; after three, turn off error
1213 /* Shift the lookahead token. */
1214 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1216 /* Discard the shifted token. */
1220 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1222 YY_IGNORE_MAYBE_UNINITIALIZED_END
1227 /*-----------------------------------------------------------.
1228 | yydefault -- do the default action for the current state. |
1229 `-----------------------------------------------------------*/
1231 yyn = yydefact[yystate];
1237 /*-----------------------------.
1238 | yyreduce -- Do a reduction. |
1239 `-----------------------------*/
1241 /* yyn is the number of a rule to reduce with. */
1244 /* If YYLEN is nonzero, implement the default value of the action:
1247 Otherwise, the following line sets YYVAL to garbage.
1248 This behavior is undocumented and Bison
1249 users should not rely upon it. Assigning to YYVAL
1250 unconditionally makes the parser a bit smaller, and it avoids a
1251 GCC warning that YYVAL may be used uninitialized. */
1252 yyval = yyvsp[1-yylen];
1255 YY_REDUCE_PRINT (yyn);
1259 #line 61 "parserPromela.yacc" /* yacc.c:1646 */
1260 { new_state((yyvsp[-1].string), 1);}
1261 #line 1262 "parserPromela.tab.cacc" /* yacc.c:1646 */
1265 #line 65 "parserPromela.yacc" /* yacc.c:1646 */
1266 { new_transition((yyvsp[-1].string), (yyvsp[-4].label));}
1267 #line 1268 "parserPromela.tab.cacc" /* yacc.c:1646 */
1271 #line 68 "parserPromela.yacc" /* yacc.c:1646 */
1272 { (yyval.label) = (yyvsp[-1].label); }
1273 #line 1274 "parserPromela.tab.cacc" /* yacc.c:1646 */
1277 #line 69 "parserPromela.yacc" /* yacc.c:1646 */
1278 { (yyval.label) = new_label(0, (yyvsp[-2].label), (yyvsp[0].label)); }
1279 #line 1280 "parserPromela.tab.cacc" /* yacc.c:1646 */
1283 #line 70 "parserPromela.yacc" /* yacc.c:1646 */
1284 { (yyval.label) = new_label(1, (yyvsp[-2].label), (yyvsp[0].label)); }
1285 #line 1286 "parserPromela.tab.cacc" /* yacc.c:1646 */
1289 #line 71 "parserPromela.yacc" /* yacc.c:1646 */
1290 { (yyval.label) = new_label(2, (yyvsp[0].label)); }
1291 #line 1292 "parserPromela.tab.cacc" /* yacc.c:1646 */
1295 #line 72 "parserPromela.yacc" /* yacc.c:1646 */
1296 { (yyval.label) = new_label(4); }
1297 #line 1298 "parserPromela.tab.cacc" /* yacc.c:1646 */
1301 #line 73 "parserPromela.yacc" /* yacc.c:1646 */
1302 { (yyval.label) = new_label(3, (yyvsp[0].string)); }
1303 #line 1304 "parserPromela.tab.cacc" /* yacc.c:1646 */
1307 #line 1308 "parserPromela.tab.cacc" /* yacc.c:1646 */
1310 /* User semantic actions sometimes alter yychar, and that requires
1311 that yytoken be updated with the new translation. We take the
1312 approach of translating immediately before every use of yytoken.
1313 One alternative is translating here after every semantic action,
1314 but that translation would be missed if the semantic action invokes
1315 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1316 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1317 incorrect destructor might then be invoked immediately. In the
1318 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1319 to an incorrect destructor call or verbose syntax error message
1320 before the lookahead is translated. */
1321 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1325 YY_STACK_PRINT (yyss, yyssp);
1329 /* Now 'shift' the result of the reduction. Determine what state
1330 that goes to, based on the state we popped back to and the rule
1331 number reduced by. */
1335 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
1336 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1337 yystate = yytable[yystate];
1339 yystate = yydefgoto[yyn - YYNTOKENS];
1344 /*--------------------------------------.
1345 | yyerrlab -- here on detecting error. |
1346 `--------------------------------------*/
1348 /* Make sure we have latest lookahead translation. See comments at
1349 user semantic actions for why this is necessary. */
1350 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1352 /* If not already recovering from an error, report this error. */
1356 #if ! YYERROR_VERBOSE
1357 yyerror (YY_("syntax error"));
1359 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1362 char const *yymsgp = YY_("syntax error");
1363 int yysyntax_error_status;
1364 yysyntax_error_status = YYSYNTAX_ERROR;
1365 if (yysyntax_error_status == 0)
1367 else if (yysyntax_error_status == 1)
1369 if (yymsg != yymsgbuf)
1370 YYSTACK_FREE (yymsg);
1371 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1375 yymsg_alloc = sizeof yymsgbuf;
1376 yysyntax_error_status = 2;
1380 yysyntax_error_status = YYSYNTAX_ERROR;
1385 if (yysyntax_error_status == 2)
1386 goto yyexhaustedlab;
1388 # undef YYSYNTAX_ERROR
1394 if (yyerrstatus == 3)
1396 /* If just tried and failed to reuse lookahead token after an
1397 error, discard it. */
1399 if (yychar <= YYEOF)
1401 /* Return failure if at end of input. */
1402 if (yychar == YYEOF)
1407 yydestruct ("Error: discarding",
1413 /* Else will try to reuse lookahead token after shifting the error
1418 /*---------------------------------------------------.
1419 | yyerrorlab -- error raised explicitly by YYERROR. |
1420 `---------------------------------------------------*/
1423 /* Pacify compilers like GCC when the user code never invokes
1424 YYERROR and the label yyerrorlab therefore never appears in user
1426 if (/*CONSTCOND*/ 0)
1429 /* Do not reclaim the symbols of the rule whose action triggered
1433 YY_STACK_PRINT (yyss, yyssp);
1438 /*-------------------------------------------------------------.
1439 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1440 `-------------------------------------------------------------*/
1442 yyerrstatus = 3; /* Each real token shifted decrements this. */
1446 yyn = yypact[yystate];
1447 if (!yypact_value_is_default (yyn))
1450 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1458 /* Pop the current state because it cannot handle the error token. */
1463 yydestruct ("Error: popping",
1464 yystos[yystate], yyvsp);
1467 YY_STACK_PRINT (yyss, yyssp);
1470 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1472 YY_IGNORE_MAYBE_UNINITIALIZED_END
1475 /* Shift the error token. */
1476 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1482 /*-------------------------------------.
1483 | yyacceptlab -- YYACCEPT comes here. |
1484 `-------------------------------------*/
1489 /*-----------------------------------.
1490 | yyabortlab -- YYABORT comes here. |
1491 `-----------------------------------*/
1496 #if !defined yyoverflow || YYERROR_VERBOSE
1497 /*-------------------------------------------------.
1498 | yyexhaustedlab -- memory exhaustion comes here. |
1499 `-------------------------------------------------*/
1501 yyerror (YY_("memory exhausted"));
1507 if (yychar != YYEMPTY)
1509 /* Make sure we have latest lookahead translation. See comments at
1510 user semantic actions for why this is necessary. */
1511 yytoken = YYTRANSLATE (yychar);
1512 yydestruct ("Cleanup: discarding lookahead",
1515 /* Do not reclaim the symbols of the rule whose action triggered
1516 this YYABORT or YYACCEPT. */
1518 YY_STACK_PRINT (yyss, yyssp);
1519 while (yyssp != yyss)
1521 yydestruct ("Cleanup: popping",
1522 yystos[*yyssp], yyvsp);
1527 YYSTACK_FREE (yyss);
1530 if (yymsg != yymsgbuf)
1531 YYSTACK_FREE (yymsg);
1535 #line 76 "parserPromela.yacc" /* yacc.c:1906 */
1540 void yyerror(const char *s){
1541 fprintf (stderr, "%s\n", s);