diff --git a/libclamav/yara_grammar.c b/libclamav/yara_grammar.c
index 9c665c587..d8d852d96 100644
--- a/libclamav/yara_grammar.c
+++ b/libclamav/yara_grammar.c
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 . */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -44,7 +44,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.5"
+#define YYBISON_VERSION "3.0.4"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -58,23 +58,17 @@
/* Pull parsers. */
#define YYPULL 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
/* Substitute the variable and function names. */
#define yyparse yara_yyparse
#define yylex yara_yylex
#define yyerror yara_yyerror
-#define yylval yara_yylval
-#define yychar yara_yychar
#define yydebug yara_yydebug
#define yynerrs yara_yynerrs
/* Copy the first part of user declarations. */
-
-/* Line 268 of yacc.c */
-#line 39 "yara_grammar.y"
+#line 39 "yara_grammar.y" /* yacc.c:339 */
#include
@@ -149,14 +143,15 @@
#define MSG(op) "wrong type \"string\" for \"" op "\" operator"
+#line 147 "yara_grammar.c" /* yacc.c:339 */
-/* Line 268 of yacc.c */
-#line 155 "yara_grammar.c"
-
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 1
-#endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus && 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# endif
/* Enabling verbose error messages. */
#ifdef YYERROR_VERBOSE
@@ -166,70 +161,75 @@
# define YYERROR_VERBOSE 0
#endif
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
+/* In a future release of Bison, this section will be replaced
+ by #include "y.tab.h". */
+#ifndef YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED
+# define YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int yara_yydebug;
#endif
-
-/* Tokens. */
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- _RULE_ = 258,
- _PRIVATE_ = 259,
- _GLOBAL_ = 260,
- _META_ = 261,
- _STRINGS_ = 262,
- _CONDITION_ = 263,
- _IDENTIFIER_ = 264,
- _STRING_IDENTIFIER_ = 265,
- _STRING_COUNT_ = 266,
- _STRING_OFFSET_ = 267,
- _STRING_IDENTIFIER_WITH_WILDCARD_ = 268,
- _NUMBER_ = 269,
- _TEXT_STRING_ = 270,
- _HEX_STRING_ = 271,
- _REGEXP_ = 272,
- _ASCII_ = 273,
- _WIDE_ = 274,
- _NOCASE_ = 275,
- _FULLWORD_ = 276,
- _AT_ = 277,
- _FILESIZE_ = 278,
- _ENTRYPOINT_ = 279,
- _ALL_ = 280,
- _ANY_ = 281,
- _IN_ = 282,
- _OF_ = 283,
- _FOR_ = 284,
- _THEM_ = 285,
- _INT8_ = 286,
- _INT16_ = 287,
- _INT32_ = 288,
- _UINT8_ = 289,
- _UINT16_ = 290,
- _UINT32_ = 291,
- _MATCHES_ = 292,
- _CONTAINS_ = 293,
- _IMPORT_ = 294,
- _TRUE_ = 295,
- _FALSE_ = 296,
- _OR_ = 297,
- _AND_ = 298,
- _IS_ = 299,
- _NEQ_ = 300,
- _EQ_ = 301,
- _GE_ = 302,
- _GT_ = 303,
- _LE_ = 304,
- _LT_ = 305,
- _SHIFT_RIGHT_ = 306,
- _SHIFT_LEFT_ = 307,
- _NOT_ = 308
- };
+ enum yytokentype
+ {
+ _RULE_ = 258,
+ _PRIVATE_ = 259,
+ _GLOBAL_ = 260,
+ _META_ = 261,
+ _STRINGS_ = 262,
+ _CONDITION_ = 263,
+ _IDENTIFIER_ = 264,
+ _STRING_IDENTIFIER_ = 265,
+ _STRING_COUNT_ = 266,
+ _STRING_OFFSET_ = 267,
+ _STRING_IDENTIFIER_WITH_WILDCARD_ = 268,
+ _NUMBER_ = 269,
+ _TEXT_STRING_ = 270,
+ _HEX_STRING_ = 271,
+ _REGEXP_ = 272,
+ _ASCII_ = 273,
+ _WIDE_ = 274,
+ _NOCASE_ = 275,
+ _FULLWORD_ = 276,
+ _AT_ = 277,
+ _FILESIZE_ = 278,
+ _ENTRYPOINT_ = 279,
+ _ALL_ = 280,
+ _ANY_ = 281,
+ _IN_ = 282,
+ _OF_ = 283,
+ _FOR_ = 284,
+ _THEM_ = 285,
+ _INT8_ = 286,
+ _INT16_ = 287,
+ _INT32_ = 288,
+ _UINT8_ = 289,
+ _UINT16_ = 290,
+ _UINT32_ = 291,
+ _MATCHES_ = 292,
+ _CONTAINS_ = 293,
+ _IMPORT_ = 294,
+ _TRUE_ = 295,
+ _FALSE_ = 296,
+ _OR_ = 297,
+ _AND_ = 298,
+ _LT_ = 299,
+ _LE_ = 300,
+ _GT_ = 301,
+ _GE_ = 302,
+ _EQ_ = 303,
+ _NEQ_ = 304,
+ _IS_ = 305,
+ _SHIFT_LEFT_ = 306,
+ _SHIFT_RIGHT_ = 307,
+ _NOT_ = 308
+ };
#endif
/* Tokens. */
#define _RULE_ 258
@@ -273,26 +273,23 @@
#define _FALSE_ 296
#define _OR_ 297
#define _AND_ 298
-#define _IS_ 299
-#define _NEQ_ 300
-#define _EQ_ 301
+#define _LT_ 299
+#define _LE_ 300
+#define _GT_ 301
#define _GE_ 302
-#define _GT_ 303
-#define _LE_ 304
-#define _LT_ 305
-#define _SHIFT_RIGHT_ 306
-#define _SHIFT_LEFT_ 307
+#define _EQ_ 303
+#define _NEQ_ 304
+#define _IS_ 305
+#define _SHIFT_LEFT_ 306
+#define _SHIFT_RIGHT_ 307
#define _NOT_ 308
-
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-/* Line 293 of yacc.c */
-#line 214 "yara_grammar.y"
+union YYSTYPE
+{
+#line 214 "yara_grammar.y" /* yacc.c:355 */
SIZED_STRING* sized_string;
char* c_string;
@@ -302,22 +299,23 @@ typedef union YYSTYPE
YR_META* meta;
YR_OBJECT* object;
+#line 303 "yara_grammar.c" /* yacc.c:355 */
+};
-
-/* Line 293 of yacc.c */
-#line 309 "yara_grammar.c"
-} YYSTYPE;
+typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+
+int yara_yyparse (void *yyscanner, YR_COMPILER* compiler);
+
+#endif /* !YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED */
+
/* Copy the second part of user declarations. */
-
-/* Line 343 of yacc.c */
-#line 321 "yara_grammar.c"
+#line 319 "yara_grammar.c" /* yacc.c:358 */
#ifdef short
# undef short
@@ -331,11 +329,8 @@ typedef unsigned char yytype_uint8;
#ifdef YYTYPE_INT8
typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
#else
-typedef short int yytype_int8;
+typedef signed char yytype_int8;
#endif
#ifdef YYTYPE_UINT16
@@ -355,8 +350,7 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif ! defined YYSIZE_T
# include /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
@@ -370,38 +364,67 @@ typedef short int yytype_int16;
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
-# define YY_(msgid) msgid
+# define YY_(Msgid) Msgid
+# 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__))
+#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)
+# else
+# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YYUSE(E) ((void) (E))
#else
-# define YYUSE(e) /* empty */
+# define YYUSE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
+#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\"")\
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
- int yyi;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return yyi;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
#if ! defined yyoverflow || YYERROR_VERBOSE
@@ -420,9 +443,9 @@ YYID (yyi)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include /* INFRINGES ON USER NAME SPACE */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
@@ -432,8 +455,8 @@ YYID (yyi)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -449,7 +472,7 @@ YYID (yyi)
# endif
# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include /* INFRINGES ON USER NAME SPACE */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
@@ -457,15 +480,13 @@ YYID (yyi)
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
@@ -475,7 +496,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
@@ -500,35 +521,35 @@ union yyalloc
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
#endif
#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from FROM to TO. The source and destination do
+/* Copy COUNT objects from SRC to DST. The source and destination do
not overlap. */
# ifndef YYCOPY
# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYSIZE_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
# endif
# endif
#endif /* !YYCOPY_NEEDED */
@@ -544,17 +565,19 @@ union yyalloc
#define YYNNTS 35
/* YYNRULES -- Number of rules. */
#define YYNRULES 115
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 216
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
+ by yylex, with out-of-bounds checking. */
#define YYUNDEFTOK 2
#define YYMAXUTOK 308
-#define YYTRANSLATE(YYX) \
+#define YYTRANSLATE(YYX) \
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, without out-of-bounds checking. */
static const yytype_uint8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -591,68 +614,7 @@ static const yytype_uint8 yytranslate[] =
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint16 yyprhs[] =
-{
- 0, 0, 3, 4, 7, 10, 14, 18, 21, 31,
- 32, 36, 37, 41, 45, 46, 49, 51, 53, 54,
- 57, 59, 62, 64, 67, 71, 75, 79, 83, 85,
- 88, 93, 94, 100, 104, 105, 108, 110, 112, 114,
- 116, 118, 122, 127, 132, 133, 135, 139, 141, 143,
- 145, 147, 151, 155, 157, 161, 165, 166, 167, 179,
- 180, 190, 194, 197, 201, 205, 209, 213, 217, 221,
- 225, 229, 233, 235, 239, 243, 245, 252, 254, 258,
- 259, 264, 266, 268, 272, 274, 276, 278, 280, 282,
- 286, 288, 290, 295, 300, 305, 310, 315, 320, 322,
- 324, 326, 331, 333, 335, 339, 343, 347, 351, 355,
- 359, 363, 367, 370, 374, 378
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 75, 0, -1, -1, 75, 77, -1, 75, 76, -1,
- 75, 1, 77, -1, 75, 1, 63, -1, 39, 15,
- -1, 81, 3, 9, 83, 64, 78, 79, 80, 65,
- -1, -1, 6, 66, 85, -1, -1, 7, 66, 87,
- -1, 8, 66, 95, -1, -1, 81, 82, -1, 4,
- -1, 5, -1, -1, 66, 84, -1, 9, -1, 84,
- 9, -1, 86, -1, 85, 86, -1, 9, 67, 15,
- -1, 9, 67, 14, -1, 9, 67, 40, -1, 9,
- 67, 41, -1, 88, -1, 87, 88, -1, 10, 67,
- 15, 90, -1, -1, 10, 67, 89, 17, 90, -1,
- 10, 67, 16, -1, -1, 90, 91, -1, 19, -1,
- 18, -1, 20, -1, 21, -1, 9, -1, 92, 68,
- 9, -1, 92, 69, 108, 70, -1, 92, 71, 93,
- 72, -1, -1, 96, -1, 93, 73, 96, -1, 17,
- -1, 96, -1, 40, -1, 41, -1, 108, 37, 94,
- -1, 108, 38, 108, -1, 10, -1, 10, 22, 108,
- -1, 10, 27, 101, -1, -1, -1, 29, 107, 9,
- 27, 97, 100, 66, 98, 71, 95, 72, -1, -1,
- 29, 107, 28, 103, 66, 99, 71, 95, 72, -1,
- 107, 28, 103, -1, 61, 95, -1, 95, 43, 95,
- -1, 95, 42, 95, -1, 108, 53, 108, -1, 108,
- 51, 108, -1, 108, 52, 108, -1, 108, 50, 108,
- -1, 108, 49, 108, -1, 108, 47, 108, -1, 108,
- 48, 108, -1, 108, -1, 71, 96, 72, -1, 71,
- 102, 72, -1, 101, -1, 71, 108, 68, 68, 108,
- 72, -1, 108, -1, 102, 73, 108, -1, -1, 71,
- 104, 105, 72, -1, 30, -1, 106, -1, 105, 73,
- 106, -1, 10, -1, 13, -1, 108, -1, 25, -1,
- 26, -1, 71, 108, 72, -1, 23, -1, 24, -1,
- 31, 71, 108, 72, -1, 32, 71, 108, 72, -1,
- 33, 71, 108, 72, -1, 34, 71, 108, 72, -1,
- 35, 71, 108, 72, -1, 36, 71, 108, 72, -1,
- 14, -1, 15, -1, 11, -1, 12, 69, 108, 70,
- -1, 12, -1, 92, -1, 108, 56, 108, -1, 108,
- 57, 108, -1, 108, 58, 108, -1, 108, 59, 108,
- -1, 108, 60, 108, -1, 108, 46, 108, -1, 108,
- 44, 108, -1, 108, 45, 108, -1, 62, 108, -1,
- 108, 55, 108, -1, 108, 54, 108, -1, 94, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 227, 227, 229, 230, 231, 232, 237, 249, 268,
@@ -670,7 +632,7 @@ static const yytype_uint16 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+#if YYDEBUG || YYERROR_VERBOSE || 0
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
@@ -683,9 +645,9 @@ static const char *const yytname[] =
"_FULLWORD_", "_AT_", "_FILESIZE_", "_ENTRYPOINT_", "_ALL_", "_ANY_",
"_IN_", "_OF_", "_FOR_", "_THEM_", "_INT8_", "_INT16_", "_INT32_",
"_UINT8_", "_UINT16_", "_UINT32_", "_MATCHES_", "_CONTAINS_", "_IMPORT_",
- "_TRUE_", "_FALSE_", "_OR_", "_AND_", "'&'", "'|'", "'^'", "_IS_",
- "_NEQ_", "_EQ_", "_GE_", "_GT_", "_LE_", "_LT_", "_SHIFT_RIGHT_",
- "_SHIFT_LEFT_", "'+'", "'-'", "'*'", "'\\\\'", "'%'", "_NOT_", "'~'",
+ "_TRUE_", "_FALSE_", "_OR_", "_AND_", "'&'", "'|'", "'^'", "_LT_",
+ "_LE_", "_GT_", "_GE_", "_EQ_", "_NEQ_", "_IS_", "_SHIFT_LEFT_",
+ "_SHIFT_RIGHT_", "'+'", "'-'", "'*'", "'\\\\'", "'%'", "_NOT_", "'~'",
"'i'", "'{'", "'}'", "':'", "'='", "'.'", "'['", "']'", "'('", "')'",
"','", "$accept", "rules", "import", "rule", "meta", "strings",
"condition", "rule_modifiers", "rule_modifier", "tags", "tag_list",
@@ -694,13 +656,13 @@ static const char *const yytname[] =
"identifier", "arguments_list", "regexp", "boolean_expression",
"expression", "$@2", "$@3", "$@4", "integer_set", "range",
"integer_enumeration", "string_set", "$@5", "string_enumeration",
- "string_enumeration_item", "for_expression", "primary_expression", 0
+ "string_enumeration_item", "for_expression", "primary_expression", YY_NULLPTR
};
#endif
# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
+/* YYTOKNUM[NUM] -- (External) token number corresponding to the
+ (internal) symbol number NUM (which must be that of a token). */
static const yytype_uint16 yytoknum[] =
{
0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
@@ -714,81 +676,18 @@ static const yytype_uint16 yytoknum[] =
};
# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 74, 75, 75, 75, 75, 75, 76, 77, 78,
- 78, 79, 79, 80, 81, 81, 82, 82, 83, 83,
- 84, 84, 85, 85, 86, 86, 86, 86, 87, 87,
- 88, 89, 88, 88, 90, 90, 91, 91, 91, 91,
- 92, 92, 92, 92, 93, 93, 93, 94, 95, 96,
- 96, 96, 96, 96, 96, 96, 97, 98, 96, 99,
- 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
- 96, 96, 96, 96, 100, 100, 101, 102, 102, 104,
- 103, 103, 105, 105, 106, 106, 107, 107, 107, 108,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
- 108, 108, 108, 108, 108, 108
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 2, 2, 3, 3, 2, 9, 0,
- 3, 0, 3, 3, 0, 2, 1, 1, 0, 2,
- 1, 2, 1, 2, 3, 3, 3, 3, 1, 2,
- 4, 0, 5, 3, 0, 2, 1, 1, 1, 1,
- 1, 3, 4, 4, 0, 1, 3, 1, 1, 1,
- 1, 3, 3, 1, 3, 3, 0, 0, 11, 0,
- 9, 3, 2, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 1, 3, 3, 1, 6, 1, 3, 0,
- 4, 1, 1, 3, 1, 1, 1, 1, 1, 3,
- 1, 1, 4, 4, 4, 4, 4, 4, 1, 1,
- 1, 4, 1, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 2, 3, 3, 1
-};
-
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 2, 0, 1, 14, 0, 4, 3, 0, 6, 5,
- 7, 0, 16, 17, 15, 18, 0, 0, 20, 19,
- 9, 21, 0, 11, 0, 0, 0, 0, 10, 22,
- 0, 0, 0, 0, 23, 0, 12, 28, 0, 8,
- 25, 24, 26, 27, 31, 29, 40, 53, 100, 102,
- 98, 99, 47, 90, 91, 87, 88, 0, 0, 0,
- 0, 0, 0, 0, 49, 50, 0, 0, 0, 103,
- 115, 13, 48, 0, 72, 34, 33, 0, 0, 0,
- 0, 0, 0, 86, 0, 0, 0, 0, 0, 0,
- 62, 112, 0, 48, 72, 0, 0, 44, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 30, 34, 54, 0, 55, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 73, 89, 41, 0, 0,
- 45, 64, 63, 81, 79, 61, 51, 52, 110, 111,
- 109, 70, 71, 69, 68, 66, 67, 65, 114, 113,
- 104, 105, 106, 107, 108, 37, 36, 38, 39, 35,
- 32, 0, 101, 56, 0, 92, 93, 94, 95, 96,
- 97, 42, 43, 0, 0, 0, 0, 59, 46, 84,
- 85, 0, 82, 0, 0, 0, 75, 0, 80, 0,
- 0, 0, 77, 57, 0, 83, 76, 74, 0, 0,
- 0, 78, 0, 60, 0, 58
-};
-
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 1, 5, 6, 23, 26, 32, 7, 14, 17,
- 19, 28, 29, 36, 37, 77, 120, 169, 69, 139,
- 70, 92, 72, 186, 209, 197, 195, 124, 201, 145,
- 184, 191, 192, 73, 74
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
#define YYPACT_NINF -66
+
+#define yypact_value_is_default(Yystate) \
+ (!!((Yystate) == (-66)))
+
+#define YYTABLE_NINF -87
+
+#define yytable_value_is_error(Yytable_value) \
+ 0
+
+ /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+ STATE-NUM. */
static const yytype_int16 yypact[] =
{
-66, 6, -66, -59, 0, -66, -66, 59, -66, -66,
@@ -815,7 +714,36 @@ static const yytype_int16 yypact[] =
-26, 372, 79, -66, -19, -66
};
-/* YYPGOTO[NTERM-NUM]. */
+ /* 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[] =
+{
+ 2, 0, 1, 14, 0, 4, 3, 0, 6, 5,
+ 7, 0, 16, 17, 15, 18, 0, 0, 20, 19,
+ 9, 21, 0, 11, 0, 0, 0, 0, 10, 22,
+ 0, 0, 0, 0, 23, 0, 12, 28, 0, 8,
+ 25, 24, 26, 27, 31, 29, 40, 53, 100, 102,
+ 98, 99, 47, 90, 91, 87, 88, 0, 0, 0,
+ 0, 0, 0, 0, 49, 50, 0, 0, 0, 103,
+ 115, 13, 48, 0, 72, 34, 33, 0, 0, 0,
+ 0, 0, 0, 86, 0, 0, 0, 0, 0, 0,
+ 62, 112, 0, 48, 72, 0, 0, 44, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 30, 34, 54, 0, 55, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 73, 89, 41, 0, 0,
+ 45, 64, 63, 81, 79, 61, 51, 52, 110, 111,
+ 109, 65, 67, 66, 68, 69, 71, 70, 113, 114,
+ 104, 105, 106, 107, 108, 37, 36, 38, 39, 35,
+ 32, 0, 101, 56, 0, 92, 93, 94, 95, 96,
+ 97, 42, 43, 0, 0, 0, 0, 59, 46, 84,
+ 85, 0, 82, 0, 0, 0, 75, 0, 80, 0,
+ 0, 0, 77, 57, 0, 83, 76, 74, 0, 0,
+ 0, 78, 0, 60, 0, 58
+};
+
+ /* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
-66, -66, -66, 187, -66, -66, -66, -66, -66, -66,
@@ -824,10 +752,18 @@ static const yytype_int16 yypgoto[] =
-66, -66, 10, 151, -37
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -87
+ /* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int16 yydefgoto[] =
+{
+ -1, 1, 5, 6, 23, 26, 32, 7, 14, 17,
+ 19, 28, 29, 36, 37, 77, 120, 169, 69, 139,
+ 70, 92, 72, 186, 209, 197, 195, 124, 201, 145,
+ 184, 191, 192, 73, 74
+};
+
+ /* 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[] =
{
71, 143, 127, 93, 8, 189, 2, 3, 190, -14,
@@ -876,12 +812,6 @@ static const yytype_int16 yytable[] =
117, 118, 119, 185
};
-#define yypact_value_is_default(yystate) \
- ((yystate) == (-66))
-
-#define yytable_value_is_error(yytable_value) \
- YYID (0)
-
static const yytype_int16 yycheck[] =
{
38, 30, 9, 68, 63, 10, 0, 1, 13, 3,
@@ -930,8 +860,8 @@ static const yytype_int16 yycheck[] =
58, 59, 60, 68
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
+ /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+ symbol of state STATE-NUM. */
static const yytype_uint8 yystos[] =
{
0, 75, 0, 1, 39, 76, 77, 81, 63, 77,
@@ -958,94 +888,75 @@ static const yytype_uint8 yystos[] =
95, 108, 71, 72, 95, 72
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
+ /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const yytype_uint8 yyr1[] =
+{
+ 0, 74, 75, 75, 75, 75, 75, 76, 77, 78,
+ 78, 79, 79, 80, 81, 81, 82, 82, 83, 83,
+ 84, 84, 85, 85, 86, 86, 86, 86, 87, 87,
+ 88, 89, 88, 88, 90, 90, 91, 91, 91, 91,
+ 92, 92, 92, 92, 93, 93, 93, 94, 95, 96,
+ 96, 96, 96, 96, 96, 96, 97, 98, 96, 99,
+ 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+ 96, 96, 96, 96, 100, 100, 101, 102, 102, 104,
+ 103, 103, 105, 105, 106, 106, 107, 107, 107, 108,
+ 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
+ 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
+ 108, 108, 108, 108, 108, 108
+};
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
+ /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 0, 2, 2, 3, 3, 2, 9, 0,
+ 3, 0, 3, 3, 0, 2, 1, 1, 0, 2,
+ 1, 2, 1, 2, 3, 3, 3, 3, 1, 2,
+ 4, 0, 5, 3, 0, 2, 1, 1, 1, 1,
+ 1, 3, 4, 4, 0, 1, 3, 1, 1, 1,
+ 1, 3, 3, 1, 3, 3, 0, 0, 11, 0,
+ 9, 3, 2, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 1, 3, 3, 1, 6, 1, 3, 0,
+ 4, 1, 1, 3, 1, 1, 1, 1, 1, 3,
+ 1, 1, 4, 4, 4, 4, 4, 4, 1, 1,
+ 1, 4, 1, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 2, 3, 3, 1
+};
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
+#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 YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
yyerror (yyscanner, compiler, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
+ YYERROR; \
+ } \
+while (0)
+
+/* Error token number */
+#define YYTERROR 1
+#define YYERRCODE 256
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
-
-
-/* This macro is provided for backward compatibility. */
-
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-#else
-# define YYLEX yylex (&yylval, yyscanner, compiler)
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -1055,58 +966,48 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, yyscanner, compiler); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
+/* This macro is provided for backward compatibility. */
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Type, Value, yyscanner, compiler); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*----------------------------------------.
+| Print this symbol's value on YYOUTPUT. |
+`----------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, YR_COMPILER* compiler)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, compiler)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- void *yyscanner;
- YR_COMPILER* compiler;
-#endif
{
- if (!yyvaluep)
- return;
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
YYUSE (yyscanner);
YYUSE (compiler);
+ if (!yyvaluep)
+ return;
# ifdef YYPRINT
if (yytype < YYNTOKENS)
YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YYUSE (yytype);
}
@@ -1114,24 +1015,11 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, compiler)
| Print this symbol on YYOUTPUT. |
`--------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, void *yyscanner, YR_COMPILER* compiler)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, compiler)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
- void *yyscanner;
- YR_COMPILER* compiler;
-#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyoutput, "%s %s (",
+ yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
yy_symbol_value_print (yyoutput, yytype, yyvaluep, yyscanner, compiler);
YYFPRINTF (yyoutput, ")");
@@ -1142,16 +1030,8 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yyscanner, compiler)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
{
YYFPRINTF (stderr, "Stack now");
for (; yybottom <= yytop; yybottom++)
@@ -1162,51 +1042,42 @@ yy_stack_print (yybottom, yytop)
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, void *yyscanner, YR_COMPILER* compiler)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule, yyscanner, compiler)
- YYSTYPE *yyvsp;
- int yyrule;
- void *yyscanner;
- YR_COMPILER* compiler;
-#endif
+yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, void *yyscanner, YR_COMPILER* compiler)
{
+ unsigned long int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , yyscanner, compiler);
+ yy_symbol_print (stderr,
+ yystos[yyssp[yyi + 1 - yynrhs]],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , yyscanner, compiler);
YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule, yyscanner, compiler); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule, yyscanner, compiler); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
@@ -1220,7 +1091,7 @@ int yydebug;
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -1243,15 +1114,8 @@ int yydebug;
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
{
YYSIZE_T yylen;
for (yylen = 0; yystr[yylen]; yylen++)
@@ -1267,16 +1131,8 @@ yystrlen (yystr)
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
{
char *yyd = yydest;
const char *yys = yysrc;
@@ -1306,27 +1162,27 @@ yytnamerr (char *yyres, const char *yystr)
char const *yyp = yystr;
for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
do_not_strip_quotes: ;
}
@@ -1349,12 +1205,11 @@ static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
yytype_int16 *yyssp, int yytoken)
{
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
+ YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Internationalized format string. */
- const char *yyformat = 0;
+ const char *yyformat = YY_NULLPTR;
/* Arguments of yyformat. */
char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
/* Number of reported tokens (one for the "unexpected", one per
@@ -1362,10 +1217,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
int yycount = 0;
/* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
-
- for details. YYERROR is fine as it does not invoke this
- function.
- If this state is a consistent state with a default action, then
the only way this function was invoked is if the default action
is an error action. In that case, don't check for expected
@@ -1414,11 +1265,13 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
break;
}
yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
}
}
}
@@ -1438,10 +1291,12 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
# undef YYCASE_
}
- yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
if (*yymsg_alloc < yysize)
{
@@ -1478,158 +1333,93 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, YR_COMPILER* compiler)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep, yyscanner, compiler)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
- void *yyscanner;
- YR_COMPILER* compiler;
-#endif
{
YYUSE (yyvaluep);
YYUSE (yyscanner);
YYUSE (compiler);
-
if (!yymsg)
yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
switch (yytype)
{
- case 9: /* "_IDENTIFIER_" */
+ case 9: /* _IDENTIFIER_ */
+#line 205 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).c_string)); }
+#line 1353 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 205 "yara_grammar.y"
- { yr_free((yyvaluep->c_string)); };
+ case 10: /* _STRING_IDENTIFIER_ */
+#line 206 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).c_string)); }
+#line 1359 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 1514 "yara_grammar.c"
- break;
- case 10: /* "_STRING_IDENTIFIER_" */
+ case 11: /* _STRING_COUNT_ */
+#line 207 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).c_string)); }
+#line 1365 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 206 "yara_grammar.y"
- { yr_free((yyvaluep->c_string)); };
+ case 12: /* _STRING_OFFSET_ */
+#line 208 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).c_string)); }
+#line 1371 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 1523 "yara_grammar.c"
- break;
- case 11: /* "_STRING_COUNT_" */
+ case 13: /* _STRING_IDENTIFIER_WITH_WILDCARD_ */
+#line 209 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).c_string)); }
+#line 1377 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 207 "yara_grammar.y"
- { yr_free((yyvaluep->c_string)); };
+ case 15: /* _TEXT_STRING_ */
+#line 210 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).sized_string)); }
+#line 1383 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 1532 "yara_grammar.c"
- break;
- case 12: /* "_STRING_OFFSET_" */
+ case 16: /* _HEX_STRING_ */
+#line 211 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).sized_string)); }
+#line 1389 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 208 "yara_grammar.y"
- { yr_free((yyvaluep->c_string)); };
+ case 17: /* _REGEXP_ */
+#line 212 "yara_grammar.y" /* yacc.c:1257 */
+ { yr_free(((*yyvaluep).sized_string)); }
+#line 1395 "yara_grammar.c" /* yacc.c:1257 */
+ break;
-/* Line 1391 of yacc.c */
-#line 1541 "yara_grammar.c"
- break;
- case 13: /* "_STRING_IDENTIFIER_WITH_WILDCARD_" */
-
-/* Line 1391 of yacc.c */
-#line 209 "yara_grammar.y"
- { yr_free((yyvaluep->c_string)); };
-
-/* Line 1391 of yacc.c */
-#line 1550 "yara_grammar.c"
- break;
- case 15: /* "_TEXT_STRING_" */
-
-/* Line 1391 of yacc.c */
-#line 210 "yara_grammar.y"
- { yr_free((yyvaluep->sized_string)); };
-
-/* Line 1391 of yacc.c */
-#line 1559 "yara_grammar.c"
- break;
- case 16: /* "_HEX_STRING_" */
-
-/* Line 1391 of yacc.c */
-#line 211 "yara_grammar.y"
- { yr_free((yyvaluep->sized_string)); };
-
-/* Line 1391 of yacc.c */
-#line 1568 "yara_grammar.c"
- break;
- case 17: /* "_REGEXP_" */
-
-/* Line 1391 of yacc.c */
-#line 212 "yara_grammar.y"
- { yr_free((yyvaluep->sized_string)); };
-
-/* Line 1391 of yacc.c */
-#line 1577 "yara_grammar.c"
- break;
default:
- break;
+ break;
}
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *yyscanner, YR_COMPILER* compiler);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
/*----------.
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (void *yyscanner, YR_COMPILER* compiler)
-#else
-int
-yyparse (yyscanner, compiler)
- void *yyscanner;
- YR_COMPILER* compiler;
-#endif
-#endif
{
/* The lookahead symbol. */
int yychar;
+
/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval;
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
+YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
/* Number of syntax errors so far. */
int yynerrs;
@@ -1639,10 +1429,10 @@ YYSTYPE yylval;
int yyerrstatus;
/* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ 'yyss': related to states.
+ 'yyvs': related to semantic values.
- Refer to the stacks thru separate pointers, to allow yyoverflow
+ Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
/* The state stack. */
@@ -1660,7 +1450,7 @@ YYSTYPE yylval;
int yyn;
int yyresult;
/* Lookahead token as an internal (translated) token number. */
- int yytoken;
+ int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
@@ -1678,9 +1468,8 @@ YYSTYPE yylval;
Keep to zero when no symbol should be popped. */
int yylen = 0;
- yytoken = 0;
- yyss = yyssa;
- yyvs = yyvsa;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1689,14 +1478,6 @@ YYSTYPE yylval;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
- yyssp = yyss;
- yyvsp = yyvs;
-
goto yysetstate;
/*------------------------------------------------------------.
@@ -1717,23 +1498,23 @@ YYSTYPE yylval;
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
- yyss = yyss1;
- yyvs = yyvs1;
+ yyss = yyss1;
+ yyvs = yyvs1;
}
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
@@ -1741,22 +1522,22 @@ YYSTYPE yylval;
# else
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
#endif /* no yyoverflow */
@@ -1765,10 +1546,10 @@ YYSTYPE yylval;
yyvsp = yyvs + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ (unsigned long int) yystacksize));
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1797,7 +1578,7 @@ yybackup:
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ yychar = yylex (&yylval, yyscanner, compiler);
}
if (yychar <= YYEOF)
@@ -1837,7 +1618,9 @@ yybackup:
yychar = YYEMPTY;
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
goto yynewstate;
@@ -1860,7 +1643,7 @@ yyreduce:
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1874,50 +1657,45 @@ yyreduce:
switch (yyn)
{
case 7:
-
-/* Line 1806 of yacc.c */
-#line 238 "yara_grammar.y"
+#line 238 "yara_grammar.y" /* yacc.c:1661 */
{
- int result = yr_parser_reduce_import(yyscanner, (yyvsp[(2) - (2)].sized_string));
+ int result = yr_parser_reduce_import(yyscanner, (yyvsp[0].sized_string));
- yr_free((yyvsp[(2) - (2)].sized_string));
+ yr_free((yyvsp[0].sized_string));
ERROR_IF(result != ERROR_SUCCESS);
}
+#line 1669 "yara_grammar.c" /* yacc.c:1661 */
break;
case 8:
-
-/* Line 1806 of yacc.c */
-#line 250 "yara_grammar.y"
+#line 250 "yara_grammar.y" /* yacc.c:1661 */
{
int result = yr_parser_reduce_rule_declaration(
yyscanner,
- (yyvsp[(1) - (9)].integer),
- (yyvsp[(3) - (9)].c_string),
- (yyvsp[(4) - (9)].c_string),
- (yyvsp[(7) - (9)].string),
- (yyvsp[(6) - (9)].meta));
+ (yyvsp[-8].integer),
+ (yyvsp[-6].c_string),
+ (yyvsp[-5].c_string),
+ (yyvsp[-2].string),
+ (yyvsp[-3].meta));
- yr_free((yyvsp[(3) - (9)].c_string));
+ yr_free((yyvsp[-6].c_string));
ERROR_IF(result != ERROR_SUCCESS);
}
+#line 1687 "yara_grammar.c" /* yacc.c:1661 */
break;
case 9:
-
-/* Line 1806 of yacc.c */
-#line 268 "yara_grammar.y"
+#line 268 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.meta) = NULL;
}
+#line 1695 "yara_grammar.c" /* yacc.c:1661 */
break;
case 10:
-
-/* Line 1806 of yacc.c */
-#line 272 "yara_grammar.y"
+#line 272 "yara_grammar.y" /* yacc.c:1661 */
{
#if REAL_YARA //Meta not supported
// Each rule have a list of meta-data info, consisting in a
@@ -1938,26 +1716,24 @@ yyreduce:
NULL);
#endif
- (yyval.meta) = (yyvsp[(3) - (3)].meta);
+ (yyval.meta) = (yyvsp[0].meta);
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 1724 "yara_grammar.c" /* yacc.c:1661 */
break;
case 11:
-
-/* Line 1806 of yacc.c */
-#line 301 "yara_grammar.y"
+#line 301 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.string) = NULL;
compiler->current_rule_strings = (yyval.string);
}
+#line 1733 "yara_grammar.c" /* yacc.c:1661 */
break;
case 12:
-
-/* Line 1806 of yacc.c */
-#line 306 "yara_grammar.y"
+#line 306 "yara_grammar.y" /* yacc.c:1661 */
{
// Each rule have a list of strings, consisting in a sequence
// of YR_STRING structures. The last YR_STRING structure does not
@@ -1978,52 +1754,46 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
- compiler->current_rule_strings = (yyvsp[(3) - (3)].string);
- (yyval.string) = (yyvsp[(3) - (3)].string);
+ compiler->current_rule_strings = (yyvsp[0].string);
+ (yyval.string) = (yyvsp[0].string);
}
+#line 1761 "yara_grammar.c" /* yacc.c:1661 */
break;
case 14:
-
-/* Line 1806 of yacc.c */
-#line 338 "yara_grammar.y"
+#line 338 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = 0; }
+#line 1767 "yara_grammar.c" /* yacc.c:1661 */
break;
case 15:
-
-/* Line 1806 of yacc.c */
-#line 339 "yara_grammar.y"
- { (yyval.integer) = (yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer); }
+#line 339 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.integer) = (yyvsp[-1].integer) | (yyvsp[0].integer); }
+#line 1773 "yara_grammar.c" /* yacc.c:1661 */
break;
case 16:
-
-/* Line 1806 of yacc.c */
-#line 344 "yara_grammar.y"
+#line 344 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = RULE_GFLAGS_PRIVATE; }
+#line 1779 "yara_grammar.c" /* yacc.c:1661 */
break;
case 17:
-
-/* Line 1806 of yacc.c */
-#line 345 "yara_grammar.y"
+#line 345 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = RULE_GFLAGS_GLOBAL; }
+#line 1785 "yara_grammar.c" /* yacc.c:1661 */
break;
case 18:
-
-/* Line 1806 of yacc.c */
-#line 351 "yara_grammar.y"
+#line 351 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.c_string) = NULL;
}
+#line 1793 "yara_grammar.c" /* yacc.c:1661 */
break;
case 19:
-
-/* Line 1806 of yacc.c */
-#line 355 "yara_grammar.y"
+#line 355 "yara_grammar.y" /* yacc.c:1661 */
{
#if REAL_YARA //tags not supported
// Tags list is represented in the arena as a sequence
@@ -2037,23 +1807,22 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
#endif
- (yyval.c_string) = (yyvsp[(2) - (2)].c_string);
+ (yyval.c_string) = (yyvsp[0].c_string);
}
+#line 1813 "yara_grammar.c" /* yacc.c:1661 */
break;
case 20:
-
-/* Line 1806 of yacc.c */
-#line 375 "yara_grammar.y"
+#line 375 "yara_grammar.y" /* yacc.c:1661 */
{
#if REAL_YARA //tags not supported
char* identifier;
compiler->last_result = yr_arena_write_string(
- yyget_extra(yyscanner)->sz_arena, (yyvsp[(1) - (1)].c_string), &identifier);
+ yyget_extra(yyscanner)->sz_arena, (yyvsp[0].c_string), &identifier);
#endif
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_free((yyvsp[0].c_string));
#if REAL_YARA //tags not supported
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
@@ -2061,20 +1830,19 @@ yyreduce:
(yyval.c_string) = identifier;
#endif
}
+#line 1834 "yara_grammar.c" /* yacc.c:1661 */
break;
case 21:
-
-/* Line 1806 of yacc.c */
-#line 392 "yara_grammar.y"
+#line 392 "yara_grammar.y" /* yacc.c:1661 */
{
#if REAL_YARA //tags not supported
- char* tag_name = (yyvsp[(1) - (2)].c_string);
+ char* tag_name = (yyvsp[-1].c_string);
size_t tag_length = tag_name != NULL ? strlen(tag_name) : 0;
while (tag_length > 0)
{
- if (strcmp(tag_name, (yyvsp[(2) - (2)].c_string)) == 0)
+ if (strcmp(tag_name, (yyvsp[0].c_string)) == 0)
{
yr_compiler_set_error_extra_info(compiler, tag_name);
compiler->last_result = ERROR_DUPLICATE_TAG_IDENTIFIER;
@@ -2091,229 +1859,210 @@ yyreduce:
if (compiler->last_result == ERROR_SUCCESS)
compiler->last_result = yr_arena_write_string(
- yyget_extra(yyscanner)->sz_arena, (yyvsp[(2) - (2)].c_string), NULL);
+ yyget_extra(yyscanner)->sz_arena, (yyvsp[0].c_string), NULL);
#endif
- yr_free((yyvsp[(2) - (2)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
- (yyval.c_string) = (yyvsp[(1) - (2)].c_string);
+ (yyval.c_string) = (yyvsp[-1].c_string);
}
+#line 1872 "yara_grammar.c" /* yacc.c:1661 */
break;
case 22:
-
-/* Line 1806 of yacc.c */
-#line 430 "yara_grammar.y"
- { (yyval.meta) = (yyvsp[(1) - (1)].meta); }
+#line 430 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.meta) = (yyvsp[0].meta); }
+#line 1878 "yara_grammar.c" /* yacc.c:1661 */
break;
case 23:
-
-/* Line 1806 of yacc.c */
-#line 431 "yara_grammar.y"
- { (yyval.meta) = (yyvsp[(1) - (2)].meta); }
+#line 431 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.meta) = (yyvsp[-1].meta); }
+#line 1884 "yara_grammar.c" /* yacc.c:1661 */
break;
case 24:
-
-/* Line 1806 of yacc.c */
-#line 437 "yara_grammar.y"
+#line 437 "yara_grammar.y" /* yacc.c:1661 */
{
- SIZED_STRING* sized_string = (yyvsp[(3) - (3)].sized_string);
+ SIZED_STRING* sized_string = (yyvsp[0].sized_string);
(yyval.meta) = yr_parser_reduce_meta_declaration(
yyscanner,
META_TYPE_STRING,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
sized_string->c_string,
0);
- yr_free((yyvsp[(1) - (3)].c_string));
- yr_free((yyvsp[(3) - (3)].sized_string));
+ yr_free((yyvsp[-2].c_string));
+ yr_free((yyvsp[0].sized_string));
ERROR_IF((yyval.meta) == NULL);
}
+#line 1904 "yara_grammar.c" /* yacc.c:1661 */
break;
case 25:
-
-/* Line 1806 of yacc.c */
-#line 453 "yara_grammar.y"
+#line 453 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.meta) = yr_parser_reduce_meta_declaration(
yyscanner,
META_TYPE_INTEGER,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
NULL,
- (yyvsp[(3) - (3)].integer));
+ (yyvsp[0].integer));
- yr_free((yyvsp[(1) - (3)].c_string));
+ yr_free((yyvsp[-2].c_string));
ERROR_IF((yyval.meta) == NULL);
}
+#line 1921 "yara_grammar.c" /* yacc.c:1661 */
break;
case 26:
-
-/* Line 1806 of yacc.c */
-#line 466 "yara_grammar.y"
+#line 466 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.meta) = yr_parser_reduce_meta_declaration(
yyscanner,
META_TYPE_BOOLEAN,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
NULL,
TRUE);
- yr_free((yyvsp[(1) - (3)].c_string));
+ yr_free((yyvsp[-2].c_string));
ERROR_IF((yyval.meta) == NULL);
}
+#line 1938 "yara_grammar.c" /* yacc.c:1661 */
break;
case 27:
-
-/* Line 1806 of yacc.c */
-#line 479 "yara_grammar.y"
+#line 479 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.meta) = yr_parser_reduce_meta_declaration(
yyscanner,
META_TYPE_BOOLEAN,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
NULL,
FALSE);
- yr_free((yyvsp[(1) - (3)].c_string));
+ yr_free((yyvsp[-2].c_string));
ERROR_IF((yyval.meta) == NULL);
}
+#line 1955 "yara_grammar.c" /* yacc.c:1661 */
break;
case 28:
-
-/* Line 1806 of yacc.c */
-#line 495 "yara_grammar.y"
- { (yyval.string) = (yyvsp[(1) - (1)].string); }
+#line 495 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.string) = (yyvsp[0].string); }
+#line 1961 "yara_grammar.c" /* yacc.c:1661 */
break;
case 29:
-
-/* Line 1806 of yacc.c */
-#line 496 "yara_grammar.y"
- { (yyval.string) = (yyvsp[(1) - (2)].string); }
+#line 496 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.string) = (yyvsp[-1].string); }
+#line 1967 "yara_grammar.c" /* yacc.c:1661 */
break;
case 30:
-
-/* Line 1806 of yacc.c */
-#line 502 "yara_grammar.y"
+#line 502 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.string) = yr_parser_reduce_string_declaration(
yyscanner,
- (yyvsp[(4) - (4)].integer),
- (yyvsp[(1) - (4)].c_string),
- (yyvsp[(3) - (4)].sized_string));
+ (yyvsp[0].integer),
+ (yyvsp[-3].c_string),
+ (yyvsp[-1].sized_string));
- yr_free((yyvsp[(1) - (4)].c_string));
- yr_free((yyvsp[(3) - (4)].sized_string));
+ yr_free((yyvsp[-3].c_string));
+ yr_free((yyvsp[-1].sized_string));
ERROR_IF((yyval.string) == NULL);
}
+#line 1984 "yara_grammar.c" /* yacc.c:1661 */
break;
case 31:
-
-/* Line 1806 of yacc.c */
-#line 515 "yara_grammar.y"
+#line 515 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->error_line = yyget_lineno(yyscanner);
}
+#line 1992 "yara_grammar.c" /* yacc.c:1661 */
break;
case 32:
-
-/* Line 1806 of yacc.c */
-#line 519 "yara_grammar.y"
+#line 519 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.string) = yr_parser_reduce_string_declaration(
yyscanner,
- (yyvsp[(5) - (5)].integer) | STRING_GFLAGS_REGEXP,
- (yyvsp[(1) - (5)].c_string),
- (yyvsp[(4) - (5)].sized_string));
+ (yyvsp[0].integer) | STRING_GFLAGS_REGEXP,
+ (yyvsp[-4].c_string),
+ (yyvsp[-1].sized_string));
- yr_free((yyvsp[(1) - (5)].c_string));
- yr_free((yyvsp[(4) - (5)].sized_string));
+ yr_free((yyvsp[-4].c_string));
+ yr_free((yyvsp[-1].sized_string));
ERROR_IF((yyval.string) == NULL);
}
+#line 2009 "yara_grammar.c" /* yacc.c:1661 */
break;
case 33:
-
-/* Line 1806 of yacc.c */
-#line 532 "yara_grammar.y"
+#line 532 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.string) = yr_parser_reduce_string_declaration(
yyscanner,
STRING_GFLAGS_HEXADECIMAL,
- (yyvsp[(1) - (3)].c_string),
- (yyvsp[(3) - (3)].sized_string));
+ (yyvsp[-2].c_string),
+ (yyvsp[0].sized_string));
- yr_free((yyvsp[(1) - (3)].c_string));
- yr_free((yyvsp[(3) - (3)].sized_string));
+ yr_free((yyvsp[-2].c_string));
+ yr_free((yyvsp[0].sized_string));
ERROR_IF((yyval.string) == NULL);
}
+#line 2026 "yara_grammar.c" /* yacc.c:1661 */
break;
case 34:
-
-/* Line 1806 of yacc.c */
-#line 548 "yara_grammar.y"
+#line 548 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = 0; }
+#line 2032 "yara_grammar.c" /* yacc.c:1661 */
break;
case 35:
-
-/* Line 1806 of yacc.c */
-#line 549 "yara_grammar.y"
- { (yyval.integer) = (yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer); }
+#line 549 "yara_grammar.y" /* yacc.c:1661 */
+ { (yyval.integer) = (yyvsp[-1].integer) | (yyvsp[0].integer); }
+#line 2038 "yara_grammar.c" /* yacc.c:1661 */
break;
case 36:
-
-/* Line 1806 of yacc.c */
-#line 554 "yara_grammar.y"
+#line 554 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = STRING_GFLAGS_WIDE; }
+#line 2044 "yara_grammar.c" /* yacc.c:1661 */
break;
case 37:
-
-/* Line 1806 of yacc.c */
-#line 555 "yara_grammar.y"
+#line 555 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = STRING_GFLAGS_ASCII; }
+#line 2050 "yara_grammar.c" /* yacc.c:1661 */
break;
case 38:
-
-/* Line 1806 of yacc.c */
-#line 556 "yara_grammar.y"
+#line 556 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = STRING_GFLAGS_NO_CASE; }
+#line 2056 "yara_grammar.c" /* yacc.c:1661 */
break;
case 39:
-
-/* Line 1806 of yacc.c */
-#line 557 "yara_grammar.y"
+#line 557 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = STRING_GFLAGS_FULL_WORD; }
+#line 2062 "yara_grammar.c" /* yacc.c:1661 */
break;
case 40:
-
-/* Line 1806 of yacc.c */
-#line 563 "yara_grammar.y"
+#line 563 "yara_grammar.y" /* yacc.c:1661 */
{
YR_OBJECT* object = NULL;
YR_RULE* rule;
@@ -2323,7 +2072,7 @@ yyreduce:
int var_index;
- var_index = yr_parser_lookup_loop_variable(yyscanner, (yyvsp[(1) - (1)].c_string));
+ var_index = yr_parser_lookup_loop_variable(yyscanner, (yyvsp[0].c_string));
if (var_index >= 0)
{
@@ -2341,7 +2090,7 @@ yyreduce:
// externals variables reside.
object = (YR_OBJECT*) yr_hash_table_lookup(
compiler->objects_table,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
NULL);
if (object == NULL)
{
@@ -2350,7 +2099,7 @@ yyreduce:
ns = compiler->current_namespace->name;
object = (YR_OBJECT*) yr_hash_table_lookup(
compiler->objects_table,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
ns);
}
@@ -2358,7 +2107,7 @@ yyreduce:
{
compiler->last_result = yr_arena_write_string(
compiler->sz_arena,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
&id);
if (compiler->last_result == ERROR_SUCCESS)
@@ -2374,7 +2123,7 @@ yyreduce:
{
rule = (YR_RULE*) yr_hash_table_lookup(
compiler->rules_table,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
compiler->current_namespace->name);
if (rule != NULL)
{
@@ -2386,7 +2135,7 @@ yyreduce:
}
else
{
- yr_compiler_set_error_extra_info(compiler, (yyvsp[(1) - (1)].c_string));
+ yr_compiler_set_error_extra_info(compiler, (yyvsp[0].c_string));
compiler->last_result = ERROR_UNDEFINED_IDENTIFIER;
}
@@ -2394,18 +2143,17 @@ yyreduce:
}
}
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 2151 "yara_grammar.c" /* yacc.c:1661 */
break;
case 41:
-
-/* Line 1806 of yacc.c */
-#line 648 "yara_grammar.y"
+#line 648 "yara_grammar.y" /* yacc.c:1661 */
{
- YR_OBJECT* object = (yyvsp[(1) - (3)].object);
+ YR_OBJECT* object = (yyvsp[-2].object);
YR_OBJECT* field = NULL;
char* ident;
@@ -2416,13 +2164,13 @@ yyreduce:
object->type == OBJECT_TYPE_STRUCTURE)
{
#if REAL_YARA
- field = yr_object_lookup_field(object, (yyvsp[(3) - (3)].c_string));
+ field = yr_object_lookup_field(object, (yyvsp[0].c_string));
#endif
if (field != NULL)
{
compiler->last_result = yr_arena_write_string(
compiler->sz_arena,
- (yyvsp[(3) - (3)].c_string),
+ (yyvsp[0].c_string),
&ident);
if (compiler->last_result == ERROR_SUCCESS)
@@ -2434,7 +2182,7 @@ yyreduce:
}
else
{
- yr_compiler_set_error_extra_info(compiler, (yyvsp[(3) - (3)].c_string));
+ yr_compiler_set_error_extra_info(compiler, (yyvsp[0].c_string));
compiler->last_result = ERROR_INVALID_FIELD_NAME;
}
}
@@ -2449,54 +2197,52 @@ yyreduce:
(yyval.object) = field;
- yr_free((yyvsp[(3) - (3)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 2205 "yara_grammar.c" /* yacc.c:1661 */
break;
case 42:
-
-/* Line 1806 of yacc.c */
-#line 698 "yara_grammar.y"
+#line 698 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (4)].object) != NULL && (yyvsp[(1) - (4)].object)->type == OBJECT_TYPE_ARRAY)
+ if ((yyvsp[-3].object) != NULL && (yyvsp[-3].object)->type == OBJECT_TYPE_ARRAY)
{
compiler->last_result = yr_parser_emit(
yyscanner,
OP_INDEX_ARRAY,
NULL);
- (yyval.object) = ((YR_OBJECT_ARRAY*) (yyvsp[(1) - (4)].object))->items->objects[0];
+ (yyval.object) = ((YR_OBJECT_ARRAY*) (yyvsp[-3].object))->items->objects[0];
}
else
{
yr_compiler_set_error_extra_info(
compiler,
- (yyvsp[(1) - (4)].object)->identifier);
+ (yyvsp[-3].object)->identifier);
compiler->last_result = ERROR_NOT_AN_ARRAY;
}
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 2231 "yara_grammar.c" /* yacc.c:1661 */
break;
case 43:
-
-/* Line 1806 of yacc.c */
-#line 721 "yara_grammar.y"
+#line 721 "yara_grammar.y" /* yacc.c:1661 */
{
int args_count;
- if ((yyvsp[(1) - (4)].object) != NULL && (yyvsp[(1) - (4)].object)->type == OBJECT_TYPE_FUNCTION)
+ if ((yyvsp[-3].object) != NULL && (yyvsp[-3].object)->type == OBJECT_TYPE_FUNCTION)
{
compiler->last_result = yr_parser_check_types(
- compiler, (YR_OBJECT_FUNCTION*) (yyvsp[(1) - (4)].object), (yyvsp[(3) - (4)].c_string));
+ compiler, (YR_OBJECT_FUNCTION*) (yyvsp[-3].object), (yyvsp[-1].c_string));
if (compiler->last_result == ERROR_SUCCESS)
{
- args_count = strlen((yyvsp[(3) - (4)].c_string));
+ args_count = strlen((yyvsp[-1].c_string));
compiler->last_result = yr_parser_emit_with_arg(
yyscanner,
@@ -2505,40 +2251,38 @@ yyreduce:
NULL);
}
- (yyval.object) = ((YR_OBJECT_FUNCTION*) (yyvsp[(1) - (4)].object))->return_obj;
+ (yyval.object) = ((YR_OBJECT_FUNCTION*) (yyvsp[-3].object))->return_obj;
}
else
{
yr_compiler_set_error_extra_info(
compiler,
- (yyvsp[(1) - (4)].object)->identifier);
+ (yyvsp[-3].object)->identifier);
compiler->last_result = ERROR_NOT_A_FUNCTION;
}
- yr_free((yyvsp[(3) - (4)].c_string));
+ yr_free((yyvsp[-1].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 2270 "yara_grammar.c" /* yacc.c:1661 */
break;
case 44:
-
-/* Line 1806 of yacc.c */
-#line 760 "yara_grammar.y"
+#line 760 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.c_string) = yr_strdup("");
}
+#line 2278 "yara_grammar.c" /* yacc.c:1661 */
break;
case 45:
-
-/* Line 1806 of yacc.c */
-#line 764 "yara_grammar.y"
+#line 764 "yara_grammar.y" /* yacc.c:1661 */
{
(yyval.c_string) = yr_malloc(MAX_FUNCTION_ARGS + 1);
- switch((yyvsp[(1) - (1)].expression_type))
+ switch((yyvsp[0].expression_type))
{
case EXPRESSION_TYPE_INTEGER:
strlcpy((yyval.c_string), "i", MAX_FUNCTION_ARGS);
@@ -2556,49 +2300,47 @@ yyreduce:
ERROR_IF((yyval.c_string) == NULL);
}
+#line 2304 "yara_grammar.c" /* yacc.c:1661 */
break;
case 46:
-
-/* Line 1806 of yacc.c */
-#line 786 "yara_grammar.y"
+#line 786 "yara_grammar.y" /* yacc.c:1661 */
{
- if (strlen((yyvsp[(1) - (3)].c_string)) == MAX_FUNCTION_ARGS)
+ if (strlen((yyvsp[-2].c_string)) == MAX_FUNCTION_ARGS)
{
compiler->last_result = ERROR_TOO_MANY_ARGUMENTS;
}
else
{
- switch((yyvsp[(3) - (3)].expression_type))
+ switch((yyvsp[0].expression_type))
{
case EXPRESSION_TYPE_INTEGER:
- strlcat((yyvsp[(1) - (3)].c_string), "i", MAX_FUNCTION_ARGS);
+ strlcat((yyvsp[-2].c_string), "i", MAX_FUNCTION_ARGS);
break;
case EXPRESSION_TYPE_BOOLEAN:
- strlcat((yyvsp[(1) - (3)].c_string), "b", MAX_FUNCTION_ARGS);
+ strlcat((yyvsp[-2].c_string), "b", MAX_FUNCTION_ARGS);
break;
case EXPRESSION_TYPE_STRING:
- strlcat((yyvsp[(1) - (3)].c_string), "s", MAX_FUNCTION_ARGS);
+ strlcat((yyvsp[-2].c_string), "s", MAX_FUNCTION_ARGS);
break;
case EXPRESSION_TYPE_REGEXP:
- strlcat((yyvsp[(1) - (3)].c_string), "r", MAX_FUNCTION_ARGS);
+ strlcat((yyvsp[-2].c_string), "r", MAX_FUNCTION_ARGS);
break;
}
}
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
- (yyval.c_string) = (yyvsp[(1) - (3)].c_string);
+ (yyval.c_string) = (yyvsp[-2].c_string);
}
+#line 2337 "yara_grammar.c" /* yacc.c:1661 */
break;
case 47:
-
-/* Line 1806 of yacc.c */
-#line 819 "yara_grammar.y"
+#line 819 "yara_grammar.y" /* yacc.c:1661 */
{
#ifdef REAL_YARA
- SIZED_STRING* sized_string = (yyvsp[(1) - (1)].sized_string);
+ SIZED_STRING* sized_string = (yyvsp[0].sized_string);
RE* re;
RE_ERROR error;
@@ -2617,7 +2359,7 @@ yyreduce:
&re,
&error);
- yr_free((yyvsp[(1) - (1)].sized_string));
+ yr_free((yyvsp[0].sized_string));
if (compiler->last_result == ERROR_INVALID_REGULAR_EXPRESSION)
yr_compiler_set_error_extra_info(compiler, error.message);
@@ -2638,14 +2380,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_REGEXP;
}
+#line 2384 "yara_grammar.c" /* yacc.c:1661 */
break;
case 48:
-
-/* Line 1806 of yacc.c */
-#line 866 "yara_grammar.y"
+#line 866 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (1)].expression_type) == EXPRESSION_TYPE_STRING)
+ if ((yyvsp[0].expression_type) == EXPRESSION_TYPE_STRING)
{
compiler->last_result = yr_parser_emit(
yyscanner,
@@ -2658,12 +2399,11 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2403 "yara_grammar.c" /* yacc.c:1661 */
break;
case 49:
-
-/* Line 1806 of yacc.c */
-#line 884 "yara_grammar.y"
+#line 884 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_emit_with_arg(
yyscanner, OP_PUSH, 1, NULL);
@@ -2672,12 +2412,11 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2416 "yara_grammar.c" /* yacc.c:1661 */
break;
case 50:
-
-/* Line 1806 of yacc.c */
-#line 893 "yara_grammar.y"
+#line 893 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_emit_with_arg(
yyscanner, OP_PUSH, 0, NULL);
@@ -2686,15 +2425,14 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2429 "yara_grammar.c" /* yacc.c:1661 */
break;
case 51:
-
-/* Line 1806 of yacc.c */
-#line 902 "yara_grammar.y"
+#line 902 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_STRING, "matches");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_REGEXP, "matches");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_STRING, "matches");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_REGEXP, "matches");
if (compiler->last_result == ERROR_SUCCESS)
compiler->last_result = yr_parser_emit(
@@ -2706,15 +2444,14 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2448 "yara_grammar.c" /* yacc.c:1661 */
break;
case 52:
-
-/* Line 1806 of yacc.c */
-#line 917 "yara_grammar.y"
+#line 917 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_STRING, "contains");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_STRING, "contains");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_STRING, "contains");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_STRING, "contains");
compiler->last_result = yr_parser_emit(
yyscanner,
@@ -2725,39 +2462,37 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2466 "yara_grammar.c" /* yacc.c:1661 */
break;
case 53:
-
-/* Line 1806 of yacc.c */
-#line 931 "yara_grammar.y"
+#line 931 "yara_grammar.y" /* yacc.c:1661 */
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
OP_STR_FOUND);
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(result != ERROR_SUCCESS);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2483 "yara_grammar.c" /* yacc.c:1661 */
break;
case 54:
-
-/* Line 1806 of yacc.c */
-#line 944 "yara_grammar.y"
+#line 944 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "at");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "at");
compiler->last_result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
OP_STR_FOUND_AT);
- yr_free((yyvsp[(1) - (3)].c_string));
+ yr_free((yyvsp[-2].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
@@ -2765,19 +2500,18 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2504 "yara_grammar.c" /* yacc.c:1661 */
break;
case 55:
-
-/* Line 1806 of yacc.c */
-#line 961 "yara_grammar.y"
+#line 961 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (3)].c_string),
+ (yyvsp[-2].c_string),
OP_STR_FOUND_IN);
- yr_free((yyvsp[(1) - (3)].c_string));
+ yr_free((yyvsp[-2].c_string));
ERROR_IF(compiler->last_result!= ERROR_SUCCESS);
@@ -2785,12 +2519,11 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2523 "yara_grammar.c" /* yacc.c:1661 */
break;
case 56:
-
-/* Line 1806 of yacc.c */
-#line 976 "yara_grammar.y"
+#line 976 "yara_grammar.y" /* yacc.c:1661 */
{
int var_index;
@@ -2802,13 +2535,13 @@ yyreduce:
var_index = yr_parser_lookup_loop_variable(
yyscanner,
- (yyvsp[(3) - (4)].c_string));
+ (yyvsp[-1].c_string));
if (var_index >= 0)
{
yr_compiler_set_error_extra_info(
compiler,
- (yyvsp[(3) - (4)].c_string));
+ (yyvsp[-1].c_string));
compiler->last_result = \
ERROR_DUPLICATE_LOOP_IDENTIFIER;
@@ -2824,12 +2557,11 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 2561 "yara_grammar.c" /* yacc.c:1661 */
break;
case 57:
-
-/* Line 1806 of yacc.c */
-#line 1010 "yara_grammar.y"
+#line 1010 "yara_grammar.y" /* yacc.c:1661 */
{
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
@@ -2844,7 +2576,7 @@ yyreduce:
yr_parser_emit_with_arg(
yyscanner, OP_CLEAR_M, mem_offset + 2, NULL);
- if ((yyvsp[(6) - (7)].integer) == INTEGER_SET_ENUMERATION)
+ if ((yyvsp[-1].integer) == INTEGER_SET_ENUMERATION)
{
// Pop the first integer
yr_parser_emit_with_arg(
@@ -2861,15 +2593,14 @@ yyreduce:
yyscanner, OP_POP_M, mem_offset, NULL);
}
compiler->loop_address[compiler->loop_depth] = addr;
- compiler->loop_identifier[compiler->loop_depth] = (yyvsp[(3) - (7)].c_string);
+ compiler->loop_identifier[compiler->loop_depth] = (yyvsp[-4].c_string);
compiler->loop_depth++;
}
+#line 2600 "yara_grammar.c" /* yacc.c:1661 */
break;
case 58:
-
-/* Line 1806 of yacc.c */
-#line 1045 "yara_grammar.y"
+#line 1045 "yara_grammar.y" /* yacc.c:1661 */
{
int mem_offset;
@@ -2887,7 +2618,7 @@ yyreduce:
yr_parser_emit_with_arg(
yyscanner, OP_INCR_M, mem_offset + 2, NULL);
- if ((yyvsp[(6) - (11)].integer) == INTEGER_SET_ENUMERATION)
+ if ((yyvsp[-5].integer) == INTEGER_SET_ENUMERATION)
{
yr_parser_emit_with_arg_reloc(
yyscanner,
@@ -2941,16 +2672,15 @@ yyreduce:
yr_parser_emit(yyscanner, OP_LE, NULL);
compiler->loop_identifier[compiler->loop_depth] = NULL;
- yr_free((yyvsp[(3) - (11)].c_string));
+ yr_free((yyvsp[-8].c_string));
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2680 "yara_grammar.c" /* yacc.c:1661 */
break;
case 59:
-
-/* Line 1806 of yacc.c */
-#line 1121 "yara_grammar.y"
+#line 1121 "yara_grammar.y" /* yacc.c:1661 */
{
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
int8_t* addr;
@@ -2980,12 +2710,11 @@ yyreduce:
compiler->loop_identifier[compiler->loop_depth] = NULL;
compiler->loop_depth++;
}
+#line 2714 "yara_grammar.c" /* yacc.c:1661 */
break;
case 60:
-
-/* Line 1806 of yacc.c */
-#line 1151 "yara_grammar.y"
+#line 1151 "yara_grammar.y" /* yacc.c:1661 */
{
int mem_offset;
@@ -3004,7 +2733,7 @@ yyreduce:
yyscanner, OP_INCR_M, mem_offset + 2, NULL);
// If next string is not undefined, go back to the
- // begining of the loop.
+ // beginning of the loop.
yr_parser_emit_with_arg_reloc(
yyscanner,
OP_JNUNDEF,
@@ -3031,122 +2760,113 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2764 "yara_grammar.c" /* yacc.c:1661 */
break;
case 61:
-
-/* Line 1806 of yacc.c */
-#line 1197 "yara_grammar.y"
+#line 1197 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit(yyscanner, OP_OF, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2774 "yara_grammar.c" /* yacc.c:1661 */
break;
case 62:
-
-/* Line 1806 of yacc.c */
-#line 1203 "yara_grammar.y"
+#line 1203 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit(yyscanner, OP_NOT, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2784 "yara_grammar.c" /* yacc.c:1661 */
break;
case 63:
-
-/* Line 1806 of yacc.c */
-#line 1209 "yara_grammar.y"
+#line 1209 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit(yyscanner, OP_AND, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2794 "yara_grammar.c" /* yacc.c:1661 */
break;
case 64:
-
-/* Line 1806 of yacc.c */
-#line 1215 "yara_grammar.y"
+#line 1215 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_BOOLEAN, "or");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_BOOLEAN, "or");
yr_parser_emit(yyscanner, OP_OR, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2806 "yara_grammar.c" /* yacc.c:1661 */
break;
case 65:
-
-/* Line 1806 of yacc.c */
-#line 1223 "yara_grammar.y"
+#line 1223 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "<");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "<");
yr_parser_emit(yyscanner, OP_LT, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2819 "yara_grammar.c" /* yacc.c:1661 */
break;
case 66:
-
-/* Line 1806 of yacc.c */
-#line 1232 "yara_grammar.y"
+#line 1232 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, ">");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, ">");
yr_parser_emit(yyscanner, OP_GT, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2832 "yara_grammar.c" /* yacc.c:1661 */
break;
case 67:
-
-/* Line 1806 of yacc.c */
-#line 1241 "yara_grammar.y"
+#line 1241 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<=");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<=");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "<=");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "<=");
yr_parser_emit(yyscanner, OP_LE, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2845 "yara_grammar.c" /* yacc.c:1661 */
break;
case 68:
-
-/* Line 1806 of yacc.c */
-#line 1250 "yara_grammar.y"
+#line 1250 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">=");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">=");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, ">=");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, ">=");
yr_parser_emit(yyscanner, OP_GE, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2858 "yara_grammar.c" /* yacc.c:1661 */
break;
case 69:
-
-/* Line 1806 of yacc.c */
-#line 1259 "yara_grammar.y"
+#line 1259 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (3)].expression_type) != (yyvsp[(3) - (3)].expression_type))
+ if ((yyvsp[-2].expression_type) != (yyvsp[0].expression_type))
{
yr_compiler_set_error_extra_info(
compiler, "mismatching types for == operator");
compiler->last_result = ERROR_WRONG_TYPE;
}
- else if ((yyvsp[(1) - (3)].expression_type) == EXPRESSION_TYPE_STRING)
+ else if ((yyvsp[-2].expression_type) == EXPRESSION_TYPE_STRING)
{
compiler->last_result = yr_parser_emit(
yyscanner,
@@ -3165,20 +2885,19 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2889 "yara_grammar.c" /* yacc.c:1661 */
break;
case 70:
-
-/* Line 1806 of yacc.c */
-#line 1286 "yara_grammar.y"
+#line 1286 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (3)].expression_type) != (yyvsp[(3) - (3)].expression_type))
+ if ((yyvsp[-2].expression_type) != (yyvsp[0].expression_type))
{
yr_compiler_set_error_extra_info(
compiler, "mismatching types for == operator");
compiler->last_result = ERROR_WRONG_TYPE;
}
- else if ((yyvsp[(1) - (3)].expression_type) == EXPRESSION_TYPE_STRING)
+ else if ((yyvsp[-2].expression_type) == EXPRESSION_TYPE_STRING)
{
compiler->last_result = yr_parser_emit(
yyscanner,
@@ -3197,20 +2916,19 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2920 "yara_grammar.c" /* yacc.c:1661 */
break;
case 71:
-
-/* Line 1806 of yacc.c */
-#line 1313 "yara_grammar.y"
+#line 1313 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (3)].expression_type) != (yyvsp[(3) - (3)].expression_type))
+ if ((yyvsp[-2].expression_type) != (yyvsp[0].expression_type))
{
yr_compiler_set_error_extra_info(
compiler, "mismatching types for != operator");
compiler->last_result = ERROR_WRONG_TYPE;
}
- else if ((yyvsp[(1) - (3)].expression_type) == EXPRESSION_TYPE_STRING)
+ else if ((yyvsp[-2].expression_type) == EXPRESSION_TYPE_STRING)
{
compiler->last_result = yr_parser_emit(
yyscanner,
@@ -3229,53 +2947,48 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
+#line 2951 "yara_grammar.c" /* yacc.c:1661 */
break;
case 72:
-
-/* Line 1806 of yacc.c */
-#line 1340 "yara_grammar.y"
+#line 1340 "yara_grammar.y" /* yacc.c:1661 */
{
- (yyval.expression_type) = (yyvsp[(1) - (1)].expression_type);
+ (yyval.expression_type) = (yyvsp[0].expression_type);
}
+#line 2959 "yara_grammar.c" /* yacc.c:1661 */
break;
case 73:
-
-/* Line 1806 of yacc.c */
-#line 1344 "yara_grammar.y"
+#line 1344 "yara_grammar.y" /* yacc.c:1661 */
{
- (yyval.expression_type) = (yyvsp[(2) - (3)].expression_type);
+ (yyval.expression_type) = (yyvsp[-1].expression_type);
}
+#line 2967 "yara_grammar.c" /* yacc.c:1661 */
break;
case 74:
-
-/* Line 1806 of yacc.c */
-#line 1351 "yara_grammar.y"
+#line 1351 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = INTEGER_SET_ENUMERATION; }
+#line 2973 "yara_grammar.c" /* yacc.c:1661 */
break;
case 75:
-
-/* Line 1806 of yacc.c */
-#line 1352 "yara_grammar.y"
+#line 1352 "yara_grammar.y" /* yacc.c:1661 */
{ (yyval.integer) = INTEGER_SET_RANGE; }
+#line 2979 "yara_grammar.c" /* yacc.c:1661 */
break;
case 76:
-
-/* Line 1806 of yacc.c */
-#line 1358 "yara_grammar.y"
+#line 1358 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(2) - (6)].expression_type) != EXPRESSION_TYPE_INTEGER)
+ if ((yyvsp[-4].expression_type) != EXPRESSION_TYPE_INTEGER)
{
yr_compiler_set_error_extra_info(
compiler, "wrong type for range's lower bound");
compiler->last_result = ERROR_WRONG_TYPE;
}
- if ((yyvsp[(5) - (6)].expression_type) != EXPRESSION_TYPE_INTEGER)
+ if ((yyvsp[-1].expression_type) != EXPRESSION_TYPE_INTEGER)
{
yr_compiler_set_error_extra_info(
compiler, "wrong type for range's upper bound");
@@ -3284,14 +2997,13 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 3001 "yara_grammar.c" /* yacc.c:1661 */
break;
case 77:
-
-/* Line 1806 of yacc.c */
-#line 1380 "yara_grammar.y"
+#line 1380 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (1)].expression_type) != EXPRESSION_TYPE_INTEGER)
+ if ((yyvsp[0].expression_type) != EXPRESSION_TYPE_INTEGER)
{
yr_compiler_set_error_extra_info(
compiler, "wrong type for enumeration item");
@@ -3301,14 +3013,13 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 3017 "yara_grammar.c" /* yacc.c:1661 */
break;
case 78:
-
-/* Line 1806 of yacc.c */
-#line 1392 "yara_grammar.y"
+#line 1392 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(3) - (3)].expression_type) != EXPRESSION_TYPE_INTEGER)
+ if ((yyvsp[0].expression_type) != EXPRESSION_TYPE_INTEGER)
{
yr_compiler_set_error_extra_info(
compiler, "wrong type for enumeration item");
@@ -3317,22 +3028,20 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 3032 "yara_grammar.c" /* yacc.c:1661 */
break;
case 79:
-
-/* Line 1806 of yacc.c */
-#line 1407 "yara_grammar.y"
+#line 1407 "yara_grammar.y" /* yacc.c:1661 */
{
// Push end-of-list marker
yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL);
}
+#line 3041 "yara_grammar.c" /* yacc.c:1661 */
break;
case 81:
-
-/* Line 1806 of yacc.c */
-#line 1413 "yara_grammar.y"
+#line 1413 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL);
yr_parser_emit_pushes_for_strings(yyscanner, "$*");
@@ -3340,65 +3049,59 @@ yyreduce:
compiler->current_rule_clflags |= RULE_THEM;
#endif
}
+#line 3053 "yara_grammar.c" /* yacc.c:1661 */
break;
case 84:
-
-/* Line 1806 of yacc.c */
-#line 1431 "yara_grammar.y"
+#line 1431 "yara_grammar.y" /* yacc.c:1661 */
{
- yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[0].c_string));
+ yr_free((yyvsp[0].c_string));
}
+#line 3062 "yara_grammar.c" /* yacc.c:1661 */
break;
case 85:
-
-/* Line 1806 of yacc.c */
-#line 1436 "yara_grammar.y"
+#line 1436 "yara_grammar.y" /* yacc.c:1661 */
{
- yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[0].c_string));
+ yr_free((yyvsp[0].c_string));
}
+#line 3071 "yara_grammar.c" /* yacc.c:1661 */
break;
case 87:
-
-/* Line 1806 of yacc.c */
-#line 1446 "yara_grammar.y"
+#line 1446 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL);
#ifdef YARA_PROTO
compiler->current_rule_clflags |= RULE_ALL;
#endif
}
+#line 3082 "yara_grammar.c" /* yacc.c:1661 */
break;
case 88:
-
-/* Line 1806 of yacc.c */
-#line 1453 "yara_grammar.y"
+#line 1453 "yara_grammar.y" /* yacc.c:1661 */
{
yr_parser_emit_with_arg(yyscanner, OP_PUSH, 1, NULL);
#ifdef YARA_PROTO
compiler->current_rule_clflags |= RULE_ANY;
#endif
}
+#line 3093 "yara_grammar.c" /* yacc.c:1661 */
break;
case 89:
-
-/* Line 1806 of yacc.c */
-#line 1464 "yara_grammar.y"
+#line 1464 "yara_grammar.y" /* yacc.c:1661 */
{
- (yyval.expression_type) = (yyvsp[(2) - (3)].expression_type);
+ (yyval.expression_type) = (yyvsp[-1].expression_type);
}
+#line 3101 "yara_grammar.c" /* yacc.c:1661 */
break;
case 90:
-
-/* Line 1806 of yacc.c */
-#line 1468 "yara_grammar.y"
+#line 1468 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_emit(
yyscanner, OP_FILESIZE, NULL);
@@ -3407,12 +3110,11 @@ yyreduce:
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 3114 "yara_grammar.c" /* yacc.c:1661 */
break;
case 91:
-
-/* Line 1806 of yacc.c */
-#line 1477 "yara_grammar.y"
+#line 1477 "yara_grammar.y" /* yacc.c:1661 */
{
#ifndef YARA_PROTO
yywarning(yyscanner,
@@ -3427,14 +3129,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3133 "yara_grammar.c" /* yacc.c:1661 */
break;
case 92:
-
-/* Line 1806 of yacc.c */
-#line 1492 "yara_grammar.y"
+#line 1492 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "int8");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "int8");
compiler->last_result = yr_parser_emit(
yyscanner, OP_INT8, NULL);
@@ -3443,14 +3144,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3148 "yara_grammar.c" /* yacc.c:1661 */
break;
case 93:
-
-/* Line 1806 of yacc.c */
-#line 1503 "yara_grammar.y"
+#line 1503 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "int16");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "int16");
compiler->last_result = yr_parser_emit(
yyscanner, OP_INT16, NULL);
@@ -3459,14 +3159,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3163 "yara_grammar.c" /* yacc.c:1661 */
break;
case 94:
-
-/* Line 1806 of yacc.c */
-#line 1514 "yara_grammar.y"
+#line 1514 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "int32");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "int32");
compiler->last_result = yr_parser_emit(
yyscanner, OP_INT32, NULL);
@@ -3475,14 +3174,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3178 "yara_grammar.c" /* yacc.c:1661 */
break;
case 95:
-
-/* Line 1806 of yacc.c */
-#line 1525 "yara_grammar.y"
+#line 1525 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "uint8");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "uint8");
compiler->last_result = yr_parser_emit(
yyscanner, OP_UINT8, NULL);
@@ -3491,14 +3189,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3193 "yara_grammar.c" /* yacc.c:1661 */
break;
case 96:
-
-/* Line 1806 of yacc.c */
-#line 1536 "yara_grammar.y"
+#line 1536 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "uint16");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "uint16");
compiler->last_result = yr_parser_emit(
yyscanner, OP_UINT16, NULL);
@@ -3507,14 +3204,13 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3208 "yara_grammar.c" /* yacc.c:1661 */
break;
case 97:
-
-/* Line 1806 of yacc.c */
-#line 1547 "yara_grammar.y"
+#line 1547 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(3) - (4)].expression_type), EXPRESSION_TYPE_INTEGER, "uint32");
+ CHECK_TYPE((yyvsp[-1].expression_type), EXPRESSION_TYPE_INTEGER, "uint32");
compiler->last_result = yr_parser_emit(
yyscanner, OP_UINT32, NULL);
@@ -3523,29 +3219,27 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3223 "yara_grammar.c" /* yacc.c:1661 */
break;
case 98:
-
-/* Line 1806 of yacc.c */
-#line 1558 "yara_grammar.y"
+#line 1558 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_emit_with_arg(
- yyscanner, OP_PUSH, (yyvsp[(1) - (1)].integer), NULL);
+ yyscanner, OP_PUSH, (yyvsp[0].integer), NULL);
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3236 "yara_grammar.c" /* yacc.c:1661 */
break;
case 99:
-
-/* Line 1806 of yacc.c */
-#line 1567 "yara_grammar.y"
+#line 1567 "yara_grammar.y" /* yacc.c:1661 */
{
- SIZED_STRING* sized_string = (yyvsp[(1) - (1)].sized_string);
- char* string;
+ SIZED_STRING* sized_string = (yyvsp[0].sized_string);
+ char* string = NULL;
#if REAL_YARA
compiler->last_result = yr_arena_write_string(
@@ -3554,7 +3248,7 @@ yyreduce:
&string);
#endif
- yr_free((yyvsp[(1) - (1)].sized_string));
+ yr_free((yyvsp[0].sized_string));
if (compiler->last_result == ERROR_SUCCESS)
compiler->last_result = yr_parser_emit_with_arg_reloc(
@@ -3567,37 +3261,35 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_STRING;
}
+#line 3265 "yara_grammar.c" /* yacc.c:1661 */
break;
case 100:
-
-/* Line 1806 of yacc.c */
-#line 1592 "yara_grammar.y"
+#line 1592 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
OP_STR_COUNT);
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3282 "yara_grammar.c" /* yacc.c:1661 */
break;
case 101:
-
-/* Line 1806 of yacc.c */
-#line 1605 "yara_grammar.y"
+#line 1605 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (4)].c_string),
+ (yyvsp[-3].c_string),
OP_STR_OFFSET);
- yr_free((yyvsp[(1) - (4)].c_string));
+ yr_free((yyvsp[-3].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
@@ -3605,12 +3297,11 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3301 "yara_grammar.c" /* yacc.c:1661 */
break;
case 102:
-
-/* Line 1806 of yacc.c */
-#line 1620 "yara_grammar.y"
+#line 1620 "yara_grammar.y" /* yacc.c:1661 */
{
compiler->last_result = yr_parser_emit_with_arg(
yyscanner,
@@ -3621,10 +3312,10 @@ yyreduce:
if (compiler->last_result == ERROR_SUCCESS)
compiler->last_result = yr_parser_reduce_string_identifier(
yyscanner,
- (yyvsp[(1) - (1)].c_string),
+ (yyvsp[0].c_string),
OP_STR_OFFSET);
- yr_free((yyvsp[(1) - (1)].c_string));
+ yr_free((yyvsp[0].c_string));
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
@@ -3632,27 +3323,26 @@ yyreduce:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3327 "yara_grammar.c" /* yacc.c:1661 */
break;
case 103:
-
-/* Line 1806 of yacc.c */
-#line 1642 "yara_grammar.y"
+#line 1642 "yara_grammar.y" /* yacc.c:1661 */
{
- if ((yyvsp[(1) - (1)].object) == (YR_OBJECT*) -1) // loop identifier
+ if ((yyvsp[0].object) == (YR_OBJECT*) -1) // loop identifier
{
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
- else if ((yyvsp[(1) - (1)].object) == (YR_OBJECT*) -2) // rule identifier
+ else if ((yyvsp[0].object) == (YR_OBJECT*) -2) // rule identifier
{
(yyval.expression_type) = EXPRESSION_TYPE_BOOLEAN;
}
- else if ((yyvsp[(1) - (1)].object) != NULL)
+ else if ((yyvsp[0].object) != NULL)
{
compiler->last_result = yr_parser_emit(
yyscanner, OP_OBJ_VALUE, NULL);
- switch((yyvsp[(1) - (1)].object)->type)
+ switch((yyvsp[0].object)->type)
{
case OBJECT_TYPE_INTEGER:
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
@@ -3666,180 +3356,167 @@ yyreduce:
}
else
{
- yr_compiler_set_error_extra_info(compiler, (yyvsp[(1) - (1)].object)->identifier);
+ yr_compiler_set_error_extra_info(compiler, (yyvsp[0].object)->identifier);
compiler->last_result = ERROR_WRONG_TYPE;
}
ERROR_IF(compiler->last_result != ERROR_SUCCESS);
}
+#line 3366 "yara_grammar.c" /* yacc.c:1661 */
break;
case 104:
-
-/* Line 1806 of yacc.c */
-#line 1677 "yara_grammar.y"
+#line 1677 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "+");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "+");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "+");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "+");
yr_parser_emit(yyscanner, OP_ADD, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3379 "yara_grammar.c" /* yacc.c:1661 */
break;
case 105:
-
-/* Line 1806 of yacc.c */
-#line 1686 "yara_grammar.y"
+#line 1686 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "-");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "-");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "-");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "-");
yr_parser_emit(yyscanner, OP_SUB, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3392 "yara_grammar.c" /* yacc.c:1661 */
break;
case 106:
-
-/* Line 1806 of yacc.c */
-#line 1695 "yara_grammar.y"
+#line 1695 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "*");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "*");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "*");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "*");
yr_parser_emit(yyscanner, OP_MUL, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3405 "yara_grammar.c" /* yacc.c:1661 */
break;
case 107:
-
-/* Line 1806 of yacc.c */
-#line 1704 "yara_grammar.y"
+#line 1704 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "\\");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "\\");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "\\");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "\\");
yr_parser_emit(yyscanner, OP_DIV, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3418 "yara_grammar.c" /* yacc.c:1661 */
break;
case 108:
-
-/* Line 1806 of yacc.c */
-#line 1713 "yara_grammar.y"
+#line 1713 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "%");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "%");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "%");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "%");
yr_parser_emit(yyscanner, OP_MOD, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3431 "yara_grammar.c" /* yacc.c:1661 */
break;
case 109:
-
-/* Line 1806 of yacc.c */
-#line 1722 "yara_grammar.y"
+#line 1722 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "^");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "^");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "^");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "^");
yr_parser_emit(yyscanner, OP_XOR, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3444 "yara_grammar.c" /* yacc.c:1661 */
break;
case 110:
-
-/* Line 1806 of yacc.c */
-#line 1731 "yara_grammar.y"
+#line 1731 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "^");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "^");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "^");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "^");
yr_parser_emit(yyscanner, OP_AND, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3457 "yara_grammar.c" /* yacc.c:1661 */
break;
case 111:
-
-/* Line 1806 of yacc.c */
-#line 1740 "yara_grammar.y"
+#line 1740 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "|");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "|");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "|");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "|");
yr_parser_emit(yyscanner, OP_OR, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3470 "yara_grammar.c" /* yacc.c:1661 */
break;
case 112:
-
-/* Line 1806 of yacc.c */
-#line 1749 "yara_grammar.y"
+#line 1749 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(2) - (2)].expression_type), EXPRESSION_TYPE_INTEGER, "~");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "~");
yr_parser_emit(yyscanner, OP_NEG, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3482 "yara_grammar.c" /* yacc.c:1661 */
break;
case 113:
-
-/* Line 1806 of yacc.c */
-#line 1757 "yara_grammar.y"
+#line 1757 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<<");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, "<<");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, "<<");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, "<<");
yr_parser_emit(yyscanner, OP_SHL, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3495 "yara_grammar.c" /* yacc.c:1661 */
break;
case 114:
-
-/* Line 1806 of yacc.c */
-#line 1766 "yara_grammar.y"
+#line 1766 "yara_grammar.y" /* yacc.c:1661 */
{
- CHECK_TYPE((yyvsp[(1) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">>");
- CHECK_TYPE((yyvsp[(3) - (3)].expression_type), EXPRESSION_TYPE_INTEGER, ">>");
+ CHECK_TYPE((yyvsp[-2].expression_type), EXPRESSION_TYPE_INTEGER, ">>");
+ CHECK_TYPE((yyvsp[0].expression_type), EXPRESSION_TYPE_INTEGER, ">>");
yr_parser_emit(yyscanner, OP_SHR, NULL);
(yyval.expression_type) = EXPRESSION_TYPE_INTEGER;
}
+#line 3508 "yara_grammar.c" /* yacc.c:1661 */
break;
case 115:
-
-/* Line 1806 of yacc.c */
-#line 1775 "yara_grammar.y"
+#line 1775 "yara_grammar.y" /* yacc.c:1661 */
{
- (yyval.expression_type) = (yyvsp[(1) - (1)].expression_type);
+ (yyval.expression_type) = (yyvsp[0].expression_type);
}
+#line 3516 "yara_grammar.c" /* yacc.c:1661 */
break;
-
-/* Line 1806 of yacc.c */
-#line 3843 "yara_grammar.c"
+#line 3520 "yara_grammar.c" /* yacc.c:1661 */
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -3861,7 +3538,7 @@ yyreduce:
*++yyvsp = yyval;
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -3876,9 +3553,9 @@ yyreduce:
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
/* Make sure we have latest lookahead translation. See comments at
user semantic actions for why this is necessary. */
@@ -3929,20 +3606,20 @@ yyerrlab:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, yyscanner, compiler);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, yyscanner, compiler);
+ yychar = YYEMPTY;
+ }
}
/* Else will try to reuse lookahead token after shifting the error
@@ -3961,7 +3638,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -3974,35 +3651,37 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
for (;;)
{
yyn = yypact[yystate];
if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, yyscanner, compiler);
+ yystos[yystate], yyvsp, yyscanner, compiler);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
@@ -4026,7 +3705,7 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined(yyoverflow) || YYERROR_VERBOSE
+#if !defined yyoverflow || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -4045,14 +3724,14 @@ yyreturn:
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, yyscanner, compiler);
}
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, yyscanner, compiler);
+ yystos[*yyssp], yyvsp, yyscanner, compiler);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -4063,13 +3742,7 @@ yyreturn:
if (yymsg != yymsgbuf)
YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-
-/* Line 2067 of yacc.c */
-#line 1780 "yara_grammar.y"
-
+#line 1780 "yara_grammar.y" /* yacc.c:1906 */
diff --git a/libclamav/yara_grammar.h b/libclamav/yara_grammar.h
index f71a4ca9b..68aa176b9 100644
--- a/libclamav/yara_grammar.h
+++ b/libclamav/yara_grammar.h
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 2.5. */
+/* A Bison parser, made by GNU Bison 3.0.4. */
/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
-
+
+ Copyright (C) 1984, 1989-1990, 2000-2015 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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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 . */
@@ -26,69 +26,79 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+#ifndef YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED
+# define YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 1
+#endif
+#if YYDEBUG
+extern int yara_yydebug;
+#endif
-/* Tokens. */
+#include "yara_compiler.h"
+
+/* Token type. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- _RULE_ = 258,
- _PRIVATE_ = 259,
- _GLOBAL_ = 260,
- _META_ = 261,
- _STRINGS_ = 262,
- _CONDITION_ = 263,
- _IDENTIFIER_ = 264,
- _STRING_IDENTIFIER_ = 265,
- _STRING_COUNT_ = 266,
- _STRING_OFFSET_ = 267,
- _STRING_IDENTIFIER_WITH_WILDCARD_ = 268,
- _NUMBER_ = 269,
- _TEXT_STRING_ = 270,
- _HEX_STRING_ = 271,
- _REGEXP_ = 272,
- _ASCII_ = 273,
- _WIDE_ = 274,
- _NOCASE_ = 275,
- _FULLWORD_ = 276,
- _AT_ = 277,
- _FILESIZE_ = 278,
- _ENTRYPOINT_ = 279,
- _ALL_ = 280,
- _ANY_ = 281,
- _IN_ = 282,
- _OF_ = 283,
- _FOR_ = 284,
- _THEM_ = 285,
- _INT8_ = 286,
- _INT16_ = 287,
- _INT32_ = 288,
- _UINT8_ = 289,
- _UINT16_ = 290,
- _UINT32_ = 291,
- _MATCHES_ = 292,
- _CONTAINS_ = 293,
- _IMPORT_ = 294,
- _TRUE_ = 295,
- _FALSE_ = 296,
- _OR_ = 297,
- _AND_ = 298,
- _IS_ = 299,
- _NEQ_ = 300,
- _EQ_ = 301,
- _GE_ = 302,
- _GT_ = 303,
- _LE_ = 304,
- _LT_ = 305,
- _SHIFT_RIGHT_ = 306,
- _SHIFT_LEFT_ = 307,
- _NOT_ = 308
- };
+ enum yytokentype
+ {
+ _RULE_ = 258,
+ _PRIVATE_ = 259,
+ _GLOBAL_ = 260,
+ _META_ = 261,
+ _STRINGS_ = 262,
+ _CONDITION_ = 263,
+ _IDENTIFIER_ = 264,
+ _STRING_IDENTIFIER_ = 265,
+ _STRING_COUNT_ = 266,
+ _STRING_OFFSET_ = 267,
+ _STRING_IDENTIFIER_WITH_WILDCARD_ = 268,
+ _NUMBER_ = 269,
+ _TEXT_STRING_ = 270,
+ _HEX_STRING_ = 271,
+ _REGEXP_ = 272,
+ _ASCII_ = 273,
+ _WIDE_ = 274,
+ _NOCASE_ = 275,
+ _FULLWORD_ = 276,
+ _AT_ = 277,
+ _FILESIZE_ = 278,
+ _ENTRYPOINT_ = 279,
+ _ALL_ = 280,
+ _ANY_ = 281,
+ _IN_ = 282,
+ _OF_ = 283,
+ _FOR_ = 284,
+ _THEM_ = 285,
+ _INT8_ = 286,
+ _INT16_ = 287,
+ _INT32_ = 288,
+ _UINT8_ = 289,
+ _UINT16_ = 290,
+ _UINT32_ = 291,
+ _MATCHES_ = 292,
+ _CONTAINS_ = 293,
+ _IMPORT_ = 294,
+ _TRUE_ = 295,
+ _FALSE_ = 296,
+ _OR_ = 297,
+ _AND_ = 298,
+ _LT_ = 299,
+ _LE_ = 300,
+ _GT_ = 301,
+ _GE_ = 302,
+ _EQ_ = 303,
+ _NEQ_ = 304,
+ _IS_ = 305,
+ _SHIFT_LEFT_ = 306,
+ _SHIFT_RIGHT_ = 307,
+ _NOT_ = 308
+ };
#endif
/* Tokens. */
#define _RULE_ 258
@@ -132,26 +142,23 @@
#define _FALSE_ 296
#define _OR_ 297
#define _AND_ 298
-#define _IS_ 299
-#define _NEQ_ 300
-#define _EQ_ 301
+#define _LT_ 299
+#define _LE_ 300
+#define _GT_ 301
#define _GE_ 302
-#define _GT_ 303
-#define _LE_ 304
-#define _LT_ 305
-#define _SHIFT_RIGHT_ 306
-#define _SHIFT_LEFT_ 307
+#define _EQ_ 303
+#define _NEQ_ 304
+#define _IS_ 305
+#define _SHIFT_LEFT_ 306
+#define _SHIFT_RIGHT_ 307
#define _NOT_ 308
-
-
-
+/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-/* Line 2068 of yacc.c */
-#line 214 "yara_grammar.y"
+union YYSTYPE
+{
+#line 214 "yara_grammar.y" /* yacc.c:1915 */
SIZED_STRING* sized_string;
char* c_string;
@@ -161,16 +168,16 @@ typedef union YYSTYPE
YR_META* meta;
YR_OBJECT* object;
+#line 170 "yara_grammar.h" /* yacc.c:1915 */
+};
-
-/* Line 2068 of yacc.c */
-#line 168 "yara_grammar.h"
-} YYSTYPE;
+typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
#endif
+int yara_yyparse (void *yyscanner, YR_COMPILER* compiler);
+#endif /* !YY_YARA_YY_YARA_GRAMMAR_H_INCLUDED */
diff --git a/libclamav/yara_lexer.c b/libclamav/yara_lexer.c
index edd762a28..fc7bce1e0 100644
--- a/libclamav/yara_lexer.c
+++ b/libclamav/yara_lexer.c
@@ -1,6 +1,6 @@
-#line 2 "yara_lexer.c"
+#line 1 "yara_lexer.c"
-#line 4 "yara_lexer.c"
+#line 3 "yara_lexer.c"
#define YY_INT_ALIGNED short int
@@ -8,12 +8,234 @@
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_MINOR_VERSION 6
+#define YY_FLEX_SUBMINOR_VERSION 4
#if YY_FLEX_SUBMINOR_VERSION > 0
#define FLEX_BETA
#endif
+#ifdef yy_create_buffer
+#define yara_yy_create_buffer_ALREADY_DEFINED
+#else
+#define yy_create_buffer yara_yy_create_buffer
+#endif
+
+#ifdef yy_delete_buffer
+#define yara_yy_delete_buffer_ALREADY_DEFINED
+#else
+#define yy_delete_buffer yara_yy_delete_buffer
+#endif
+
+#ifdef yy_scan_buffer
+#define yara_yy_scan_buffer_ALREADY_DEFINED
+#else
+#define yy_scan_buffer yara_yy_scan_buffer
+#endif
+
+#ifdef yy_scan_string
+#define yara_yy_scan_string_ALREADY_DEFINED
+#else
+#define yy_scan_string yara_yy_scan_string
+#endif
+
+#ifdef yy_scan_bytes
+#define yara_yy_scan_bytes_ALREADY_DEFINED
+#else
+#define yy_scan_bytes yara_yy_scan_bytes
+#endif
+
+#ifdef yy_init_buffer
+#define yara_yy_init_buffer_ALREADY_DEFINED
+#else
+#define yy_init_buffer yara_yy_init_buffer
+#endif
+
+#ifdef yy_flush_buffer
+#define yara_yy_flush_buffer_ALREADY_DEFINED
+#else
+#define yy_flush_buffer yara_yy_flush_buffer
+#endif
+
+#ifdef yy_load_buffer_state
+#define yara_yy_load_buffer_state_ALREADY_DEFINED
+#else
+#define yy_load_buffer_state yara_yy_load_buffer_state
+#endif
+
+#ifdef yy_switch_to_buffer
+#define yara_yy_switch_to_buffer_ALREADY_DEFINED
+#else
+#define yy_switch_to_buffer yara_yy_switch_to_buffer
+#endif
+
+#ifdef yypush_buffer_state
+#define yara_yypush_buffer_state_ALREADY_DEFINED
+#else
+#define yypush_buffer_state yara_yypush_buffer_state
+#endif
+
+#ifdef yypop_buffer_state
+#define yara_yypop_buffer_state_ALREADY_DEFINED
+#else
+#define yypop_buffer_state yara_yypop_buffer_state
+#endif
+
+#ifdef yyensure_buffer_stack
+#define yara_yyensure_buffer_stack_ALREADY_DEFINED
+#else
+#define yyensure_buffer_stack yara_yyensure_buffer_stack
+#endif
+
+#ifdef yylex
+#define yara_yylex_ALREADY_DEFINED
+#else
+#define yylex yara_yylex
+#endif
+
+#ifdef yyrestart
+#define yara_yyrestart_ALREADY_DEFINED
+#else
+#define yyrestart yara_yyrestart
+#endif
+
+#ifdef yylex_init
+#define yara_yylex_init_ALREADY_DEFINED
+#else
+#define yylex_init yara_yylex_init
+#endif
+
+#ifdef yylex_init_extra
+#define yara_yylex_init_extra_ALREADY_DEFINED
+#else
+#define yylex_init_extra yara_yylex_init_extra
+#endif
+
+#ifdef yylex_destroy
+#define yara_yylex_destroy_ALREADY_DEFINED
+#else
+#define yylex_destroy yara_yylex_destroy
+#endif
+
+#ifdef yyget_debug
+#define yara_yyget_debug_ALREADY_DEFINED
+#else
+#define yyget_debug yara_yyget_debug
+#endif
+
+#ifdef yyset_debug
+#define yara_yyset_debug_ALREADY_DEFINED
+#else
+#define yyset_debug yara_yyset_debug
+#endif
+
+#ifdef yyget_extra
+#define yara_yyget_extra_ALREADY_DEFINED
+#else
+#define yyget_extra yara_yyget_extra
+#endif
+
+#ifdef yyset_extra
+#define yara_yyset_extra_ALREADY_DEFINED
+#else
+#define yyset_extra yara_yyset_extra
+#endif
+
+#ifdef yyget_in
+#define yara_yyget_in_ALREADY_DEFINED
+#else
+#define yyget_in yara_yyget_in
+#endif
+
+#ifdef yyset_in
+#define yara_yyset_in_ALREADY_DEFINED
+#else
+#define yyset_in yara_yyset_in
+#endif
+
+#ifdef yyget_out
+#define yara_yyget_out_ALREADY_DEFINED
+#else
+#define yyget_out yara_yyget_out
+#endif
+
+#ifdef yyset_out
+#define yara_yyset_out_ALREADY_DEFINED
+#else
+#define yyset_out yara_yyset_out
+#endif
+
+#ifdef yyget_leng
+#define yara_yyget_leng_ALREADY_DEFINED
+#else
+#define yyget_leng yara_yyget_leng
+#endif
+
+#ifdef yyget_text
+#define yara_yyget_text_ALREADY_DEFINED
+#else
+#define yyget_text yara_yyget_text
+#endif
+
+#ifdef yyget_lineno
+#define yara_yyget_lineno_ALREADY_DEFINED
+#else
+#define yyget_lineno yara_yyget_lineno
+#endif
+
+#ifdef yyset_lineno
+#define yara_yyset_lineno_ALREADY_DEFINED
+#else
+#define yyset_lineno yara_yyset_lineno
+#endif
+
+#ifdef yyget_column
+#define yara_yyget_column_ALREADY_DEFINED
+#else
+#define yyget_column yara_yyget_column
+#endif
+
+#ifdef yyset_column
+#define yara_yyset_column_ALREADY_DEFINED
+#else
+#define yyset_column yara_yyset_column
+#endif
+
+#ifdef yywrap
+#define yara_yywrap_ALREADY_DEFINED
+#else
+#define yywrap yara_yywrap
+#endif
+
+#ifdef yyget_lval
+#define yara_yyget_lval_ALREADY_DEFINED
+#else
+#define yyget_lval yara_yyget_lval
+#endif
+
+#ifdef yyset_lval
+#define yara_yyset_lval_ALREADY_DEFINED
+#else
+#define yyset_lval yara_yyset_lval
+#endif
+
+#ifdef yyalloc
+#define yara_yyalloc_ALREADY_DEFINED
+#else
+#define yyalloc yara_yyalloc
+#endif
+
+#ifdef yyrealloc
+#define yara_yyrealloc_ALREADY_DEFINED
+#else
+#define yyrealloc yara_yyrealloc
+#endif
+
+#ifdef yyfree
+#define yara_yyfree_ALREADY_DEFINED
+#else
+#define yyfree yara_yyfree
+#endif
+
/* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */
@@ -48,10 +270,6 @@ typedef uint16_t flex_uint16_t;
typedef int32_t flex_int32_t;
typedef uint32_t flex_uint32_t;
#else
-
-#if _MSC_VER
-#include
-#endif
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
@@ -88,40 +306,32 @@ typedef unsigned int flex_uint32_t;
#define UINT32_MAX (4294967295U)
#endif
+#ifndef SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+
#endif /* ! C99 */
#endif /* ! FLEXINT_H */
-#ifdef __cplusplus
+/* begin standard C++ headers. */
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
-
-#define YY_USE_CONST
-
-#endif /* defined (__STDC__) */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
+/* TODO: this is always defined, so inline it */
#define yyconst const
+
+#if defined(__GNUC__) && __GNUC__ >= 3
+#define yynoreturn __attribute__((__noreturn__))
#else
-#define yyconst
+#define yynoreturn
#endif
/* Returned upon end-of-file. */
#define YY_NULL 0
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
+/* Promotes a possibly negative, possibly signed char to an
+ * integer in range [0..255] for use as an array index.
*/
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
+#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
/* An opaque pointer. */
#ifndef YY_TYPEDEF_YY_SCANNER_T
@@ -145,20 +355,16 @@ typedef void* yyscan_t;
* definition of BEGIN.
*/
#define BEGIN yyg->yy_start = 1 + 2 *
-
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
#define YY_START ((yyg->yy_start - 1) / 2)
#define YYSTATE YY_START
-
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yara_yyrestart(yyin ,yyscanner )
-
+#define YY_NEW_FILE yyrestart( yyin , yyscanner )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
@@ -183,13 +389,18 @@ typedef void* yyscan_t;
typedef struct yy_buffer_state *YY_BUFFER_STATE;
#endif
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
-
+
/* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
* access to the local variable yy_act. Since yyless() is a macro, it would break
- * existing scanners that call yyless() from OUTSIDE yara_yylex.
+ * existing scanners that call yyless() from OUTSIDE yylex.
* One obvious solution it to make yy_act a global. I tried that, and saw
* a 5% performance hit in a non-yylineno scanner, because yy_act is
* normally declared as a register variable-- so it is not worth it.
@@ -201,6 +412,13 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
if ( yytext[yyl] == '\n' )\
--yylineno;\
}while(0)
+ #define YY_LINENO_REWIND_TO(dst) \
+ do {\
+ const char *p;\
+ for ( p = yy_cp-1; p >= (dst); --p)\
+ if ( *p == '\n' )\
+ --yylineno;\
+ }while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
@@ -215,14 +433,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
-
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
@@ -235,7 +447,7 @@ struct yy_buffer_state
/* Size of input buffer in bytes, not including room for EOB
* characters.
*/
- yy_size_t yy_buf_size;
+ int yy_buf_size;
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
@@ -263,7 +475,7 @@ struct yy_buffer_state
int yy_bs_lineno; /**< The line count. */
int yy_bs_column; /**< The column count. */
-
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -280,7 +492,7 @@ struct yy_buffer_state
* possible backing-up.
*
* When we actually see the EOF, we change the status to "new"
- * (via yara_yyrestart()), so that the user can continue scanning by
+ * (via yyrestart()), so that the user can continue scanning by
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
@@ -297,84 +509,77 @@ struct yy_buffer_state
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
: NULL)
-
/* Same as previous macro, but useful when we know that the buffer stack is not
* NULL or when we need an lvalue. For internal use only.
*/
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-void yara_yyrestart (FILE *input_file ,yyscan_t yyscanner );
-void yara_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-YY_BUFFER_STATE yara_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner );
-void yara_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void yara_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
-void yara_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
-void yara_yypop_buffer_state (yyscan_t yyscanner );
+void yyrestart ( FILE *input_file , yyscan_t yyscanner );
+void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
+void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
+void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
+void yypop_buffer_state ( yyscan_t yyscanner );
-static void yara_yyensure_buffer_stack (yyscan_t yyscanner );
-static void yara_yy_load_buffer_state (yyscan_t yyscanner );
-static void yara_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
+static void yyensure_buffer_stack ( yyscan_t yyscanner );
+static void yy_load_buffer_state ( yyscan_t yyscanner );
+static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
-#define YY_FLUSH_BUFFER yara_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
+YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
+YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
-YY_BUFFER_STATE yara_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
-YY_BUFFER_STATE yara_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
-YY_BUFFER_STATE yara_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
-
-void *yara_yyalloc (yy_size_t ,yyscan_t yyscanner );
-void *yara_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner );
-void yara_yyfree (void * ,yyscan_t yyscanner );
-
-#define yy_new_buffer yara_yy_create_buffer
+void *yyalloc ( yy_size_t , yyscan_t yyscanner );
+void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
+void yyfree ( void * , yyscan_t yyscanner );
+#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
if ( ! YY_CURRENT_BUFFER ){ \
- yara_yyensure_buffer_stack (yyscanner); \
+ yyensure_buffer_stack (yyscanner); \
YY_CURRENT_BUFFER_LVALUE = \
- yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
}
-
#define yy_set_bol(at_bol) \
{ \
if ( ! YY_CURRENT_BUFFER ){\
- yara_yyensure_buffer_stack (yyscanner); \
+ yyensure_buffer_stack (yyscanner); \
YY_CURRENT_BUFFER_LVALUE = \
- yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
} \
YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
}
-
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
/* Begin user sect3 */
-#define yara_yywrap(n) 1
+#define yara_yywrap(yyscanner) (/*CONSTCOND*/1)
#define YY_SKIP_YYWRAP
-
-typedef unsigned char YY_CHAR;
+typedef flex_uint8_t YY_CHAR;
typedef int yy_state_type;
#define yytext_ptr yytext_r
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner);
-static int yy_get_next_buffer (yyscan_t yyscanner );
-static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
+static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
+static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
+static int yy_get_next_buffer ( yyscan_t yyscanner );
+static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
+ yyleng = (int) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-
#define YY_NUM_RULES 75
#define YY_END_OF_BUFFER 76
/* This struct is not used in this scanner,
@@ -384,7 +589,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[219] =
+static const flex_int16_t yy_accept[219] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
76, 74, 73, 73, 74, 70, 51, 50, 71, 54,
@@ -412,7 +617,7 @@ static yyconst flex_int16_t yy_accept[219] =
32, 16, 0, 18, 53, 46, 31, 0
} ;
-static yyconst flex_int32_t yy_ec[256] =
+static const YY_CHAR yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 1, 4, 1, 1, 1, 1, 1, 1, 1,
@@ -444,7 +649,7 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[55] =
+static const YY_CHAR yy_meta[55] =
{ 0,
1, 2, 3, 1, 1, 4, 1, 1, 2, 5,
6, 7, 7, 7, 7, 7, 7, 7, 1, 1,
@@ -454,7 +659,7 @@ static yyconst flex_int32_t yy_meta[55] =
9, 9, 1, 1
} ;
-static yyconst flex_int16_t yy_base[238] =
+static const flex_int16_t yy_base[238] =
{ 0,
0, 0, 52, 53, 54, 57, 350, 349, 344, 343,
352, 357, 357, 357, 331, 357, 0, 340, 51, 37,
@@ -484,7 +689,7 @@ static yyconst flex_int16_t yy_base[238] =
219, 229, 240, 251, 256, 258, 260
} ;
-static yyconst flex_int16_t yy_def[238] =
+static const flex_int16_t yy_def[238] =
{ 0,
218, 1, 219, 219, 220, 220, 221, 221, 222, 222,
218, 218, 218, 218, 218, 218, 223, 224, 218, 225,
@@ -514,7 +719,7 @@ static yyconst flex_int16_t yy_def[238] =
218, 218, 218, 218, 218, 218, 218
} ;
-static yyconst flex_int16_t yy_nxt[412] =
+static const flex_int16_t yy_nxt[412] =
{ 0,
12, 13, 14, 13, 15, 16, 17, 18, 12, 12,
19, 20, 21, 21, 21, 21, 21, 21, 22, 23,
@@ -564,7 +769,7 @@ static yyconst flex_int16_t yy_nxt[412] =
218
} ;
-static yyconst flex_int16_t yy_chk[412] =
+static const flex_int16_t yy_chk[412] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -615,7 +820,7 @@ static yyconst flex_int16_t yy_chk[412] =
} ;
/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[76] =
+static const flex_int32_t yy_rule_can_match_eol[76] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -633,7 +838,7 @@ static yyconst flex_int32_t yy_rule_can_match_eol[76] =
/*
* YARA rule lexer for ClamAV
*
- * Copyright (C) 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
+ * Copyright (C) 2014, 2017 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*
* Authors: Steven Morgan
*
@@ -716,13 +921,11 @@ limitations under the License.
#define snprintf _snprintf
#endif
+#line 924 "yara_lexer.c"
#define YY_NO_UNISTD_H 1
#define YY_NO_INPUT 1
-
-
-
-#line 722 "yara_lexer.c"
+#line 928 "yara_lexer.c"
#define INITIAL 0
#define str 1
@@ -778,48 +981,52 @@ struct yyguts_t
}; /* end struct yyguts_t */
-static int yy_init_globals (yyscan_t yyscanner );
+static int yy_init_globals ( yyscan_t yyscanner );
/* This must go here because YYSTYPE and YYLTYPE are included
* from bison output in section 1.*/
# define yylval yyg->yylval_r
-int yara_yylex_init (yyscan_t* scanner);
+int yylex_init (yyscan_t* scanner);
-int yara_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
+int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
/* Accessor methods to globals.
These are made visible to non-reentrant scanners for convenience. */
-int yara_yylex_destroy (yyscan_t yyscanner );
+int yylex_destroy ( yyscan_t yyscanner );
-int yara_yyget_debug (yyscan_t yyscanner );
+int yyget_debug ( yyscan_t yyscanner );
-void yara_yyset_debug (int debug_flag ,yyscan_t yyscanner );
+void yyset_debug ( int debug_flag , yyscan_t yyscanner );
-YY_EXTRA_TYPE yara_yyget_extra (yyscan_t yyscanner );
+YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
-void yara_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
+void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
-FILE *yara_yyget_in (yyscan_t yyscanner );
+FILE *yyget_in ( yyscan_t yyscanner );
-void yara_yyset_in (FILE * in_str ,yyscan_t yyscanner );
+void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
-FILE *yara_yyget_out (yyscan_t yyscanner );
+FILE *yyget_out ( yyscan_t yyscanner );
-void yara_yyset_out (FILE * out_str ,yyscan_t yyscanner );
+void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
-int yara_yyget_leng (yyscan_t yyscanner );
+ int yyget_leng ( yyscan_t yyscanner );
-char *yara_yyget_text (yyscan_t yyscanner );
+char *yyget_text ( yyscan_t yyscanner );
-int yara_yyget_lineno (yyscan_t yyscanner );
+int yyget_lineno ( yyscan_t yyscanner );
-void yara_yyset_lineno (int line_number ,yyscan_t yyscanner );
+void yyset_lineno ( int _line_number , yyscan_t yyscanner );
-YYSTYPE * yara_yyget_lval (yyscan_t yyscanner );
+int yyget_column ( yyscan_t yyscanner );
-void yara_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+void yyset_column ( int _column_no , yyscan_t yyscanner );
+
+YYSTYPE * yyget_lval ( yyscan_t yyscanner );
+
+void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -827,26 +1034,29 @@ void yara_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yara_yywrap (yyscan_t yyscanner );
+extern "C" int yywrap ( yyscan_t yyscanner );
#else
-extern int yara_yywrap (yyscan_t yyscanner );
+extern int yywrap ( yyscan_t yyscanner );
#endif
#endif
+#ifndef YY_NO_UNPUT
+
+#endif
+
#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
+static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
+static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
#endif
#ifndef YY_NO_INPUT
-
#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner );
+static int yyinput ( yyscan_t yyscanner );
#else
-static int input (yyscan_t yyscanner );
+static int input ( yyscan_t yyscanner );
#endif
#endif
@@ -866,7 +1076,7 @@ static int input (yyscan_t yyscanner );
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -877,7 +1087,7 @@ static int input (yyscan_t yyscanner );
if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
{ \
int c = '*'; \
- size_t n; \
+ int n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -890,7 +1100,7 @@ static int input (yyscan_t yyscanner );
else \
{ \
errno=0; \
- while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
{ \
if( errno != EINTR) \
{ \
@@ -931,10 +1141,10 @@ static int input (yyscan_t yyscanner );
#ifndef YY_DECL
#define YY_DECL_IS_OURS 1
-extern int yara_yylex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+extern int yylex \
+ (YYSTYPE * yylval_param , yyscan_t yyscanner);
-#define YY_DECL int yara_yylex \
+#define YY_DECL int yylex \
(YYSTYPE * yylval_param , yyscan_t yyscanner)
#endif /* !YY_DECL */
@@ -947,7 +1157,7 @@ extern int yara_yylex \
/* Code executed at the end of each rule. */
#ifndef YY_BREAK
-#define YY_BREAK break;
+#define YY_BREAK /*LINTED*/break;
#endif
#define YY_RULE_SETUP \
@@ -957,16 +1167,11 @@ extern int yara_yylex \
*/
YY_DECL
{
- register yy_state_type yy_current_state;
- register char *yy_cp, *yy_bp;
- register int yy_act;
+ yy_state_type yy_current_state;
+ char *yy_cp, *yy_bp;
+ int yy_act;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-#line 112 "yara_lexer.l"
-
-
-#line 965 "yara_lexer.c"
-
yylval = yylval_param;
if ( !yyg->yy_init )
@@ -987,15 +1192,21 @@ YY_DECL
yyout = stdout;
if ( ! YY_CURRENT_BUFFER ) {
- yara_yyensure_buffer_stack (yyscanner);
+ yyensure_buffer_stack (yyscanner);
YY_CURRENT_BUFFER_LVALUE =
- yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
}
- yara_yy_load_buffer_state(yyscanner );
+ yy_load_buffer_state( yyscanner );
}
- while ( 1 ) /* loops until end-of-file is reached */
+ {
+#line 112 "yara_lexer.l"
+
+
+#line 1207 "yara_lexer.c"
+
+ while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
yy_cp = yyg->yy_c_buf_p;
@@ -1011,7 +1222,7 @@ YY_DECL
yy_match:
do
{
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
+ YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -1021,9 +1232,9 @@ yy_match:
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 219 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
++yy_cp;
}
while ( yy_base[yy_current_state] != 357 );
@@ -1044,7 +1255,7 @@ yy_find_action:
int yyl;
for ( yyl = 0; yyl < yyleng; ++yyl )
if ( yytext[yyl] == '\n' )
-
+
do{ yylineno++;
yycolumn=0;
}while(0)
@@ -1388,7 +1599,8 @@ YY_RULE_SETUP
}
_yr_compiler_push_file(compiler, fh);
- yara_yypush_buffer_state(yara_yy_create_buffer(fh,YY_BUF_SIZE,yyscanner),yyscanner);
+ yypush_buffer_state(
+ yy_create_buffer(fh, YY_BUF_SIZE, yyscanner), yyscanner);
}
else
{
@@ -1414,7 +1626,7 @@ case YY_STATE_EOF(comment):
#line 277 "yara_lexer.l"
{
- YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
+ YR_COMPILER* compiler = yyget_extra(yyscanner);
FILE* file = _yr_compiler_pop_file(compiler);
if (file != NULL)
@@ -1423,7 +1635,7 @@ case YY_STATE_EOF(comment):
}
_yr_compiler_pop_file_name(compiler);
- yara_yypop_buffer_state(yyscanner);
+ yypop_buffer_state(yyscanner);
if (!YY_CURRENT_BUFFER)
{
@@ -1781,7 +1993,7 @@ YY_RULE_SETUP
#line 582 "yara_lexer.l"
ECHO;
YY_BREAK
-#line 1781 "yara_lexer.c"
+#line 1996 "yara_lexer.c"
case YY_END_OF_BUFFER:
{
@@ -1797,7 +2009,7 @@ ECHO;
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
- * yara_yylex(). If so, then we have to assure
+ * yylex(). If so, then we have to assure
* consistency between YY_CURRENT_BUFFER and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
@@ -1857,7 +2069,7 @@ ECHO;
{
yyg->yy_did_buffer_switch_on_eof = 0;
- if ( yara_yywrap(yyscanner ) )
+ if ( yywrap( yyscanner ) )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
@@ -1910,7 +2122,8 @@ ECHO;
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
-} /* end of yara_yylex */
+ } /* end of user's declarations */
+} /* end of yylex */
/* yy_get_next_buffer - try to read in a new buffer
*
@@ -1922,9 +2135,9 @@ ECHO;
static int yy_get_next_buffer (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = yyg->yytext_ptr;
- register int number_to_move, i;
+ char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
+ char *source = yyg->yytext_ptr;
+ int number_to_move, i;
int ret_val;
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
@@ -1953,7 +2166,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* Try to read more data. */
/* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
+ number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
@@ -1973,7 +2186,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{ /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
int yy_c_buf_p_offset =
(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -1989,11 +2202,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
- yara_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+ yyrealloc( (void *) b->yy_ch_buf,
+ (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
}
else
/* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
+ b->yy_ch_buf = NULL;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
@@ -2011,7 +2225,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, (size_t) num_to_read );
+ yyg->yy_n_chars, num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
@@ -2021,7 +2235,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
- yara_yyrestart(yyin ,yyscanner);
+ yyrestart( yyin , yyscanner);
}
else
@@ -2035,12 +2249,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yara_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
+ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+ YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
+ (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
+ /* "- 2" to take care of EOB's */
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
}
yyg->yy_n_chars += number_to_move;
@@ -2056,15 +2273,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
{
- register yy_state_type yy_current_state;
- register char *yy_cp;
+ yy_state_type yy_current_state;
+ char *yy_cp;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yy_current_state = yyg->yy_start;
for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
{
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
+ YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -2074,9 +2291,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 219 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
}
return yy_current_state;
@@ -2089,11 +2306,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
{
- register int yy_is_jam;
+ int yy_is_jam;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- register char *yy_cp = yyg->yy_c_buf_p;
+ char *yy_cp = yyg->yy_c_buf_p;
- register YY_CHAR yy_c = 1;
+ YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
yyg->yy_last_accepting_state = yy_current_state;
@@ -2103,14 +2320,19 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
{
yy_current_state = (int) yy_def[yy_current_state];
if ( yy_current_state >= 219 )
- yy_c = yy_meta[(unsigned int) yy_c];
+ yy_c = yy_meta[yy_c];
}
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
+ yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
yy_is_jam = (yy_current_state == 218);
+ (void)yyg;
return yy_is_jam ? 0 : yy_current_state;
}
+#ifndef YY_NO_UNPUT
+
+#endif
+
#ifndef YY_NO_INPUT
#ifdef __cplusplus
static int yyinput (yyscan_t yyscanner)
@@ -2136,7 +2358,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
{ /* need more input */
- int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
+ int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
++yyg->yy_c_buf_p;
switch ( yy_get_next_buffer( yyscanner ) )
@@ -2153,14 +2375,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
/* Reset buffer status. */
- yara_yyrestart(yyin ,yyscanner);
+ yyrestart( yyin , yyscanner);
/*FALLTHROUGH*/
case EOB_ACT_END_OF_FILE:
{
- if ( yara_yywrap(yyscanner ) )
- return EOF;
+ if ( yywrap( yyscanner ) )
+ return 0;
if ( ! yyg->yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
@@ -2183,7 +2405,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
if ( c == '\n' )
-
+
do{ yylineno++;
yycolumn=0;
}while(0)
@@ -2198,34 +2420,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
* @param yyscanner The scanner object.
* @note This function does not reset the start condition to @c INITIAL .
*/
- void yara_yyrestart (FILE * input_file , yyscan_t yyscanner)
+ void yyrestart (FILE * input_file , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if ( ! YY_CURRENT_BUFFER ){
- yara_yyensure_buffer_stack (yyscanner);
+ yyensure_buffer_stack (yyscanner);
YY_CURRENT_BUFFER_LVALUE =
- yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
}
- yara_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
- yara_yy_load_buffer_state(yyscanner );
+ yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
+ yy_load_buffer_state( yyscanner );
}
/** Switch to a different input buffer.
* @param new_buffer The new input buffer.
* @param yyscanner The scanner object.
*/
- void yara_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* TODO. We should be able to replace this entire function body
* with
- * yara_yypop_buffer_state();
- * yara_yypush_buffer_state(new_buffer);
+ * yypop_buffer_state();
+ * yypush_buffer_state(new_buffer);
*/
- yara_yyensure_buffer_stack (yyscanner);
+ yyensure_buffer_stack (yyscanner);
if ( YY_CURRENT_BUFFER == new_buffer )
return;
@@ -2238,17 +2460,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
}
YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yara_yy_load_buffer_state(yyscanner );
+ yy_load_buffer_state( yyscanner );
/* We don't actually know whether we did this switch during
- * EOF (yara_yywrap()) processing, but the only time this flag
- * is looked at is after yara_yywrap() is called, so it's safe
+ * EOF (yywrap()) processing, but the only time this flag
+ * is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
yyg->yy_did_buffer_switch_on_eof = 1;
}
-static void yara_yy_load_buffer_state (yyscan_t yyscanner)
+static void yy_load_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
@@ -2263,35 +2485,35 @@ static void yara_yy_load_buffer_state (yyscan_t yyscanner)
* @param yyscanner The scanner object.
* @return the allocated buffer state.
*/
- YY_BUFFER_STATE yara_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
+ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
- b = (YY_BUFFER_STATE) yara_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yy_create_buffer()" );
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_buf_size = size;
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
- b->yy_ch_buf = (char *) yara_yyalloc(b->yy_buf_size + 2 ,yyscanner );
+ b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yy_create_buffer()" );
+ YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
- yara_yy_init_buffer(b,file ,yyscanner);
+ yy_init_buffer( b, file , yyscanner);
return b;
}
/** Destroy the buffer.
- * @param b a buffer created with yara_yy_create_buffer()
+ * @param b a buffer created with yy_create_buffer()
* @param yyscanner The scanner object.
*/
- void yara_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+ void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
@@ -2302,32 +2524,28 @@ static void yara_yy_load_buffer_state (yyscan_t yyscanner)
YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
- yara_yyfree((void *) b->yy_ch_buf ,yyscanner );
+ yyfree( (void *) b->yy_ch_buf , yyscanner );
- yara_yyfree((void *) b ,yyscanner );
+ yyfree( (void *) b , yyscanner );
}
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-
/* Initializes or reinitializes a buffer.
* This function is sometimes called more than once on the same buffer,
- * such as during a yara_yyrestart() or at EOF.
+ * such as during a yyrestart() or at EOF.
*/
- static void yara_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
+ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
{
int oerrno = errno;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yara_yy_flush_buffer(b ,yyscanner);
+ yy_flush_buffer( b , yyscanner);
b->yy_input_file = file;
b->yy_fill_buffer = 1;
- /* If b is the current buffer, then yara_yy_init_buffer was _probably_
- * called from yara_yyrestart() or through yy_get_next_buffer.
+ /* If b is the current buffer, then yy_init_buffer was _probably_
+ * called from yyrestart() or through yy_get_next_buffer.
* In that case, we don't want to reset the lineno or column.
*/
if (b != YY_CURRENT_BUFFER){
@@ -2344,7 +2562,7 @@ extern int isatty (int );
* @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
* @param yyscanner The scanner object.
*/
- void yara_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+ void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if ( ! b )
@@ -2365,7 +2583,7 @@ extern int isatty (int );
b->yy_buffer_status = YY_BUFFER_NEW;
if ( b == YY_CURRENT_BUFFER )
- yara_yy_load_buffer_state(yyscanner );
+ yy_load_buffer_state( yyscanner );
}
/** Pushes the new state onto the stack. The new state becomes
@@ -2374,15 +2592,15 @@ extern int isatty (int );
* @param new_buffer The new state.
* @param yyscanner The scanner object.
*/
-void yara_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (new_buffer == NULL)
return;
- yara_yyensure_buffer_stack(yyscanner);
+ yyensure_buffer_stack(yyscanner);
- /* This block is copied from yara_yy_switch_to_buffer. */
+ /* This block is copied from yy_switch_to_buffer. */
if ( YY_CURRENT_BUFFER )
{
/* Flush out information for old buffer. */
@@ -2396,8 +2614,8 @@ void yara_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
yyg->yy_buffer_stack_top++;
YY_CURRENT_BUFFER_LVALUE = new_buffer;
- /* copied from yara_yy_switch_to_buffer. */
- yara_yy_load_buffer_state(yyscanner );
+ /* copied from yy_switch_to_buffer. */
+ yy_load_buffer_state( yyscanner );
yyg->yy_did_buffer_switch_on_eof = 1;
}
@@ -2405,19 +2623,19 @@ void yara_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
* The next element becomes the new top.
* @param yyscanner The scanner object.
*/
-void yara_yypop_buffer_state (yyscan_t yyscanner)
+void yypop_buffer_state (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!YY_CURRENT_BUFFER)
return;
- yara_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
+ yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
YY_CURRENT_BUFFER_LVALUE = NULL;
if (yyg->yy_buffer_stack_top > 0)
--yyg->yy_buffer_stack_top;
if (YY_CURRENT_BUFFER) {
- yara_yy_load_buffer_state(yyscanner );
+ yy_load_buffer_state( yyscanner );
yyg->yy_did_buffer_switch_on_eof = 1;
}
}
@@ -2425,9 +2643,9 @@ void yara_yypop_buffer_state (yyscan_t yyscanner)
/* Allocates the stack if it does not exist.
* Guarantees space for at least one push.
*/
-static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
+static void yyensure_buffer_stack (yyscan_t yyscanner)
{
- int num_to_alloc;
+ yy_size_t num_to_alloc;
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!yyg->yy_buffer_stack) {
@@ -2436,15 +2654,15 @@ static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
- num_to_alloc = 1;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_yyalloc
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yyensure_buffer_stack()" );
-
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
@@ -2453,15 +2671,15 @@ static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
/* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
+ yy_size_t grow_size = 8 /* arbitrary grow size */;
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_yyrealloc
+ yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
(yyg->yy_buffer_stack,
num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yyensure_buffer_stack()" );
+ YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
/* zero only the new slots.*/
memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
@@ -2473,9 +2691,9 @@ static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE yara_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
@@ -2483,49 +2701,49 @@ YY_BUFFER_STATE yara_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yy
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
- return 0;
+ return NULL;
- b = (YY_BUFFER_STATE) yara_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner );
+ b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yy_scan_buffer()" );
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
+ b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
b->yy_buf_pos = b->yy_ch_buf = base;
b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
+ b->yy_input_file = NULL;
b->yy_n_chars = b->yy_buf_size;
b->yy_is_interactive = 0;
b->yy_at_bol = 1;
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
- yara_yy_switch_to_buffer(b ,yyscanner );
+ yy_switch_to_buffer( b , yyscanner );
return b;
}
-/** Setup the input buffer state to scan a string. The next call to yara_yylex() will
+/** Setup the input buffer state to scan a string. The next call to yylex() will
* scan from a @e copy of @a str.
* @param yystr a NUL-terminated string to scan
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
* @note If you want to scan bytes that may contain NUL values, then use
- * yara_yy_scan_bytes() instead.
+ * yy_scan_bytes() instead.
*/
-YY_BUFFER_STATE yara_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
{
- return yara_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner);
+ return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
}
-/** Setup the input buffer state to scan the given bytes. The next call to yara_yylex() will
+/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
* scan from a @e copy of @a bytes.
* @param yybytes the byte buffer to scan
* @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE yara_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner)
+YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
{
YY_BUFFER_STATE b;
char *buf;
@@ -2533,19 +2751,19 @@ YY_BUFFER_STATE yara_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ,
int i;
/* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) yara_yyalloc(n ,yyscanner );
+ n = (yy_size_t) (_yybytes_len + 2);
+ buf = (char *) yyalloc( n , yyscanner );
if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yara_yy_scan_bytes()" );
+ YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
for ( i = 0; i < _yybytes_len; ++i )
buf[i] = yybytes[i];
buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
- b = yara_yy_scan_buffer(buf,n ,yyscanner);
+ b = yy_scan_buffer( buf, n , yyscanner);
if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yara_yy_scan_bytes()" );
+ YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
/* It's okay to grow etc. this buffer, and we should throw it
* away when we're done.
@@ -2559,9 +2777,11 @@ YY_BUFFER_STATE yara_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ,
#define YY_EXIT_FAILURE 2
#endif
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
{
- (void) fprintf( stderr, "%s\n", msg );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
@@ -2587,7 +2807,7 @@ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
/** Get the user-defined data for this scanner.
* @param yyscanner The scanner object.
*/
-YY_EXTRA_TYPE yara_yyget_extra (yyscan_t yyscanner)
+YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyextra;
@@ -2596,10 +2816,10 @@ YY_EXTRA_TYPE yara_yyget_extra (yyscan_t yyscanner)
/** Get the current line number.
* @param yyscanner The scanner object.
*/
-int yara_yyget_lineno (yyscan_t yyscanner)
+int yyget_lineno (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
@@ -2609,10 +2829,10 @@ int yara_yyget_lineno (yyscan_t yyscanner)
/** Get the current column number.
* @param yyscanner The scanner object.
*/
-int yara_yyget_column (yyscan_t yyscanner)
+int yyget_column (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
+
if (! YY_CURRENT_BUFFER)
return 0;
@@ -2622,7 +2842,7 @@ int yara_yyget_column (yyscan_t yyscanner)
/** Get the input stream.
* @param yyscanner The scanner object.
*/
-FILE *yara_yyget_in (yyscan_t yyscanner)
+FILE *yyget_in (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyin;
@@ -2631,7 +2851,7 @@ FILE *yara_yyget_in (yyscan_t yyscanner)
/** Get the output stream.
* @param yyscanner The scanner object.
*/
-FILE *yara_yyget_out (yyscan_t yyscanner)
+FILE *yyget_out (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyout;
@@ -2640,7 +2860,7 @@ FILE *yara_yyget_out (yyscan_t yyscanner)
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
-int yara_yyget_leng (yyscan_t yyscanner)
+int yyget_leng (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yyleng;
@@ -2650,7 +2870,7 @@ int yara_yyget_leng (yyscan_t yyscanner)
* @param yyscanner The scanner object.
*/
-char *yara_yyget_text (yyscan_t yyscanner)
+char *yyget_text (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yytext;
@@ -2660,81 +2880,81 @@ char *yara_yyget_text (yyscan_t yyscanner)
* @param user_defined The data to be associated with this scanner.
* @param yyscanner The scanner object.
*/
-void yara_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
+void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyextra = user_defined ;
}
/** Set the current line number.
- * @param line_number
+ * @param _line_number line number
* @param yyscanner The scanner object.
*/
-void yara_yyset_lineno (int line_number , yyscan_t yyscanner)
+void yyset_lineno (int _line_number , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* lineno is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "yara_yyset_lineno called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
- yylineno = line_number;
+ yylineno = _line_number;
}
/** Set the current column.
- * @param line_number
+ * @param _column_no column number
* @param yyscanner The scanner object.
*/
-void yara_yyset_column (int column_no , yyscan_t yyscanner)
+void yyset_column (int _column_no , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* column is only valid if an input buffer exists. */
if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "yara_yyset_column called with no buffer" , yyscanner);
+ YY_FATAL_ERROR( "yyset_column called with no buffer" );
- yycolumn = column_no;
+ yycolumn = _column_no;
}
/** Set the input stream. This does not discard the current
* input buffer.
- * @param in_str A readable stream.
+ * @param _in_str A readable stream.
* @param yyscanner The scanner object.
- * @see yara_yy_switch_to_buffer
+ * @see yy_switch_to_buffer
*/
-void yara_yyset_in (FILE * in_str , yyscan_t yyscanner)
+void yyset_in (FILE * _in_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
+ yyin = _in_str ;
}
-void yara_yyset_out (FILE * out_str , yyscan_t yyscanner)
+void yyset_out (FILE * _out_str , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
+ yyout = _out_str ;
}
-int yara_yyget_debug (yyscan_t yyscanner)
+int yyget_debug (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yy_flex_debug;
}
-void yara_yyset_debug (int bdebug , yyscan_t yyscanner)
+void yyset_debug (int _bdebug , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = bdebug ;
+ yy_flex_debug = _bdebug ;
}
/* Accessor methods for yylval and yylloc */
-YYSTYPE * yara_yyget_lval (yyscan_t yyscanner)
+YYSTYPE * yyget_lval (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
return yylval;
}
-void yara_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
+void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yylval = yylval_param;
@@ -2742,20 +2962,18 @@ void yara_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
/* User-visible API */
-/* yara_yylex_init is special because it creates the scanner itself, so it is
+/* yylex_init is special because it creates the scanner itself, so it is
* the ONLY reentrant function that doesn't take the scanner as the last argument.
* That's why we explicitly handle the declaration, instead of using our macros.
*/
-
-int yara_yylex_init(yyscan_t* ptr_yy_globals)
-
+int yylex_init(yyscan_t* ptr_yy_globals)
{
if (ptr_yy_globals == NULL){
errno = EINVAL;
return 1;
}
- *ptr_yy_globals = (yyscan_t) yara_yyalloc ( sizeof( struct yyguts_t ), NULL );
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
if (*ptr_yy_globals == NULL){
errno = ENOMEM;
@@ -2768,39 +2986,37 @@ int yara_yylex_init(yyscan_t* ptr_yy_globals)
return yy_init_globals ( *ptr_yy_globals );
}
-/* yara_yylex_init_extra has the same functionality as yara_yylex_init, but follows the
+/* yylex_init_extra has the same functionality as yylex_init, but follows the
* convention of taking the scanner as the last argument. Note however, that
* this is a *pointer* to a scanner, as it will be allocated by this call (and
* is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to yara_yyalloc in
+ * The user defined value in the first argument will be available to yyalloc in
* the yyextra field.
*/
-
-int yara_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
-
+int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
{
struct yyguts_t dummy_yyguts;
- yara_yyset_extra (yy_user_defined, &dummy_yyguts);
+ yyset_extra (yy_user_defined, &dummy_yyguts);
if (ptr_yy_globals == NULL){
errno = EINVAL;
return 1;
}
-
- *ptr_yy_globals = (yyscan_t) yara_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
+
+ *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
if (*ptr_yy_globals == NULL){
errno = ENOMEM;
return 1;
}
-
+
/* By setting to 0xAA, we expose bugs in
yy_init_globals. Leave at 0x00 for releases. */
memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- yara_yyset_extra (yy_user_defined, *ptr_yy_globals);
-
+
+ yyset_extra (yy_user_defined, *ptr_yy_globals);
+
return yy_init_globals ( *ptr_yy_globals );
}
@@ -2808,13 +3024,13 @@ static int yy_init_globals (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* Initialization is the same as for the non-reentrant scanner.
- * This function is called from yara_yylex_destroy(), so don't allocate here.
+ * This function is called from yylex_destroy(), so don't allocate here.
*/
- yyg->yy_buffer_stack = 0;
+ yyg->yy_buffer_stack = NULL;
yyg->yy_buffer_stack_top = 0;
yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = (char *) 0;
+ yyg->yy_c_buf_p = NULL;
yyg->yy_init = 0;
yyg->yy_start = 0;
@@ -2827,42 +3043,42 @@ static int yy_init_globals (yyscan_t yyscanner)
yyin = stdin;
yyout = stdout;
#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
+ yyin = NULL;
+ yyout = NULL;
#endif
/* For future reference: Set errno on error, since we are called by
- * yara_yylex_init()
+ * yylex_init()
*/
return 0;
}
-/* yara_yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yara_yylex_destroy (yyscan_t yyscanner)
+/* yylex_destroy is for both reentrant and non-reentrant scanners. */
+int yylex_destroy (yyscan_t yyscanner)
{
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* Pop the buffer stack, destroying each element. */
while(YY_CURRENT_BUFFER){
- yara_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
+ yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
YY_CURRENT_BUFFER_LVALUE = NULL;
- yara_yypop_buffer_state(yyscanner);
+ yypop_buffer_state(yyscanner);
}
/* Destroy the stack itself. */
- yara_yyfree(yyg->yy_buffer_stack ,yyscanner);
+ yyfree(yyg->yy_buffer_stack , yyscanner);
yyg->yy_buffer_stack = NULL;
/* Destroy the start condition stack. */
- yara_yyfree(yyg->yy_start_stack ,yyscanner );
+ yyfree( yyg->yy_start_stack , yyscanner );
yyg->yy_start_stack = NULL;
/* Reset the globals. This is important in a non-reentrant scanner so the next time
- * yara_yylex() is called, initialization will occur. */
+ * yylex() is called, initialization will occur. */
yy_init_globals( yyscanner);
/* Destroy the main struct (reentrant only). */
- yara_yyfree ( yyscanner , yyscanner );
+ yyfree ( yyscanner , yyscanner );
yyscanner = NULL;
return 0;
}
@@ -2872,18 +3088,21 @@ int yara_yylex_destroy (yyscan_t yyscanner)
*/
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
{
- register int i;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
+ int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
}
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
{
- register int n;
+ int n;
for ( n = 0; s[n]; ++n )
;
@@ -2891,13 +3110,18 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
}
#endif
-void *yara_yyalloc (yy_size_t size , yyscan_t yyscanner)
+void *yyalloc (yy_size_t size , yyscan_t yyscanner)
{
- return (void *) malloc( size );
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ return malloc(size);
}
-void *yara_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
+void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@@ -2905,12 +3129,14 @@ void *yara_yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
* any pointer type to void*, and deal with argument conversions
* as though doing an assignment.
*/
- return (void *) realloc( (char *) ptr, size );
+ return realloc(ptr, size);
}
-void yara_yyfree (void * ptr , yyscan_t yyscanner)
+void yyfree (void * ptr , yyscan_t yyscanner)
{
- free( (char *) ptr ); /* see yara_yyrealloc() for (char *) cast */
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ (void)yyg;
+ free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
}
#define YYTABLES_NAME "yytables"
@@ -2919,12 +3145,11 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
-
void yywarning(
yyscan_t yyscanner,
const char *warning_message)
{
- YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
+ YR_COMPILER* compiler = yyget_extra(yyscanner);
char* file_name;
if (compiler->file_name_stack_ptr > 0)
@@ -2936,7 +3161,7 @@ void yywarning(
compiler->callback(
YARA_ERROR_LEVEL_WARNING,
file_name,
- yara_yyget_lineno(yyscanner),
+ yyget_lineno(yyscanner),
warning_message);
#else
cli_warnmsg("yywarning(): %s line %d %s\n", file_name?file_name:"(file name missing)", compiler->last_error_line, warning_message);
@@ -2948,7 +3173,7 @@ void yyfatal(
yyscan_t yyscanner,
const char *error_message)
{
- YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
+ YR_COMPILER* compiler = yyget_extra(yyscanner);
int last_result = compiler->last_result;
yyerror(yyscanner, compiler, error_message);
@@ -2976,7 +3201,7 @@ void yyerror(
if (compiler->error_line != 0)
compiler->last_error_line = compiler->error_line;
else
- compiler->last_error_line = yara_yyget_lineno(yyscanner);
+ compiler->last_error_line = yyget_lineno(yyscanner);
compiler->error_line = 0;
@@ -3044,17 +3269,17 @@ int yr_lex_parse_rules_string(
if (setjmp(compiler->error_recovery) != 0)
return compiler->errors;
- yara_yylex_init(&yyscanner);
+ yylex_init(&yyscanner);
- yara_yyset_debug(1,yyscanner);
+ yyset_debug(1, yyscanner);
- yara_yyset_extra(compiler,yyscanner);
+ yyset_extra(compiler, yyscanner);
- yara_yy_scan_string(rules_string,yyscanner);
+ yy_scan_string(rules_string, yyscanner);
- yara_yyset_lineno(1,yyscanner);
+ yyset_lineno(1, yyscanner);
yyparse(yyscanner, compiler);
- yara_yylex_destroy(yyscanner);
+ yylex_destroy(yyscanner);
return compiler->errors;
#else
@@ -3075,18 +3300,18 @@ int yr_lex_parse_rules_file(
if (setjmp(compiler->error_recovery) != 0)
return compiler->errors;
- yara_yylex_init(&yyscanner);
+ yylex_init(&yyscanner);
#if YYDEBUG
printf("debug enabled");
#endif
- yara_yyset_debug(1,yyscanner);
+ yyset_debug(1, yyscanner);
- yara_yyset_in(rules_file,yyscanner);
- yara_yyset_extra(compiler,yyscanner);
+ yyset_in(rules_file, yyscanner);
+ yyset_extra(compiler, yyscanner);
yyparse(yyscanner, compiler);
- yara_yylex_destroy(yyscanner);
+ yylex_destroy(yyscanner);
return compiler->errors;
}
diff --git a/libclamav/yara_parser.h b/libclamav/yara_parser.h
index bdfd1b226..35f1e1df3 100644
--- a/libclamav/yara_parser.h
+++ b/libclamav/yara_parser.h
@@ -37,12 +37,10 @@ int yr_parser_emit_with_arg_reloc(
int64_t argument,
int8_t** instruction_address);
-#if REAL_YARA
int yr_parser_check_types(
YR_COMPILER* compiler,
YR_OBJECT_FUNCTION* function,
const char* actual_args_fmt);
-#endif
YR_STRING* yr_parser_lookup_string(
yyscan_t yyscanner,