1 /* A Bison parser, made by GNU Bison 3.4.1. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
21 /* As a special exception, you may create a larger work that contains
22 part or all of the Bison parser skeleton and distribute that work
23 under terms of your choice, so long as that work isn't itself a
24 parser generator using the skeleton or a modified version thereof
25 as a parser skeleton. Alternatively, if you modify or redistribute
26 the parser skeleton itself, you may (at your option) remove this
27 special exception, which will cause the skeleton and the resulting
28 Bison output files to be licensed under the GNU General Public
29 License without this special exception.
31 This special exception was added by the Free Software Foundation in
32 version 2.2 of Bison. */
34 /* C LALR(1) parser skeleton written by Richard Stallman, by
35 simplifying the original so-called "semantic" parser. */
37 /* All symbols defined below should begin with yy or YY, to avoid
38 infringing on user name space. This should be done even for local
39 variables, as they might otherwise be expanded by user macros.
40 There are some unavoidable exceptions within include files to
41 define necessary library symbols; they are noted "INFRINGES ON
42 USER NAME SPACE" below. */
44 /* Undocumented macros, especially those whose name start with YY_,
45 are private implementation details. Do not rely on them. */
47 /* Identify Bison output. */
51 #define YYBISON_VERSION "3.4.1"
54 #define YYSKELETON_NAME "yacc.c"
66 /* Substitute the variable and function names. */
67 #define yyparse xbt_automaton_parser_parse
68 #define yylex xbt_automaton_parser_lex
69 #define yyerror xbt_automaton_parser_error
70 #define yydebug xbt_automaton_parser_debug
71 #define yynerrs xbt_automaton_parser_nerrs
73 #define yylval xbt_automaton_parser_lval
74 #define yychar xbt_automaton_parser_char
76 /* First part of user prologue. */
77 #line 7 "parserPromela.yacc"
79 #include "simgrid/config.h"
81 #define YY_NO_UNISTD_H /* hello Windows */
84 #include "automaton_lexer.yy.c"
85 #include <xbt/automaton.h>
87 void yyerror(const char *s);
89 static void new_state(char* id, int src);
90 static void new_transition(char* id, xbt_automaton_exp_label_t label);
93 #line 94 "parserPromela.tab.cacc"
96 # if defined __cplusplus
97 # if 201103L <= __cplusplus
98 # define YY_NULLPTR nullptr
100 # define YY_NULLPTR 0
103 # define YY_NULLPTR ((void*)0)
107 /* Enabling verbose error messages. */
108 #ifdef YYERROR_VERBOSE
109 # undef YYERROR_VERBOSE
110 # define YYERROR_VERBOSE 1
112 # define YYERROR_VERBOSE 0
115 /* Use api.header.include to #include this header
116 instead of duplicating it here. */
117 #ifndef YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
118 # define YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED
124 extern int xbt_automaton_parser_debug;
156 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
159 #line 23 "parserPromela.yacc"
164 xbt_automaton_exp_label_t label;
166 #line 167 "parserPromela.tab.cacc"
169 typedef union YYSTYPE YYSTYPE;
170 # define YYSTYPE_IS_TRIVIAL 1
171 # define YYSTYPE_IS_DECLARED 1
175 extern YYSTYPE xbt_automaton_parser_lval;
177 int xbt_automaton_parser_parse (void);
179 #endif /* !YY_XBT_AUTOMATON_PARSER_PARSERPROMELA_TAB_HACC_INCLUDED */
188 typedef YYTYPE_UINT8 yytype_uint8;
190 typedef unsigned char yytype_uint8;
194 typedef YYTYPE_INT8 yytype_int8;
196 typedef signed char yytype_int8;
200 typedef YYTYPE_UINT16 yytype_uint16;
202 typedef unsigned short yytype_uint16;
206 typedef YYTYPE_INT16 yytype_int16;
208 typedef short yytype_int16;
212 # ifdef __SIZE_TYPE__
213 # define YYSIZE_T __SIZE_TYPE__
214 # elif defined size_t
215 # define YYSIZE_T size_t
216 # elif ! defined YYSIZE_T
217 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
218 # define YYSIZE_T size_t
220 # define YYSIZE_T unsigned
224 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
227 # if defined YYENABLE_NLS && YYENABLE_NLS
229 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
230 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
234 # define YY_(Msgid) Msgid
239 # if (defined __GNUC__ \
240 && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
241 || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
242 # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
244 # define YY_ATTRIBUTE(Spec) /* empty */
248 #ifndef YY_ATTRIBUTE_PURE
249 # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
252 #ifndef YY_ATTRIBUTE_UNUSED
253 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
256 /* Suppress unused-variable warnings by "using" E. */
257 #if ! defined lint || defined __GNUC__
258 # define YYUSE(E) ((void) (E))
260 # define YYUSE(E) /* empty */
263 #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
264 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
265 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
266 _Pragma ("GCC diagnostic push") \
267 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
268 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
269 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
270 _Pragma ("GCC diagnostic pop")
272 # define YY_INITIAL_VALUE(Value) Value
274 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
275 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
276 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
278 #ifndef YY_INITIAL_VALUE
279 # define YY_INITIAL_VALUE(Value) /* Nothing. */
283 #define YY_ASSERT(E) ((void) (0 && (E)))
285 #if ! defined yyoverflow || YYERROR_VERBOSE
287 /* The parser invokes alloca or malloc; define the necessary symbols. */
289 # ifdef YYSTACK_USE_ALLOCA
290 # if YYSTACK_USE_ALLOCA
292 # define YYSTACK_ALLOC __builtin_alloca
293 # elif defined __BUILTIN_VA_ARG_INCR
294 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
296 # define YYSTACK_ALLOC __alloca
297 # elif defined _MSC_VER
298 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
299 # define alloca _alloca
301 # define YYSTACK_ALLOC alloca
302 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
303 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
304 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
305 # ifndef EXIT_SUCCESS
306 # define EXIT_SUCCESS 0
313 # ifdef YYSTACK_ALLOC
314 /* Pacify GCC's 'empty if-body' warning. */
315 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
316 # ifndef YYSTACK_ALLOC_MAXIMUM
317 /* The OS might guarantee only one guard page at the bottom of the stack,
318 and a page size can be as small as 4096 bytes. So we cannot safely
319 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
320 to allow for a few compiler-allocated temporary stack slots. */
321 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
324 # define YYSTACK_ALLOC YYMALLOC
325 # define YYSTACK_FREE YYFREE
326 # ifndef YYSTACK_ALLOC_MAXIMUM
327 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
329 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
330 && ! ((defined YYMALLOC || defined malloc) \
331 && (defined YYFREE || defined free)))
332 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
333 # ifndef EXIT_SUCCESS
334 # define EXIT_SUCCESS 0
338 # define YYMALLOC malloc
339 # if ! defined malloc && ! defined EXIT_SUCCESS
340 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
345 # if ! defined free && ! defined EXIT_SUCCESS
346 void free (void *); /* INFRINGES ON USER NAME SPACE */
350 #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
353 #if (! defined yyoverflow \
354 && (! defined __cplusplus \
355 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
357 /* A type that is properly aligned for any stack member. */
360 yytype_int16 yyss_alloc;
364 /* The size of the maximum gap between one aligned stack and the next. */
365 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
367 /* The size of an array large to enough to hold all stacks, each with
369 # define YYSTACK_BYTES(N) \
370 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
371 + YYSTACK_GAP_MAXIMUM)
373 # define YYCOPY_NEEDED 1
375 /* Relocate STACK from its old location to the new one. The
376 local variables YYSIZE and YYSTACKSIZE give the old and new number of
377 elements in the stack, and YYPTR gives the new location of the
378 stack. Advance YYPTR to a properly aligned location for the next
380 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
383 YYSIZE_T yynewbytes; \
384 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
385 Stack = &yyptr->Stack_alloc; \
386 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
387 yyptr += yynewbytes / sizeof (*yyptr); \
393 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
394 /* Copy COUNT objects from SRC to DST. The source and destination do
397 # if defined __GNUC__ && 1 < __GNUC__
398 # define YYCOPY(Dst, Src, Count) \
399 __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
401 # define YYCOPY(Dst, Src, Count) \
405 for (yyi = 0; yyi < (Count); yyi++) \
406 (Dst)[yyi] = (Src)[yyi]; \
411 #endif /* !YYCOPY_NEEDED */
413 /* YYFINAL -- State number of the termination state. */
415 /* YYLAST -- Last index in YYTABLE. */
418 /* YYNTOKENS -- Number of terminals. */
420 /* YYNNTS -- Number of nonterminals. */
422 /* YYNRULES -- Number of rules. */
424 /* YYNSTATES -- Number of states. */
428 #define YYMAXUTOK 277
430 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
431 as returned by yylex, with out-of-bounds checking. */
432 #define YYTRANSLATE(YYX) \
433 ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
435 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
436 as returned by yylex. */
437 static const yytype_uint8 yytranslate[] =
439 0, 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, 2, 2, 2, 2,
464 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
465 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
466 15, 16, 17, 18, 19, 20, 21, 22
470 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
471 static const yytype_uint8 yyrline[] =
473 0, 60, 60, 63, 64, 64, 67, 68, 71, 72,
478 #if YYDEBUG || YYERROR_VERBOSE || 0
479 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
480 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
481 static const char *const yytname[] =
483 "$end", "error", "$undefined", "NEVER", "IF", "FI", "IMPLIES", "GOTO",
484 "AND", "OR", "NOT", "LEFT_PAR", "RIGHT_PAR", "CASE", "COLON",
485 "SEMI_COLON", "CASE_TRUE", "LEFT_BRACE", "RIGHT_BRACE", "LITT_ENT",
486 "LITT_CHAINE", "LITT_REEL", "ID", "$accept", "automaton", "stateseq",
487 "$@1", "option", "exp", YY_NULLPTR
492 /* YYTOKNUM[NUM] -- (External) token number corresponding to the
493 (internal) symbol number NUM (which must be that of a token). */
494 static const yytype_uint16 yytoknum[] =
496 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
497 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
502 #define YYPACT_NINF -16
504 #define yypact_value_is_default(Yystate) \
505 (!!((Yystate) == (-16)))
507 #define YYTABLE_NINF -1
509 #define yytable_value_is_error(Yytable_value) \
512 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
514 static const yytype_int8 yypact[] =
516 0, -15, 10, -13, -16, 2, 1, -16, -16, 16,
517 8, -10, 17, -10, -10, -16, -16, 9, 11, -16,
518 -1, 18, -10, -10, -13, -16, 5, -16, -16, -16,
522 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
523 Performed when YYTABLE does not specify something else to do. Zero
524 means the default is an error. */
525 static const yytype_uint8 yydefact[] =
527 0, 0, 0, 3, 1, 0, 0, 4, 2, 0,
528 6, 0, 0, 0, 0, 12, 13, 0, 0, 11,
529 0, 0, 0, 0, 3, 8, 0, 10, 9, 5,
533 /* YYPGOTO[NTERM-NUM]. */
534 static const yytype_int8 yypgoto[] =
536 -16, -16, 4, -16, -7, -9
539 /* YYDEFGOTO[NTERM-NUM]. */
540 static const yytype_int8 yydefgoto[] =
545 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
546 positive, shift that token. If negative, reduce the rule whose
547 number is the opposite. If YYTABLE_NINF, syntax error. */
548 static const yytype_uint8 yytable[] =
550 13, 14, 3, 1, 19, 20, 15, 22, 23, 5,
551 4, 25, 16, 27, 28, 21, 7, 22, 23, 8,
552 10, 11, 18, 31, 0, 26, 24, 30, 29
555 static const yytype_int8 yycheck[] =
557 10, 11, 17, 3, 13, 14, 16, 8, 9, 22,
558 0, 12, 22, 22, 23, 6, 14, 8, 9, 18,
559 4, 13, 5, 30, -1, 7, 15, 22, 24
562 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
563 symbol of state STATE-NUM. */
564 static const yytype_uint8 yystos[] =
566 0, 3, 24, 17, 0, 22, 25, 14, 18, 26,
567 4, 13, 27, 10, 11, 16, 22, 28, 5, 28,
568 28, 6, 8, 9, 15, 12, 7, 28, 28, 25,
572 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
573 static const yytype_uint8 yyr1[] =
575 0, 23, 24, 25, 26, 25, 27, 27, 28, 28,
579 /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
580 static const yytype_uint8 yyr2[] =
582 0, 2, 4, 0, 0, 8, 0, 6, 3, 3,
587 #define yyerrok (yyerrstatus = 0)
588 #define yyclearin (yychar = YYEMPTY)
592 #define YYACCEPT goto yyacceptlab
593 #define YYABORT goto yyabortlab
594 #define YYERROR goto yyerrorlab
597 #define YYRECOVERING() (!!yyerrstatus)
599 #define YYBACKUP(Token, Value) \
601 if (yychar == YYEMPTY) \
605 YYPOPSTACK (yylen); \
611 yyerror (YY_("syntax error: cannot back up")); \
616 /* Error token number */
618 #define YYERRCODE 256
622 /* Enable debugging if requested. */
626 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
627 # define YYFPRINTF fprintf
630 # define YYDPRINTF(Args) \
636 /* This macro is provided for backward compatibility. */
637 #ifndef YY_LOCATION_PRINT
638 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
642 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
646 YYFPRINTF (stderr, "%s ", Title); \
647 yy_symbol_print (stderr, \
649 YYFPRINTF (stderr, "\n"); \
654 /*-----------------------------------.
655 | Print this symbol's value on YYO. |
656 `-----------------------------------*/
659 yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
661 FILE *yyoutput = yyo;
666 if (yytype < YYNTOKENS)
667 YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
673 /*---------------------------.
674 | Print this symbol on YYO. |
675 `---------------------------*/
678 yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
680 YYFPRINTF (yyo, "%s %s (",
681 yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
683 yy_symbol_value_print (yyo, yytype, yyvaluep);
684 YYFPRINTF (yyo, ")");
687 /*------------------------------------------------------------------.
688 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
690 `------------------------------------------------------------------*/
693 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
695 YYFPRINTF (stderr, "Stack now");
696 for (; yybottom <= yytop; yybottom++)
698 int yybot = *yybottom;
699 YYFPRINTF (stderr, " %d", yybot);
701 YYFPRINTF (stderr, "\n");
704 # define YY_STACK_PRINT(Bottom, Top) \
707 yy_stack_print ((Bottom), (Top)); \
711 /*------------------------------------------------.
712 | Report that the YYRULE is going to be reduced. |
713 `------------------------------------------------*/
716 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
718 unsigned long yylno = yyrline[yyrule];
719 int yynrhs = yyr2[yyrule];
721 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
723 /* The symbols being reduced. */
724 for (yyi = 0; yyi < yynrhs; yyi++)
726 YYFPRINTF (stderr, " $%d = ", yyi + 1);
727 yy_symbol_print (stderr,
728 yystos[yyssp[yyi + 1 - yynrhs]],
729 &yyvsp[(yyi + 1) - (yynrhs)]
731 YYFPRINTF (stderr, "\n");
735 # define YY_REDUCE_PRINT(Rule) \
738 yy_reduce_print (yyssp, yyvsp, Rule); \
741 /* Nonzero means print parse trace. It is left uninitialized so that
742 multiple parsers can coexist. */
745 # define YYDPRINTF(Args)
746 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
747 # define YY_STACK_PRINT(Bottom, Top)
748 # define YY_REDUCE_PRINT(Rule)
749 #endif /* !YYDEBUG */
752 /* YYINITDEPTH -- initial size of the parser's stacks. */
754 # define YYINITDEPTH 200
757 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
758 if the built-in stack extension method is used).
760 Do not make this value too large; the results are undefined if
761 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
762 evaluated with infinite-precision integer arithmetic. */
765 # define YYMAXDEPTH 10000
772 # if defined __GLIBC__ && defined _STRING_H
773 # define yystrlen strlen
775 /* Return the length of YYSTR. */
777 yystrlen (const char *yystr)
780 for (yylen = 0; yystr[yylen]; yylen++)
788 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
789 # define yystpcpy stpcpy
791 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
794 yystpcpy (char *yydest, const char *yysrc)
797 const char *yys = yysrc;
799 while ((*yyd++ = *yys++) != '\0')
808 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
809 quotes and backslashes, so that it's suitable for yyerror. The
810 heuristic is that double-quoting is unnecessary unless the string
811 contains an apostrophe, a comma, or backslash (other than
812 backslash-backslash). YYSTR is taken from yytname. If YYRES is
813 null, do not copy; instead, return the length of what the result
816 yytnamerr (char *yyres, const char *yystr)
821 char const *yyp = yystr;
828 goto do_not_strip_quotes;
832 goto do_not_strip_quotes;
848 do_not_strip_quotes: ;
852 return yystrlen (yystr);
854 return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
858 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
859 about the unexpected token YYTOKEN for the state stack whose top is
862 Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
863 not large enough to hold the message. In that case, also set
864 *YYMSG_ALLOC to the required number of bytes. Return 2 if the
865 required number of bytes is too large to store. */
867 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
868 yytype_int16 *yyssp, int yytoken)
870 YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
871 YYSIZE_T yysize = yysize0;
872 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
873 /* Internationalized format string. */
874 const char *yyformat = YY_NULLPTR;
875 /* Arguments of yyformat. */
876 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
877 /* Number of reported tokens (one for the "unexpected", one per
881 /* There are many possibilities here to consider:
882 - If this state is a consistent state with a default action, then
883 the only way this function was invoked is if the default action
884 is an error action. In that case, don't check for expected
885 tokens because there are none.
886 - The only way there can be no lookahead present (in yychar) is if
887 this state is a consistent state with a default action. Thus,
888 detecting the absence of a lookahead is sufficient to determine
889 that there is no unexpected or expected token to report. In that
890 case, just report a simple "syntax error".
891 - Don't assume there isn't a lookahead just because this state is a
892 consistent state with a default action. There might have been a
893 previous inconsistent state, consistent state with a non-default
894 action, or user semantic action that manipulated yychar.
895 - Of course, the expected token list depends on states to have
896 correct lookahead information, and it depends on the parser not
897 to perform extra reductions after fetching a lookahead from the
898 scanner and before detecting a syntax error. Thus, state merging
899 (from LALR or IELR) and default reductions corrupt the expected
900 token list. However, the list is correct for canonical LR with
901 one exception: it will still contain any token that will not be
902 accepted due to an error action in a later state.
904 if (yytoken != YYEMPTY)
906 int yyn = yypact[*yyssp];
907 yyarg[yycount++] = yytname[yytoken];
908 if (!yypact_value_is_default (yyn))
910 /* Start YYX at -YYN if negative to avoid negative indexes in
911 YYCHECK. In other words, skip the first -YYN actions for
912 this state because they are default actions. */
913 int yyxbegin = yyn < 0 ? -yyn : 0;
914 /* Stay within bounds of both yycheck and yytname. */
915 int yychecklim = YYLAST - yyn + 1;
916 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
919 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
920 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
921 && !yytable_value_is_error (yytable[yyx + yyn]))
923 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
929 yyarg[yycount++] = yytname[yyx];
931 YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
932 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
943 # define YYCASE_(N, S) \
947 default: /* Avoid compiler warnings. */
948 YYCASE_(0, YY_("syntax error"));
949 YYCASE_(1, YY_("syntax error, unexpected %s"));
950 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
951 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
952 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
953 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
958 YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
959 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
965 if (*yymsg_alloc < yysize)
967 *yymsg_alloc = 2 * yysize;
968 if (! (yysize <= *yymsg_alloc
969 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
970 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
974 /* Avoid sprintf, as that infringes on the user's name space.
975 Don't have undefined behavior even if the translation
976 produced a string with the wrong number of "%s"s. */
980 while ((*yyp = *yyformat) != '\0')
981 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
983 yyp += yytnamerr (yyp, yyarg[yyi++]);
994 #endif /* YYERROR_VERBOSE */
996 /*-----------------------------------------------.
997 | Release the memory associated to this symbol. |
998 `-----------------------------------------------*/
1001 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
1006 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1008 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1010 YY_IGNORE_MAYBE_UNINITIALIZED_END
1016 /* The lookahead symbol. */
1019 /* The semantic value of the lookahead symbol. */
1021 /* Number of syntax errors so far. */
1033 /* Number of tokens to shift before error messages enabled. */
1036 /* The stacks and their tools:
1037 'yyss': related to states.
1038 'yyvs': related to semantic values.
1040 Refer to the stacks through separate pointers, to allow yyoverflow
1041 to reallocate them elsewhere. */
1043 /* The state stack. */
1044 yytype_int16 yyssa[YYINITDEPTH];
1046 yytype_int16 *yyssp;
1048 /* The semantic value stack. */
1049 YYSTYPE yyvsa[YYINITDEPTH];
1053 YYSIZE_T yystacksize;
1057 /* Lookahead token as an internal (translated) token number. */
1059 /* The variables used to return semantic value and location from the
1064 /* Buffer for error messages, and its allocated size. */
1066 char *yymsg = yymsgbuf;
1067 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
1070 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1072 /* The number of symbols on the RHS of the reduced rule.
1073 Keep to zero when no symbol should be popped. */
1076 yyssp = yyss = yyssa;
1077 yyvsp = yyvs = yyvsa;
1078 yystacksize = YYINITDEPTH;
1080 YYDPRINTF ((stderr, "Starting parse\n"));
1085 yychar = YYEMPTY; /* Cause a token to be read. */
1089 /*------------------------------------------------------------.
1090 | yynewstate -- push a new state, which is found in yystate. |
1091 `------------------------------------------------------------*/
1093 /* In all cases, when you get here, the value and location stacks
1094 have just been pushed. So pushing a state here evens the stacks. */
1098 /*--------------------------------------------------------------------.
1099 | yynewstate -- set current state (the top of the stack) to yystate. |
1100 `--------------------------------------------------------------------*/
1102 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1103 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1104 *yyssp = (yytype_int16) yystate;
1106 if (yyss + yystacksize - 1 <= yyssp)
1107 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1108 goto yyexhaustedlab;
1111 /* Get the current used size of the three stacks, in elements. */
1112 YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
1114 # if defined yyoverflow
1116 /* Give user a chance to reallocate the stack. Use copies of
1117 these so that the &'s don't force the real ones into
1119 YYSTYPE *yyvs1 = yyvs;
1120 yytype_int16 *yyss1 = yyss;
1122 /* Each stack pointer address is followed by the size of the
1123 data in use in that stack, in bytes. This used to be a
1124 conditional around just the two extra args, but that might
1125 be undefined if yyoverflow is a macro. */
1126 yyoverflow (YY_("memory exhausted"),
1127 &yyss1, yysize * sizeof (*yyssp),
1128 &yyvs1, yysize * sizeof (*yyvsp),
1133 # else /* defined YYSTACK_RELOCATE */
1134 /* Extend the stack our own way. */
1135 if (YYMAXDEPTH <= yystacksize)
1136 goto yyexhaustedlab;
1138 if (YYMAXDEPTH < yystacksize)
1139 yystacksize = YYMAXDEPTH;
1142 yytype_int16 *yyss1 = yyss;
1143 union yyalloc *yyptr =
1144 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
1146 goto yyexhaustedlab;
1147 YYSTACK_RELOCATE (yyss_alloc, yyss);
1148 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1149 # undef YYSTACK_RELOCATE
1151 YYSTACK_FREE (yyss1);
1155 yyssp = yyss + yysize - 1;
1156 yyvsp = yyvs + yysize - 1;
1158 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
1159 (unsigned long) yystacksize));
1161 if (yyss + yystacksize - 1 <= yyssp)
1164 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1166 if (yystate == YYFINAL)
1176 /* Do appropriate processing given the current state. Read a
1177 lookahead token if we need one and don't already have one. */
1179 /* First try to decide what to do without reference to lookahead token. */
1180 yyn = yypact[yystate];
1181 if (yypact_value_is_default (yyn))
1184 /* Not known => get a lookahead token if don't already have one. */
1186 /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1187 if (yychar == YYEMPTY)
1189 YYDPRINTF ((stderr, "Reading a token: "));
1193 if (yychar <= YYEOF)
1195 yychar = yytoken = YYEOF;
1196 YYDPRINTF ((stderr, "Now at end of input.\n"));
1200 yytoken = YYTRANSLATE (yychar);
1201 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1204 /* If the proper action on seeing token YYTOKEN is to reduce or to
1205 detect an error, take that action. */
1207 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1212 if (yytable_value_is_error (yyn))
1218 /* Count tokens shifted since error; after three, turn off error
1223 /* Shift the lookahead token. */
1224 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1226 /* Discard the shifted token. */
1230 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1232 YY_IGNORE_MAYBE_UNINITIALIZED_END
1236 /*-----------------------------------------------------------.
1237 | yydefault -- do the default action for the current state. |
1238 `-----------------------------------------------------------*/
1240 yyn = yydefact[yystate];
1246 /*-----------------------------.
1247 | yyreduce -- do a reduction. |
1248 `-----------------------------*/
1250 /* yyn is the number of a rule to reduce with. */
1253 /* If YYLEN is nonzero, implement the default value of the action:
1256 Otherwise, the following line sets YYVAL to garbage.
1257 This behavior is undocumented and Bison
1258 users should not rely upon it. Assigning to YYVAL
1259 unconditionally makes the parser a bit smaller, and it avoids a
1260 GCC warning that YYVAL may be used uninitialized. */
1261 yyval = yyvsp[1-yylen];
1264 YY_REDUCE_PRINT (yyn);
1268 #line 64 "parserPromela.yacc"
1269 { new_state((yyvsp[-1].string), 1);}
1270 #line 1271 "parserPromela.tab.cacc"
1274 #line 68 "parserPromela.yacc"
1275 { new_transition((yyvsp[-1].string), (yyvsp[-4].label));}
1276 #line 1277 "parserPromela.tab.cacc"
1280 #line 71 "parserPromela.yacc"
1281 { (yyval.label) = (yyvsp[-1].label); }
1282 #line 1283 "parserPromela.tab.cacc"
1286 #line 72 "parserPromela.yacc"
1287 { (yyval.label) = xbt_automaton_exp_label_new_or((yyvsp[-2].label), (yyvsp[0].label)); }
1288 #line 1289 "parserPromela.tab.cacc"
1292 #line 73 "parserPromela.yacc"
1293 { (yyval.label) = xbt_automaton_exp_label_new_and((yyvsp[-2].label), (yyvsp[0].label)); }
1294 #line 1295 "parserPromela.tab.cacc"
1298 #line 74 "parserPromela.yacc"
1299 { (yyval.label) = xbt_automaton_exp_label_new_not((yyvsp[0].label)); }
1300 #line 1301 "parserPromela.tab.cacc"
1304 #line 75 "parserPromela.yacc"
1305 { (yyval.label) = xbt_automaton_exp_label_new_one(); }
1306 #line 1307 "parserPromela.tab.cacc"
1310 #line 76 "parserPromela.yacc"
1311 { (yyval.label) = xbt_automaton_exp_label_new_predicat((yyvsp[0].string)); }
1312 #line 1313 "parserPromela.tab.cacc"
1316 #line 1317 "parserPromela.tab.cacc"
1320 /* User semantic actions sometimes alter yychar, and that requires
1321 that yytoken be updated with the new translation. We take the
1322 approach of translating immediately before every use of yytoken.
1323 One alternative is translating here after every semantic action,
1324 but that translation would be missed if the semantic action invokes
1325 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1326 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1327 incorrect destructor might then be invoked immediately. In the
1328 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1329 to an incorrect destructor call or verbose syntax error message
1330 before the lookahead is translated. */
1331 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
1335 YY_STACK_PRINT (yyss, yyssp);
1339 /* Now 'shift' the result of the reduction. Determine what state
1340 that goes to, based on the state we popped back to and the rule
1341 number reduced by. */
1343 const int yylhs = yyr1[yyn] - YYNTOKENS;
1344 const int yyi = yypgoto[yylhs] + *yyssp;
1345 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1347 : yydefgoto[yylhs]);
1353 /*--------------------------------------.
1354 | yyerrlab -- here on detecting error. |
1355 `--------------------------------------*/
1357 /* Make sure we have latest lookahead translation. See comments at
1358 user semantic actions for why this is necessary. */
1359 yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
1361 /* If not already recovering from an error, report this error. */
1365 #if ! YYERROR_VERBOSE
1366 yyerror (YY_("syntax error"));
1368 # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
1371 char const *yymsgp = YY_("syntax error");
1372 int yysyntax_error_status;
1373 yysyntax_error_status = YYSYNTAX_ERROR;
1374 if (yysyntax_error_status == 0)
1376 else if (yysyntax_error_status == 1)
1378 if (yymsg != yymsgbuf)
1379 YYSTACK_FREE (yymsg);
1380 yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
1384 yymsg_alloc = sizeof yymsgbuf;
1385 yysyntax_error_status = 2;
1389 yysyntax_error_status = YYSYNTAX_ERROR;
1394 if (yysyntax_error_status == 2)
1395 goto yyexhaustedlab;
1397 # undef YYSYNTAX_ERROR
1403 if (yyerrstatus == 3)
1405 /* If just tried and failed to reuse lookahead token after an
1406 error, discard it. */
1408 if (yychar <= YYEOF)
1410 /* Return failure if at end of input. */
1411 if (yychar == YYEOF)
1416 yydestruct ("Error: discarding",
1422 /* Else will try to reuse lookahead token after shifting the error
1427 /*---------------------------------------------------.
1428 | yyerrorlab -- error raised explicitly by YYERROR. |
1429 `---------------------------------------------------*/
1431 /* Pacify compilers when the user code never invokes YYERROR and the
1432 label yyerrorlab therefore never appears in user code. */
1436 /* Do not reclaim the symbols of the rule whose action triggered
1440 YY_STACK_PRINT (yyss, yyssp);
1445 /*-------------------------------------------------------------.
1446 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1447 `-------------------------------------------------------------*/
1449 yyerrstatus = 3; /* Each real token shifted decrements this. */
1453 yyn = yypact[yystate];
1454 if (!yypact_value_is_default (yyn))
1457 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
1465 /* Pop the current state because it cannot handle the error token. */
1470 yydestruct ("Error: popping",
1471 yystos[yystate], yyvsp);
1474 YY_STACK_PRINT (yyss, yyssp);
1477 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1479 YY_IGNORE_MAYBE_UNINITIALIZED_END
1482 /* Shift the error token. */
1483 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
1489 /*-------------------------------------.
1490 | yyacceptlab -- YYACCEPT comes here. |
1491 `-------------------------------------*/
1497 /*-----------------------------------.
1498 | yyabortlab -- YYABORT comes here. |
1499 `-----------------------------------*/
1505 #if !defined yyoverflow || YYERROR_VERBOSE
1506 /*-------------------------------------------------.
1507 | yyexhaustedlab -- memory exhaustion comes here. |
1508 `-------------------------------------------------*/
1510 yyerror (YY_("memory exhausted"));
1516 /*-----------------------------------------------------.
1517 | yyreturn -- parsing is finished, return the result. |
1518 `-----------------------------------------------------*/
1520 if (yychar != YYEMPTY)
1522 /* Make sure we have latest lookahead translation. See comments at
1523 user semantic actions for why this is necessary. */
1524 yytoken = YYTRANSLATE (yychar);
1525 yydestruct ("Cleanup: discarding lookahead",
1528 /* Do not reclaim the symbols of the rule whose action triggered
1529 this YYABORT or YYACCEPT. */
1531 YY_STACK_PRINT (yyss, yyssp);
1532 while (yyssp != yyss)
1534 yydestruct ("Cleanup: popping",
1535 yystos[*yyssp], yyvsp);
1540 YYSTACK_FREE (yyss);
1543 if (yymsg != yymsgbuf)
1544 YYSTACK_FREE (yymsg);
1548 #line 79 "parserPromela.yacc"
1553 void yyerror(const char *s){
1554 fprintf (stderr, "%s\n", s);