CMake Nightly Date Stamp
[kiteware-cmake.git] / Source / LexerParser / cmFortranParser.cxx
blobf25856abedacc66b9b37f421ea775b5efba2a46b
1 /* A Bison parser, made by GNU Bison 3.8.2. */
3 /* Bison implementation for Yacc-like parsers in C
5 Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
6 Inc.
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 <https://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 /* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
38 especially those whose name start with YY_ or yy_. They are
39 private implementation details that can be changed or removed. */
41 /* All symbols defined below should begin with yy or YY, to avoid
42 infringing on user name space. This should be done even for local
43 variables, as they might otherwise be expanded by user macros.
44 There are some unavoidable exceptions within include files to
45 define necessary library symbols; they are noted "INFRINGES ON
46 USER NAME SPACE" below. */
48 /* Identify Bison output, and Bison version. */
49 #define YYBISON 30802
51 /* Bison version string. */
52 #define YYBISON_VERSION "3.8.2"
54 /* Skeleton name. */
55 #define YYSKELETON_NAME "yacc.c"
57 /* Pure parsers. */
58 #define YYPURE 1
60 /* Push parsers. */
61 #define YYPUSH 0
63 /* Pull parsers. */
64 #define YYPULL 1
67 /* Substitute the variable and function names. */
68 #define yyparse cmFortran_yyparse
69 #define yylex cmFortran_yylex
70 #define yyerror cmFortran_yyerror
71 #define yydebug cmFortran_yydebug
72 #define yynerrs cmFortran_yynerrs
74 /* First part of user prologue. */
75 #line 1 "cmFortranParser.y"
77 /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
78 file Copyright.txt or https://cmake.org/licensing for details. */
79 /*-------------------------------------------------------------------------
80 Portions of this source have been derived from makedepf90 version 2.8.8,
82 Copyright (C) 2000--2006 Erik Edelmann <erik.edelmann@iki.fi>
84 The code was originally distributed under the GPL but permission
85 from the copyright holder has been obtained to distribute this
86 derived work under the CMake license.
87 -------------------------------------------------------------------------*/
91 This file must be translated to C and modified to build everywhere.
93 Run bison like this:
95 bison --name-prefix=cmFortran_yy
96 --defines=cmFortranParserTokens.h
97 -ocmFortranParser.cxx
98 cmFortranParser.y
102 #include "cmConfigure.h" // IWYU pragma: keep
104 #include "cmsys/String.h"
105 #include <stdlib.h>
106 #include <string.h>
108 /*-------------------------------------------------------------------------*/
109 #define cmFortranParser_cxx
110 #include "cmFortranParser.h" /* Interface to parser object. */
112 /* Forward declare the lexer entry point. */
113 YY_DECL;
115 /* Helper function to forward error callback from parser. */
116 static void cmFortran_yyerror(yyscan_t yyscanner, const char* message)
118 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
119 cmFortranParser_Error(parser, message);
122 /* Disable some warnings in the generated code. */
123 #ifdef _MSC_VER
124 # pragma warning (disable: 4102) /* Unused goto label. */
125 # pragma warning (disable: 4065) /* Switch contains default but no case. */
126 # pragma warning (disable: 4701) /* Local variable may not be initialized. */
127 # pragma warning (disable: 4702) /* Unreachable code. */
128 # pragma warning (disable: 4127) /* Conditional expression is constant. */
129 # pragma warning (disable: 4244) /* Conversion to smaller type, data loss. */
130 #endif
131 #if defined(__GNUC__) && __GNUC__ >= 8
132 # pragma GCC diagnostic ignored "-Wconversion"
133 # pragma GCC diagnostic ignored "-Wfree-nonheap-object"
134 #endif
135 #if defined(__clang__) && defined(__has_warning)
136 # if __has_warning("-Wunused-but-set-variable")
137 # pragma clang diagnostic ignored "-Wunused-but-set-variable"
138 # endif
139 #endif
141 #line 142 "cmFortranParser.cxx"
143 # ifndef YY_CAST
144 # ifdef __cplusplus
145 # define YY_CAST(Type, Val) static_cast<Type> (Val)
146 # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
147 # else
148 # define YY_CAST(Type, Val) ((Type) (Val))
149 # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
150 # endif
151 # endif
152 # ifndef YY_NULLPTR
153 # if defined __cplusplus
154 # if 201103L <= __cplusplus
155 # define YY_NULLPTR nullptr
156 # else
157 # define YY_NULLPTR 0
158 # endif
159 # else
160 # define YY_NULLPTR ((void*)0)
161 # endif
162 # endif
164 #include "cmFortranParserTokens.h"
165 /* Symbol kind. */
166 enum yysymbol_kind_t
168 YYSYMBOL_YYEMPTY = -2,
169 YYSYMBOL_YYEOF = 0, /* "end of file" */
170 YYSYMBOL_YYerror = 1, /* error */
171 YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
172 YYSYMBOL_EOSTMT = 3, /* EOSTMT */
173 YYSYMBOL_ASSIGNMENT_OP = 4, /* ASSIGNMENT_OP */
174 YYSYMBOL_GARBAGE = 5, /* GARBAGE */
175 YYSYMBOL_CPP_LINE_DIRECTIVE = 6, /* CPP_LINE_DIRECTIVE */
176 YYSYMBOL_CPP_INCLUDE = 7, /* CPP_INCLUDE */
177 YYSYMBOL_F90PPR_INCLUDE = 8, /* F90PPR_INCLUDE */
178 YYSYMBOL_COCO_INCLUDE = 9, /* COCO_INCLUDE */
179 YYSYMBOL_F90PPR_DEFINE = 10, /* F90PPR_DEFINE */
180 YYSYMBOL_CPP_DEFINE = 11, /* CPP_DEFINE */
181 YYSYMBOL_F90PPR_UNDEF = 12, /* F90PPR_UNDEF */
182 YYSYMBOL_CPP_UNDEF = 13, /* CPP_UNDEF */
183 YYSYMBOL_CPP_IFDEF = 14, /* CPP_IFDEF */
184 YYSYMBOL_CPP_IFNDEF = 15, /* CPP_IFNDEF */
185 YYSYMBOL_CPP_IF = 16, /* CPP_IF */
186 YYSYMBOL_CPP_ELSE = 17, /* CPP_ELSE */
187 YYSYMBOL_CPP_ELIF = 18, /* CPP_ELIF */
188 YYSYMBOL_CPP_ENDIF = 19, /* CPP_ENDIF */
189 YYSYMBOL_F90PPR_IFDEF = 20, /* F90PPR_IFDEF */
190 YYSYMBOL_F90PPR_IFNDEF = 21, /* F90PPR_IFNDEF */
191 YYSYMBOL_F90PPR_IF = 22, /* F90PPR_IF */
192 YYSYMBOL_F90PPR_ELSE = 23, /* F90PPR_ELSE */
193 YYSYMBOL_F90PPR_ELIF = 24, /* F90PPR_ELIF */
194 YYSYMBOL_F90PPR_ENDIF = 25, /* F90PPR_ENDIF */
195 YYSYMBOL_COMMA = 26, /* COMMA */
196 YYSYMBOL_COLON = 27, /* COLON */
197 YYSYMBOL_DCOLON = 28, /* DCOLON */
198 YYSYMBOL_LPAREN = 29, /* LPAREN */
199 YYSYMBOL_RPAREN = 30, /* RPAREN */
200 YYSYMBOL_UNTERMINATED_STRING = 31, /* UNTERMINATED_STRING */
201 YYSYMBOL_STRING = 32, /* STRING */
202 YYSYMBOL_WORD = 33, /* WORD */
203 YYSYMBOL_CPP_INCLUDE_ANGLE = 34, /* CPP_INCLUDE_ANGLE */
204 YYSYMBOL_END = 35, /* END */
205 YYSYMBOL_INCLUDE = 36, /* INCLUDE */
206 YYSYMBOL_INTERFACE = 37, /* INTERFACE */
207 YYSYMBOL_MODULE = 38, /* MODULE */
208 YYSYMBOL_SUBMODULE = 39, /* SUBMODULE */
209 YYSYMBOL_USE = 40, /* USE */
210 YYSYMBOL_YYACCEPT = 41, /* $accept */
211 YYSYMBOL_code = 42, /* code */
212 YYSYMBOL_stmt = 43, /* stmt */
213 YYSYMBOL_include = 44, /* include */
214 YYSYMBOL_define = 45, /* define */
215 YYSYMBOL_undef = 46, /* undef */
216 YYSYMBOL_ifdef = 47, /* ifdef */
217 YYSYMBOL_ifndef = 48, /* ifndef */
218 YYSYMBOL_if = 49, /* if */
219 YYSYMBOL_elif = 50, /* elif */
220 YYSYMBOL_else = 51, /* else */
221 YYSYMBOL_endif = 52, /* endif */
222 YYSYMBOL_other = 53, /* other */
223 YYSYMBOL_misc_code = 54 /* misc_code */
225 typedef enum yysymbol_kind_t yysymbol_kind_t;
230 #ifdef short
231 # undef short
232 #endif
234 /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
235 <limits.h> and (if available) <stdint.h> are included
236 so that the code can choose integer types of a good width. */
238 #ifndef __PTRDIFF_MAX__
239 # include <limits.h> /* INFRINGES ON USER NAME SPACE */
240 # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
241 # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
242 # define YY_STDINT_H
243 # endif
244 #endif
246 /* Narrow types that promote to a signed type and that can represent a
247 signed or unsigned integer of at least N bits. In tables they can
248 save space and decrease cache pressure. Promoting to a signed type
249 helps avoid bugs in integer arithmetic. */
251 #ifdef __INT_LEAST8_MAX__
252 typedef __INT_LEAST8_TYPE__ yytype_int8;
253 #elif defined YY_STDINT_H
254 typedef int_least8_t yytype_int8;
255 #else
256 typedef signed char yytype_int8;
257 #endif
259 #ifdef __INT_LEAST16_MAX__
260 typedef __INT_LEAST16_TYPE__ yytype_int16;
261 #elif defined YY_STDINT_H
262 typedef int_least16_t yytype_int16;
263 #else
264 typedef short yytype_int16;
265 #endif
267 /* Work around bug in HP-UX 11.23, which defines these macros
268 incorrectly for preprocessor constants. This workaround can likely
269 be removed in 2023, as HPE has promised support for HP-UX 11.23
270 (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
271 <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
272 #ifdef __hpux
273 # undef UINT_LEAST8_MAX
274 # undef UINT_LEAST16_MAX
275 # define UINT_LEAST8_MAX 255
276 # define UINT_LEAST16_MAX 65535
277 #endif
279 #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
280 typedef __UINT_LEAST8_TYPE__ yytype_uint8;
281 #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
282 && UINT_LEAST8_MAX <= INT_MAX)
283 typedef uint_least8_t yytype_uint8;
284 #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
285 typedef unsigned char yytype_uint8;
286 #else
287 typedef short yytype_uint8;
288 #endif
290 #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
291 typedef __UINT_LEAST16_TYPE__ yytype_uint16;
292 #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
293 && UINT_LEAST16_MAX <= INT_MAX)
294 typedef uint_least16_t yytype_uint16;
295 #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
296 typedef unsigned short yytype_uint16;
297 #else
298 typedef int yytype_uint16;
299 #endif
301 #ifndef YYPTRDIFF_T
302 # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
303 # define YYPTRDIFF_T __PTRDIFF_TYPE__
304 # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
305 # elif defined PTRDIFF_MAX
306 # ifndef ptrdiff_t
307 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
308 # endif
309 # define YYPTRDIFF_T ptrdiff_t
310 # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
311 # else
312 # define YYPTRDIFF_T long
313 # define YYPTRDIFF_MAXIMUM LONG_MAX
314 # endif
315 #endif
317 #ifndef YYSIZE_T
318 # ifdef __SIZE_TYPE__
319 # define YYSIZE_T __SIZE_TYPE__
320 # elif defined size_t
321 # define YYSIZE_T size_t
322 # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
323 # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
324 # define YYSIZE_T size_t
325 # else
326 # define YYSIZE_T unsigned
327 # endif
328 #endif
330 #define YYSIZE_MAXIMUM \
331 YY_CAST (YYPTRDIFF_T, \
332 (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
333 ? YYPTRDIFF_MAXIMUM \
334 : YY_CAST (YYSIZE_T, -1)))
336 #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
339 /* Stored state numbers (used for stacks). */
340 typedef yytype_int8 yy_state_t;
342 /* State numbers in computations. */
343 typedef int yy_state_fast_t;
345 #ifndef YY_
346 # if defined YYENABLE_NLS && YYENABLE_NLS
347 # if ENABLE_NLS
348 # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
349 # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
350 # endif
351 # endif
352 # ifndef YY_
353 # define YY_(Msgid) Msgid
354 # endif
355 #endif
358 #ifndef YY_ATTRIBUTE_PURE
359 # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
360 # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
361 # else
362 # define YY_ATTRIBUTE_PURE
363 # endif
364 #endif
366 #ifndef YY_ATTRIBUTE_UNUSED
367 # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
368 # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
369 # else
370 # define YY_ATTRIBUTE_UNUSED
371 # endif
372 #endif
374 /* Suppress unused-variable warnings by "using" E. */
375 #if ! defined lint || defined __GNUC__
376 # define YY_USE(E) ((void) (E))
377 #else
378 # define YY_USE(E) /* empty */
379 #endif
381 /* Suppress an incorrect diagnostic about yylval being uninitialized. */
382 #if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
383 # if __GNUC__ * 100 + __GNUC_MINOR__ < 407
384 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
385 _Pragma ("GCC diagnostic push") \
386 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
387 # else
388 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
389 _Pragma ("GCC diagnostic push") \
390 _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
391 _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
392 # endif
393 # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
394 _Pragma ("GCC diagnostic pop")
395 #else
396 # define YY_INITIAL_VALUE(Value) Value
397 #endif
398 #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
399 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
400 # define YY_IGNORE_MAYBE_UNINITIALIZED_END
401 #endif
402 #ifndef YY_INITIAL_VALUE
403 # define YY_INITIAL_VALUE(Value) /* Nothing. */
404 #endif
406 #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
407 # define YY_IGNORE_USELESS_CAST_BEGIN \
408 _Pragma ("GCC diagnostic push") \
409 _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
410 # define YY_IGNORE_USELESS_CAST_END \
411 _Pragma ("GCC diagnostic pop")
412 #endif
413 #ifndef YY_IGNORE_USELESS_CAST_BEGIN
414 # define YY_IGNORE_USELESS_CAST_BEGIN
415 # define YY_IGNORE_USELESS_CAST_END
416 #endif
419 #define YY_ASSERT(E) ((void) (0 && (E)))
421 #if 1
423 /* The parser invokes alloca or malloc; define the necessary symbols. */
425 # ifdef YYSTACK_USE_ALLOCA
426 # if YYSTACK_USE_ALLOCA
427 # ifdef __GNUC__
428 # define YYSTACK_ALLOC __builtin_alloca
429 # elif defined __BUILTIN_VA_ARG_INCR
430 # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
431 # elif defined _AIX
432 # define YYSTACK_ALLOC __alloca
433 # elif defined _MSC_VER
434 # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
435 # define alloca _alloca
436 # else
437 # define YYSTACK_ALLOC alloca
438 # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
439 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
440 /* Use EXIT_SUCCESS as a witness for stdlib.h. */
441 # ifndef EXIT_SUCCESS
442 # define EXIT_SUCCESS 0
443 # endif
444 # endif
445 # endif
446 # endif
447 # endif
449 # ifdef YYSTACK_ALLOC
450 /* Pacify GCC's 'empty if-body' warning. */
451 # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
452 # ifndef YYSTACK_ALLOC_MAXIMUM
453 /* The OS might guarantee only one guard page at the bottom of the stack,
454 and a page size can be as small as 4096 bytes. So we cannot safely
455 invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
456 to allow for a few compiler-allocated temporary stack slots. */
457 # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
458 # endif
459 # else
460 # define YYSTACK_ALLOC YYMALLOC
461 # define YYSTACK_FREE YYFREE
462 # ifndef YYSTACK_ALLOC_MAXIMUM
463 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
464 # endif
465 # if (defined __cplusplus && ! defined EXIT_SUCCESS \
466 && ! ((defined YYMALLOC || defined malloc) \
467 && (defined YYFREE || defined free)))
468 # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
469 # ifndef EXIT_SUCCESS
470 # define EXIT_SUCCESS 0
471 # endif
472 # endif
473 # ifndef YYMALLOC
474 # define YYMALLOC malloc
475 # if ! defined malloc && ! defined EXIT_SUCCESS
476 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
477 # endif
478 # endif
479 # ifndef YYFREE
480 # define YYFREE free
481 # if ! defined free && ! defined EXIT_SUCCESS
482 void free (void *); /* INFRINGES ON USER NAME SPACE */
483 # endif
484 # endif
485 # endif
486 #endif /* 1 */
488 #if (! defined yyoverflow \
489 && (! defined __cplusplus \
490 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
492 /* A type that is properly aligned for any stack member. */
493 union yyalloc
495 yy_state_t yyss_alloc;
496 YYSTYPE yyvs_alloc;
499 /* The size of the maximum gap between one aligned stack and the next. */
500 # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
502 /* The size of an array large to enough to hold all stacks, each with
503 N elements. */
504 # define YYSTACK_BYTES(N) \
505 ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
506 + YYSTACK_GAP_MAXIMUM)
508 # define YYCOPY_NEEDED 1
510 /* Relocate STACK from its old location to the new one. The
511 local variables YYSIZE and YYSTACKSIZE give the old and new number of
512 elements in the stack, and YYPTR gives the new location of the
513 stack. Advance YYPTR to a properly aligned location for the next
514 stack. */
515 # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
516 do \
518 YYPTRDIFF_T yynewbytes; \
519 YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
520 Stack = &yyptr->Stack_alloc; \
521 yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
522 yyptr += yynewbytes / YYSIZEOF (*yyptr); \
524 while (0)
526 #endif
528 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
529 /* Copy COUNT objects from SRC to DST. The source and destination do
530 not overlap. */
531 # ifndef YYCOPY
532 # if defined __GNUC__ && 1 < __GNUC__
533 # define YYCOPY(Dst, Src, Count) \
534 __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
535 # else
536 # define YYCOPY(Dst, Src, Count) \
537 do \
539 YYPTRDIFF_T yyi; \
540 for (yyi = 0; yyi < (Count); yyi++) \
541 (Dst)[yyi] = (Src)[yyi]; \
543 while (0)
544 # endif
545 # endif
546 #endif /* !YYCOPY_NEEDED */
548 /* YYFINAL -- State number of the termination state. */
549 #define YYFINAL 2
550 /* YYLAST -- Last index in YYTABLE. */
551 #define YYLAST 433
553 /* YYNTOKENS -- Number of terminals. */
554 #define YYNTOKENS 41
555 /* YYNNTS -- Number of nonterminals. */
556 #define YYNNTS 14
557 /* YYNRULES -- Number of rules. */
558 #define YYNRULES 65
559 /* YYNSTATES -- Number of states. */
560 #define YYNSTATES 123
562 /* YYMAXUTOK -- Last valid token kind. */
563 #define YYMAXUTOK 295
566 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
567 as returned by yylex, with out-of-bounds checking. */
568 #define YYTRANSLATE(YYX) \
569 (0 <= (YYX) && (YYX) <= YYMAXUTOK \
570 ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
571 : YYSYMBOL_YYUNDEF)
573 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
574 as returned by yylex. */
575 static const yytype_int8 yytranslate[] =
577 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
593 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
594 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
595 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
596 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
597 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
598 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
599 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
600 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
601 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
602 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
603 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
604 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
605 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
606 35, 36, 37, 38, 39, 40
609 #if YYDEBUG
610 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
611 static const yytype_int16 yyrline[] =
613 0, 106, 106, 106, 109, 113, 118, 123, 129, 136,
614 141, 146, 150, 155, 167, 172, 177, 182, 187, 192,
615 197, 202, 207, 211, 215, 219, 223, 224, 229, 229,
616 229, 230, 230, 231, 231, 232, 232, 233, 233, 234,
617 234, 235, 235, 236, 236, 237, 237, 238, 238, 241,
618 242, 243, 244, 245, 246, 247, 248, 249, 250, 251,
619 252, 253, 254, 255, 256, 257
621 #endif
623 /** Accessing symbol of state STATE. */
624 #define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
626 #if 1
627 /* The user-facing name of the symbol whose (internal) number is
628 YYSYMBOL. No bounds checking. */
629 static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
631 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
632 First, the terminals, then, starting at YYNTOKENS, nonterminals. */
633 static const char *const yytname[] =
635 "\"end of file\"", "error", "\"invalid token\"", "EOSTMT",
636 "ASSIGNMENT_OP", "GARBAGE", "CPP_LINE_DIRECTIVE", "CPP_INCLUDE",
637 "F90PPR_INCLUDE", "COCO_INCLUDE", "F90PPR_DEFINE", "CPP_DEFINE",
638 "F90PPR_UNDEF", "CPP_UNDEF", "CPP_IFDEF", "CPP_IFNDEF", "CPP_IF",
639 "CPP_ELSE", "CPP_ELIF", "CPP_ENDIF", "F90PPR_IFDEF", "F90PPR_IFNDEF",
640 "F90PPR_IF", "F90PPR_ELSE", "F90PPR_ELIF", "F90PPR_ENDIF", "COMMA",
641 "COLON", "DCOLON", "LPAREN", "RPAREN", "UNTERMINATED_STRING", "STRING",
642 "WORD", "CPP_INCLUDE_ANGLE", "END", "INCLUDE", "INTERFACE", "MODULE",
643 "SUBMODULE", "USE", "$accept", "code", "stmt", "include", "define",
644 "undef", "ifdef", "ifndef", "if", "elif", "else", "endif", "other",
645 "misc_code", YY_NULLPTR
648 static const char *
649 yysymbol_name (yysymbol_kind_t yysymbol)
651 return yytname[yysymbol];
653 #endif
655 #define YYPACT_NINF (-39)
657 #define yypact_value_is_default(Yyn) \
658 ((Yyn) == YYPACT_NINF)
660 #define YYTABLE_NINF (-1)
662 #define yytable_value_is_error(Yyn) \
665 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
666 STATE-NUM. */
667 static const yytype_int16 yypact[] =
669 -39, 21, -39, 5, -39, -23, -39, -39, -39, -39,
670 -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
671 -39, -39, -39, -39, -39, -39, -25, -19, 20, -8,
672 -15, -22, -39, -6, 14, 15, 16, 17, -39, -39,
673 -39, -39, -39, -39, 59, 51, 48, -39, 63, 64,
674 35, 36, 37, -39, -39, -39, -39, -39, -39, 75,
675 113, 128, 166, 181, -39, -39, -39, -39, -39, -39,
676 -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
677 -39, -39, -39, -39, 68, -39, -39, -39, -20, 44,
678 -39, 219, 234, 272, 287, 325, 340, -39, -39, -39,
679 -39, -39, -39, 40, 41, 42, 378, -39, -39, -39,
680 -39, -39, -39, 46, 79, -39, -39, 50, -39, 393,
681 90, -39, -39
684 /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
685 Performed when YYTABLE does not specify something else to do. Zero
686 means the default is an error. */
687 static const yytype_int8 yydefact[] =
689 2, 0, 1, 0, 26, 0, 28, 29, 30, 32,
690 31, 34, 33, 35, 37, 39, 43, 41, 45, 36,
691 38, 40, 44, 42, 46, 47, 0, 0, 0, 0,
692 0, 0, 3, 0, 0, 0, 0, 0, 47, 47,
693 47, 47, 27, 47, 0, 0, 0, 4, 0, 0,
694 0, 0, 0, 47, 47, 47, 47, 47, 47, 0,
695 0, 0, 0, 0, 16, 58, 57, 65, 63, 59,
696 60, 61, 62, 64, 56, 49, 50, 51, 52, 53,
697 54, 55, 48, 11, 0, 14, 9, 6, 0, 0,
698 47, 0, 0, 0, 0, 0, 0, 22, 23, 24,
699 25, 15, 10, 0, 0, 0, 0, 5, 17, 18,
700 19, 20, 21, 0, 0, 47, 12, 0, 7, 0,
701 0, 13, 8
704 /* YYPGOTO[NTERM-NUM]. */
705 static const yytype_int8 yypgoto[] =
707 -39, -39, -39, -39, -39, -39, -39, -39, -39, -39,
708 -39, -39, -38, -39
711 /* YYDEFGOTO[NTERM-NUM]. */
712 static const yytype_int8 yydefgoto[] =
714 0, 1, 32, 33, 34, 35, 36, 37, 38, 39,
715 40, 41, 44, 82
718 /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
719 positive, shift that token. If negative, reduce the rule whose
720 number is the opposite. If YYTABLE_NINF, syntax error. */
721 static const yytype_int8 yytable[] =
723 59, 60, 61, 62, 51, 63, 52, 103, 42, 43,
724 104, 53, 45, 46, 50, 91, 92, 93, 94, 95,
725 96, 2, 3, 47, 4, 49, 54, 5, 6, 7,
726 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
727 18, 19, 20, 21, 22, 23, 24, 55, 56, 57,
728 58, 85, 106, 48, 83, 25, 26, 27, 28, 29,
729 30, 31, 64, 65, 66, 67, 86, 87, 88, 89,
730 90, 102, 105, 113, 114, 115, 117, 119, 97, 65,
731 66, 67, 118, 120, 84, 68, 69, 70, 71, 72,
732 73, 74, 75, 122, 76, 77, 78, 79, 80, 81,
733 0, 68, 69, 70, 71, 72, 73, 74, 75, 0,
734 76, 77, 78, 79, 80, 81, 98, 65, 66, 67,
735 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
736 0, 99, 65, 66, 67, 0, 0, 0, 0, 68,
737 69, 70, 71, 72, 73, 74, 75, 0, 76, 77,
738 78, 79, 80, 81, 68, 69, 70, 71, 72, 73,
739 74, 75, 0, 76, 77, 78, 79, 80, 81, 100,
740 65, 66, 67, 0, 0, 0, 0, 0, 0, 0,
741 0, 0, 0, 0, 101, 65, 66, 67, 0, 0,
742 0, 0, 68, 69, 70, 71, 72, 73, 74, 75,
743 0, 76, 77, 78, 79, 80, 81, 68, 69, 70,
744 71, 72, 73, 74, 75, 0, 76, 77, 78, 79,
745 80, 81, 107, 65, 66, 67, 0, 0, 0, 0,
746 0, 0, 0, 0, 0, 0, 0, 108, 65, 66,
747 67, 0, 0, 0, 0, 68, 69, 70, 71, 72,
748 73, 74, 75, 0, 76, 77, 78, 79, 80, 81,
749 68, 69, 70, 71, 72, 73, 74, 75, 0, 76,
750 77, 78, 79, 80, 81, 109, 65, 66, 67, 0,
751 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
752 110, 65, 66, 67, 0, 0, 0, 0, 68, 69,
753 70, 71, 72, 73, 74, 75, 0, 76, 77, 78,
754 79, 80, 81, 68, 69, 70, 71, 72, 73, 74,
755 75, 0, 76, 77, 78, 79, 80, 81, 111, 65,
756 66, 67, 0, 0, 0, 0, 0, 0, 0, 0,
757 0, 0, 0, 112, 65, 66, 67, 0, 0, 0,
758 0, 68, 69, 70, 71, 72, 73, 74, 75, 0,
759 76, 77, 78, 79, 80, 81, 68, 69, 70, 71,
760 72, 73, 74, 75, 0, 76, 77, 78, 79, 80,
761 81, 116, 65, 66, 67, 0, 0, 0, 0, 0,
762 0, 0, 0, 0, 0, 0, 121, 65, 66, 67,
763 0, 0, 0, 0, 68, 69, 70, 71, 72, 73,
764 74, 75, 0, 76, 77, 78, 79, 80, 81, 68,
765 69, 70, 71, 72, 73, 74, 75, 0, 76, 77,
766 78, 79, 80, 81
769 static const yytype_int8 yycheck[] =
771 38, 39, 40, 41, 26, 43, 28, 27, 3, 32,
772 30, 33, 37, 32, 29, 53, 54, 55, 56, 57,
773 58, 0, 1, 3, 3, 33, 32, 6, 7, 8,
774 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
775 19, 20, 21, 22, 23, 24, 25, 33, 33, 33,
776 33, 3, 90, 33, 3, 34, 35, 36, 37, 38,
777 39, 40, 3, 4, 5, 6, 3, 3, 33, 33,
778 33, 3, 28, 33, 33, 33, 30, 115, 3, 4,
779 5, 6, 3, 33, 33, 26, 27, 28, 29, 30,
780 31, 32, 33, 3, 35, 36, 37, 38, 39, 40,
781 -1, 26, 27, 28, 29, 30, 31, 32, 33, -1,
782 35, 36, 37, 38, 39, 40, 3, 4, 5, 6,
783 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
784 -1, 3, 4, 5, 6, -1, -1, -1, -1, 26,
785 27, 28, 29, 30, 31, 32, 33, -1, 35, 36,
786 37, 38, 39, 40, 26, 27, 28, 29, 30, 31,
787 32, 33, -1, 35, 36, 37, 38, 39, 40, 3,
788 4, 5, 6, -1, -1, -1, -1, -1, -1, -1,
789 -1, -1, -1, -1, 3, 4, 5, 6, -1, -1,
790 -1, -1, 26, 27, 28, 29, 30, 31, 32, 33,
791 -1, 35, 36, 37, 38, 39, 40, 26, 27, 28,
792 29, 30, 31, 32, 33, -1, 35, 36, 37, 38,
793 39, 40, 3, 4, 5, 6, -1, -1, -1, -1,
794 -1, -1, -1, -1, -1, -1, -1, 3, 4, 5,
795 6, -1, -1, -1, -1, 26, 27, 28, 29, 30,
796 31, 32, 33, -1, 35, 36, 37, 38, 39, 40,
797 26, 27, 28, 29, 30, 31, 32, 33, -1, 35,
798 36, 37, 38, 39, 40, 3, 4, 5, 6, -1,
799 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
800 3, 4, 5, 6, -1, -1, -1, -1, 26, 27,
801 28, 29, 30, 31, 32, 33, -1, 35, 36, 37,
802 38, 39, 40, 26, 27, 28, 29, 30, 31, 32,
803 33, -1, 35, 36, 37, 38, 39, 40, 3, 4,
804 5, 6, -1, -1, -1, -1, -1, -1, -1, -1,
805 -1, -1, -1, 3, 4, 5, 6, -1, -1, -1,
806 -1, 26, 27, 28, 29, 30, 31, 32, 33, -1,
807 35, 36, 37, 38, 39, 40, 26, 27, 28, 29,
808 30, 31, 32, 33, -1, 35, 36, 37, 38, 39,
809 40, 3, 4, 5, 6, -1, -1, -1, -1, -1,
810 -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
811 -1, -1, -1, -1, 26, 27, 28, 29, 30, 31,
812 32, 33, -1, 35, 36, 37, 38, 39, 40, 26,
813 27, 28, 29, 30, 31, 32, 33, -1, 35, 36,
814 37, 38, 39, 40
817 /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
818 state STATE-NUM. */
819 static const yytype_int8 yystos[] =
821 0, 42, 0, 1, 3, 6, 7, 8, 9, 10,
822 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
823 21, 22, 23, 24, 25, 34, 35, 36, 37, 38,
824 39, 40, 43, 44, 45, 46, 47, 48, 49, 50,
825 51, 52, 3, 32, 53, 37, 32, 3, 33, 33,
826 29, 26, 28, 33, 32, 33, 33, 33, 33, 53,
827 53, 53, 53, 53, 3, 4, 5, 6, 26, 27,
828 28, 29, 30, 31, 32, 33, 35, 36, 37, 38,
829 39, 40, 54, 3, 33, 3, 3, 3, 33, 33,
830 33, 53, 53, 53, 53, 53, 53, 3, 3, 3,
831 3, 3, 3, 27, 30, 28, 53, 3, 3, 3,
832 3, 3, 3, 33, 33, 33, 3, 30, 3, 53,
833 33, 3, 3
836 /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
837 static const yytype_int8 yyr1[] =
839 0, 41, 42, 42, 43, 43, 43, 43, 43, 43,
840 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
841 43, 43, 43, 43, 43, 43, 43, 43, 44, 44,
842 44, 45, 45, 46, 46, 47, 47, 48, 48, 49,
843 49, 50, 50, 51, 51, 52, 52, 53, 53, 54,
844 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
845 54, 54, 54, 54, 54, 54
848 /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
849 static const yytype_int8 yyr2[] =
851 0, 2, 0, 2, 2, 4, 3, 6, 8, 3,
852 4, 3, 5, 7, 3, 4, 3, 4, 4, 4,
853 4, 4, 3, 3, 3, 3, 1, 2, 1, 1,
854 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
855 1, 1, 1, 1, 1, 1, 1, 0, 2, 1,
856 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
857 1, 1, 1, 1, 1, 1
861 enum { YYENOMEM = -2 };
863 #define yyerrok (yyerrstatus = 0)
864 #define yyclearin (yychar = YYEMPTY)
866 #define YYACCEPT goto yyacceptlab
867 #define YYABORT goto yyabortlab
868 #define YYERROR goto yyerrorlab
869 #define YYNOMEM goto yyexhaustedlab
872 #define YYRECOVERING() (!!yyerrstatus)
874 #define YYBACKUP(Token, Value) \
875 do \
876 if (yychar == YYEMPTY) \
878 yychar = (Token); \
879 yylval = (Value); \
880 YYPOPSTACK (yylen); \
881 yystate = *yyssp; \
882 goto yybackup; \
884 else \
886 yyerror (yyscanner, YY_("syntax error: cannot back up")); \
887 YYERROR; \
889 while (0)
891 /* Backward compatibility with an undocumented macro.
892 Use YYerror or YYUNDEF. */
893 #define YYERRCODE YYUNDEF
896 /* Enable debugging if requested. */
897 #if YYDEBUG
899 # ifndef YYFPRINTF
900 # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
901 # define YYFPRINTF fprintf
902 # endif
904 # define YYDPRINTF(Args) \
905 do { \
906 if (yydebug) \
907 YYFPRINTF Args; \
908 } while (0)
913 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
914 do { \
915 if (yydebug) \
917 YYFPRINTF (stderr, "%s ", Title); \
918 yy_symbol_print (stderr, \
919 Kind, Value, yyscanner); \
920 YYFPRINTF (stderr, "\n"); \
922 } while (0)
925 /*-----------------------------------.
926 | Print this symbol's value on YYO. |
927 `-----------------------------------*/
929 static void
930 yy_symbol_value_print (FILE *yyo,
931 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
933 FILE *yyoutput = yyo;
934 YY_USE (yyoutput);
935 YY_USE (yyscanner);
936 if (!yyvaluep)
937 return;
938 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
939 YY_USE (yykind);
940 YY_IGNORE_MAYBE_UNINITIALIZED_END
944 /*---------------------------.
945 | Print this symbol on YYO. |
946 `---------------------------*/
948 static void
949 yy_symbol_print (FILE *yyo,
950 yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, yyscan_t yyscanner)
952 YYFPRINTF (yyo, "%s %s (",
953 yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
955 yy_symbol_value_print (yyo, yykind, yyvaluep, yyscanner);
956 YYFPRINTF (yyo, ")");
959 /*------------------------------------------------------------------.
960 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
961 | TOP (included). |
962 `------------------------------------------------------------------*/
964 static void
965 yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
967 YYFPRINTF (stderr, "Stack now");
968 for (; yybottom <= yytop; yybottom++)
970 int yybot = *yybottom;
971 YYFPRINTF (stderr, " %d", yybot);
973 YYFPRINTF (stderr, "\n");
976 # define YY_STACK_PRINT(Bottom, Top) \
977 do { \
978 if (yydebug) \
979 yy_stack_print ((Bottom), (Top)); \
980 } while (0)
983 /*------------------------------------------------.
984 | Report that the YYRULE is going to be reduced. |
985 `------------------------------------------------*/
987 static void
988 yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
989 int yyrule, yyscan_t yyscanner)
991 int yylno = yyrline[yyrule];
992 int yynrhs = yyr2[yyrule];
993 int yyi;
994 YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
995 yyrule - 1, yylno);
996 /* The symbols being reduced. */
997 for (yyi = 0; yyi < yynrhs; yyi++)
999 YYFPRINTF (stderr, " $%d = ", yyi + 1);
1000 yy_symbol_print (stderr,
1001 YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
1002 &yyvsp[(yyi + 1) - (yynrhs)], yyscanner);
1003 YYFPRINTF (stderr, "\n");
1007 # define YY_REDUCE_PRINT(Rule) \
1008 do { \
1009 if (yydebug) \
1010 yy_reduce_print (yyssp, yyvsp, Rule, yyscanner); \
1011 } while (0)
1013 /* Nonzero means print parse trace. It is left uninitialized so that
1014 multiple parsers can coexist. */
1015 int yydebug;
1016 #else /* !YYDEBUG */
1017 # define YYDPRINTF(Args) ((void) 0)
1018 # define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
1019 # define YY_STACK_PRINT(Bottom, Top)
1020 # define YY_REDUCE_PRINT(Rule)
1021 #endif /* !YYDEBUG */
1024 /* YYINITDEPTH -- initial size of the parser's stacks. */
1025 #ifndef YYINITDEPTH
1026 # define YYINITDEPTH 200
1027 #endif
1029 /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1030 if the built-in stack extension method is used).
1032 Do not make this value too large; the results are undefined if
1033 YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1034 evaluated with infinite-precision integer arithmetic. */
1036 #ifndef YYMAXDEPTH
1037 # define YYMAXDEPTH 10000
1038 #endif
1041 /* Context of a parse error. */
1042 typedef struct
1044 yy_state_t *yyssp;
1045 yysymbol_kind_t yytoken;
1046 } yypcontext_t;
1048 /* Put in YYARG at most YYARGN of the expected tokens given the
1049 current YYCTX, and return the number of tokens stored in YYARG. If
1050 YYARG is null, return the number of expected tokens (guaranteed to
1051 be less than YYNTOKENS). Return YYENOMEM on memory exhaustion.
1052 Return 0 if there are more than YYARGN expected tokens, yet fill
1053 YYARG up to YYARGN. */
1054 static int
1055 yypcontext_expected_tokens (const yypcontext_t *yyctx,
1056 yysymbol_kind_t yyarg[], int yyargn)
1058 /* Actual size of YYARG. */
1059 int yycount = 0;
1060 int yyn = yypact[+*yyctx->yyssp];
1061 if (!yypact_value_is_default (yyn))
1063 /* Start YYX at -YYN if negative to avoid negative indexes in
1064 YYCHECK. In other words, skip the first -YYN actions for
1065 this state because they are default actions. */
1066 int yyxbegin = yyn < 0 ? -yyn : 0;
1067 /* Stay within bounds of both yycheck and yytname. */
1068 int yychecklim = YYLAST - yyn + 1;
1069 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1070 int yyx;
1071 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1072 if (yycheck[yyx + yyn] == yyx && yyx != YYSYMBOL_YYerror
1073 && !yytable_value_is_error (yytable[yyx + yyn]))
1075 if (!yyarg)
1076 ++yycount;
1077 else if (yycount == yyargn)
1078 return 0;
1079 else
1080 yyarg[yycount++] = YY_CAST (yysymbol_kind_t, yyx);
1083 if (yyarg && yycount == 0 && 0 < yyargn)
1084 yyarg[0] = YYSYMBOL_YYEMPTY;
1085 return yycount;
1091 #ifndef yystrlen
1092 # if defined __GLIBC__ && defined _STRING_H
1093 # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1094 # else
1095 /* Return the length of YYSTR. */
1096 static YYPTRDIFF_T
1097 yystrlen (const char *yystr)
1099 YYPTRDIFF_T yylen;
1100 for (yylen = 0; yystr[yylen]; yylen++)
1101 continue;
1102 return yylen;
1104 # endif
1105 #endif
1107 #ifndef yystpcpy
1108 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1109 # define yystpcpy stpcpy
1110 # else
1111 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1112 YYDEST. */
1113 static char *
1114 yystpcpy (char *yydest, const char *yysrc)
1116 char *yyd = yydest;
1117 const char *yys = yysrc;
1119 while ((*yyd++ = *yys++) != '\0')
1120 continue;
1122 return yyd - 1;
1124 # endif
1125 #endif
1127 #ifndef yytnamerr
1128 /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1129 quotes and backslashes, so that it's suitable for yyerror. The
1130 heuristic is that double-quoting is unnecessary unless the string
1131 contains an apostrophe, a comma, or backslash (other than
1132 backslash-backslash). YYSTR is taken from yytname. If YYRES is
1133 null, do not copy; instead, return the length of what the result
1134 would have been. */
1135 static YYPTRDIFF_T
1136 yytnamerr (char *yyres, const char *yystr)
1138 if (*yystr == '"')
1140 YYPTRDIFF_T yyn = 0;
1141 char const *yyp = yystr;
1142 for (;;)
1143 switch (*++yyp)
1145 case '\'':
1146 case ',':
1147 goto do_not_strip_quotes;
1149 case '\\':
1150 if (*++yyp != '\\')
1151 goto do_not_strip_quotes;
1152 else
1153 goto append;
1155 append:
1156 default:
1157 if (yyres)
1158 yyres[yyn] = *yyp;
1159 yyn++;
1160 break;
1162 case '"':
1163 if (yyres)
1164 yyres[yyn] = '\0';
1165 return yyn;
1167 do_not_strip_quotes: ;
1170 if (yyres)
1171 return yystpcpy (yyres, yystr) - yyres;
1172 else
1173 return yystrlen (yystr);
1175 #endif
1178 static int
1179 yy_syntax_error_arguments (const yypcontext_t *yyctx,
1180 yysymbol_kind_t yyarg[], int yyargn)
1182 /* Actual size of YYARG. */
1183 int yycount = 0;
1184 /* There are many possibilities here to consider:
1185 - If this state is a consistent state with a default action, then
1186 the only way this function was invoked is if the default action
1187 is an error action. In that case, don't check for expected
1188 tokens because there are none.
1189 - The only way there can be no lookahead present (in yychar) is if
1190 this state is a consistent state with a default action. Thus,
1191 detecting the absence of a lookahead is sufficient to determine
1192 that there is no unexpected or expected token to report. In that
1193 case, just report a simple "syntax error".
1194 - Don't assume there isn't a lookahead just because this state is a
1195 consistent state with a default action. There might have been a
1196 previous inconsistent state, consistent state with a non-default
1197 action, or user semantic action that manipulated yychar.
1198 - Of course, the expected token list depends on states to have
1199 correct lookahead information, and it depends on the parser not
1200 to perform extra reductions after fetching a lookahead from the
1201 scanner and before detecting a syntax error. Thus, state merging
1202 (from LALR or IELR) and default reductions corrupt the expected
1203 token list. However, the list is correct for canonical LR with
1204 one exception: it will still contain any token that will not be
1205 accepted due to an error action in a later state.
1207 if (yyctx->yytoken != YYSYMBOL_YYEMPTY)
1209 int yyn;
1210 if (yyarg)
1211 yyarg[yycount] = yyctx->yytoken;
1212 ++yycount;
1213 yyn = yypcontext_expected_tokens (yyctx,
1214 yyarg ? yyarg + 1 : yyarg, yyargn - 1);
1215 if (yyn == YYENOMEM)
1216 return YYENOMEM;
1217 else
1218 yycount += yyn;
1220 return yycount;
1223 /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1224 about the unexpected token YYTOKEN for the state stack whose top is
1225 YYSSP.
1227 Return 0 if *YYMSG was successfully written. Return -1 if *YYMSG is
1228 not large enough to hold the message. In that case, also set
1229 *YYMSG_ALLOC to the required number of bytes. Return YYENOMEM if the
1230 required number of bytes is too large to store. */
1231 static int
1232 yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1233 const yypcontext_t *yyctx)
1235 enum { YYARGS_MAX = 5 };
1236 /* Internationalized format string. */
1237 const char *yyformat = YY_NULLPTR;
1238 /* Arguments of yyformat: reported tokens (one for the "unexpected",
1239 one per "expected"). */
1240 yysymbol_kind_t yyarg[YYARGS_MAX];
1241 /* Cumulated lengths of YYARG. */
1242 YYPTRDIFF_T yysize = 0;
1244 /* Actual size of YYARG. */
1245 int yycount = yy_syntax_error_arguments (yyctx, yyarg, YYARGS_MAX);
1246 if (yycount == YYENOMEM)
1247 return YYENOMEM;
1249 switch (yycount)
1251 #define YYCASE_(N, S) \
1252 case N: \
1253 yyformat = S; \
1254 break
1255 default: /* Avoid compiler warnings. */
1256 YYCASE_(0, YY_("syntax error"));
1257 YYCASE_(1, YY_("syntax error, unexpected %s"));
1258 YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1259 YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1260 YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1261 YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1262 #undef YYCASE_
1265 /* Compute error message size. Don't count the "%s"s, but reserve
1266 room for the terminator. */
1267 yysize = yystrlen (yyformat) - 2 * yycount + 1;
1269 int yyi;
1270 for (yyi = 0; yyi < yycount; ++yyi)
1272 YYPTRDIFF_T yysize1
1273 = yysize + yytnamerr (YY_NULLPTR, yytname[yyarg[yyi]]);
1274 if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1275 yysize = yysize1;
1276 else
1277 return YYENOMEM;
1281 if (*yymsg_alloc < yysize)
1283 *yymsg_alloc = 2 * yysize;
1284 if (! (yysize <= *yymsg_alloc
1285 && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1286 *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1287 return -1;
1290 /* Avoid sprintf, as that infringes on the user's name space.
1291 Don't have undefined behavior even if the translation
1292 produced a string with the wrong number of "%s"s. */
1294 char *yyp = *yymsg;
1295 int yyi = 0;
1296 while ((*yyp = *yyformat) != '\0')
1297 if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1299 yyp += yytnamerr (yyp, yytname[yyarg[yyi++]]);
1300 yyformat += 2;
1302 else
1304 ++yyp;
1305 ++yyformat;
1308 return 0;
1312 /*-----------------------------------------------.
1313 | Release the memory associated to this symbol. |
1314 `-----------------------------------------------*/
1316 static void
1317 yydestruct (const char *yymsg,
1318 yysymbol_kind_t yykind, YYSTYPE *yyvaluep, yyscan_t yyscanner)
1320 YY_USE (yyvaluep);
1321 YY_USE (yyscanner);
1322 if (!yymsg)
1323 yymsg = "Deleting";
1324 YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
1326 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1327 switch (yykind)
1329 case YYSYMBOL_STRING: /* STRING */
1330 #line 100 "cmFortranParser.y"
1331 { free(((*yyvaluep).string)); }
1332 #line 1333 "cmFortranParser.cxx"
1333 break;
1335 case YYSYMBOL_WORD: /* WORD */
1336 #line 100 "cmFortranParser.y"
1337 { free(((*yyvaluep).string)); }
1338 #line 1339 "cmFortranParser.cxx"
1339 break;
1341 case YYSYMBOL_CPP_INCLUDE_ANGLE: /* CPP_INCLUDE_ANGLE */
1342 #line 100 "cmFortranParser.y"
1343 { free(((*yyvaluep).string)); }
1344 #line 1345 "cmFortranParser.cxx"
1345 break;
1347 default:
1348 break;
1350 YY_IGNORE_MAYBE_UNINITIALIZED_END
1358 /*----------.
1359 | yyparse. |
1360 `----------*/
1363 yyparse (yyscan_t yyscanner)
1365 /* Lookahead token kind. */
1366 int yychar;
1369 /* The semantic value of the lookahead symbol. */
1370 /* Default value used for initialization, for pacifying older GCCs
1371 or non-GCC compilers. */
1372 YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
1373 YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
1375 /* Number of syntax errors so far. */
1376 int yynerrs = 0;
1378 yy_state_fast_t yystate = 0;
1379 /* Number of tokens to shift before error messages enabled. */
1380 int yyerrstatus = 0;
1382 /* Refer to the stacks through separate pointers, to allow yyoverflow
1383 to reallocate them elsewhere. */
1385 /* Their size. */
1386 YYPTRDIFF_T yystacksize = YYINITDEPTH;
1388 /* The state stack: array, bottom, top. */
1389 yy_state_t yyssa[YYINITDEPTH];
1390 yy_state_t *yyss = yyssa;
1391 yy_state_t *yyssp = yyss;
1393 /* The semantic value stack: array, bottom, top. */
1394 YYSTYPE yyvsa[YYINITDEPTH];
1395 YYSTYPE *yyvs = yyvsa;
1396 YYSTYPE *yyvsp = yyvs;
1398 int yyn;
1399 /* The return value of yyparse. */
1400 int yyresult;
1401 /* Lookahead symbol kind. */
1402 yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
1403 /* The variables used to return semantic value and location from the
1404 action routines. */
1405 YYSTYPE yyval;
1407 /* Buffer for error messages, and its allocated size. */
1408 char yymsgbuf[128];
1409 char *yymsg = yymsgbuf;
1410 YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1412 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
1414 /* The number of symbols on the RHS of the reduced rule.
1415 Keep to zero when no symbol should be popped. */
1416 int yylen = 0;
1418 YYDPRINTF ((stderr, "Starting parse\n"));
1420 yychar = YYEMPTY; /* Cause a token to be read. */
1422 goto yysetstate;
1425 /*------------------------------------------------------------.
1426 | yynewstate -- push a new state, which is found in yystate. |
1427 `------------------------------------------------------------*/
1428 yynewstate:
1429 /* In all cases, when you get here, the value and location stacks
1430 have just been pushed. So pushing a state here evens the stacks. */
1431 yyssp++;
1434 /*--------------------------------------------------------------------.
1435 | yysetstate -- set current state (the top of the stack) to yystate. |
1436 `--------------------------------------------------------------------*/
1437 yysetstate:
1438 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1439 YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1440 YY_IGNORE_USELESS_CAST_BEGIN
1441 *yyssp = YY_CAST (yy_state_t, yystate);
1442 YY_IGNORE_USELESS_CAST_END
1443 YY_STACK_PRINT (yyss, yyssp);
1445 if (yyss + yystacksize - 1 <= yyssp)
1446 #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1447 YYNOMEM;
1448 #else
1450 /* Get the current used size of the three stacks, in elements. */
1451 YYPTRDIFF_T yysize = yyssp - yyss + 1;
1453 # if defined yyoverflow
1455 /* Give user a chance to reallocate the stack. Use copies of
1456 these so that the &'s don't force the real ones into
1457 memory. */
1458 yy_state_t *yyss1 = yyss;
1459 YYSTYPE *yyvs1 = yyvs;
1461 /* Each stack pointer address is followed by the size of the
1462 data in use in that stack, in bytes. This used to be a
1463 conditional around just the two extra args, but that might
1464 be undefined if yyoverflow is a macro. */
1465 yyoverflow (YY_("memory exhausted"),
1466 &yyss1, yysize * YYSIZEOF (*yyssp),
1467 &yyvs1, yysize * YYSIZEOF (*yyvsp),
1468 &yystacksize);
1469 yyss = yyss1;
1470 yyvs = yyvs1;
1472 # else /* defined YYSTACK_RELOCATE */
1473 /* Extend the stack our own way. */
1474 if (YYMAXDEPTH <= yystacksize)
1475 YYNOMEM;
1476 yystacksize *= 2;
1477 if (YYMAXDEPTH < yystacksize)
1478 yystacksize = YYMAXDEPTH;
1481 yy_state_t *yyss1 = yyss;
1482 union yyalloc *yyptr =
1483 YY_CAST (union yyalloc *,
1484 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1485 if (! yyptr)
1486 YYNOMEM;
1487 YYSTACK_RELOCATE (yyss_alloc, yyss);
1488 YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1489 # undef YYSTACK_RELOCATE
1490 if (yyss1 != yyssa)
1491 YYSTACK_FREE (yyss1);
1493 # endif
1495 yyssp = yyss + yysize - 1;
1496 yyvsp = yyvs + yysize - 1;
1498 YY_IGNORE_USELESS_CAST_BEGIN
1499 YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1500 YY_CAST (long, yystacksize)));
1501 YY_IGNORE_USELESS_CAST_END
1503 if (yyss + yystacksize - 1 <= yyssp)
1504 YYABORT;
1506 #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1509 if (yystate == YYFINAL)
1510 YYACCEPT;
1512 goto yybackup;
1515 /*-----------.
1516 | yybackup. |
1517 `-----------*/
1518 yybackup:
1519 /* Do appropriate processing given the current state. Read a
1520 lookahead token if we need one and don't already have one. */
1522 /* First try to decide what to do without reference to lookahead token. */
1523 yyn = yypact[yystate];
1524 if (yypact_value_is_default (yyn))
1525 goto yydefault;
1527 /* Not known => get a lookahead token if don't already have one. */
1529 /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
1530 if (yychar == YYEMPTY)
1532 YYDPRINTF ((stderr, "Reading a token\n"));
1533 yychar = yylex (&yylval, yyscanner);
1536 if (yychar <= YYEOF)
1538 yychar = YYEOF;
1539 yytoken = YYSYMBOL_YYEOF;
1540 YYDPRINTF ((stderr, "Now at end of input.\n"));
1542 else if (yychar == YYerror)
1544 /* The scanner already issued an error message, process directly
1545 to error recovery. But do not keep the error token as
1546 lookahead, it is too special and may lead us to an endless
1547 loop in error recovery. */
1548 yychar = YYUNDEF;
1549 yytoken = YYSYMBOL_YYerror;
1550 goto yyerrlab1;
1552 else
1554 yytoken = YYTRANSLATE (yychar);
1555 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1558 /* If the proper action on seeing token YYTOKEN is to reduce or to
1559 detect an error, take that action. */
1560 yyn += yytoken;
1561 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1562 goto yydefault;
1563 yyn = yytable[yyn];
1564 if (yyn <= 0)
1566 if (yytable_value_is_error (yyn))
1567 goto yyerrlab;
1568 yyn = -yyn;
1569 goto yyreduce;
1572 /* Count tokens shifted since error; after three, turn off error
1573 status. */
1574 if (yyerrstatus)
1575 yyerrstatus--;
1577 /* Shift the lookahead token. */
1578 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1579 yystate = yyn;
1580 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1581 *++yyvsp = yylval;
1582 YY_IGNORE_MAYBE_UNINITIALIZED_END
1584 /* Discard the shifted token. */
1585 yychar = YYEMPTY;
1586 goto yynewstate;
1589 /*-----------------------------------------------------------.
1590 | yydefault -- do the default action for the current state. |
1591 `-----------------------------------------------------------*/
1592 yydefault:
1593 yyn = yydefact[yystate];
1594 if (yyn == 0)
1595 goto yyerrlab;
1596 goto yyreduce;
1599 /*-----------------------------.
1600 | yyreduce -- do a reduction. |
1601 `-----------------------------*/
1602 yyreduce:
1603 /* yyn is the number of a rule to reduce with. */
1604 yylen = yyr2[yyn];
1606 /* If YYLEN is nonzero, implement the default value of the action:
1607 '$$ = $1'.
1609 Otherwise, the following line sets YYVAL to garbage.
1610 This behavior is undocumented and Bison
1611 users should not rely upon it. Assigning to YYVAL
1612 unconditionally makes the parser a bit smaller, and it avoids a
1613 GCC warning that YYVAL may be used uninitialized. */
1614 yyval = yyvsp[1-yylen];
1617 YY_REDUCE_PRINT (yyn);
1618 switch (yyn)
1620 case 4: /* stmt: INTERFACE EOSTMT */
1621 #line 109 "cmFortranParser.y"
1623 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1624 cmFortranParser_SetInInterface(parser, true);
1626 #line 1627 "cmFortranParser.cxx"
1627 break;
1629 case 5: /* stmt: USE WORD other EOSTMT */
1630 #line 113 "cmFortranParser.y"
1632 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1633 cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
1634 free((yyvsp[-2].string));
1636 #line 1637 "cmFortranParser.cxx"
1637 break;
1639 case 6: /* stmt: MODULE WORD EOSTMT */
1640 #line 118 "cmFortranParser.y"
1642 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1643 cmFortranParser_RuleModule(parser, (yyvsp[-1].string));
1644 free((yyvsp[-1].string));
1646 #line 1647 "cmFortranParser.cxx"
1647 break;
1649 case 7: /* stmt: SUBMODULE LPAREN WORD RPAREN WORD EOSTMT */
1650 #line 123 "cmFortranParser.y"
1652 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1653 cmFortranParser_RuleSubmodule(parser, (yyvsp[-3].string), (yyvsp[-1].string));
1654 free((yyvsp[-3].string));
1655 free((yyvsp[-1].string));
1657 #line 1658 "cmFortranParser.cxx"
1658 break;
1660 case 8: /* stmt: SUBMODULE LPAREN WORD COLON WORD RPAREN WORD EOSTMT */
1661 #line 129 "cmFortranParser.y"
1663 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1664 cmFortranParser_RuleSubmoduleNested(parser, (yyvsp[-5].string), (yyvsp[-3].string), (yyvsp[-1].string));
1665 free((yyvsp[-5].string));
1666 free((yyvsp[-3].string));
1667 free((yyvsp[-1].string));
1669 #line 1670 "cmFortranParser.cxx"
1670 break;
1672 case 9: /* stmt: INTERFACE WORD EOSTMT */
1673 #line 136 "cmFortranParser.y"
1675 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1676 cmFortranParser_SetInInterface(parser, true);
1677 free((yyvsp[-1].string));
1679 #line 1680 "cmFortranParser.cxx"
1680 break;
1682 case 10: /* stmt: END INTERFACE WORD EOSTMT */
1683 #line 141 "cmFortranParser.y"
1685 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1686 cmFortranParser_SetInInterface(parser, false);
1687 free((yyvsp[-1].string));
1689 #line 1690 "cmFortranParser.cxx"
1690 break;
1692 case 11: /* stmt: END INTERFACE EOSTMT */
1693 #line 146 "cmFortranParser.y"
1695 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1696 cmFortranParser_SetInInterface(parser, false);
1698 #line 1699 "cmFortranParser.cxx"
1699 break;
1701 case 12: /* stmt: USE DCOLON WORD other EOSTMT */
1702 #line 150 "cmFortranParser.y"
1704 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1705 cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
1706 free((yyvsp[-2].string));
1708 #line 1709 "cmFortranParser.cxx"
1709 break;
1711 case 13: /* stmt: USE COMMA WORD DCOLON WORD other EOSTMT */
1712 #line 155 "cmFortranParser.y"
1714 if (cmsysString_strcasecmp((yyvsp[-4].string), "non_intrinsic") == 0) {
1715 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1716 cmFortranParser_RuleUse(parser, (yyvsp[-2].string));
1718 if (cmsysString_strcasecmp((yyvsp[-4].string), "intrinsic") == 0) {
1719 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1720 cmFortranParser_RuleUseIntrinsic(parser, (yyvsp[-2].string));
1722 free((yyvsp[-4].string));
1723 free((yyvsp[-2].string));
1725 #line 1726 "cmFortranParser.cxx"
1726 break;
1728 case 14: /* stmt: INCLUDE STRING EOSTMT */
1729 #line 167 "cmFortranParser.y"
1731 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1732 cmFortranParser_RuleInclude(parser, (yyvsp[-1].string));
1733 free((yyvsp[-1].string));
1735 #line 1736 "cmFortranParser.cxx"
1736 break;
1738 case 15: /* stmt: CPP_LINE_DIRECTIVE STRING other EOSTMT */
1739 #line 172 "cmFortranParser.y"
1741 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1742 cmFortranParser_RuleLineDirective(parser, (yyvsp[-2].string));
1743 free((yyvsp[-2].string));
1745 #line 1746 "cmFortranParser.cxx"
1746 break;
1748 case 16: /* stmt: CPP_INCLUDE_ANGLE other EOSTMT */
1749 #line 177 "cmFortranParser.y"
1751 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1752 cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
1753 free((yyvsp[-2].string));
1755 #line 1756 "cmFortranParser.cxx"
1756 break;
1758 case 17: /* stmt: include STRING other EOSTMT */
1759 #line 182 "cmFortranParser.y"
1761 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1762 cmFortranParser_RuleInclude(parser, (yyvsp[-2].string));
1763 free((yyvsp[-2].string));
1765 #line 1766 "cmFortranParser.cxx"
1766 break;
1768 case 18: /* stmt: define WORD other EOSTMT */
1769 #line 187 "cmFortranParser.y"
1771 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1772 cmFortranParser_RuleDefine(parser, (yyvsp[-2].string));
1773 free((yyvsp[-2].string));
1775 #line 1776 "cmFortranParser.cxx"
1776 break;
1778 case 19: /* stmt: undef WORD other EOSTMT */
1779 #line 192 "cmFortranParser.y"
1781 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1782 cmFortranParser_RuleUndef(parser, (yyvsp[-2].string));
1783 free((yyvsp[-2].string));
1785 #line 1786 "cmFortranParser.cxx"
1786 break;
1788 case 20: /* stmt: ifdef WORD other EOSTMT */
1789 #line 197 "cmFortranParser.y"
1791 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1792 cmFortranParser_RuleIfdef(parser, (yyvsp[-2].string));
1793 free((yyvsp[-2].string));
1795 #line 1796 "cmFortranParser.cxx"
1796 break;
1798 case 21: /* stmt: ifndef WORD other EOSTMT */
1799 #line 202 "cmFortranParser.y"
1801 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1802 cmFortranParser_RuleIfndef(parser, (yyvsp[-2].string));
1803 free((yyvsp[-2].string));
1805 #line 1806 "cmFortranParser.cxx"
1806 break;
1808 case 22: /* stmt: if other EOSTMT */
1809 #line 207 "cmFortranParser.y"
1811 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1812 cmFortranParser_RuleIf(parser);
1814 #line 1815 "cmFortranParser.cxx"
1815 break;
1817 case 23: /* stmt: elif other EOSTMT */
1818 #line 211 "cmFortranParser.y"
1820 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1821 cmFortranParser_RuleElif(parser);
1823 #line 1824 "cmFortranParser.cxx"
1824 break;
1826 case 24: /* stmt: else other EOSTMT */
1827 #line 215 "cmFortranParser.y"
1829 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1830 cmFortranParser_RuleElse(parser);
1832 #line 1833 "cmFortranParser.cxx"
1833 break;
1835 case 25: /* stmt: endif other EOSTMT */
1836 #line 219 "cmFortranParser.y"
1838 cmFortranParser* parser = cmFortran_yyget_extra(yyscanner);
1839 cmFortranParser_RuleEndif(parser);
1841 #line 1842 "cmFortranParser.cxx"
1842 break;
1844 case 49: /* misc_code: WORD */
1845 #line 241 "cmFortranParser.y"
1846 { free ((yyvsp[0].string)); }
1847 #line 1848 "cmFortranParser.cxx"
1848 break;
1850 case 56: /* misc_code: STRING */
1851 #line 248 "cmFortranParser.y"
1852 { free ((yyvsp[0].string)); }
1853 #line 1854 "cmFortranParser.cxx"
1854 break;
1857 #line 1858 "cmFortranParser.cxx"
1859 default: break;
1861 /* User semantic actions sometimes alter yychar, and that requires
1862 that yytoken be updated with the new translation. We take the
1863 approach of translating immediately before every use of yytoken.
1864 One alternative is translating here after every semantic action,
1865 but that translation would be missed if the semantic action invokes
1866 YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
1867 if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
1868 incorrect destructor might then be invoked immediately. In the
1869 case of YYERROR or YYBACKUP, subsequent parser actions might lead
1870 to an incorrect destructor call or verbose syntax error message
1871 before the lookahead is translated. */
1872 YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
1874 YYPOPSTACK (yylen);
1875 yylen = 0;
1877 *++yyvsp = yyval;
1879 /* Now 'shift' the result of the reduction. Determine what state
1880 that goes to, based on the state we popped back to and the rule
1881 number reduced by. */
1883 const int yylhs = yyr1[yyn] - YYNTOKENS;
1884 const int yyi = yypgoto[yylhs] + *yyssp;
1885 yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
1886 ? yytable[yyi]
1887 : yydefgoto[yylhs]);
1890 goto yynewstate;
1893 /*--------------------------------------.
1894 | yyerrlab -- here on detecting error. |
1895 `--------------------------------------*/
1896 yyerrlab:
1897 /* Make sure we have latest lookahead translation. See comments at
1898 user semantic actions for why this is necessary. */
1899 yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
1900 /* If not already recovering from an error, report this error. */
1901 if (!yyerrstatus)
1903 ++yynerrs;
1905 yypcontext_t yyctx
1906 = {yyssp, yytoken};
1907 char const *yymsgp = YY_("syntax error");
1908 int yysyntax_error_status;
1909 yysyntax_error_status = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1910 if (yysyntax_error_status == 0)
1911 yymsgp = yymsg;
1912 else if (yysyntax_error_status == -1)
1914 if (yymsg != yymsgbuf)
1915 YYSTACK_FREE (yymsg);
1916 yymsg = YY_CAST (char *,
1917 YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
1918 if (yymsg)
1920 yysyntax_error_status
1921 = yysyntax_error (&yymsg_alloc, &yymsg, &yyctx);
1922 yymsgp = yymsg;
1924 else
1926 yymsg = yymsgbuf;
1927 yymsg_alloc = sizeof yymsgbuf;
1928 yysyntax_error_status = YYENOMEM;
1931 yyerror (yyscanner, yymsgp);
1932 if (yysyntax_error_status == YYENOMEM)
1933 YYNOMEM;
1937 if (yyerrstatus == 3)
1939 /* If just tried and failed to reuse lookahead token after an
1940 error, discard it. */
1942 if (yychar <= YYEOF)
1944 /* Return failure if at end of input. */
1945 if (yychar == YYEOF)
1946 YYABORT;
1948 else
1950 yydestruct ("Error: discarding",
1951 yytoken, &yylval, yyscanner);
1952 yychar = YYEMPTY;
1956 /* Else will try to reuse lookahead token after shifting the error
1957 token. */
1958 goto yyerrlab1;
1961 /*---------------------------------------------------.
1962 | yyerrorlab -- error raised explicitly by YYERROR. |
1963 `---------------------------------------------------*/
1964 yyerrorlab:
1965 /* Pacify compilers when the user code never invokes YYERROR and the
1966 label yyerrorlab therefore never appears in user code. */
1967 if (0)
1968 YYERROR;
1969 ++yynerrs;
1971 /* Do not reclaim the symbols of the rule whose action triggered
1972 this YYERROR. */
1973 YYPOPSTACK (yylen);
1974 yylen = 0;
1975 YY_STACK_PRINT (yyss, yyssp);
1976 yystate = *yyssp;
1977 goto yyerrlab1;
1980 /*-------------------------------------------------------------.
1981 | yyerrlab1 -- common code for both syntax error and YYERROR. |
1982 `-------------------------------------------------------------*/
1983 yyerrlab1:
1984 yyerrstatus = 3; /* Each real token shifted decrements this. */
1986 /* Pop stack until we find a state that shifts the error token. */
1987 for (;;)
1989 yyn = yypact[yystate];
1990 if (!yypact_value_is_default (yyn))
1992 yyn += YYSYMBOL_YYerror;
1993 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
1995 yyn = yytable[yyn];
1996 if (0 < yyn)
1997 break;
2001 /* Pop the current state because it cannot handle the error token. */
2002 if (yyssp == yyss)
2003 YYABORT;
2006 yydestruct ("Error: popping",
2007 YY_ACCESSING_SYMBOL (yystate), yyvsp, yyscanner);
2008 YYPOPSTACK (1);
2009 yystate = *yyssp;
2010 YY_STACK_PRINT (yyss, yyssp);
2013 YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2014 *++yyvsp = yylval;
2015 YY_IGNORE_MAYBE_UNINITIALIZED_END
2018 /* Shift the error token. */
2019 YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
2021 yystate = yyn;
2022 goto yynewstate;
2025 /*-------------------------------------.
2026 | yyacceptlab -- YYACCEPT comes here. |
2027 `-------------------------------------*/
2028 yyacceptlab:
2029 yyresult = 0;
2030 goto yyreturnlab;
2033 /*-----------------------------------.
2034 | yyabortlab -- YYABORT comes here. |
2035 `-----------------------------------*/
2036 yyabortlab:
2037 yyresult = 1;
2038 goto yyreturnlab;
2041 /*-----------------------------------------------------------.
2042 | yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
2043 `-----------------------------------------------------------*/
2044 yyexhaustedlab:
2045 yyerror (yyscanner, YY_("memory exhausted"));
2046 yyresult = 2;
2047 goto yyreturnlab;
2050 /*----------------------------------------------------------.
2051 | yyreturnlab -- parsing is finished, clean up and return. |
2052 `----------------------------------------------------------*/
2053 yyreturnlab:
2054 if (yychar != YYEMPTY)
2056 /* Make sure we have latest lookahead translation. See comments at
2057 user semantic actions for why this is necessary. */
2058 yytoken = YYTRANSLATE (yychar);
2059 yydestruct ("Cleanup: discarding lookahead",
2060 yytoken, &yylval, yyscanner);
2062 /* Do not reclaim the symbols of the rule whose action triggered
2063 this YYABORT or YYACCEPT. */
2064 YYPOPSTACK (yylen);
2065 YY_STACK_PRINT (yyss, yyssp);
2066 while (yyssp != yyss)
2068 yydestruct ("Cleanup: popping",
2069 YY_ACCESSING_SYMBOL (+*yyssp), yyvsp, yyscanner);
2070 YYPOPSTACK (1);
2072 #ifndef yyoverflow
2073 if (yyss != yyssa)
2074 YYSTACK_FREE (yyss);
2075 #endif
2076 if (yymsg != yymsgbuf)
2077 YYSTACK_FREE (yymsg);
2078 return yyresult;
2081 #line 260 "cmFortranParser.y"
2083 /* End of grammar */