summaryrefslogtreecommitdiffstats
path: root/src/parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c2907
1 files changed, 1597 insertions, 1310 deletions
diff --git a/src/parser.c b/src/parser.c
index 82bf21d6..28d47c50 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+ Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -15,7 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -33,6 +34,10 @@
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+ especially those whose name start with YY_ or yy_. They are
+ private implementation details that can be changed or removed. */
+
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
@@ -40,11 +45,11 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-/* Identify Bison output. */
-#define YYBISON 1
+/* Identify Bison output, and Bison version. */
+#define YYBISON 30802
-/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
+/* Bison version string. */
+#define YYBISON_VERSION "3.8.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -61,8 +66,8 @@
-/* Copy the first part of user declarations. */
-#line 1 "src/parser.y" /* yacc.c:339 */
+/* First part of user prologue. */
+#line 1 "src/parser.y"
#include <assert.h>
#include <math.h>
@@ -73,26 +78,31 @@
#define YYMALLOC jv_mem_alloc
#define YYFREE jv_mem_free
-#line 77 "src/parser.c" /* yacc.c:339 */
+#line 82 "src/parser.c"
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
# else
-# define YY_NULLPTR 0
+# define YY_NULLPTR ((void*)0)
# endif
# endif
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 1
-#endif
-
-/* In a future release of Bison, this section will be replaced
- by #include "y.tab.h". */
+/* Use api.header.include to #include this header
+ instead of duplicating it here. */
#ifndef YY_YY_SRC_PARSER_H_INCLUDED
# define YY_YY_SRC_PARSER_H_INCLUDED
/* Debug traces. */
@@ -103,7 +113,7 @@
extern int yydebug;
#endif
/* "%code requires" blocks. */
-#line 11 "src/parser.y" /* yacc.c:355 */
+#line 11 "src/parser.y"
#include "locfile.h"
struct lexer_param;
@@ -120,61 +130,70 @@ struct lexer_param;
} \
} while (0)
-#line 124 "src/parser.c" /* yacc.c:355 */
+#line 134 "src/parser.c"
-/* Token type. */
+/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
- INVALID_CHARACTER = 258,
- IDENT = 259,
- FIELD = 260,
- LITERAL = 261,
- FORMAT = 262,
- REC = 263,
- SETMOD = 264,
- EQ = 265,
- NEQ = 266,
- DEFINEDOR = 267,
- AS = 268,
- DEF = 269,
- MODULE = 270,
- IMPORT = 271,
- INCLUDE = 272,
- IF = 273,
- THEN = 274,
- ELSE = 275,
- ELSE_IF = 276,
- REDUCE = 277,
- FOREACH = 278,
- END = 279,
- AND = 280,
- OR = 281,
- TRY = 282,
- CATCH = 283,
- LABEL = 284,
- BREAK = 285,
- LOC = 286,
- SETPIPE = 287,
- SETPLUS = 288,
- SETMINUS = 289,
- SETMULT = 290,
- SETDIV = 291,
- SETDEFINEDOR = 292,
- LESSEQ = 293,
- GREATEREQ = 294,
- ALTERNATION = 295,
- QQSTRING_START = 296,
- QQSTRING_TEXT = 297,
- QQSTRING_INTERP_START = 298,
- QQSTRING_INTERP_END = 299,
- QQSTRING_END = 300,
- FUNCDEF = 301,
- NONOPT = 302
+ YYEMPTY = -2,
+ YYEOF = 0, /* "end of file" */
+ YYerror = 256, /* error */
+ YYUNDEF = 257, /* "invalid token" */
+ INVALID_CHARACTER = 258, /* INVALID_CHARACTER */
+ IDENT = 259, /* IDENT */
+ FIELD = 260, /* FIELD */
+ LITERAL = 261, /* LITERAL */
+ FORMAT = 262, /* FORMAT */
+ REC = 263, /* ".." */
+ SETMOD = 264, /* "%=" */
+ EQ = 265, /* "==" */
+ NEQ = 266, /* "!=" */
+ DEFINEDOR = 267, /* "//" */
+ AS = 268, /* "as" */
+ DEF = 269, /* "def" */
+ MODULE = 270, /* "module" */
+ IMPORT = 271, /* "import" */
+ INCLUDE = 272, /* "include" */
+ IF = 273, /* "if" */
+ THEN = 274, /* "then" */
+ ELSE = 275, /* "else" */
+ ELSE_IF = 276, /* "elif" */
+ REDUCE = 277, /* "reduce" */
+ FOREACH = 278, /* "foreach" */
+ END = 279, /* "end" */
+ AND = 280, /* "and" */
+ OR = 281, /* "or" */
+ TRY = 282, /* "try" */
+ CATCH = 283, /* "catch" */
+ LABEL = 284, /* "label" */
+ BREAK = 285, /* "break" */
+ LOC = 286, /* "__loc__" */
+ SETPIPE = 287, /* "|=" */
+ SETPLUS = 288, /* "+=" */
+ SETMINUS = 289, /* "-=" */
+ SETMULT = 290, /* "*=" */
+ SETDIV = 291, /* "/=" */
+ SETDEFINEDOR = 292, /* "//=" */
+ LESSEQ = 293, /* "<=" */
+ GREATEREQ = 294, /* ">=" */
+ ALTERNATION = 295, /* "?//" */
+ QQSTRING_START = 296, /* QQSTRING_START */
+ QQSTRING_TEXT = 297, /* QQSTRING_TEXT */
+ QQSTRING_INTERP_START = 298, /* QQSTRING_INTERP_START */
+ QQSTRING_INTERP_END = 299, /* QQSTRING_INTERP_END */
+ QQSTRING_END = 300, /* QQSTRING_END */
+ FUNCDEF = 301, /* FUNCDEF */
+ NONOPT = 302 /* NONOPT */
};
+ typedef enum yytokentype yytoken_kind_t;
#endif
-/* Tokens. */
+/* Token kinds. */
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYerror 256
+#define YYUNDEF 257
#define INVALID_CHARACTER 258
#define IDENT 259
#define FIELD 260
@@ -223,17 +242,16 @@ struct lexer_param;
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
union YYSTYPE
{
-#line 31 "src/parser.y" /* yacc.c:355 */
+#line 31 "src/parser.y"
jv literal;
block blk;
-#line 235 "src/parser.c" /* yacc.c:355 */
-};
+#line 253 "src/parser.c"
+};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define YYSTYPE_IS_DECLARED 1
@@ -255,12 +273,120 @@ struct YYLTYPE
+
int yyparse (block* answer, int* errors, struct locfile* locations, struct lexer_param* lexer_param_ptr);
+
#endif /* !YY_YY_SRC_PARSER_H_INCLUDED */
+/* Symbol kind. */
+enum yysymbol_kind_t
+{
+ YYSYMBOL_YYEMPTY = -2,
+ YYSYMBOL_YYEOF = 0, /* "end of file" */
+ YYSYMBOL_YYerror = 1, /* error */
+ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
+ YYSYMBOL_INVALID_CHARACTER = 3, /* INVALID_CHARACTER */
+ YYSYMBOL_IDENT = 4, /* IDENT */
+ YYSYMBOL_FIELD = 5, /* FIELD */
+ YYSYMBOL_LITERAL = 6, /* LITERAL */
+ YYSYMBOL_FORMAT = 7, /* FORMAT */
+ YYSYMBOL_REC = 8, /* ".." */
+ YYSYMBOL_SETMOD = 9, /* "%=" */
+ YYSYMBOL_EQ = 10, /* "==" */
+ YYSYMBOL_NEQ = 11, /* "!=" */
+ YYSYMBOL_DEFINEDOR = 12, /* "//" */
+ YYSYMBOL_AS = 13, /* "as" */
+ YYSYMBOL_DEF = 14, /* "def" */
+ YYSYMBOL_MODULE = 15, /* "module" */
+ YYSYMBOL_IMPORT = 16, /* "import" */
+ YYSYMBOL_INCLUDE = 17, /* "include" */
+ YYSYMBOL_IF = 18, /* "if" */
+ YYSYMBOL_THEN = 19, /* "then" */
+ YYSYMBOL_ELSE = 20, /* "else" */
+ YYSYMBOL_ELSE_IF = 21, /* "elif" */
+ YYSYMBOL_REDUCE = 22, /* "reduce" */
+ YYSYMBOL_FOREACH = 23, /* "foreach" */
+ YYSYMBOL_END = 24, /* "end" */
+ YYSYMBOL_AND = 25, /* "and" */
+ YYSYMBOL_OR = 26, /* "or" */
+ YYSYMBOL_TRY = 27, /* "try" */
+ YYSYMBOL_CATCH = 28, /* "catch" */
+ YYSYMBOL_LABEL = 29, /* "label" */
+ YYSYMBOL_BREAK = 30, /* "break" */
+ YYSYMBOL_LOC = 31, /* "__loc__" */
+ YYSYMBOL_SETPIPE = 32, /* "|=" */
+ YYSYMBOL_SETPLUS = 33, /* "+=" */
+ YYSYMBOL_SETMINUS = 34, /* "-=" */
+ YYSYMBOL_SETMULT = 35, /* "*=" */
+ YYSYMBOL_SETDIV = 36, /* "/=" */
+ YYSYMBOL_SETDEFINEDOR = 37, /* "//=" */
+ YYSYMBOL_LESSEQ = 38, /* "<=" */
+ YYSYMBOL_GREATEREQ = 39, /* ">=" */
+ YYSYMBOL_ALTERNATION = 40, /* "?//" */
+ YYSYMBOL_QQSTRING_START = 41, /* QQSTRING_START */
+ YYSYMBOL_QQSTRING_TEXT = 42, /* QQSTRING_TEXT */
+ YYSYMBOL_QQSTRING_INTERP_START = 43, /* QQSTRING_INTERP_START */
+ YYSYMBOL_QQSTRING_INTERP_END = 44, /* QQSTRING_INTERP_END */
+ YYSYMBOL_QQSTRING_END = 45, /* QQSTRING_END */
+ YYSYMBOL_FUNCDEF = 46, /* FUNCDEF */
+ YYSYMBOL_47_ = 47, /* '|' */
+ YYSYMBOL_48_ = 48, /* ',' */
+ YYSYMBOL_49_ = 49, /* '=' */
+ YYSYMBOL_50_ = 50, /* '<' */
+ YYSYMBOL_51_ = 51, /* '>' */
+ YYSYMBOL_52_ = 52, /* '+' */
+ YYSYMBOL_53_ = 53, /* '-' */
+ YYSYMBOL_54_ = 54, /* '*' */
+ YYSYMBOL_55_ = 55, /* '/' */
+ YYSYMBOL_56_ = 56, /* '%' */
+ YYSYMBOL_NONOPT = 57, /* NONOPT */
+ YYSYMBOL_58_ = 58, /* '?' */
+ YYSYMBOL_59_ = 59, /* ';' */
+ YYSYMBOL_60_ = 60, /* '(' */
+ YYSYMBOL_61_ = 61, /* ')' */
+ YYSYMBOL_62_ = 62, /* '$' */
+ YYSYMBOL_63_ = 63, /* ':' */
+ YYSYMBOL_64_ = 64, /* '.' */
+ YYSYMBOL_65_ = 65, /* '[' */
+ YYSYMBOL_66_ = 66, /* ']' */
+ YYSYMBOL_67_ = 67, /* '{' */
+ YYSYMBOL_68_ = 68, /* '}' */
+ YYSYMBOL_YYACCEPT = 69, /* $accept */
+ YYSYMBOL_TopLevel = 70, /* TopLevel */
+ YYSYMBOL_Module = 71, /* Module */
+ YYSYMBOL_Imports = 72, /* Imports */
+ YYSYMBOL_FuncDefs = 73, /* FuncDefs */
+ YYSYMBOL_Exp = 74, /* Exp */
+ YYSYMBOL_Import = 75, /* Import */
+ YYSYMBOL_ImportWhat = 76, /* ImportWhat */
+ YYSYMBOL_ImportFrom = 77, /* ImportFrom */
+ YYSYMBOL_FuncDef = 78, /* FuncDef */
+ YYSYMBOL_Params = 79, /* Params */
+ YYSYMBOL_Param = 80, /* Param */
+ YYSYMBOL_String = 81, /* String */
+ YYSYMBOL_82_1 = 82, /* @1 */
+ YYSYMBOL_83_2 = 83, /* @2 */
+ YYSYMBOL_QQString = 84, /* QQString */
+ YYSYMBOL_ElseBody = 85, /* ElseBody */
+ YYSYMBOL_ExpD = 86, /* ExpD */
+ YYSYMBOL_Term = 87, /* Term */
+ YYSYMBOL_Args = 88, /* Args */
+ YYSYMBOL_Arg = 89, /* Arg */
+ YYSYMBOL_RepPatterns = 90, /* RepPatterns */
+ YYSYMBOL_Patterns = 91, /* Patterns */
+ YYSYMBOL_Pattern = 92, /* Pattern */
+ YYSYMBOL_ArrayPats = 93, /* ArrayPats */
+ YYSYMBOL_ObjPats = 94, /* ObjPats */
+ YYSYMBOL_ObjPat = 95, /* ObjPat */
+ YYSYMBOL_Keyword = 96, /* Keyword */
+ YYSYMBOL_MkDict = 97, /* MkDict */
+ YYSYMBOL_MkDictPair = 98 /* MkDictPair */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
-/* Copy the second part of user declarations. */
-#line 124 "src/parser.y" /* yacc.c:358 */
+
+/* Second part of user prologue. */
+#line 124 "src/parser.y"
#include "lexer.h"
struct lexer_param {
@@ -440,34 +566,94 @@ static block gen_update(block object, block val, int optype) {
}
-#line 444 "src/parser.c" /* yacc.c:358 */
+#line 570 "src/parser.c"
+
#ifdef short
# undef short
#endif
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+ <limits.h> and (if available) <stdint.h> are included
+ so that the code can choose integer types of a good width. */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_STDINT_H
+# endif
#endif
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
+/* Narrow types that promote to a signed type and that can represent a
+ signed or unsigned integer of at least N bits. In tables they can
+ save space and decrease cache pressure. Promoting to a signed type
+ helps avoid bugs in integer arithmetic. */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
#else
typedef signed char yytype_int8;
#endif
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
#else
-typedef unsigned short int yytype_uint16;
+typedef short yytype_int16;
+#endif
+
+/* Work around bug in HP-UX 11.23, which defines these macros
+ incorrectly for preprocessor constants. This workaround can likely
+ be removed in 2023, as HPE has promised support for HP-UX 11.23
+ (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+ <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
#endif
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
#else
-typedef short int yytype_int16;
+typedef short yytype_uint8;
+#endif
+
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
+#else
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+# define YYPTRDIFF_T __PTRDIFF_TYPE__
+# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+# ifndef ptrdiff_t
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYPTRDIFF_T ptrdiff_t
+# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+# define YYPTRDIFF_T long
+# define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
#endif
#ifndef YYSIZE_T
@@ -475,15 +661,28 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM \
+ YY_CAST (YYPTRDIFF_T, \
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
+ ? YYPTRDIFF_MAXIMUM \
+ : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int16 yy_state_t;
+
+/* State numbers in computations. */
+typedef int yy_state_fast_t;
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
@@ -497,47 +696,43 @@ typedef short int yytype_int16;
# endif
#endif
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define YY_ATTRIBUTE_PURE
+# endif
#endif
#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+# define YY_ATTRIBUTE_UNUSED
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YY_USE(E) ((void) (E))
#else
-# define YYUSE(E) /* empty */
+# define YY_USE(E) /* empty */
#endif
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
_Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+# endif
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
# define YY_INITIAL_VALUE(Value) Value
@@ -550,8 +745,22 @@ typedef short int yytype_int16;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
-#if ! defined yyoverflow || YYERROR_VERBOSE
+
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if 1
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -616,8 +825,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* 1 */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
@@ -627,18 +835,19 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss_alloc;
+ yy_state_t yyss_alloc;
YYSTYPE yyvs_alloc;
YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE) \
+ + YYSIZEOF (YYLTYPE)) \
+ 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
@@ -651,11 +860,11 @@ union yyalloc
# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
- YYSIZE_T yynewbytes; \
+ YYPTRDIFF_T yynewbytes; \
YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
} \
while (0)
@@ -667,12 +876,12 @@ union yyalloc
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
# else
# define YYCOPY(Dst, Src, Count) \
do \
{ \
- YYSIZE_T yyi; \
+ YYPTRDIFF_T yyi; \
for (yyi = 0; yyi < (Count); yyi++) \
(Dst)[yyi] = (Src)[yyi]; \
} \
@@ -695,17 +904,20 @@ union yyalloc
/* YYNSTATES -- Number of states. */
#define YYNSTATES 326
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
-#define YYUNDEFTOK 2
+/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 302
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
+#define YYTRANSLATE(YYX) \
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
+ : YYSYMBOL_YYUNDEF)
/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
-static const yytype_uint8 yytranslate[] =
+ as returned by yylex. */
+static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -741,81 +953,79 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_int16 yyrline[] =
{
- 0, 306, 306, 309, 314, 317, 328, 331, 336, 339,
- 344, 348, 351, 355, 359, 363, 366, 369, 374, 378,
- 382, 387, 394, 398, 402, 406, 410, 414, 418, 422,
- 426, 430, 434, 438, 442, 446, 450, 454, 458, 464,
- 470, 474, 478, 482, 486, 490, 494, 498, 502, 507,
- 510, 527, 536, 543, 551, 562, 567, 573, 576, 581,
- 585, 589, 596, 596, 600, 600, 607, 610, 613, 619,
- 622, 627, 630, 633, 639, 642, 645, 653, 657, 660,
- 663, 666, 669, 672, 675, 678, 681, 685, 691, 694,
- 697, 700, 703, 706, 709, 712, 715, 718, 721, 724,
- 727, 730, 733, 736, 739, 742, 745, 767, 771, 775,
- 784, 796, 801, 802, 803, 804, 807, 810, 815, 820,
- 823, 828, 831, 836, 840, 843, 848, 851, 856, 859,
- 864, 867, 870, 873, 876, 879, 887, 893, 896, 899,
- 902, 905, 908, 911, 914, 917, 920, 923, 926, 929,
- 932, 935, 938, 941, 944, 947, 952, 955, 956, 957,
- 960, 963, 966, 969, 973, 977, 981, 985, 989, 993,
- 1001
+ 0, 306, 306, 309, 314, 317, 332, 335, 340, 343,
+ 348, 352, 355, 359, 363, 367, 370, 373, 378, 382,
+ 386, 391, 398, 402, 406, 410, 414, 418, 422, 426,
+ 430, 434, 438, 442, 446, 450, 454, 458, 462, 468,
+ 474, 478, 482, 486, 490, 494, 498, 502, 506, 511,
+ 514, 531, 540, 547, 555, 566, 571, 577, 580, 585,
+ 589, 593, 600, 600, 604, 604, 611, 614, 617, 623,
+ 626, 631, 634, 637, 643, 646, 649, 657, 661, 664,
+ 667, 670, 673, 676, 679, 682, 685, 689, 695, 698,
+ 701, 704, 707, 710, 713, 716, 719, 722, 725, 728,
+ 731, 734, 737, 740, 743, 746, 749, 771, 775, 779,
+ 788, 800, 805, 806, 807, 808, 811, 814, 819, 824,
+ 827, 832, 835, 840, 844, 847, 852, 855, 860, 863,
+ 868, 871, 874, 877, 880, 883, 891, 897, 900, 903,
+ 906, 909, 912, 915, 918, 921, 924, 927, 930, 933,
+ 936, 939, 942, 945, 948, 951, 956, 959, 960, 961,
+ 964, 967, 970, 973, 977, 981, 985, 989, 993, 997,
+ 1005
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || 1
+/** Accessing symbol of state STATE. */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if 1
+/* The user-facing name of the symbol whose (internal) number is
+ YYSYMBOL. No bounds checking. */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "INVALID_CHARACTER", "IDENT", "FIELD",
- "LITERAL", "FORMAT", "\"..\"", "\"%=\"", "\"==\"", "\"!=\"", "\"//\"",
- "\"as\"", "\"def\"", "\"module\"", "\"import\"", "\"include\"", "\"if\"",
- "\"then\"", "\"else\"", "\"elif\"", "\"reduce\"", "\"foreach\"",
- "\"end\"", "\"and\"", "\"or\"", "\"try\"", "\"catch\"", "\"label\"",
- "\"break\"", "\"__loc__\"", "\"|=\"", "\"+=\"", "\"-=\"", "\"*=\"",
- "\"/=\"", "\"//=\"", "\"<=\"", "\">=\"", "\"?//\"", "QQSTRING_START",
- "QQSTRING_TEXT", "QQSTRING_INTERP_START", "QQSTRING_INTERP_END",
- "QQSTRING_END", "FUNCDEF", "'|'", "','", "'='", "'<'", "'>'", "'+'",
- "'-'", "'*'", "'/'", "'%'", "NONOPT", "'?'", "';'", "'('", "')'", "'$'",
- "':'", "'.'", "'['", "']'", "'{'", "'}'", "$accept", "TopLevel",
- "Module", "Imports", "FuncDefs", "Exp", "Import", "ImportWhat",
- "ImportFrom", "FuncDef", "Params", "Param", "String", "@1", "@2",
- "QQString", "ElseBody", "ExpD", "Term", "Args", "Arg", "RepPatterns",
- "Patterns", "Pattern", "ArrayPats", "ObjPats", "ObjPat", "Keyword",
- "MkDict", "MkDictPair", YY_NULLPTR
+ "\"end of file\"", "error", "\"invalid token\"", "INVALID_CHARACTER",
+ "IDENT", "FIELD", "LITERAL", "FORMAT", "\"..\"", "\"%=\"", "\"==\"",
+ "\"!=\"", "\"//\"", "\"as\"", "\"def\"", "\"module\"", "\"import\"",
+ "\"include\"", "\"if\"", "\"then\"", "\"else\"", "\"elif\"",
+ "\"reduce\"", "\"foreach\"", "\"end\"", "\"and\"", "\"or\"", "\"try\"",
+ "\"catch\"", "\"label\"", "\"break\"", "\"__loc__\"", "\"|=\"", "\"+=\"",
+ "\"-=\"", "\"*=\"", "\"/=\"", "\"//=\"", "\"<=\"", "\">=\"", "\"?//\"",
+ "QQSTRING_START", "QQSTRING_TEXT", "QQSTRING_INTERP_START",
+ "QQSTRING_INTERP_END", "QQSTRING_END", "FUNCDEF", "'|'", "','", "'='",
+ "'<'", "'>'", "'+'", "'-'", "'*'", "'/'", "'%'", "NONOPT", "'?'", "';'",
+ "'('", "')'", "'$'", "':'", "'.'", "'['", "']'", "'{'", "'}'", "$accept",
+ "TopLevel", "Module", "Imports", "FuncDefs", "Exp", "Import",
+ "ImportWhat", "ImportFrom", "FuncDef", "Params", "Param", "String", "@1",
+ "@2", "QQString", "ElseBody", "ExpD", "Term", "Args", "Arg",
+ "RepPatterns", "Patterns", "Pattern", "ArrayPats", "ObjPats", "ObjPat",
+ "Keyword", "MkDict", "MkDictPair", YY_NULLPTR
};
-#endif
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 124, 44, 61,
- 60, 62, 43, 45, 42, 47, 37, 302, 63, 59,
- 40, 41, 36, 58, 46, 91, 93, 123, 125
-};
-# endif
+ return yytname[yysymbol];
+}
+#endif
-#define YYPACT_NINF -120
+#define YYPACT_NINF (-120)
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-120)))
+#define yypact_value_is_default(Yyn) \
+ ((Yyn) == YYPACT_NINF)
-#define YYTABLE_NINF -157
+#define YYTABLE_NINF (-157)
-#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-157)))
+#define yytable_value_is_error(Yyn) \
+ ((Yyn) == YYTABLE_NINF)
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int16 yypact[] =
{
13, 775, 14, 49, -55, 11, -120, 7, -120, 32,
@@ -853,9 +1063,9 @@ static const yytype_int16 yypact[] =
-120, -120, 775, -120, 1357, -120
};
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
static const yytype_uint8 yydefact[] =
{
4, 0, 0, 6, 110, 83, 100, 102, 75, 0,
@@ -893,7 +1103,7 @@ static const yytype_uint8 yydefact[] =
69, 12, 0, 14, 0, 13
};
- /* YYPGOTO[NTERM-NUM]. */
+/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-120, -120, -120, 171, 83, -1, -120, -120, 176, -12,
@@ -901,17 +1111,17 @@ static const yytype_int16 yypgoto[] =
22, -120, -16, -119, -120, -120, -68, -18, -105, -120
};
- /* YYDEFGOTO[NTERM-NUM]. */
+/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
- -1, 2, 3, 30, 119, 111, 31, 32, 116, 24,
+ 0, 2, 3, 30, 119, 111, 31, 32, 116, 24,
201, 202, 25, 44, 128, 137, 258, 218, 26, 126,
127, 184, 185, 186, 228, 234, 235, 82, 83, 84
};
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int16 yytable[] =
{
23, 69, 199, 42, 72, 33, 38, 39, 112, 37,
@@ -1350,9 +1560,9 @@ static const yytype_int16 yycheck[] =
28, 29, 30, 31
};
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+ state STATE-NUM. */
+static const yytype_int8 yystos[] =
{
0, 15, 70, 71, 4, 5, 6, 7, 8, 14,
18, 22, 23, 27, 29, 30, 41, 53, 60, 62,
@@ -1389,8 +1599,8 @@ static const yytype_uint8 yystos[] =
85, 61, 59, 61, 74, 61
};
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
+static const yytype_int8 yyr1[] =
{
0, 69, 70, 70, 71, 71, 72, 72, 73, 73,
74, 74, 74, 74, 74, 74, 74, 74, 74, 74,
@@ -1412,8 +1622,8 @@ static const yytype_uint8 yyr1[] =
98
};
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
+static const yytype_int8 yyr2[] =
{
0, 2, 3, 3, 0, 3, 0, 2, 0, 2,
2, 5, 9, 11, 9, 5, 5, 4, 4, 2,
@@ -1436,39 +1646,39 @@ static const yytype_uint8 yyr2[] =
};
+enum { YYENOMEM = -2 };
+
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
#define YYACCEPT goto yyacceptlab
#define YYABORT goto yyabortlab
#define YYERROR goto yyerrorlab
+#define YYNOMEM goto yyexhaustedlab
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- }