Line data Source code
1 : /* A Bison parser, made by GNU Bison 3.5.1. */
2 :
3 : /* Bison implementation for Yacc-like parsers in C
4 :
5 : Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2020 Free Software Foundation,
6 : Inc.
7 :
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.
12 :
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.
17 :
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/>. */
20 :
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.
30 :
31 : This special exception was added by the Free Software Foundation in
32 : version 2.2 of Bison. */
33 :
34 : /* C LALR(1) parser skeleton written by Richard Stallman, by
35 : simplifying the original so-called "semantic" parser. */
36 :
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. */
43 :
44 : /* Undocumented macros, especially those whose name start with YY_,
45 : are private implementation details. Do not rely on them. */
46 :
47 : /* Identify Bison output. */
48 : #define YYBISON 1
49 :
50 : /* Bison version. */
51 : #define YYBISON_VERSION "3.5.1"
52 :
53 : /* Skeleton name. */
54 : #define YYSKELETON_NAME "yacc.c"
55 :
56 : /* Pure parsers. */
57 : #define YYPURE 0
58 :
59 : /* Push parsers. */
60 : #define YYPUSH 0
61 :
62 : /* Pull parsers. */
63 : #define YYPULL 1
64 :
65 : /* Substitute the type names. */
66 : #define YYSTYPE OMP_EXPRPARSER_STYPE
67 : #define YYLTYPE OMP_EXPRPARSER_LTYPE
68 : /* Substitute the variable and function names. */
69 : #define yyparse omp_exprparser_parse
70 : #define yylex omp_exprparser_lex
71 : #define yyerror omp_exprparser_error
72 : #define yydebug omp_exprparser_debug
73 : #define yynerrs omp_exprparser_nerrs
74 : #define yylval omp_exprparser_lval
75 : #define yychar omp_exprparser_char
76 : #define yylloc omp_exprparser_lloc
77 :
78 : /* First part of user prologue. */
79 : #line 17 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
80 :
81 : /* DQ (2/10/2014): IF is conflicting with Boost template IF. */
82 : #undef IF
83 :
84 : #include <stdio.h>
85 : #include <assert.h>
86 : #include <iostream>
87 : #include "sage3basic.h" // Sage Interface and Builders
88 : #include "sageBuilder.h"
89 :
90 : #ifdef _MSC_VER
91 : #undef IN
92 : #undef OUT
93 : #undef DUPLICATE
94 : #endif
95 :
96 : using namespace OmpSupport;
97 : using namespace SageInterface;
98 :
99 : /* Parser - BISON */
100 :
101 : /*the scanner function*/
102 : extern int omp_exprparser_lex();
103 :
104 : /*A customized initialization function for the scanner, str is the string to be scanned.*/
105 : extern void omp_exprparser_lexer_init(const char* str);
106 :
107 : //! Initialize the parser with the originating SgPragmaDeclaration and its pragma text
108 : extern void omp_exprparser_parser_init(SgNode* aNode, const char* str);
109 : extern SgExpression* parseExpression(SgNode*, const char*);
110 : extern SgExpression* parseArraySectionExpression(SgNode*, const char*);
111 :
112 : static int omp_exprparser_error(const char*);
113 :
114 : // The context node with the pragma annotation being parsed
115 : //
116 : // We attach the attribute to the pragma declaration directly for now,
117 : // A few OpenMP directive does not affect the next structure block
118 : // This variable is set by the prefix_parser_init() before prefix_parse() is called.
119 : //Liao
120 : static SgNode* omp_directive_node;
121 :
122 : static const char* orig_str;
123 :
124 : // The current expression node being generated
125 : static SgExpression* current_exp = NULL;
126 : // a flag to indicate if the program is looking forward in the symbol table
127 : static bool omp_exprparser_look_forward = false;
128 :
129 : // We now follow the OpenMP 4.0 standard's C-style array section syntax: [lower-bound:length] or just [length]
130 : // the latest variable symbol being parsed, used to help parsing the array dimensions associated with array symbol
131 : // such as a[0:n][0:m]
132 : static SgVariableSymbol* array_symbol;
133 : static SgExpression* lower_exp = NULL;
134 : static SgExpression* length_exp = NULL;
135 : // check if the parsed a[][] is an array element access a[i][j] or array section a[lower:length][lower:length]
136 : //
137 : static bool arraySection=true;
138 :
139 : // mark whether it is for ompparser
140 : static bool is_ompparser_variable = false;
141 : static bool is_ompparser_expression = false;
142 : // add ompparser var
143 : static bool addOmpVariable(const char*);
144 : std::vector<std::pair<std::string, SgNode*> > omp_variable_list;
145 : std::map<SgSymbol*, std::vector < std::pair <SgExpression*, SgExpression*> > > array_dimensions;
146 :
147 : #line 148 "omp_exprparser_parser.cc"
148 :
149 : # ifndef YY_CAST
150 : # ifdef __cplusplus
151 : # define YY_CAST(Type, Val) static_cast<Type> (Val)
152 : # define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
153 : # else
154 : # define YY_CAST(Type, Val) ((Type) (Val))
155 : # define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
156 : # endif
157 : # endif
158 : # ifndef YY_NULLPTR
159 : # if defined __cplusplus
160 : # if 201103L <= __cplusplus
161 : # define YY_NULLPTR nullptr
162 : # else
163 : # define YY_NULLPTR 0
164 : # endif
165 : # else
166 : # define YY_NULLPTR ((void*)0)
167 : # endif
168 : # endif
169 :
170 : /* Enabling verbose error messages. */
171 : #ifdef YYERROR_VERBOSE
172 : # undef YYERROR_VERBOSE
173 : # define YYERROR_VERBOSE 1
174 : #else
175 : # define YYERROR_VERBOSE 1
176 : #endif
177 :
178 : /* Use api.header.include to #include this header
179 : instead of duplicating it here. */
180 : #ifndef YY_OMP_EXPRPARSER_OMP_EXPRPARSER_PARSER_HH_INCLUDED
181 : # define YY_OMP_EXPRPARSER_OMP_EXPRPARSER_PARSER_HH_INCLUDED
182 : /* Debug traces. */
183 : #ifndef OMP_EXPRPARSER_DEBUG
184 : # if defined YYDEBUG
185 : #if YYDEBUG
186 : # define OMP_EXPRPARSER_DEBUG 1
187 : # else
188 : # define OMP_EXPRPARSER_DEBUG 0
189 : # endif
190 : # else /* ! defined YYDEBUG */
191 : # define OMP_EXPRPARSER_DEBUG 0
192 : # endif /* ! defined YYDEBUG */
193 : #endif /* ! defined OMP_EXPRPARSER_DEBUG */
194 : #if OMP_EXPRPARSER_DEBUG
195 : extern int omp_exprparser_debug;
196 : #endif
197 :
198 : /* Token type. */
199 : #ifndef OMP_EXPRPARSER_TOKENTYPE
200 : # define OMP_EXPRPARSER_TOKENTYPE
201 : enum omp_exprparser_tokentype
202 : {
203 : LOGAND = 258,
204 : LOGOR = 259,
205 : SHLEFT = 260,
206 : SHRIGHT = 261,
207 : PLUSPLUS = 262,
208 : MINUSMINUS = 263,
209 : PTR_TO = 264,
210 : LE_OP2 = 265,
211 : GE_OP2 = 266,
212 : EQ_OP2 = 267,
213 : NE_OP2 = 268,
214 : RIGHT_ASSIGN2 = 269,
215 : LEFT_ASSIGN2 = 270,
216 : ADD_ASSIGN2 = 271,
217 : SUB_ASSIGN2 = 272,
218 : MUL_ASSIGN2 = 273,
219 : DIV_ASSIGN2 = 274,
220 : MOD_ASSIGN2 = 275,
221 : AND_ASSIGN2 = 276,
222 : XOR_ASSIGN2 = 277,
223 : OR_ASSIGN2 = 278,
224 : DEPEND = 279,
225 : IN = 280,
226 : OUT = 281,
227 : INOUT = 282,
228 : MERGEABLE = 283,
229 : LEXICALERROR = 284,
230 : IDENTIFIER = 285,
231 : MIN = 286,
232 : MAX = 287,
233 : VARLIST = 288,
234 : ARRAY_SECTION = 289,
235 : ICONSTANT = 290,
236 : EXPRESSION = 291,
237 : ID_EXPRESSION = 292
238 : };
239 : #endif
240 : /* Tokens. */
241 : #define LOGAND 258
242 : #define LOGOR 259
243 : #define SHLEFT 260
244 : #define SHRIGHT 261
245 : #define PLUSPLUS 262
246 : #define MINUSMINUS 263
247 : #define PTR_TO 264
248 : #define LE_OP2 265
249 : #define GE_OP2 266
250 : #define EQ_OP2 267
251 : #define NE_OP2 268
252 : #define RIGHT_ASSIGN2 269
253 : #define LEFT_ASSIGN2 270
254 : #define ADD_ASSIGN2 271
255 : #define SUB_ASSIGN2 272
256 : #define MUL_ASSIGN2 273
257 : #define DIV_ASSIGN2 274
258 : #define MOD_ASSIGN2 275
259 : #define AND_ASSIGN2 276
260 : #define XOR_ASSIGN2 277
261 : #define OR_ASSIGN2 278
262 : #define DEPEND 279
263 : #define IN 280
264 : #define OUT 281
265 : #define INOUT 282
266 : #define MERGEABLE 283
267 : #define LEXICALERROR 284
268 : #define IDENTIFIER 285
269 : #define MIN 286
270 : #define MAX 287
271 : #define VARLIST 288
272 : #define ARRAY_SECTION 289
273 : #define ICONSTANT 290
274 : #define EXPRESSION 291
275 : #define ID_EXPRESSION 292
276 :
277 : /* Value type. */
278 : #if ! defined OMP_EXPRPARSER_STYPE && ! defined OMP_EXPRPARSER_STYPE_IS_DECLARED
279 : union OMP_EXPRPARSER_STYPE
280 : {
281 : #line 91 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
282 : int itype;
283 : double ftype;
284 : const char* stype;
285 : void* ptype; /* For expressions */
286 :
287 :
288 : #line 289 "omp_exprparser_parser.cc"
289 :
290 : };
291 : typedef union OMP_EXPRPARSER_STYPE OMP_EXPRPARSER_STYPE;
292 : # define OMP_EXPRPARSER_STYPE_IS_TRIVIAL 1
293 : # define OMP_EXPRPARSER_STYPE_IS_DECLARED 1
294 : #endif
295 :
296 : /* Location type. */
297 : #if ! defined OMP_EXPRPARSER_LTYPE && ! defined OMP_EXPRPARSER_LTYPE_IS_DECLARED
298 : typedef struct OMP_EXPRPARSER_LTYPE OMP_EXPRPARSER_LTYPE;
299 : struct OMP_EXPRPARSER_LTYPE
300 : {
301 : int first_line;
302 : int first_column;
303 : int last_line;
304 : int last_column;
305 : };
306 : # define OMP_EXPRPARSER_LTYPE_IS_DECLARED 1
307 : # define OMP_EXPRPARSER_LTYPE_IS_TRIVIAL 1
308 : #endif
309 :
310 :
311 : extern OMP_EXPRPARSER_STYPE omp_exprparser_lval;
312 : extern OMP_EXPRPARSER_LTYPE omp_exprparser_lloc;
313 : int omp_exprparser_parse (void);
314 :
315 : #endif /* !YY_OMP_EXPRPARSER_OMP_EXPRPARSER_PARSER_HH_INCLUDED */
316 :
317 :
318 :
319 : #ifdef short
320 : # undef short
321 : #endif
322 :
323 : /* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
324 : <limits.h> and (if available) <stdint.h> are included
325 : so that the code can choose integer types of a good width. */
326 :
327 : #ifndef __PTRDIFF_MAX__
328 : # include <limits.h> /* INFRINGES ON USER NAME SPACE */
329 : # if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
330 : # include <stdint.h> /* INFRINGES ON USER NAME SPACE */
331 : # define YY_STDINT_H
332 : # endif
333 : #endif
334 :
335 : /* Narrow types that promote to a signed type and that can represent a
336 : signed or unsigned integer of at least N bits. In tables they can
337 : save space and decrease cache pressure. Promoting to a signed type
338 : helps avoid bugs in integer arithmetic. */
339 :
340 : #ifdef __INT_LEAST8_MAX__
341 : typedef __INT_LEAST8_TYPE__ yytype_int8;
342 : #elif defined YY_STDINT_H
343 : typedef int_least8_t yytype_int8;
344 : #else
345 : typedef signed char yytype_int8;
346 : #endif
347 :
348 : #ifdef __INT_LEAST16_MAX__
349 : typedef __INT_LEAST16_TYPE__ yytype_int16;
350 : #elif defined YY_STDINT_H
351 : typedef int_least16_t yytype_int16;
352 : #else
353 : typedef short yytype_int16;
354 : #endif
355 :
356 : #if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
357 : typedef __UINT_LEAST8_TYPE__ yytype_uint8;
358 : #elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
359 : && UINT_LEAST8_MAX <= INT_MAX)
360 : typedef uint_least8_t yytype_uint8;
361 : #elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
362 : typedef unsigned char yytype_uint8;
363 : #else
364 : typedef short yytype_uint8;
365 : #endif
366 :
367 : #if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
368 : typedef __UINT_LEAST16_TYPE__ yytype_uint16;
369 : #elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
370 : && UINT_LEAST16_MAX <= INT_MAX)
371 : typedef uint_least16_t yytype_uint16;
372 : #elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
373 : typedef unsigned short yytype_uint16;
374 : #else
375 : typedef int yytype_uint16;
376 : #endif
377 :
378 : #ifndef YYPTRDIFF_T
379 : # if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
380 : # define YYPTRDIFF_T __PTRDIFF_TYPE__
381 : # define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
382 : # elif defined PTRDIFF_MAX
383 : # ifndef ptrdiff_t
384 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
385 : # endif
386 : # define YYPTRDIFF_T ptrdiff_t
387 : # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
388 : # else
389 : # define YYPTRDIFF_T long
390 : # define YYPTRDIFF_MAXIMUM LONG_MAX
391 : # endif
392 : #endif
393 :
394 : #ifndef YYSIZE_T
395 : # ifdef __SIZE_TYPE__
396 : # define YYSIZE_T __SIZE_TYPE__
397 : # elif defined size_t
398 : # define YYSIZE_T size_t
399 : # elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
400 : # include <stddef.h> /* INFRINGES ON USER NAME SPACE */
401 : # define YYSIZE_T size_t
402 : # else
403 : # define YYSIZE_T unsigned
404 : # endif
405 : #endif
406 :
407 : #define YYSIZE_MAXIMUM \
408 : YY_CAST (YYPTRDIFF_T, \
409 : (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
410 : ? YYPTRDIFF_MAXIMUM \
411 : : YY_CAST (YYSIZE_T, -1)))
412 :
413 : #define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
414 :
415 : /* Stored state numbers (used for stacks). */
416 : typedef yytype_uint8 yy_state_t;
417 :
418 : /* State numbers in computations. */
419 : typedef int yy_state_fast_t;
420 :
421 : #ifndef YY_
422 : # if defined YYENABLE_NLS && YYENABLE_NLS
423 : # if ENABLE_NLS
424 : # include <libintl.h> /* INFRINGES ON USER NAME SPACE */
425 : # define YY_(Msgid) dgettext ("bison-runtime", Msgid)
426 : # endif
427 : # endif
428 : # ifndef YY_
429 : # define YY_(Msgid) Msgid
430 : # endif
431 : #endif
432 :
433 : #ifndef YY_ATTRIBUTE_PURE
434 : # if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
435 : # define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
436 : # else
437 : # define YY_ATTRIBUTE_PURE
438 : # endif
439 : #endif
440 :
441 : #ifndef YY_ATTRIBUTE_UNUSED
442 : # if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
443 : # define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
444 : # else
445 : # define YY_ATTRIBUTE_UNUSED
446 : # endif
447 : #endif
448 :
449 : /* Suppress unused-variable warnings by "using" E. */
450 : #if ! defined lint || defined __GNUC__
451 : # define YYUSE(E) ((void) (E))
452 : #else
453 : # define YYUSE(E) /* empty */
454 : #endif
455 :
456 : #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
457 : /* Suppress an incorrect diagnostic about yylval being uninitialized. */
458 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
459 : _Pragma ("GCC diagnostic push") \
460 : _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
461 : _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
462 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
463 : _Pragma ("GCC diagnostic pop")
464 : #else
465 : # define YY_INITIAL_VALUE(Value) Value
466 : #endif
467 : #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
468 : # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
469 : # define YY_IGNORE_MAYBE_UNINITIALIZED_END
470 : #endif
471 : #ifndef YY_INITIAL_VALUE
472 : # define YY_INITIAL_VALUE(Value) /* Nothing. */
473 : #endif
474 :
475 : #if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
476 : # define YY_IGNORE_USELESS_CAST_BEGIN \
477 : _Pragma ("GCC diagnostic push") \
478 : _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
479 : # define YY_IGNORE_USELESS_CAST_END \
480 : _Pragma ("GCC diagnostic pop")
481 : #endif
482 : #ifndef YY_IGNORE_USELESS_CAST_BEGIN
483 : # define YY_IGNORE_USELESS_CAST_BEGIN
484 : # define YY_IGNORE_USELESS_CAST_END
485 : #endif
486 :
487 :
488 : #define YY_ASSERT(E) ((void) (0 && (E)))
489 :
490 : #if ! defined yyoverflow || YYERROR_VERBOSE
491 :
492 : /* The parser invokes alloca or malloc; define the necessary symbols. */
493 :
494 : # ifdef YYSTACK_USE_ALLOCA
495 : # if YYSTACK_USE_ALLOCA
496 : # ifdef __GNUC__
497 : # define YYSTACK_ALLOC __builtin_alloca
498 : # elif defined __BUILTIN_VA_ARG_INCR
499 : # include <alloca.h> /* INFRINGES ON USER NAME SPACE */
500 : # elif defined _AIX
501 : # define YYSTACK_ALLOC __alloca
502 : # elif defined _MSC_VER
503 : # include <malloc.h> /* INFRINGES ON USER NAME SPACE */
504 : # define alloca _alloca
505 : # else
506 : # define YYSTACK_ALLOC alloca
507 : # if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
508 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
509 : /* Use EXIT_SUCCESS as a witness for stdlib.h. */
510 : # ifndef EXIT_SUCCESS
511 : # define EXIT_SUCCESS 0
512 : # endif
513 : # endif
514 : # endif
515 : # endif
516 : # endif
517 :
518 : # ifdef YYSTACK_ALLOC
519 : /* Pacify GCC's 'empty if-body' warning. */
520 : # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
521 : # ifndef YYSTACK_ALLOC_MAXIMUM
522 : /* The OS might guarantee only one guard page at the bottom of the stack,
523 : and a page size can be as small as 4096 bytes. So we cannot safely
524 : invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
525 : to allow for a few compiler-allocated temporary stack slots. */
526 : # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
527 : # endif
528 : # else
529 : # define YYSTACK_ALLOC YYMALLOC
530 : # define YYSTACK_FREE YYFREE
531 : # ifndef YYSTACK_ALLOC_MAXIMUM
532 : # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
533 : # endif
534 : # if (defined __cplusplus && ! defined EXIT_SUCCESS \
535 : && ! ((defined YYMALLOC || defined malloc) \
536 : && (defined YYFREE || defined free)))
537 : # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
538 : # ifndef EXIT_SUCCESS
539 : # define EXIT_SUCCESS 0
540 : # endif
541 : # endif
542 : # ifndef YYMALLOC
543 : # define YYMALLOC malloc
544 : # if ! defined malloc && ! defined EXIT_SUCCESS
545 : void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
546 : # endif
547 : # endif
548 : # ifndef YYFREE
549 : # define YYFREE free
550 : # if ! defined free && ! defined EXIT_SUCCESS
551 : void free (void *); /* INFRINGES ON USER NAME SPACE */
552 : # endif
553 : # endif
554 : # endif
555 : #endif /* ! defined yyoverflow || YYERROR_VERBOSE */
556 :
557 :
558 : #if (! defined yyoverflow \
559 : && (! defined __cplusplus \
560 : || (defined OMP_EXPRPARSER_LTYPE_IS_TRIVIAL && OMP_EXPRPARSER_LTYPE_IS_TRIVIAL \
561 : && defined OMP_EXPRPARSER_STYPE_IS_TRIVIAL && OMP_EXPRPARSER_STYPE_IS_TRIVIAL)))
562 :
563 : /* A type that is properly aligned for any stack member. */
564 : union yyalloc
565 : {
566 : yy_state_t yyss_alloc;
567 : YYSTYPE yyvs_alloc;
568 : YYLTYPE yyls_alloc;
569 : };
570 :
571 : /* The size of the maximum gap between one aligned stack and the next. */
572 : # define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
573 :
574 : /* The size of an array large to enough to hold all stacks, each with
575 : N elements. */
576 : # define YYSTACK_BYTES(N) \
577 : ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
578 : + YYSIZEOF (YYLTYPE)) \
579 : + 2 * YYSTACK_GAP_MAXIMUM)
580 :
581 : # define YYCOPY_NEEDED 1
582 :
583 : /* Relocate STACK from its old location to the new one. The
584 : local variables YYSIZE and YYSTACKSIZE give the old and new number of
585 : elements in the stack, and YYPTR gives the new location of the
586 : stack. Advance YYPTR to a properly aligned location for the next
587 : stack. */
588 : # define YYSTACK_RELOCATE(Stack_alloc, Stack) \
589 : do \
590 : { \
591 : YYPTRDIFF_T yynewbytes; \
592 : YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
593 : Stack = &yyptr->Stack_alloc; \
594 : yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
595 : yyptr += yynewbytes / YYSIZEOF (*yyptr); \
596 : } \
597 : while (0)
598 :
599 : #endif
600 :
601 : #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
602 : /* Copy COUNT objects from SRC to DST. The source and destination do
603 : not overlap. */
604 : # ifndef YYCOPY
605 : # if defined __GNUC__ && 1 < __GNUC__
606 : # define YYCOPY(Dst, Src, Count) \
607 : __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
608 : # else
609 : # define YYCOPY(Dst, Src, Count) \
610 : do \
611 : { \
612 : YYPTRDIFF_T yyi; \
613 : for (yyi = 0; yyi < (Count); yyi++) \
614 : (Dst)[yyi] = (Src)[yyi]; \
615 : } \
616 : while (0)
617 : # endif
618 : # endif
619 : #endif /* !YYCOPY_NEEDED */
620 :
621 : /* YYFINAL -- State number of the termination state. */
622 : #define YYFINAL 11
623 : /* YYLAST -- Last index in YYTABLE. */
624 : #define YYLAST 138
625 :
626 : /* YYNTOKENS -- Number of terminals. */
627 : #define YYNTOKENS 60
628 : /* YYNNTS -- Number of nonterminals. */
629 : #define YYNNTS 34
630 : /* YYNRULES -- Number of rules. */
631 : #define YYNRULES 79
632 : /* YYNSTATES -- Number of states. */
633 : #define YYNSTATES 138
634 :
635 : #define YYUNDEFTOK 2
636 : #define YYMAXUTOK 295
637 :
638 :
639 : /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
640 : as returned by yylex, with out-of-bounds checking. */
641 : #define YYTRANSLATE(YYX) \
642 : (0 <= (YYX) && (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
643 :
644 : /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
645 : as returned by yylex. */
646 : static const yytype_int8 yytranslate[] =
647 : {
648 : 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
649 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
650 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
651 : 2, 2, 2, 2, 2, 2, 2, 56, 10, 2,
652 : 3, 4, 8, 7, 5, 9, 20, 55, 2, 2,
653 : 2, 2, 2, 2, 2, 2, 2, 2, 6, 2,
654 : 49, 51, 50, 59, 2, 2, 2, 2, 2, 2,
655 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
656 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
657 : 2, 57, 2, 58, 11, 2, 2, 2, 2, 2,
658 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
659 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
660 : 2, 2, 2, 2, 12, 2, 2, 2, 2, 2,
661 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
662 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
663 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
664 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
665 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
666 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
667 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
668 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
669 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
670 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
671 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
672 : 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
673 : 2, 2, 2, 2, 2, 2, 1, 2, 13, 14,
674 : 15, 16, 17, 18, 19, 21, 22, 23, 24, 25,
675 : 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
676 : 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
677 : 46, 47, 48, 52, 53, 54
678 : };
679 :
680 : #if OMP_EXPRPARSER_DEBUG
681 : /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
682 : static const yytype_int16 yyrline[] =
683 : {
684 : 0, 134, 134, 135, 136, 139, 139, 144, 144, 151,
685 : 151, 158, 159, 163, 163, 164, 164, 168, 169, 172,
686 : 173, 176, 177, 176, 196, 198, 199, 200, 207, 214,
687 : 221, 228, 235, 242, 249, 256, 263, 270, 279, 289,
688 : 290, 299, 300, 309, 310, 319, 320, 329, 330, 339,
689 : 340, 347, 356, 357, 365, 372, 379, 388, 389, 396,
690 : 405, 406, 413, 422, 423, 430, 437, 446, 450, 456,
691 : 461, 465, 472, 482, 487, 492, 519, 526, 543, 547
692 : };
693 : #endif
694 :
695 : #if OMP_EXPRPARSER_DEBUG || YYERROR_VERBOSE || 1
696 : /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
697 : First, the terminals, then, starting at YYNTOKENS, nonterminals. */
698 : static const char *const yytname[] =
699 : {
700 : "$end", "error", "$undefined", "'('", "')'", "','", "':'", "'+'", "'*'",
701 : "'-'", "'&'", "'^'", "'|'", "LOGAND", "LOGOR", "SHLEFT", "SHRIGHT",
702 : "PLUSPLUS", "MINUSMINUS", "PTR_TO", "'.'", "LE_OP2", "GE_OP2", "EQ_OP2",
703 : "NE_OP2", "RIGHT_ASSIGN2", "LEFT_ASSIGN2", "ADD_ASSIGN2", "SUB_ASSIGN2",
704 : "MUL_ASSIGN2", "DIV_ASSIGN2", "MOD_ASSIGN2", "AND_ASSIGN2",
705 : "XOR_ASSIGN2", "OR_ASSIGN2", "DEPEND", "IN", "OUT", "INOUT", "MERGEABLE",
706 : "LEXICALERROR", "IDENTIFIER", "MIN", "MAX", "VARLIST", "ARRAY_SECTION",
707 : "ICONSTANT", "EXPRESSION", "ID_EXPRESSION", "'<'", "'>'", "'='",
708 : "\"!=\"", "\"<=\"", "\">=\"", "'/'", "'%'", "'['", "']'", "'?'",
709 : "$accept", "openmp_expression", "omp_varlist", "$@1", "omp_expression",
710 : "$@2", "omp_array_section", "$@3", "array_section_list",
711 : "id_expression_opt_dimension", "$@4", "$@5", "dimension_field_optseq",
712 : "dimension_field_seq", "dimension_field", "$@6", "$@7", "expression",
713 : "assignment_expr", "conditional_expr", "logical_or_expr",
714 : "logical_and_expr", "inclusive_or_expr", "exclusive_or_expr", "and_expr",
715 : "equality_expr", "relational_expr", "shift_expr", "additive_expr",
716 : "multiplicative_expr", "primary_expr", "unary_expr", "postfix_expr",
717 : "variable_list", YY_NULLPTR
718 : };
719 : #endif
720 :
721 : # ifdef YYPRINT
722 : /* YYTOKNUM[NUM] -- (External) token number corresponding to the
723 : (internal) symbol number NUM (which must be that of a token). */
724 : static const yytype_int16 yytoknum[] =
725 : {
726 : 0, 256, 257, 40, 41, 44, 58, 43, 42, 45,
727 : 38, 94, 124, 258, 259, 260, 261, 262, 263, 264,
728 : 46, 265, 266, 267, 268, 269, 270, 271, 272, 273,
729 : 274, 275, 276, 277, 278, 279, 280, 281, 282, 283,
730 : 284, 285, 286, 287, 288, 289, 290, 291, 292, 60,
731 : 62, 61, 293, 294, 295, 47, 37, 91, 93, 63
732 : };
733 : # endif
734 :
735 : #define YYPACT_NINF (-55)
736 :
737 : #define yypact_value_is_default(Yyn) \
738 : ((Yyn) == YYPACT_NINF)
739 :
740 : #define YYTABLE_NINF (-74)
741 :
742 : #define yytable_value_is_error(Yyn) \
743 : 0
744 :
745 : /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
746 : STATE-NUM. */
747 : static const yytype_int8 yypact[] =
748 : {
749 : -30, -55, -55, -55, 18, -55, -55, -55, -14, 61,
750 : 87, -55, -55, 100, 24, 13, 8, 63, -55, 6,
751 : -55, 13, 13, 13, -55, -55, 97, -55, -55, -1,
752 : 103, 101, 109, 111, 47, 65, 58, 53, -3, 51,
753 : 66, 49, -55, -55, 67, -55, 24, 118, -55, -55,
754 : -55, -55, 9, 13, 9, 9, 9, 9, 9, 9,
755 : 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
756 : 9, 13, 13, 13, 13, 13, 13, 13, 13, 13,
757 : 13, 13, -55, -55, 13, 67, 13, -55, 67, -55,
758 : -55, -55, 103, -55, 117, 101, 109, 111, 47, 65,
759 : 65, 58, 58, 58, 58, 53, 53, -3, -3, -55,
760 : -55, -55, -55, -55, -55, -55, -55, -55, -55, -55,
761 : -55, -55, -55, -4, -55, -55, -55, 13, 13, -55,
762 : 119, -55, 68, 13, -55, -55, 69, -55
763 : };
764 :
765 : /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
766 : Performed when YYTABLE does not specify something else to do. Zero
767 : means the default is an error. */
768 : static const yytype_int8 yydefact[] =
769 : {
770 : 0, 5, 9, 7, 0, 2, 3, 4, 0, 0,
771 : 0, 1, 78, 6, 0, 0, 0, 0, 13, 0,
772 : 11, 0, 0, 0, 67, 68, 0, 24, 25, 26,
773 : 39, 41, 43, 45, 47, 49, 52, 57, 60, 63,
774 : 0, 70, 79, 15, 17, 10, 0, 0, 73, 71,
775 : 72, 8, 0, 0, 0, 0, 0, 0, 0, 0,
776 : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
777 : 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
778 : 0, 0, 76, 77, 0, 17, 0, 14, 18, 19,
779 : 12, 69, 40, 63, 0, 42, 44, 46, 48, 50,
780 : 51, 55, 56, 53, 54, 59, 58, 61, 62, 64,
781 : 65, 66, 28, 29, 30, 31, 32, 33, 34, 35,
782 : 36, 37, 27, 0, 16, 21, 20, 0, 0, 74,
783 : 0, 38, 0, 0, 75, 22, 0, 23
784 : };
785 :
786 : /* YYPGOTO[NTERM-NUM]. */
787 : static const yytype_int8 yypgoto[] =
788 : {
789 : -55, -55, -55, -55, -55, -55, -55, -55, -55, 82,
790 : -55, -55, 44, -55, 42, -55, -55, -21, -52, -55,
791 : -55, 79, 78, 80, 77, 81, 30, -54, 39, 43,
792 : -19, 96, -55, -55
793 : };
794 :
795 : /* YYDEFGOTO[NTERM-NUM]. */
796 : static const yytype_int16 yydefgoto[] =
797 : {
798 : -1, 4, 5, 8, 6, 10, 7, 9, 19, 20,
799 : 44, 85, 87, 88, 89, 130, 136, 26, 27, 28,
800 : 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
801 : 39, 40, 41, 13
802 : };
803 :
804 : /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
805 : positive, shift that token. If negative, reduce the rule whose
806 : number is the opposite. If YYTABLE_NINF, syntax error. */
807 : static const yytype_int16 yytable[] =
808 : {
809 : 47, 94, 128, 48, 48, 68, 101, 102, 103, 104,
810 : 45, 46, 21, 52, 1, 2, 21, 3, 11, 112,
811 : 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
812 : 22, 23, 17, 93, 12, 93, 93, 93, 93, 93,
813 : 93, 93, 93, 93, 93, 93, 93, 93, 93, 109,
814 : 110, 111, 69, 70, 129, 24, 42, 25, 53, 24,
815 : 66, 25, 67, 123, 14, 125, 82, 83, -73, -73,
816 : 58, 59, 18, 64, 65, 131, -73, -73, -73, -73,
817 : -73, -73, -73, -73, -73, -73, 60, 61, 99, 100,
818 : 15, 71, 72, 73, 74, 75, 76, 77, 78, 79,
819 : 80, 51, -73, 105, 106, 16, 84, 132, -73, 107,
820 : 108, 43, 135, 55, 62, 63, 54, 81, 49, 50,
821 : 56, 57, 91, 127, 86, 133, 134, 137, 90, 124,
822 : 126, 92, 95, 97, 0, 96, 0, 0, 98
823 : };
824 :
825 : static const yytype_int16 yycheck[] =
826 : {
827 : 21, 53, 6, 22, 23, 8, 60, 61, 62, 63,
828 : 4, 5, 3, 14, 44, 45, 3, 47, 0, 71,
829 : 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
830 : 17, 18, 8, 52, 48, 54, 55, 56, 57, 58,
831 : 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
832 : 69, 70, 55, 56, 58, 46, 48, 48, 59, 46,
833 : 7, 48, 9, 84, 3, 86, 17, 18, 17, 18,
834 : 23, 24, 48, 15, 16, 127, 25, 26, 27, 28,
835 : 29, 30, 31, 32, 33, 34, 21, 22, 58, 59,
836 : 3, 25, 26, 27, 28, 29, 30, 31, 32, 33,
837 : 34, 4, 51, 64, 65, 5, 57, 128, 57, 66,
838 : 67, 48, 133, 12, 49, 50, 13, 51, 22, 23,
839 : 11, 10, 4, 6, 57, 6, 58, 58, 46, 85,
840 : 88, 52, 54, 56, -1, 55, -1, -1, 57
841 : };
842 :
843 : /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
844 : symbol of state STATE-NUM. */
845 : static const yytype_int8 yystos[] =
846 : {
847 : 0, 44, 45, 47, 61, 62, 64, 66, 63, 67,
848 : 65, 0, 48, 93, 3, 3, 5, 8, 48, 68,
849 : 69, 3, 17, 18, 46, 48, 77, 78, 79, 80,
850 : 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
851 : 91, 92, 48, 48, 70, 4, 5, 77, 90, 91,
852 : 91, 4, 14, 59, 13, 12, 11, 10, 23, 24,
853 : 21, 22, 49, 50, 15, 16, 7, 9, 8, 55,
854 : 56, 25, 26, 27, 28, 29, 30, 31, 32, 33,
855 : 34, 51, 17, 18, 57, 71, 57, 72, 73, 74,
856 : 69, 4, 81, 90, 78, 82, 83, 84, 85, 86,
857 : 86, 87, 87, 87, 87, 88, 88, 89, 89, 90,
858 : 90, 90, 78, 78, 78, 78, 78, 78, 78, 78,
859 : 78, 78, 78, 77, 72, 77, 74, 6, 6, 58,
860 : 75, 78, 77, 6, 58, 77, 76, 58
861 : };
862 :
863 : /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
864 : static const yytype_int8 yyr1[] =
865 : {
866 : 0, 60, 61, 61, 61, 63, 62, 65, 64, 67,
867 : 66, 68, 68, 70, 69, 71, 69, 72, 72, 73,
868 : 73, 75, 76, 74, 77, 78, 78, 78, 78, 78,
869 : 78, 78, 78, 78, 78, 78, 78, 78, 79, 80,
870 : 80, 81, 81, 82, 82, 83, 83, 84, 84, 85,
871 : 85, 85, 86, 86, 86, 86, 86, 87, 87, 87,
872 : 88, 88, 88, 89, 89, 89, 89, 90, 90, 90,
873 : 91, 91, 91, 92, 92, 92, 92, 92, 93, 93
874 : };
875 :
876 : /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
877 : static const yytype_int8 yyr2[] =
878 : {
879 : 0, 2, 1, 1, 1, 0, 3, 0, 5, 0,
880 : 5, 1, 3, 0, 3, 0, 4, 0, 1, 1,
881 : 2, 0, 0, 7, 1, 1, 1, 3, 3, 3,
882 : 3, 3, 3, 3, 3, 3, 3, 3, 5, 1,
883 : 3, 1, 3, 1, 3, 1, 3, 1, 3, 1,
884 : 3, 3, 1, 3, 3, 3, 3, 1, 3, 3,
885 : 1, 3, 3, 1, 3, 3, 3, 1, 1, 3,
886 : 1, 2, 2, 1, 4, 6, 2, 2, 1, 3
887 : };
888 :
889 :
890 : #define yyerrok (yyerrstatus = 0)
891 : #define yyclearin (yychar = YYEMPTY)
892 : #define YYEMPTY (-2)
893 : #define YYEOF 0
894 :
895 : #define YYACCEPT goto yyacceptlab
896 : #define YYABORT goto yyabortlab
897 : #define YYERROR goto yyerrorlab
898 :
899 :
900 : #define YYRECOVERING() (!!yyerrstatus)
901 :
902 : #define YYBACKUP(Token, Value) \
903 : do \
904 : if (yychar == YYEMPTY) \
905 : { \
906 : yychar = (Token); \
907 : yylval = (Value); \
908 : YYPOPSTACK (yylen); \
909 : yystate = *yyssp; \
910 : goto yybackup; \
911 : } \
912 : else \
913 : { \
914 : yyerror (YY_("syntax error: cannot back up")); \
915 : YYERROR; \
916 : } \
917 : while (0)
918 :
919 : /* Error token number */
920 : #define YYTERROR 1
921 : #define YYERRCODE 256
922 :
923 :
924 : /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
925 : If N is 0, then set CURRENT to the empty location which ends
926 : the previous symbol: RHS[0] (always defined). */
927 :
928 : #ifndef YYLLOC_DEFAULT
929 : # define YYLLOC_DEFAULT(Current, Rhs, N) \
930 : do \
931 : if (N) \
932 : { \
933 : (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
934 : (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
935 : (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
936 : (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
937 : } \
938 : else \
939 : { \
940 : (Current).first_line = (Current).last_line = \
941 : YYRHSLOC (Rhs, 0).last_line; \
942 : (Current).first_column = (Current).last_column = \
943 : YYRHSLOC (Rhs, 0).last_column; \
944 : } \
945 : while (0)
946 : #endif
947 :
948 : #define YYRHSLOC(Rhs, K) ((Rhs)[K])
949 :
950 :
951 : /* Enable debugging if requested. */
952 : #if OMP_EXPRPARSER_DEBUG
953 :
954 : # ifndef YYFPRINTF
955 : # include <stdio.h> /* INFRINGES ON USER NAME SPACE */
956 : # define YYFPRINTF fprintf
957 : # endif
958 :
959 : # define YYDPRINTF(Args) \
960 : do { \
961 : if (yydebug) \
962 : YYFPRINTF Args; \
963 : } while (0)
964 :
965 :
966 : /* YY_LOCATION_PRINT -- Print the location on the stream.
967 : This macro was not mandated originally: define only if we know
968 : we won't break user code: when these are the locations we know. */
969 :
970 : #ifndef YY_LOCATION_PRINT
971 : # if defined OMP_EXPRPARSER_LTYPE_IS_TRIVIAL && OMP_EXPRPARSER_LTYPE_IS_TRIVIAL
972 :
973 : /* Print *YYLOCP on YYO. Private, do not rely on its existence. */
974 :
975 : YY_ATTRIBUTE_UNUSED
976 : static int
977 : yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
978 : {
979 : int res = 0;
980 : int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
981 : if (0 <= yylocp->first_line)
982 : {
983 : res += YYFPRINTF (yyo, "%d", yylocp->first_line);
984 : if (0 <= yylocp->first_column)
985 : res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
986 : }
987 : if (0 <= yylocp->last_line)
988 : {
989 : if (yylocp->first_line < yylocp->last_line)
990 : {
991 : res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
992 : if (0 <= end_col)
993 : res += YYFPRINTF (yyo, ".%d", end_col);
994 : }
995 : else if (0 <= end_col && yylocp->first_column < end_col)
996 : res += YYFPRINTF (yyo, "-%d", end_col);
997 : }
998 : return res;
999 : }
1000 :
1001 : # define YY_LOCATION_PRINT(File, Loc) \
1002 : yy_location_print_ (File, &(Loc))
1003 :
1004 : # else
1005 : # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
1006 : # endif
1007 : #endif
1008 :
1009 :
1010 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
1011 : do { \
1012 : if (yydebug) \
1013 : { \
1014 : YYFPRINTF (stderr, "%s ", Title); \
1015 : yy_symbol_print (stderr, \
1016 : Type, Value, Location); \
1017 : YYFPRINTF (stderr, "\n"); \
1018 : } \
1019 : } while (0)
1020 :
1021 :
1022 : /*-----------------------------------.
1023 : | Print this symbol's value on YYO. |
1024 : `-----------------------------------*/
1025 :
1026 : static void
1027 : yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1028 : {
1029 : FILE *yyoutput = yyo;
1030 : YYUSE (yyoutput);
1031 : YYUSE (yylocationp);
1032 : if (!yyvaluep)
1033 : return;
1034 : # ifdef YYPRINT
1035 : if (yytype < YYNTOKENS)
1036 : YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
1037 : # endif
1038 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1039 : YYUSE (yytype);
1040 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1041 : }
1042 :
1043 :
1044 : /*---------------------------.
1045 : | Print this symbol on YYO. |
1046 : `---------------------------*/
1047 :
1048 : static void
1049 : yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
1050 : {
1051 : YYFPRINTF (yyo, "%s %s (",
1052 : yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
1053 :
1054 : YY_LOCATION_PRINT (yyo, *yylocationp);
1055 : YYFPRINTF (yyo, ": ");
1056 : yy_symbol_value_print (yyo, yytype, yyvaluep, yylocationp);
1057 : YYFPRINTF (yyo, ")");
1058 : }
1059 :
1060 : /*------------------------------------------------------------------.
1061 : | yy_stack_print -- Print the state stack from its BOTTOM up to its |
1062 : | TOP (included). |
1063 : `------------------------------------------------------------------*/
1064 :
1065 : static void
1066 : yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
1067 : {
1068 : YYFPRINTF (stderr, "Stack now");
1069 : for (; yybottom <= yytop; yybottom++)
1070 : {
1071 : int yybot = *yybottom;
1072 : YYFPRINTF (stderr, " %d", yybot);
1073 : }
1074 : YYFPRINTF (stderr, "\n");
1075 : }
1076 :
1077 : # define YY_STACK_PRINT(Bottom, Top) \
1078 : do { \
1079 : if (yydebug) \
1080 : yy_stack_print ((Bottom), (Top)); \
1081 : } while (0)
1082 :
1083 :
1084 : /*------------------------------------------------.
1085 : | Report that the YYRULE is going to be reduced. |
1086 : `------------------------------------------------*/
1087 :
1088 : static void
1089 : yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule)
1090 : {
1091 : int yylno = yyrline[yyrule];
1092 : int yynrhs = yyr2[yyrule];
1093 : int yyi;
1094 : YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
1095 : yyrule - 1, yylno);
1096 : /* The symbols being reduced. */
1097 : for (yyi = 0; yyi < yynrhs; yyi++)
1098 : {
1099 : YYFPRINTF (stderr, " $%d = ", yyi + 1);
1100 : yy_symbol_print (stderr,
1101 : yystos[+yyssp[yyi + 1 - yynrhs]],
1102 : &yyvsp[(yyi + 1) - (yynrhs)]
1103 : , &(yylsp[(yyi + 1) - (yynrhs)]) );
1104 : YYFPRINTF (stderr, "\n");
1105 : }
1106 : }
1107 :
1108 : # define YY_REDUCE_PRINT(Rule) \
1109 : do { \
1110 : if (yydebug) \
1111 : yy_reduce_print (yyssp, yyvsp, yylsp, Rule); \
1112 : } while (0)
1113 :
1114 : /* Nonzero means print parse trace. It is left uninitialized so that
1115 : multiple parsers can coexist. */
1116 : int yydebug;
1117 : #else /* !OMP_EXPRPARSER_DEBUG */
1118 : # define YYDPRINTF(Args)
1119 : # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
1120 : # define YY_STACK_PRINT(Bottom, Top)
1121 : # define YY_REDUCE_PRINT(Rule)
1122 : #endif /* !OMP_EXPRPARSER_DEBUG */
1123 :
1124 :
1125 : /* YYINITDEPTH -- initial size of the parser's stacks. */
1126 : #ifndef YYINITDEPTH
1127 : # define YYINITDEPTH 200
1128 : #endif
1129 :
1130 : /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
1131 : if the built-in stack extension method is used).
1132 :
1133 : Do not make this value too large; the results are undefined if
1134 : YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
1135 : evaluated with infinite-precision integer arithmetic. */
1136 :
1137 : #ifndef YYMAXDEPTH
1138 : # define YYMAXDEPTH 10000
1139 : #endif
1140 :
1141 :
1142 : #if YYERROR_VERBOSE
1143 :
1144 : # ifndef yystrlen
1145 : # if defined __GLIBC__ && defined _STRING_H
1146 : # define yystrlen(S) (YY_CAST (YYPTRDIFF_T, strlen (S)))
1147 : # else
1148 : /* Return the length of YYSTR. */
1149 : static YYPTRDIFF_T
1150 : yystrlen (const char *yystr)
1151 : {
1152 : YYPTRDIFF_T yylen;
1153 : for (yylen = 0; yystr[yylen]; yylen++)
1154 : continue;
1155 : return yylen;
1156 : }
1157 : # endif
1158 : # endif
1159 :
1160 : # ifndef yystpcpy
1161 : # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
1162 : # define yystpcpy stpcpy
1163 : # else
1164 : /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
1165 : YYDEST. */
1166 : static char *
1167 : yystpcpy (char *yydest, const char *yysrc)
1168 : {
1169 : char *yyd = yydest;
1170 : const char *yys = yysrc;
1171 :
1172 : while ((*yyd++ = *yys++) != '\0')
1173 : continue;
1174 :
1175 : return yyd - 1;
1176 : }
1177 : # endif
1178 : # endif
1179 :
1180 : # ifndef yytnamerr
1181 : /* Copy to YYRES the contents of YYSTR after stripping away unnecessary
1182 : quotes and backslashes, so that it's suitable for yyerror. The
1183 : heuristic is that double-quoting is unnecessary unless the string
1184 : contains an apostrophe, a comma, or backslash (other than
1185 : backslash-backslash). YYSTR is taken from yytname. If YYRES is
1186 : null, do not copy; instead, return the length of what the result
1187 : would have been. */
1188 : static YYPTRDIFF_T
1189 0 : yytnamerr (char *yyres, const char *yystr)
1190 : {
1191 0 : if (*yystr == '"')
1192 : {
1193 : YYPTRDIFF_T yyn = 0;
1194 : char const *yyp = yystr;
1195 :
1196 0 : for (;;)
1197 0 : switch (*++yyp)
1198 : {
1199 0 : case '\'':
1200 0 : case ',':
1201 0 : goto do_not_strip_quotes;
1202 :
1203 0 : case '\\':
1204 0 : if (*++yyp != '\\')
1205 0 : goto do_not_strip_quotes;
1206 : else
1207 0 : goto append;
1208 :
1209 0 : append:
1210 0 : default:
1211 0 : if (yyres)
1212 0 : yyres[yyn] = *yyp;
1213 0 : yyn++;
1214 0 : break;
1215 :
1216 0 : case '"':
1217 0 : if (yyres)
1218 0 : yyres[yyn] = '\0';
1219 0 : return yyn;
1220 : }
1221 0 : do_not_strip_quotes: ;
1222 : }
1223 :
1224 0 : if (yyres)
1225 0 : return yystpcpy (yyres, yystr) - yyres;
1226 : else
1227 0 : return yystrlen (yystr);
1228 : }
1229 : # endif
1230 :
1231 : /* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
1232 : about the unexpected token YYTOKEN for the state stack whose top is
1233 : YYSSP.
1234 :
1235 : Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
1236 : not large enough to hold the message. In that case, also set
1237 : *YYMSG_ALLOC to the required number of bytes. Return 2 if the
1238 : required number of bytes is too large to store. */
1239 : static int
1240 0 : yysyntax_error (YYPTRDIFF_T *yymsg_alloc, char **yymsg,
1241 : yy_state_t *yyssp, int yytoken)
1242 : {
1243 0 : enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
1244 : /* Internationalized format string. */
1245 0 : const char *yyformat = YY_NULLPTR;
1246 : /* Arguments of yyformat: reported tokens (one for the "unexpected",
1247 : one per "expected"). */
1248 0 : char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
1249 : /* Actual size of YYARG. */
1250 0 : int yycount = 0;
1251 : /* Cumulated lengths of YYARG. */
1252 0 : YYPTRDIFF_T yysize = 0;
1253 :
1254 : /* There are many possibilities here to consider:
1255 : - If this state is a consistent state with a default action, then
1256 : the only way this function was invoked is if the default action
1257 : is an error action. In that case, don't check for expected
1258 : tokens because there are none.
1259 : - The only way there can be no lookahead present (in yychar) is if
1260 : this state is a consistent state with a default action. Thus,
1261 : detecting the absence of a lookahead is sufficient to determine
1262 : that there is no unexpected or expected token to report. In that
1263 : case, just report a simple "syntax error".
1264 : - Don't assume there isn't a lookahead just because this state is a
1265 : consistent state with a default action. There might have been a
1266 : previous inconsistent state, consistent state with a non-default
1267 : action, or user semantic action that manipulated yychar.
1268 : - Of course, the expected token list depends on states to have
1269 : correct lookahead information, and it depends on the parser not
1270 : to perform extra reductions after fetching a lookahead from the
1271 : scanner and before detecting a syntax error. Thus, state merging
1272 : (from LALR or IELR) and default reductions corrupt the expected
1273 : token list. However, the list is correct for canonical LR with
1274 : one exception: it will still contain any token that will not be
1275 : accepted due to an error action in a later state.
1276 : */
1277 0 : if (yytoken != YYEMPTY)
1278 : {
1279 0 : int yyn = yypact[+*yyssp];
1280 0 : YYPTRDIFF_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
1281 0 : yysize = yysize0;
1282 0 : yyarg[yycount++] = yytname[yytoken];
1283 0 : if (!yypact_value_is_default (yyn))
1284 : {
1285 : /* Start YYX at -YYN if negative to avoid negative indexes in
1286 : YYCHECK. In other words, skip the first -YYN actions for
1287 : this state because they are default actions. */
1288 0 : int yyxbegin = yyn < 0 ? -yyn : 0;
1289 : /* Stay within bounds of both yycheck and yytname. */
1290 0 : int yychecklim = YYLAST - yyn + 1;
1291 0 : int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
1292 0 : int yyx;
1293 :
1294 0 : for (yyx = yyxbegin; yyx < yyxend; ++yyx)
1295 0 : if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
1296 : && !yytable_value_is_error (yytable[yyx + yyn]))
1297 : {
1298 0 : if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
1299 : {
1300 : yycount = 1;
1301 : yysize = yysize0;
1302 : break;
1303 : }
1304 0 : yyarg[yycount++] = yytname[yyx];
1305 0 : {
1306 0 : YYPTRDIFF_T yysize1
1307 0 : = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
1308 0 : if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1309 : yysize = yysize1;
1310 : else
1311 : return 2;
1312 : }
1313 : }
1314 : }
1315 : }
1316 :
1317 0 : switch (yycount)
1318 : {
1319 : # define YYCASE_(N, S) \
1320 : case N: \
1321 : yyformat = S; \
1322 : break
1323 : default: /* Avoid compiler warnings. */
1324 : YYCASE_(0, YY_("syntax error"));
1325 : YYCASE_(1, YY_("syntax error, unexpected %s"));
1326 0 : YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
1327 0 : YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
1328 0 : YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
1329 0 : YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
1330 : # undef YYCASE_
1331 : }
1332 :
1333 0 : {
1334 : /* Don't count the "%s"s in the final size, but reserve room for
1335 : the terminator. */
1336 0 : YYPTRDIFF_T yysize1 = yysize + (yystrlen (yyformat) - 2 * yycount) + 1;
1337 0 : if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
1338 0 : yysize = yysize1;
1339 : else
1340 : return 2;
1341 : }
1342 :
1343 0 : if (*yymsg_alloc < yysize)
1344 : {
1345 0 : *yymsg_alloc = 2 * yysize;
1346 0 : if (! (yysize <= *yymsg_alloc
1347 : && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
1348 0 : *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
1349 0 : return 1;
1350 : }
1351 :
1352 : /* Avoid sprintf, as that infringes on the user's name space.
1353 : Don't have undefined behavior even if the translation
1354 : produced a string with the wrong number of "%s"s. */
1355 0 : {
1356 0 : char *yyp = *yymsg;
1357 0 : int yyi = 0;
1358 0 : while ((*yyp = *yyformat) != '\0')
1359 0 : if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
1360 : {
1361 0 : yyp += yytnamerr (yyp, yyarg[yyi++]);
1362 0 : yyformat += 2;
1363 : }
1364 : else
1365 : {
1366 0 : ++yyp;
1367 0 : ++yyformat;
1368 : }
1369 : }
1370 : return 0;
1371 : }
1372 : #endif /* YYERROR_VERBOSE */
1373 :
1374 : /*-----------------------------------------------.
1375 : | Release the memory associated to this symbol. |
1376 : `-----------------------------------------------*/
1377 :
1378 : static void
1379 : yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
1380 : {
1381 : YYUSE (yyvaluep);
1382 : YYUSE (yylocationp);
1383 : if (!yymsg)
1384 959 : yymsg = "Deleting";
1385 : YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
1386 :
1387 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1388 : YYUSE (yytype);
1389 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1390 : }
1391 :
1392 :
1393 :
1394 :
1395 : /* The lookahead symbol. */
1396 : int yychar;
1397 :
1398 : /* The semantic value of the lookahead symbol. */
1399 : YYSTYPE yylval;
1400 : /* Location data for the lookahead symbol. */
1401 : YYLTYPE yylloc
1402 : # if defined OMP_EXPRPARSER_LTYPE_IS_TRIVIAL && OMP_EXPRPARSER_LTYPE_IS_TRIVIAL
1403 : = { 1, 1, 1, 1 }
1404 : # endif
1405 : ;
1406 : /* Number of syntax errors so far. */
1407 : int yynerrs;
1408 :
1409 :
1410 : /*----------.
1411 : | yyparse. |
1412 : `----------*/
1413 :
1414 : int
1415 959 : yyparse (void)
1416 : {
1417 959 : yy_state_fast_t yystate;
1418 : /* Number of tokens to shift before error messages enabled. */
1419 959 : int yyerrstatus;
1420 :
1421 : /* The stacks and their tools:
1422 : 'yyss': related to states.
1423 : 'yyvs': related to semantic values.
1424 : 'yyls': related to locations.
1425 :
1426 : Refer to the stacks through separate pointers, to allow yyoverflow
1427 : to reallocate them elsewhere. */
1428 :
1429 : /* The state stack. */
1430 959 : yy_state_t yyssa[YYINITDEPTH];
1431 959 : yy_state_t *yyss;
1432 959 : yy_state_t *yyssp;
1433 :
1434 : /* The semantic value stack. */
1435 959 : YYSTYPE yyvsa[YYINITDEPTH];
1436 959 : YYSTYPE *yyvs;
1437 959 : YYSTYPE *yyvsp;
1438 :
1439 : /* The location stack. */
1440 959 : YYLTYPE yylsa[YYINITDEPTH];
1441 959 : YYLTYPE *yyls;
1442 959 : YYLTYPE *yylsp;
1443 :
1444 : /* The locations where the error started and ended. */
1445 959 : YYLTYPE yyerror_range[3];
1446 :
1447 959 : YYPTRDIFF_T yystacksize;
1448 :
1449 959 : int yyn;
1450 959 : int yyresult;
1451 : /* Lookahead token as an internal (translated) token number. */
1452 959 : int yytoken = 0;
1453 : /* The variables used to return semantic value and location from the
1454 : action routines. */
1455 959 : YYSTYPE yyval;
1456 959 : YYLTYPE yyloc;
1457 :
1458 : #if YYERROR_VERBOSE
1459 : /* Buffer for error messages, and its allocated size. */
1460 959 : char yymsgbuf[128];
1461 959 : char *yymsg = yymsgbuf;
1462 959 : YYPTRDIFF_T yymsg_alloc = sizeof yymsgbuf;
1463 : #endif
1464 :
1465 : #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
1466 :
1467 : /* The number of symbols on the RHS of the reduced rule.
1468 : Keep to zero when no symbol should be popped. */
1469 959 : int yylen = 0;
1470 :
1471 959 : yyssp = yyss = yyssa;
1472 959 : yyvsp = yyvs = yyvsa;
1473 959 : yylsp = yyls = yylsa;
1474 959 : yystacksize = YYINITDEPTH;
1475 :
1476 959 : YYDPRINTF ((stderr, "Starting parse\n"));
1477 :
1478 959 : yystate = 0;
1479 959 : yyerrstatus = 0;
1480 959 : yynerrs = 0;
1481 959 : yychar = YYEMPTY; /* Cause a token to be read. */
1482 959 : yylsp[0] = yylloc;
1483 959 : goto yysetstate;
1484 :
1485 :
1486 : /*------------------------------------------------------------.
1487 : | yynewstate -- push a new state, which is found in yystate. |
1488 : `------------------------------------------------------------*/
1489 13536 : yynewstate:
1490 : /* In all cases, when you get here, the value and location stacks
1491 : have just been pushed. So pushing a state here evens the stacks. */
1492 13536 : yyssp++;
1493 :
1494 :
1495 : /*--------------------------------------------------------------------.
1496 : | yysetstate -- set current state (the top of the stack) to yystate. |
1497 : `--------------------------------------------------------------------*/
1498 14495 : yysetstate:
1499 14495 : YYDPRINTF ((stderr, "Entering state %d\n", yystate));
1500 14495 : YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
1501 14495 : YY_IGNORE_USELESS_CAST_BEGIN
1502 14495 : *yyssp = YY_CAST (yy_state_t, yystate);
1503 14495 : YY_IGNORE_USELESS_CAST_END
1504 :
1505 14495 : if (yyss + yystacksize - 1 <= yyssp)
1506 : #if !defined yyoverflow && !defined YYSTACK_RELOCATE
1507 : goto yyexhaustedlab;
1508 : #else
1509 : {
1510 : /* Get the current used size of the three stacks, in elements. */
1511 0 : YYPTRDIFF_T yysize = yyssp - yyss + 1;
1512 :
1513 : # if defined yyoverflow
1514 : {
1515 : /* Give user a chance to reallocate the stack. Use copies of
1516 : these so that the &'s don't force the real ones into
1517 : memory. */
1518 : yy_state_t *yyss1 = yyss;
1519 : YYSTYPE *yyvs1 = yyvs;
1520 : YYLTYPE *yyls1 = yyls;
1521 :
1522 : /* Each stack pointer address is followed by the size of the
1523 : data in use in that stack, in bytes. This used to be a
1524 : conditional around just the two extra args, but that might
1525 : be undefined if yyoverflow is a macro. */
1526 : yyoverflow (YY_("memory exhausted"),
1527 : &yyss1, yysize * YYSIZEOF (*yyssp),
1528 : &yyvs1, yysize * YYSIZEOF (*yyvsp),
1529 : &yyls1, yysize * YYSIZEOF (*yylsp),
1530 : &yystacksize);
1531 : yyss = yyss1;
1532 : yyvs = yyvs1;
1533 : yyls = yyls1;
1534 : }
1535 : # else /* defined YYSTACK_RELOCATE */
1536 : /* Extend the stack our own way. */
1537 0 : if (YYMAXDEPTH <= yystacksize)
1538 0 : goto yyexhaustedlab;
1539 0 : yystacksize *= 2;
1540 0 : if (YYMAXDEPTH < yystacksize)
1541 : yystacksize = YYMAXDEPTH;
1542 :
1543 0 : {
1544 0 : yy_state_t *yyss1 = yyss;
1545 0 : union yyalloc *yyptr =
1546 0 : YY_CAST (union yyalloc *,
1547 : YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
1548 0 : if (! yyptr)
1549 0 : goto yyexhaustedlab;
1550 0 : YYSTACK_RELOCATE (yyss_alloc, yyss);
1551 0 : YYSTACK_RELOCATE (yyvs_alloc, yyvs);
1552 0 : YYSTACK_RELOCATE (yyls_alloc, yyls);
1553 : # undef YYSTACK_RELOCATE
1554 0 : if (yyss1 != yyssa)
1555 0 : YYSTACK_FREE (yyss1);
1556 : }
1557 : # endif
1558 :
1559 0 : yyssp = yyss + yysize - 1;
1560 0 : yyvsp = yyvs + yysize - 1;
1561 0 : yylsp = yyls + yysize - 1;
1562 :
1563 0 : YY_IGNORE_USELESS_CAST_BEGIN
1564 : YYDPRINTF ((stderr, "Stack size increased to %ld\n",
1565 0 : YY_CAST (long, yystacksize)));
1566 0 : YY_IGNORE_USELESS_CAST_END
1567 :
1568 0 : if (yyss + yystacksize - 1 <= yyssp)
1569 0 : YYABORT;
1570 : }
1571 : #endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
1572 :
1573 14495 : if (yystate == YYFINAL)
1574 959 : YYACCEPT;
1575 :
1576 13536 : goto yybackup;
1577 :
1578 :
1579 : /*-----------.
1580 : | yybackup. |
1581 : `-----------*/
1582 13536 : yybackup:
1583 : /* Do appropriate processing given the current state. Read a
1584 : lookahead token if we need one and don't already have one. */
1585 :
1586 : /* First try to decide what to do without reference to lookahead token. */
1587 13536 : yyn = yypact[yystate];
1588 13536 : if (yypact_value_is_default (yyn))
1589 4435 : goto yydefault;
1590 :
1591 : /* Not known => get a lookahead token if don't already have one. */
1592 :
1593 : /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
1594 9101 : if (yychar == YYEMPTY)
1595 : {
1596 4048 : YYDPRINTF ((stderr, "Reading a token: "));
1597 4048 : yychar = yylex ();
1598 : }
1599 :
1600 9101 : if (yychar <= YYEOF)
1601 : {
1602 1560 : yychar = yytoken = YYEOF;
1603 1560 : YYDPRINTF ((stderr, "Now at end of input.\n"));
1604 : }
1605 : else
1606 : {
1607 7541 : yytoken = YYTRANSLATE (yychar);
1608 9101 : YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
1609 : }
1610 :
1611 : /* If the proper action on seeing token YYTOKEN is to reduce or to
1612 : detect an error, take that action. */
1613 9101 : yyn += yytoken;
1614 9101 : if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
1615 5052 : goto yydefault;
1616 4049 : yyn = yytable[yyn];
1617 4049 : if (yyn <= 0)
1618 : {
1619 1 : if (yytable_value_is_error (yyn))
1620 : goto yyerrlab;
1621 1 : yyn = -yyn;
1622 1 : goto yyreduce;
1623 : }
1624 :
1625 : /* Count tokens shifted since error; after three, turn off error
1626 : status. */
1627 4048 : if (yyerrstatus)
1628 : yyerrstatus--;
1629 :
1630 : /* Shift the lookahead token. */
1631 4048 : YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
1632 4048 : yystate = yyn;
1633 4048 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
1634 4048 : *++yyvsp = yylval;
1635 4048 : YY_IGNORE_MAYBE_UNINITIALIZED_END
1636 4048 : *++yylsp = yylloc;
1637 :
1638 : /* Discard the shifted token. */
1639 4048 : yychar = YYEMPTY;
1640 4048 : goto yynewstate;
1641 :
1642 :
1643 : /*-----------------------------------------------------------.
1644 : | yydefault -- do the default action for the current state. |
1645 : `-----------------------------------------------------------*/
1646 9487 : yydefault:
1647 9487 : yyn = yydefact[yystate];
1648 9487 : if (yyn == 0)
1649 0 : goto yyerrlab;
1650 9487 : goto yyreduce;
1651 :
1652 :
1653 : /*-----------------------------.
1654 : | yyreduce -- do a reduction. |
1655 : `-----------------------------*/
1656 9488 : yyreduce:
1657 : /* yyn is the number of a rule to reduce with. */
1658 9488 : yylen = yyr2[yyn];
1659 :
1660 : /* If YYLEN is nonzero, implement the default value of the action:
1661 : '$$ = $1'.
1662 :
1663 : Otherwise, the following line sets YYVAL to garbage.
1664 : This behavior is undocumented and Bison
1665 : users should not rely upon it. Assigning to YYVAL
1666 : unconditionally makes the parser a bit smaller, and it avoids a
1667 : GCC warning that YYVAL may be used uninitialized. */
1668 9488 : yyval = yyvsp[1-yylen];
1669 :
1670 : /* Default location. */
1671 9488 : YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
1672 9488 : yyerror_range[1] = yyloc;
1673 9488 : YY_REDUCE_PRINT (yyn);
1674 9488 : switch (yyn)
1675 : {
1676 601 : case 5:
1677 : #line 139 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1678 : {
1679 : is_ompparser_variable = true;
1680 : }
1681 : #line 1682 "omp_exprparser_parser.cc"
1682 601 : break;
1683 :
1684 601 : case 6:
1685 : #line 141 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1686 : { is_ompparser_variable = false; }
1687 : #line 1688 "omp_exprparser_parser.cc"
1688 601 : break;
1689 :
1690 220 : case 7:
1691 : #line 144 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1692 : {
1693 : is_ompparser_expression = true;
1694 : }
1695 : #line 1696 "omp_exprparser_parser.cc"
1696 220 : break;
1697 :
1698 220 : case 8:
1699 : #line 146 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1700 : {
1701 : is_ompparser_expression = false;
1702 : }
1703 : #line 1704 "omp_exprparser_parser.cc"
1704 220 : break;
1705 :
1706 138 : case 9:
1707 : #line 151 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1708 : {
1709 : is_ompparser_expression = true;
1710 : }
1711 : #line 1712 "omp_exprparser_parser.cc"
1712 138 : break;
1713 :
1714 138 : case 10:
1715 : #line 153 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1716 : {
1717 : is_ompparser_expression = false;
1718 : }
1719 : #line 1720 "omp_exprparser_parser.cc"
1720 138 : break;
1721 :
1722 138 : case 13:
1723 : #line 163 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1724 : { if (!addOmpVariable((const char*)(yyvsp[0].stype))) YYABORT; }
1725 : #line 1726 "omp_exprparser_parser.cc"
1726 : break;
1727 :
1728 0 : case 15:
1729 : #line 164 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1730 : { if (!addOmpVariable((const char*)(yyvsp[0].stype))) YYABORT; }
1731 : #line 1732 "omp_exprparser_parser.cc"
1732 : break;
1733 :
1734 83 : case 21:
1735 : #line 176 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1736 : {lower_exp = current_exp; }
1737 : #line 1738 "omp_exprparser_parser.cc"
1738 83 : break;
1739 :
1740 83 : case 22:
1741 : #line 177 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1742 : { length_exp = current_exp;
1743 : assert (array_symbol != NULL);
1744 : SgType* t = array_symbol->get_type();
1745 : bool isPointer= (isSgPointerType(t) != NULL );
1746 : bool isArray= (isSgArrayType(t) != NULL);
1747 : if (!isPointer && ! isArray )
1748 : {
1749 : std::cerr<<"Error. ompparser.yy expects a pointer or array type."<<std::endl;
1750 : std::cerr<<"while seeing "<<t->class_name()<<std::endl;
1751 : }
1752 : array_dimensions[array_symbol].push_back( std::make_pair (lower_exp, length_exp));
1753 : }
1754 : #line 1755 "omp_exprparser_parser.cc"
1755 83 : break;
1756 :
1757 0 : case 27:
1758 : #line 200 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1759 : {
1760 : current_exp = SageBuilder::buildAssignOp(
1761 : (SgExpression*)((yyvsp[-2].ptype)),
1762 : (SgExpression*)((yyvsp[0].ptype))
1763 : );
1764 : (yyval.ptype) = current_exp;
1765 : }
1766 : #line 1767 "omp_exprparser_parser.cc"
1767 0 : break;
1768 :
1769 0 : case 28:
1770 : #line 207 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1771 : {
1772 : current_exp = SageBuilder::buildRshiftAssignOp(
1773 : (SgExpression*)((yyvsp[-2].ptype)),
1774 : (SgExpression*)((yyvsp[0].ptype))
1775 : );
1776 : (yyval.ptype) = current_exp;
1777 : }
1778 : #line 1779 "omp_exprparser_parser.cc"
1779 0 : break;
1780 :
1781 0 : case 29:
1782 : #line 214 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1783 : {
1784 : current_exp = SageBuilder::buildLshiftAssignOp(
1785 : (SgExpression*)((yyvsp[-2].ptype)),
1786 : (SgExpression*)((yyvsp[0].ptype))
1787 : );
1788 : (yyval.ptype) = current_exp;
1789 : }
1790 : #line 1791 "omp_exprparser_parser.cc"
1791 0 : break;
1792 :
1793 1 : case 30:
1794 : #line 221 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1795 : {
1796 : current_exp = SageBuilder::buildPlusAssignOp(
1797 : (SgExpression*)((yyvsp[-2].ptype)),
1798 : (SgExpression*)((yyvsp[0].ptype))
1799 : );
1800 : (yyval.ptype) = current_exp;
1801 : }
1802 : #line 1803 "omp_exprparser_parser.cc"
1803 1 : break;
1804 :
1805 0 : case 31:
1806 : #line 228 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1807 : {
1808 : current_exp = SageBuilder::buildMinusAssignOp(
1809 : (SgExpression*)((yyvsp[-2].ptype)),
1810 : (SgExpression*)((yyvsp[0].ptype))
1811 : );
1812 : (yyval.ptype) = current_exp;
1813 : }
1814 : #line 1815 "omp_exprparser_parser.cc"
1815 0 : break;
1816 :
1817 0 : case 32:
1818 : #line 235 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1819 : {
1820 : current_exp = SageBuilder::buildMultAssignOp(
1821 : (SgExpression*)((yyvsp[-2].ptype)),
1822 : (SgExpression*)((yyvsp[0].ptype))
1823 : );
1824 : (yyval.ptype) = current_exp;
1825 : }
1826 : #line 1827 "omp_exprparser_parser.cc"
1827 0 : break;
1828 :
1829 0 : case 33:
1830 : #line 242 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1831 : {
1832 : current_exp = SageBuilder::buildDivAssignOp(
1833 : (SgExpression*)((yyvsp[-2].ptype)),
1834 : (SgExpression*)((yyvsp[0].ptype))
1835 : );
1836 : (yyval.ptype) = current_exp;
1837 : }
1838 : #line 1839 "omp_exprparser_parser.cc"
1839 0 : break;
1840 :
1841 0 : case 34:
1842 : #line 249 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1843 : {
1844 : current_exp = SageBuilder::buildModAssignOp(
1845 : (SgExpression*)((yyvsp[-2].ptype)),
1846 : (SgExpression*)((yyvsp[0].ptype))
1847 : );
1848 : (yyval.ptype) = current_exp;
1849 : }
1850 : #line 1851 "omp_exprparser_parser.cc"
1851 0 : break;
1852 :
1853 0 : case 35:
1854 : #line 256 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1855 : {
1856 : current_exp = SageBuilder::buildAndAssignOp(
1857 : (SgExpression*)((yyvsp[-2].ptype)),
1858 : (SgExpression*)((yyvsp[0].ptype))
1859 : );
1860 : (yyval.ptype) = current_exp;
1861 : }
1862 : #line 1863 "omp_exprparser_parser.cc"
1863 0 : break;
1864 :
1865 0 : case 36:
1866 : #line 263 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1867 : {
1868 : current_exp = SageBuilder::buildXorAssignOp(
1869 : (SgExpression*)((yyvsp[-2].ptype)),
1870 : (SgExpression*)((yyvsp[0].ptype))
1871 : );
1872 : (yyval.ptype) = current_exp;
1873 : }
1874 : #line 1875 "omp_exprparser_parser.cc"
1875 0 : break;
1876 :
1877 0 : case 37:
1878 : #line 270 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1879 : {
1880 : current_exp = SageBuilder::buildIorAssignOp(
1881 : (SgExpression*)((yyvsp[-2].ptype)),
1882 : (SgExpression*)((yyvsp[0].ptype))
1883 : );
1884 : (yyval.ptype) = current_exp;
1885 : }
1886 : #line 1887 "omp_exprparser_parser.cc"
1887 0 : break;
1888 :
1889 0 : case 38:
1890 : #line 279 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1891 : {
1892 : current_exp = SageBuilder::buildConditionalExp(
1893 : (SgExpression*)((yyvsp[-4].ptype)),
1894 : (SgExpression*)((yyvsp[-2].ptype)),
1895 : (SgExpression*)((yyvsp[0].ptype))
1896 : );
1897 : (yyval.ptype) = current_exp;
1898 : }
1899 : #line 1900 "omp_exprparser_parser.cc"
1900 0 : break;
1901 :
1902 0 : case 40:
1903 : #line 290 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1904 : {
1905 : current_exp = SageBuilder::buildOrOp(
1906 : (SgExpression*)((yyvsp[-2].ptype)),
1907 : (SgExpression*)((yyvsp[0].ptype))
1908 : );
1909 : (yyval.ptype) = current_exp;
1910 : }
1911 : #line 1912 "omp_exprparser_parser.cc"
1912 0 : break;
1913 :
1914 0 : case 42:
1915 : #line 300 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1916 : {
1917 : current_exp = SageBuilder::buildAndOp(
1918 : (SgExpression*)((yyvsp[-2].ptype)),
1919 : (SgExpression*)((yyvsp[0].ptype))
1920 : );
1921 : (yyval.ptype) = current_exp;
1922 : }
1923 : #line 1924 "omp_exprparser_parser.cc"
1924 0 : break;
1925 :
1926 0 : case 44:
1927 : #line 310 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1928 : {
1929 : current_exp = SageBuilder::buildBitOrOp(
1930 : (SgExpression*)((yyvsp[-2].ptype)),
1931 : (SgExpression*)((yyvsp[0].ptype))
1932 : );
1933 : (yyval.ptype) = current_exp;
1934 : }
1935 : #line 1936 "omp_exprparser_parser.cc"
1936 0 : break;
1937 :
1938 0 : case 46:
1939 : #line 320 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1940 : {
1941 : current_exp = SageBuilder::buildBitXorOp(
1942 : (SgExpression*)((yyvsp[-2].ptype)),
1943 : (SgExpression*)((yyvsp[0].ptype))
1944 : );
1945 : (yyval.ptype) = current_exp;
1946 : }
1947 : #line 1948 "omp_exprparser_parser.cc"
1948 0 : break;
1949 :
1950 0 : case 48:
1951 : #line 330 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1952 : {
1953 : current_exp = SageBuilder::buildBitAndOp(
1954 : (SgExpression*)((yyvsp[-2].ptype)),
1955 : (SgExpression*)((yyvsp[0].ptype))
1956 : );
1957 : (yyval.ptype) = current_exp;
1958 : }
1959 : #line 1960 "omp_exprparser_parser.cc"
1960 0 : break;
1961 :
1962 6 : case 50:
1963 : #line 340 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1964 : {
1965 : current_exp = SageBuilder::buildEqualityOp(
1966 : (SgExpression*)((yyvsp[-2].ptype)),
1967 : (SgExpression*)((yyvsp[0].ptype))
1968 : );
1969 : (yyval.ptype) = current_exp;
1970 : }
1971 : #line 1972 "omp_exprparser_parser.cc"
1972 6 : break;
1973 :
1974 5 : case 51:
1975 : #line 347 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1976 : {
1977 : current_exp = SageBuilder::buildNotEqualOp(
1978 : (SgExpression*)((yyvsp[-2].ptype)),
1979 : (SgExpression*)((yyvsp[0].ptype))
1980 : );
1981 : (yyval.ptype) = current_exp;
1982 : }
1983 : #line 1984 "omp_exprparser_parser.cc"
1984 5 : break;
1985 :
1986 3 : case 53:
1987 : #line 357 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
1988 : {
1989 : current_exp = SageBuilder::buildLessThanOp(
1990 : (SgExpression*)((yyvsp[-2].ptype)),
1991 : (SgExpression*)((yyvsp[0].ptype))
1992 : );
1993 : (yyval.ptype) = current_exp;
1994 : // std::cout<<"debug: buildLessThanOp():\n"<<current_exp->unparseToString()<<std::endl;
1995 : }
1996 : #line 1997 "omp_exprparser_parser.cc"
1997 3 : break;
1998 :
1999 4 : case 54:
2000 : #line 365 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2001 : {
2002 : current_exp = SageBuilder::buildGreaterThanOp(
2003 : (SgExpression*)((yyvsp[-2].ptype)),
2004 : (SgExpression*)((yyvsp[0].ptype))
2005 : );
2006 : (yyval.ptype) = current_exp;
2007 : }
2008 : #line 2009 "omp_exprparser_parser.cc"
2009 4 : break;
2010 :
2011 0 : case 55:
2012 : #line 372 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2013 : {
2014 : current_exp = SageBuilder::buildLessOrEqualOp(
2015 : (SgExpression*)((yyvsp[-2].ptype)),
2016 : (SgExpression*)((yyvsp[0].ptype))
2017 : );
2018 : (yyval.ptype) = current_exp;
2019 : }
2020 : #line 2021 "omp_exprparser_parser.cc"
2021 0 : break;
2022 :
2023 0 : case 56:
2024 : #line 379 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2025 : {
2026 : current_exp = SageBuilder::buildGreaterOrEqualOp(
2027 : (SgExpression*)((yyvsp[-2].ptype)),
2028 : (SgExpression*)((yyvsp[0].ptype))
2029 : );
2030 : (yyval.ptype) = current_exp;
2031 : }
2032 : #line 2033 "omp_exprparser_parser.cc"
2033 0 : break;
2034 :
2035 0 : case 58:
2036 : #line 389 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2037 : {
2038 : current_exp = SageBuilder::buildRshiftOp(
2039 : (SgExpression*)((yyvsp[-2].ptype)),
2040 : (SgExpression*)((yyvsp[0].ptype))
2041 : );
2042 : (yyval.ptype) = current_exp;
2043 : }
2044 : #line 2045 "omp_exprparser_parser.cc"
2045 0 : break;
2046 :
2047 0 : case 59:
2048 : #line 396 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2049 : {
2050 : current_exp = SageBuilder::buildLshiftOp(
2051 : (SgExpression*)((yyvsp[-2].ptype)),
2052 : (SgExpression*)((yyvsp[0].ptype))
2053 : );
2054 : (yyval.ptype) = current_exp;
2055 : }
2056 : #line 2057 "omp_exprparser_parser.cc"
2057 0 : break;
2058 :
2059 0 : case 61:
2060 : #line 406 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2061 : {
2062 : current_exp = SageBuilder::buildAddOp(
2063 : (SgExpression*)((yyvsp[-2].ptype)),
2064 : (SgExpression*)((yyvsp[0].ptype))
2065 : );
2066 : (yyval.ptype) = current_exp;
2067 : }
2068 : #line 2069 "omp_exprparser_parser.cc"
2069 0 : break;
2070 :
2071 1 : case 62:
2072 : #line 413 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2073 : {
2074 : current_exp = SageBuilder::buildSubtractOp(
2075 : (SgExpression*)((yyvsp[-2].ptype)),
2076 : (SgExpression*)((yyvsp[0].ptype))
2077 : );
2078 : (yyval.ptype) = current_exp;
2079 : }
2080 : #line 2081 "omp_exprparser_parser.cc"
2081 1 : break;
2082 :
2083 0 : case 64:
2084 : #line 423 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2085 : {
2086 : current_exp = SageBuilder::buildMultiplyOp(
2087 : (SgExpression*)((yyvsp[-2].ptype)),
2088 : (SgExpression*)((yyvsp[0].ptype))
2089 : );
2090 : (yyval.ptype) = current_exp;
2091 : }
2092 : #line 2093 "omp_exprparser_parser.cc"
2093 0 : break;
2094 :
2095 0 : case 65:
2096 : #line 430 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2097 : {
2098 : current_exp = SageBuilder::buildDivideOp(
2099 : (SgExpression*)((yyvsp[-2].ptype)),
2100 : (SgExpression*)((yyvsp[0].ptype))
2101 : );
2102 : (yyval.ptype) = current_exp;
2103 : }
2104 : #line 2105 "omp_exprparser_parser.cc"
2105 0 : break;
2106 :
2107 0 : case 66:
2108 : #line 437 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2109 : {
2110 : current_exp = SageBuilder::buildModOp(
2111 : (SgExpression*)((yyvsp[-2].ptype)),
2112 : (SgExpression*)((yyvsp[0].ptype))
2113 : );
2114 : (yyval.ptype) = current_exp;
2115 : }
2116 : #line 2117 "omp_exprparser_parser.cc"
2117 0 : break;
2118 :
2119 241 : case 67:
2120 : #line 446 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2121 : {
2122 : current_exp = SageBuilder::buildIntVal((yyvsp[0].itype));
2123 : (yyval.ptype) = current_exp;
2124 : }
2125 : #line 2126 "omp_exprparser_parser.cc"
2126 241 : break;
2127 :
2128 165 : case 68:
2129 : #line 450 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2130 : {
2131 : current_exp = SageBuilder::buildVarRefExp(
2132 : (const char*)((yyvsp[0].stype)),SageInterface::getScope(omp_directive_node)
2133 : );
2134 : (yyval.ptype) = current_exp;
2135 : }
2136 : #line 2137 "omp_exprparser_parser.cc"
2137 165 : break;
2138 :
2139 0 : case 69:
2140 : #line 456 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2141 : {
2142 : (yyval.ptype) = current_exp;
2143 : }
2144 : #line 2145 "omp_exprparser_parser.cc"
2145 0 : break;
2146 :
2147 1 : case 70:
2148 : #line 461 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2149 : {
2150 : current_exp = (SgExpression*)((yyvsp[0].ptype));
2151 : (yyval.ptype) = current_exp;
2152 : }
2153 : #line 2154 "omp_exprparser_parser.cc"
2154 1 : break;
2155 :
2156 0 : case 71:
2157 : #line 465 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2158 : {
2159 : current_exp = SageBuilder::buildPlusPlusOp(
2160 : (SgExpression*)((yyvsp[0].ptype)),
2161 : SgUnaryOp::prefix
2162 : );
2163 : (yyval.ptype) = current_exp;
2164 : }
2165 : #line 2166 "omp_exprparser_parser.cc"
2166 0 : break;
2167 :
2168 0 : case 72:
2169 : #line 472 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2170 : {
2171 : current_exp = SageBuilder::buildMinusMinusOp(
2172 : (SgExpression*)((yyvsp[0].ptype)),
2173 : SgUnaryOp::prefix
2174 : );
2175 : (yyval.ptype) = current_exp;
2176 : }
2177 : #line 2178 "omp_exprparser_parser.cc"
2178 0 : break;
2179 :
2180 1 : case 73:
2181 : #line 482 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2182 : {
2183 : arraySection= false;
2184 : current_exp = (SgExpression*)((yyvsp[0].ptype));
2185 : (yyval.ptype) = current_exp;
2186 : }
2187 : #line 2188 "omp_exprparser_parser.cc"
2188 1 : break;
2189 :
2190 0 : case 74:
2191 : #line 487 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2192 : {
2193 : arraySection= false;
2194 : current_exp = SageBuilder::buildPntrArrRefExp((SgExpression*)((yyvsp[-3].ptype)), (SgExpression*)((yyvsp[-1].ptype)));
2195 : (yyval.ptype) = current_exp;
2196 : }
2197 : #line 2198 "omp_exprparser_parser.cc"
2198 0 : break;
2199 :
2200 0 : case 75:
2201 : #line 493 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2202 : {
2203 : arraySection= true; // array section // TODO; BEST solution: still need a tree here!!
2204 : // only add symbol to the attribute for this first time
2205 : // postfix_expr should be ID_EXPRESSION
2206 : if (!array_symbol)
2207 : {
2208 : SgVarRefExp* vref = isSgVarRefExp((SgExpression*)((yyvsp[-5].ptype)));
2209 : assert (vref);
2210 : //array_symbol = ompattribute->addVariable(omptype, vref->unparseToString());
2211 : }
2212 : lower_exp= NULL;
2213 : length_exp= NULL;
2214 : lower_exp = (SgExpression*)((yyvsp[-3].ptype));
2215 : length_exp = (SgExpression*)((yyvsp[-1].ptype));
2216 : assert (array_symbol != NULL);
2217 : SgType* t = array_symbol->get_type();
2218 : bool isPointer= (isSgPointerType(t) != NULL );
2219 : bool isArray= (isSgArrayType(t) != NULL);
2220 : if (!isPointer && ! isArray )
2221 : {
2222 : std::cerr<<"Error. ompparser.yy expects a pointer or array type."<<std::endl;
2223 : std::cerr<<"while seeing "<<t->class_name()<<std::endl;
2224 : }
2225 : assert (lower_exp && length_exp);
2226 : //ompattribute->array_dimensions[array_symbol].push_back( std::make_pair (lower_exp, length_exp));
2227 : }
2228 : #line 2229 "omp_exprparser_parser.cc"
2229 : break;
2230 :
2231 0 : case 76:
2232 : #line 519 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2233 : {
2234 : current_exp = SageBuilder::buildPlusPlusOp(
2235 : (SgExpression*)((yyvsp[-1].ptype)),
2236 : SgUnaryOp::postfix
2237 : );
2238 : (yyval.ptype) = current_exp;
2239 : }
2240 : #line 2241 "omp_exprparser_parser.cc"
2241 0 : break;
2242 :
2243 0 : case 77:
2244 : #line 526 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2245 : {
2246 : current_exp = SageBuilder::buildMinusMinusOp(
2247 : (SgExpression*)((yyvsp[-1].ptype)),
2248 : SgUnaryOp::postfix
2249 : );
2250 : (yyval.ptype) = current_exp;
2251 : }
2252 : #line 2253 "omp_exprparser_parser.cc"
2253 0 : break;
2254 :
2255 601 : case 78:
2256 : #line 543 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2257 : {
2258 : std::cout << "Got expression: " << (yyvsp[0].stype) << "\n";
2259 : addOmpVariable((const char*)(yyvsp[0].stype));
2260 : }
2261 : #line 2262 "omp_exprparser_parser.cc"
2262 : break;
2263 :
2264 0 : case 79:
2265 : #line 547 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2266 : {
2267 : std::cout << "Got expression: " << (yyvsp[0].stype) << "\n";
2268 : addOmpVariable((const char*)(yyvsp[0].stype));
2269 : }
2270 : #line 2271 "omp_exprparser_parser.cc"
2271 : break;
2272 :
2273 :
2274 : #line 2275 "omp_exprparser_parser.cc"
2275 :
2276 : default: break;
2277 : }
2278 : /* User semantic actions sometimes alter yychar, and that requires
2279 : that yytoken be updated with the new translation. We take the
2280 : approach of translating immediately before every use of yytoken.
2281 : One alternative is translating here after every semantic action,
2282 : but that translation would be missed if the semantic action invokes
2283 : YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
2284 : if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
2285 : incorrect destructor might then be invoked immediately. In the
2286 : case of YYERROR or YYBACKUP, subsequent parser actions might lead
2287 : to an incorrect destructor call or verbose syntax error message
2288 : before the lookahead is translated. */
2289 9488 : YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
2290 :
2291 9488 : YYPOPSTACK (yylen);
2292 9488 : yylen = 0;
2293 9488 : YY_STACK_PRINT (yyss, yyssp);
2294 :
2295 9488 : *++yyvsp = yyval;
2296 9488 : *++yylsp = yyloc;
2297 :
2298 : /* Now 'shift' the result of the reduction. Determine what state
2299 : that goes to, based on the state we popped back to and the rule
2300 : number reduced by. */
2301 9488 : {
2302 9488 : const int yylhs = yyr1[yyn] - YYNTOKENS;
2303 9488 : const int yyi = yypgoto[yylhs] + *yyssp;
2304 3468 : yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
2305 9720 : ? yytable[yyi]
2306 9256 : : yydefgoto[yylhs]);
2307 : }
2308 :
2309 9488 : goto yynewstate;
2310 :
2311 :
2312 : /*--------------------------------------.
2313 : | yyerrlab -- here on detecting error. |
2314 : `--------------------------------------*/
2315 0 : yyerrlab:
2316 : /* Make sure we have latest lookahead translation. See comments at
2317 : user semantic actions for why this is necessary. */
2318 0 : yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
2319 :
2320 : /* If not already recovering from an error, report this error. */
2321 0 : if (!yyerrstatus)
2322 : {
2323 0 : ++yynerrs;
2324 : #if ! YYERROR_VERBOSE
2325 : yyerror (YY_("syntax error"));
2326 : #else
2327 : # define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
2328 : yyssp, yytoken)
2329 0 : {
2330 0 : char const *yymsgp = YY_("syntax error");
2331 0 : int yysyntax_error_status;
2332 0 : yysyntax_error_status = YYSYNTAX_ERROR;
2333 0 : if (yysyntax_error_status == 0)
2334 0 : yymsgp = yymsg;
2335 0 : else if (yysyntax_error_status == 1)
2336 : {
2337 0 : if (yymsg != yymsgbuf)
2338 0 : YYSTACK_FREE (yymsg);
2339 0 : yymsg = YY_CAST (char *, YYSTACK_ALLOC (YY_CAST (YYSIZE_T, yymsg_alloc)));
2340 0 : if (!yymsg)
2341 : {
2342 0 : yymsg = yymsgbuf;
2343 0 : yymsg_alloc = sizeof yymsgbuf;
2344 0 : yysyntax_error_status = 2;
2345 : }
2346 : else
2347 : {
2348 0 : yysyntax_error_status = YYSYNTAX_ERROR;
2349 0 : yymsgp = yymsg;
2350 : }
2351 : }
2352 0 : yyerror (yymsgp);
2353 : if (yysyntax_error_status == 2)
2354 : goto yyexhaustedlab;
2355 : }
2356 : # undef YYSYNTAX_ERROR
2357 : #endif
2358 : }
2359 :
2360 : yyerror_range[1] = yylloc;
2361 :
2362 : if (yyerrstatus == 3)
2363 : {
2364 : /* If just tried and failed to reuse lookahead token after an
2365 : error, discard it. */
2366 :
2367 : if (yychar <= YYEOF)
2368 : {
2369 : /* Return failure if at end of input. */
2370 : if (yychar == YYEOF)
2371 : YYABORT;
2372 : }
2373 : else
2374 : {
2375 : yydestruct ("Error: discarding",
2376 : yytoken, &yylval, &yylloc);
2377 : yychar = YYEMPTY;
2378 : }
2379 : }
2380 :
2381 : /* Else will try to reuse lookahead token after shifting the error
2382 : token. */
2383 : goto yyerrlab1;
2384 :
2385 :
2386 : /*---------------------------------------------------.
2387 : | yyerrorlab -- error raised explicitly by YYERROR. |
2388 : `---------------------------------------------------*/
2389 : yyerrorlab:
2390 : /* Pacify compilers when the user code never invokes YYERROR and the
2391 : label yyerrorlab therefore never appears in user code. */
2392 : if (0)
2393 : YYERROR;
2394 :
2395 : /* Do not reclaim the symbols of the rule whose action triggered
2396 : this YYERROR. */
2397 : YYPOPSTACK (yylen);
2398 : yylen = 0;
2399 : YY_STACK_PRINT (yyss, yyssp);
2400 : yystate = *yyssp;
2401 : goto yyerrlab1;
2402 :
2403 :
2404 : /*-------------------------------------------------------------.
2405 : | yyerrlab1 -- common code for both syntax error and YYERROR. |
2406 : `-------------------------------------------------------------*/
2407 : yyerrlab1:
2408 : yyerrstatus = 3; /* Each real token shifted decrements this. */
2409 :
2410 : for (;;)
2411 : {
2412 : yyn = yypact[yystate];
2413 : if (!yypact_value_is_default (yyn))
2414 : {
2415 : yyn += YYTERROR;
2416 : if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
2417 : {
2418 : yyn = yytable[yyn];
2419 : if (0 < yyn)
2420 : break;
2421 : }
2422 : }
2423 :
2424 : /* Pop the current state because it cannot handle the error token. */
2425 : if (yyssp == yyss)
2426 : YYABORT;
2427 :
2428 : yyerror_range[1] = *yylsp;
2429 : yydestruct ("Error: popping",
2430 : yystos[yystate], yyvsp, yylsp);
2431 : YYPOPSTACK (1);
2432 : yystate = *yyssp;
2433 : YY_STACK_PRINT (yyss, yyssp);
2434 : }
2435 :
2436 : YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
2437 : *++yyvsp = yylval;
2438 : YY_IGNORE_MAYBE_UNINITIALIZED_END
2439 :
2440 : yyerror_range[2] = yylloc;
2441 : /* Using YYLLOC is tempting, but would change the location of
2442 : the lookahead. YYLOC is available though. */
2443 : YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
2444 : *++yylsp = yyloc;
2445 :
2446 : /* Shift the error token. */
2447 : YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
2448 :
2449 : yystate = yyn;
2450 : goto yynewstate;
2451 :
2452 :
2453 : /*-------------------------------------.
2454 : | yyacceptlab -- YYACCEPT comes here. |
2455 : `-------------------------------------*/
2456 959 : yyacceptlab:
2457 959 : yyresult = 0;
2458 959 : goto yyreturn;
2459 :
2460 :
2461 : /*-----------------------------------.
2462 : | yyabortlab -- YYABORT comes here. |
2463 : `-----------------------------------*/
2464 0 : yyabortlab:
2465 0 : yyresult = 1;
2466 0 : goto yyreturn;
2467 :
2468 :
2469 : #if !defined yyoverflow || YYERROR_VERBOSE
2470 : /*-------------------------------------------------.
2471 : | yyexhaustedlab -- memory exhaustion comes here. |
2472 : `-------------------------------------------------*/
2473 0 : yyexhaustedlab:
2474 0 : yyerror (YY_("memory exhausted"));
2475 : yyresult = 2;
2476 : /* Fall through. */
2477 : #endif
2478 :
2479 :
2480 : /*-----------------------------------------------------.
2481 : | yyreturn -- parsing is finished, return the result. |
2482 : `-----------------------------------------------------*/
2483 959 : yyreturn:
2484 959 : if (yychar != YYEMPTY)
2485 : {
2486 : /* Make sure we have latest lookahead translation. See comments at
2487 : user semantic actions for why this is necessary. */
2488 959 : yytoken = YYTRANSLATE (yychar);
2489 : yydestruct ("Cleanup: discarding lookahead",
2490 : yytoken, &yylval, &yylloc);
2491 : }
2492 : /* Do not reclaim the symbols of the rule whose action triggered
2493 : this YYABORT or YYACCEPT. */
2494 959 : YYPOPSTACK (yylen);
2495 959 : YY_STACK_PRINT (yyss, yyssp);
2496 959 : while (yyssp != yyss)
2497 : {
2498 : yydestruct ("Cleanup: popping",
2499 : yystos[+*yyssp], yyvsp, yylsp);
2500 : YYPOPSTACK (1);
2501 : }
2502 : #ifndef yyoverflow
2503 959 : if (yyss != yyssa)
2504 0 : YYSTACK_FREE (yyss);
2505 : #endif
2506 : #if YYERROR_VERBOSE
2507 959 : if (yymsg != yymsgbuf)
2508 0 : YYSTACK_FREE (yymsg);
2509 : #endif
2510 959 : return yyresult;
2511 : }
2512 : #line 552 "../../../../rexompiler/src/frontend/SageIII/omp_exprparser_parser.yy"
2513 :
2514 : int yyerror(const char *s) {
2515 : SgLocatedNode* lnode = isSgLocatedNode(omp_directive_node);
2516 : assert (lnode);
2517 : printf("Error when parsing pragma:\n\t %s \n\t associated with node at line %d\n", orig_str, lnode->get_file_info()->get_line());
2518 : printf(" %s!\n", s);
2519 : assert(0);
2520 : return 0; // we want to the program to stop on error
2521 : }
2522 :
2523 : void omp_exprparser_parser_init(SgNode* directive, const char* str) {
2524 : orig_str = str;
2525 : omp_exprparser_lexer_init(str);
2526 : omp_directive_node = directive;
2527 : }
2528 :
2529 : // Grab all explicit? variables declared within a common block and add them into the omp variable list
2530 : static void ofs_add_block_variables (const char* block_name)
2531 : {
2532 : std::vector<SgCommonBlock*> block_vec = SageInterface::getSgNodeListFromMemoryPool<SgCommonBlock>();
2533 : SgCommonBlockObject* found_block_object = NULL;
2534 : for (std::vector<SgCommonBlock*>::const_iterator i = block_vec.begin();
2535 : i!= block_vec.end();i++)
2536 : {
2537 : bool innerbreak = false;
2538 : SgCommonBlock* c_block = *i;
2539 : SgCommonBlockObjectPtrList & blockList = c_block->get_block_list();
2540 : SgCommonBlockObjectPtrList::iterator i2 = blockList.begin();
2541 : while (i2 != blockList.end())
2542 : {
2543 : std::string name = (*i2)->get_block_name();
2544 : if (strcmp(block_name, name.c_str())==0)
2545 : {
2546 : found_block_object = *i2;
2547 : innerbreak = true;
2548 : break;
2549 : }
2550 : i2++;
2551 : }// end while block objects
2552 :
2553 : if (innerbreak)
2554 : break;
2555 : } // end for all blocks
2556 :
2557 : if (found_block_object == NULL)
2558 : {
2559 : printf("error: cannot find a common block with a name of %s\n",block_name);
2560 : ROSE_ABORT();
2561 : }
2562 :
2563 : // add each variable within the block into ompattribute
2564 : SgExprListExp * explistexp = found_block_object->get_variable_reference_list ();
2565 : assert(explistexp != NULL);
2566 : SgExpressionPtrList& explist = explistexp->get_expressions();
2567 :
2568 : Rose_STL_Container<SgExpression*>::const_iterator exp_iter = explist.begin();
2569 : assert (explist.size()>0); // must have variable defined
2570 : while (exp_iter !=explist.end())
2571 : {
2572 : SgVarRefExp * var_exp = isSgVarRefExp(*exp_iter);
2573 : assert (var_exp!=NULL);
2574 : SgVariableSymbol * symbol = isSgVariableSymbol(var_exp->get_symbol());
2575 : assert (symbol!=NULL);
2576 : SgInitializedName* sgvar = symbol->get_declaration();
2577 : const char* var = sgvar->get_name().getString().c_str();
2578 : if (sgvar != NULL) {
2579 : symbol = isSgVariableSymbol(sgvar->get_symbol_from_symbol_table());
2580 : };
2581 : omp_variable_list.push_back(std::make_pair(var, sgvar));
2582 : exp_iter++;
2583 : }
2584 : }
2585 :
2586 : static bool addOmpVariable(const char* var) {
2587 :
2588 : // if the leading symbol is '/', it is a block name in Fortran
2589 : if (var[0] == '/') {
2590 : std::string block_name = std::string(var);
2591 : block_name.pop_back();
2592 : ofs_add_block_variables(block_name.c_str()+1);
2593 : return true;
2594 : }
2595 :
2596 : SgInitializedName* sgvar = NULL;
2597 : SgVariableSymbol* symbol = NULL;
2598 : SgScopeStatement* scope = NULL;
2599 :
2600 : if (omp_exprparser_look_forward != true) {
2601 : scope = SageInterface::getScope(omp_directive_node);
2602 : }
2603 : else {
2604 : SgStatement* cur_stmt = getEnclosingStatement(omp_directive_node);
2605 : ROSE_ASSERT (isSgPragmaDeclaration(cur_stmt));
2606 :
2607 : // omp declare simd may show up several times before the impacted function declaration.
2608 : SgStatement* nstmt = getNextStatement(cur_stmt);
2609 : ROSE_ASSERT (nstmt); // must have next statement followed.
2610 : // skip possible multiple pragma declarations
2611 : while (!isSgFunctionDeclaration(nstmt)) {
2612 : nstmt = getNextStatement (nstmt);
2613 : ROSE_ASSERT (nstmt);
2614 : };
2615 : // At this point, it must be a function declaration
2616 : SgFunctionDeclaration* func = isSgFunctionDeclaration(nstmt);
2617 : ROSE_ASSERT (func);
2618 : SgFunctionDefinition* def = func->get_definition();
2619 : scope = def->get_body();
2620 : };
2621 :
2622 : ROSE_ASSERT(scope != NULL);
2623 : symbol = lookupVariableSymbolInParentScopes(var, scope);
2624 : sgvar = symbol->get_declaration();
2625 : if (sgvar != NULL) {
2626 : symbol = isSgVariableSymbol(sgvar->get_symbol_from_symbol_table());
2627 : };
2628 : omp_variable_list.push_back(std::make_pair(var, sgvar));
2629 : array_symbol = symbol;
2630 : return true;
2631 : }
2632 :
2633 : SgExpression* parseArraySectionExpression(SgNode* directive, bool look_forward, const char* str) {
2634 : orig_str = str;
2635 : omp_exprparser_lexer_init(str);
2636 : omp_directive_node = directive;
2637 : omp_exprparser_look_forward = look_forward;
2638 : omp_exprparser_parse();
2639 : SgExpression* sg_expression = current_exp;
2640 :
2641 : return sg_expression;
2642 : }
2643 :
2644 : SgExpression* parseExpression(SgNode* directive, bool look_forward, const char* str) {
2645 : orig_str = str;
2646 : omp_exprparser_lexer_init(str);
2647 : omp_directive_node = directive;
2648 : omp_exprparser_look_forward = look_forward;
2649 : omp_exprparser_parse();
2650 : SgExpression* sg_expression = current_exp;
2651 :
2652 : return sg_expression;
2653 : }
|