From 2e664c566f1a9ea047271b516cce8fd456dc8cbd Mon Sep 17 00:00:00 2001 From: Wesley Shields Date: Sun, 18 Feb 2018 13:46:08 -0500 Subject: [PATCH] Implement xor modifier. (#830) --- libyara/atoms.c | 67 ++ libyara/grammar.c | 1235 +++++++++++++-------------- libyara/grammar.h | 118 +-- libyara/grammar.y | 2 + libyara/include/yara/types.h | 4 + libyara/lexer.c | 1546 ++++++++++++++-------------------- libyara/lexer.l | 2 +- libyara/parser.c | 3 +- libyara/scan.c | 79 ++ tests/data/xor.out | Bin 0 -> 6383 bytes tests/data/xornocase.out | Bin 0 -> 8124 bytes tests/data/xorwide.out | Bin 0 -> 11247 bytes tests/test-rules.c | 32 + 13 files changed, 1521 insertions(+), 1567 deletions(-) create mode 100644 tests/data/xor.out create mode 100644 tests/data/xornocase.out create mode 100644 tests/data/xorwide.out diff --git a/libyara/atoms.c b/libyara/atoms.c index aaeadbf5..0890a22d 100644 --- a/libyara/atoms.c +++ b/libyara/atoms.c @@ -578,6 +578,48 @@ static int _yr_atoms_case_insensitive( } +// +// _yr_atoms_xor +// +// For a given list of atoms returns another list after a single byte xor +// has been applied to it. +// +static int _yr_atoms_xor( + YR_ATOM_LIST_ITEM* atoms, + YR_ATOM_LIST_ITEM** xor_atoms) +{ + YR_ATOM_LIST_ITEM* atom; + YR_ATOM_LIST_ITEM* new_atom; + + int i, j; + *xor_atoms = NULL; + atom = atoms; + + while (atom != NULL) + { + for (j = 1; j <= 255; j++) + { + new_atom = (YR_ATOM_LIST_ITEM*) yr_malloc(sizeof(YR_ATOM_LIST_ITEM)); + + if (new_atom == NULL) + return ERROR_INSUFFICIENT_MEMORY; + + for (i = 0; i < atom->atom_length; i++) + new_atom->atom[i] = atom->atom[i] ^ j; + + new_atom->atom_length = yr_min(atom->atom_length, MAX_ATOM_LENGTH); + new_atom->forward_code = atom->forward_code; + new_atom->backward_code = atom->backward_code; + new_atom->backtrack = atom->backtrack; + new_atom->next = *xor_atoms; + + *xor_atoms = new_atom; + } + + atom = atom->next; + } + return ERROR_SUCCESS; +} // // _yr_atoms_wide // @@ -1185,6 +1227,7 @@ int yr_atoms_extract_from_string( { YR_ATOM_LIST_ITEM* item; YR_ATOM_LIST_ITEM* case_insensitive_atoms; + YR_ATOM_LIST_ITEM* xor_atoms; YR_ATOM_LIST_ITEM* wide_atoms; int max_quality; @@ -1260,6 +1303,30 @@ int yr_atoms_extract_from_string( *atoms = _yr_atoms_list_concat(*atoms, case_insensitive_atoms); } + if (flags & STRING_GFLAGS_XOR) + { + FAIL_ON_ERROR_WITH_CLEANUP( + _yr_atoms_xor(*atoms, &xor_atoms), + { + yr_atoms_list_destroy(*atoms); + yr_atoms_list_destroy(xor_atoms); + *atoms = NULL; + }); + + if (flags & STRING_GFLAGS_ASCII || + flags & STRING_GFLAGS_WIDE || + flags & STRING_GFLAGS_NO_CASE) + { + *atoms = _yr_atoms_list_concat(*atoms, xor_atoms); + } + else + { + yr_atoms_list_destroy(*atoms); + *atoms = xor_atoms; + } + + } + return ERROR_SUCCESS; } diff --git a/libyara/grammar.c b/libyara/grammar.c index 54fcbea2..e8a33abc 100644 --- a/libyara/grammar.c +++ b/libyara/grammar.c @@ -200,34 +200,35 @@ extern int yara_yydebug; _REGEXP_ = 276, _ASCII_ = 277, _WIDE_ = 278, - _NOCASE_ = 279, - _FULLWORD_ = 280, - _AT_ = 281, - _FILESIZE_ = 282, - _ENTRYPOINT_ = 283, - _ALL_ = 284, - _ANY_ = 285, - _IN_ = 286, - _OF_ = 287, - _FOR_ = 288, - _THEM_ = 289, - _MATCHES_ = 290, - _CONTAINS_ = 291, - _IMPORT_ = 292, - _TRUE_ = 293, - _FALSE_ = 294, - _OR_ = 295, - _AND_ = 296, - _EQ_ = 297, - _NEQ_ = 298, - _LT_ = 299, - _LE_ = 300, - _GT_ = 301, - _GE_ = 302, - _SHIFT_LEFT_ = 303, - _SHIFT_RIGHT_ = 304, - _NOT_ = 305, - UNARY_MINUS = 306 + _XOR_ = 279, + _NOCASE_ = 280, + _FULLWORD_ = 281, + _AT_ = 282, + _FILESIZE_ = 283, + _ENTRYPOINT_ = 284, + _ALL_ = 285, + _ANY_ = 286, + _IN_ = 287, + _OF_ = 288, + _FOR_ = 289, + _THEM_ = 290, + _MATCHES_ = 291, + _CONTAINS_ = 292, + _IMPORT_ = 293, + _TRUE_ = 294, + _FALSE_ = 295, + _OR_ = 296, + _AND_ = 297, + _EQ_ = 298, + _NEQ_ = 299, + _LT_ = 300, + _LE_ = 301, + _GT_ = 302, + _GE_ = 303, + _SHIFT_LEFT_ = 304, + _SHIFT_RIGHT_ = 305, + _NOT_ = 306, + UNARY_MINUS = 307 }; #endif /* Tokens. */ @@ -252,41 +253,42 @@ extern int yara_yydebug; #define _REGEXP_ 276 #define _ASCII_ 277 #define _WIDE_ 278 -#define _NOCASE_ 279 -#define _FULLWORD_ 280 -#define _AT_ 281 -#define _FILESIZE_ 282 -#define _ENTRYPOINT_ 283 -#define _ALL_ 284 -#define _ANY_ 285 -#define _IN_ 286 -#define _OF_ 287 -#define _FOR_ 288 -#define _THEM_ 289 -#define _MATCHES_ 290 -#define _CONTAINS_ 291 -#define _IMPORT_ 292 -#define _TRUE_ 293 -#define _FALSE_ 294 -#define _OR_ 295 -#define _AND_ 296 -#define _EQ_ 297 -#define _NEQ_ 298 -#define _LT_ 299 -#define _LE_ 300 -#define _GT_ 301 -#define _GE_ 302 -#define _SHIFT_LEFT_ 303 -#define _SHIFT_RIGHT_ 304 -#define _NOT_ 305 -#define UNARY_MINUS 306 +#define _XOR_ 279 +#define _NOCASE_ 280 +#define _FULLWORD_ 281 +#define _AT_ 282 +#define _FILESIZE_ 283 +#define _ENTRYPOINT_ 284 +#define _ALL_ 285 +#define _ANY_ 286 +#define _IN_ 287 +#define _OF_ 288 +#define _FOR_ 289 +#define _THEM_ 290 +#define _MATCHES_ 291 +#define _CONTAINS_ 292 +#define _IMPORT_ 293 +#define _TRUE_ 294 +#define _FALSE_ 295 +#define _OR_ 296 +#define _AND_ 297 +#define _EQ_ 298 +#define _NEQ_ 299 +#define _LT_ 300 +#define _LE_ 301 +#define _GT_ 302 +#define _GE_ 303 +#define _SHIFT_LEFT_ 304 +#define _SHIFT_RIGHT_ 305 +#define _NOT_ 306 +#define UNARY_MINUS 307 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 215 "grammar.y" /* yacc.c:355 */ +#line 216 "grammar.y" /* yacc.c:355 */ EXPRESSION expression; SIZED_STRING* sized_string; @@ -297,7 +299,7 @@ union YYSTYPE YR_META* meta; YR_RULE* rule; -#line 301 "grammar.c" /* yacc.c:355 */ +#line 303 "grammar.c" /* yacc.c:355 */ }; typedef union YYSTYPE YYSTYPE; @@ -313,7 +315,7 @@ int yara_yyparse (void *yyscanner, YR_COMPILER* compiler); /* Copy the second part of user declarations. */ -#line 317 "grammar.c" /* yacc.c:358 */ +#line 319 "grammar.c" /* yacc.c:358 */ #ifdef short # undef short @@ -555,21 +557,21 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 2 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 406 +#define YYLAST 396 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 72 +#define YYNTOKENS 73 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 41 /* YYNRULES -- Number of rules. */ -#define YYNRULES 122 +#define YYNRULES 123 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 210 +#define YYNSTATES 211 /* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 307 +#define YYMAXUTOK 308 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -581,16 +583,16 @@ static const yytype_uint8 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 57, 44, 2, - 69, 70, 55, 53, 71, 54, 66, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 64, 2, - 2, 65, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 58, 45, 2, + 70, 71, 56, 54, 72, 55, 67, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 65, 2, + 2, 66, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 67, 56, 68, 43, 2, 2, 2, 2, 2, + 2, 68, 57, 69, 44, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 62, 42, 63, 59, 2, 2, 2, + 2, 2, 2, 63, 43, 64, 60, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -607,27 +609,27 @@ static const yytype_uint8 yytranslate[] = 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 45, 46, 47, - 48, 49, 50, 51, 52, 58, 60, 61 + 35, 36, 37, 38, 39, 40, 41, 42, 46, 47, + 48, 49, 50, 51, 52, 53, 59, 61, 62 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 229, 229, 231, 232, 233, 234, 235, 240, 253, - 262, 252, 285, 288, 316, 319, 346, 351, 352, 357, - 358, 364, 367, 385, 398, 435, 436, 441, 457, 470, - 483, 496, 513, 514, 520, 519, 535, 534, 550, 564, - 565, 570, 571, 572, 573, 578, 663, 709, 767, 812, - 813, 817, 844, 882, 924, 946, 955, 964, 979, 991, - 1005, 1018, 1029, 1040, 1070, 1039, 1184, 1183, 1262, 1268, - 1275, 1274, 1328, 1327, 1379, 1388, 1397, 1406, 1415, 1424, - 1433, 1437, 1445, 1446, 1451, 1473, 1485, 1501, 1500, 1506, - 1517, 1518, 1523, 1530, 1541, 1542, 1546, 1554, 1558, 1568, - 1582, 1598, 1608, 1617, 1642, 1654, 1666, 1682, 1694, 1710, - 1755, 1774, 1809, 1844, 1878, 1903, 1921, 1931, 1941, 1951, - 1961, 1975, 1989 + 0, 230, 230, 232, 233, 234, 235, 236, 241, 254, + 263, 253, 286, 289, 317, 320, 347, 352, 353, 358, + 359, 365, 368, 386, 399, 436, 437, 442, 458, 471, + 484, 497, 514, 515, 521, 520, 536, 535, 551, 565, + 566, 571, 572, 573, 574, 575, 580, 665, 711, 769, + 814, 815, 819, 846, 884, 926, 948, 957, 966, 981, + 993, 1007, 1020, 1031, 1042, 1072, 1041, 1186, 1185, 1264, + 1270, 1277, 1276, 1330, 1329, 1381, 1390, 1399, 1408, 1417, + 1426, 1435, 1439, 1447, 1448, 1453, 1475, 1487, 1503, 1502, + 1508, 1519, 1520, 1525, 1532, 1543, 1544, 1548, 1556, 1560, + 1570, 1584, 1600, 1610, 1619, 1644, 1656, 1668, 1684, 1696, + 1712, 1757, 1776, 1811, 1846, 1880, 1905, 1923, 1933, 1943, + 1953, 1963, 1977, 1991 }; #endif @@ -641,15 +643,15 @@ static const char *const yytname[] = "_STRING_IDENTIFIER_", "_STRING_COUNT_", "_STRING_OFFSET_", "_STRING_LENGTH_", "_STRING_IDENTIFIER_WITH_WILDCARD_", "_NUMBER_", "_DOUBLE_", "_INTEGER_FUNCTION_", "_TEXT_STRING_", "_HEX_STRING_", - "_REGEXP_", "_ASCII_", "_WIDE_", "_NOCASE_", "_FULLWORD_", "_AT_", - "_FILESIZE_", "_ENTRYPOINT_", "_ALL_", "_ANY_", "_IN_", "_OF_", "_FOR_", - "_THEM_", "_MATCHES_", "_CONTAINS_", "_IMPORT_", "_TRUE_", "_FALSE_", - "_OR_", "_AND_", "'|'", "'^'", "'&'", "_EQ_", "_NEQ_", "_LT_", "_LE_", - "_GT_", "_GE_", "_SHIFT_LEFT_", "_SHIFT_RIGHT_", "'+'", "'-'", "'*'", - "'\\\\'", "'%'", "_NOT_", "'~'", "UNARY_MINUS", "\"include\"", "'{'", - "'}'", "':'", "'='", "'.'", "'['", "']'", "'('", "')'", "','", "$accept", - "rules", "import", "rule", "@1", "$@2", "meta", "strings", "condition", - "rule_modifiers", "rule_modifier", "tags", "tag_list", + "_REGEXP_", "_ASCII_", "_WIDE_", "_XOR_", "_NOCASE_", "_FULLWORD_", + "_AT_", "_FILESIZE_", "_ENTRYPOINT_", "_ALL_", "_ANY_", "_IN_", "_OF_", + "_FOR_", "_THEM_", "_MATCHES_", "_CONTAINS_", "_IMPORT_", "_TRUE_", + "_FALSE_", "_OR_", "_AND_", "'|'", "'^'", "'&'", "_EQ_", "_NEQ_", "_LT_", + "_LE_", "_GT_", "_GE_", "_SHIFT_LEFT_", "_SHIFT_RIGHT_", "'+'", "'-'", + "'*'", "'\\\\'", "'%'", "_NOT_", "'~'", "UNARY_MINUS", "\"include\"", + "'{'", "'}'", "':'", "'='", "'.'", "'['", "']'", "'('", "')'", "','", + "$accept", "rules", "import", "rule", "@1", "$@2", "meta", "strings", + "condition", "rule_modifiers", "rule_modifier", "tags", "tag_list", "meta_declarations", "meta_declaration", "string_declarations", "string_declaration", "$@3", "$@4", "string_modifiers", "string_modifier", "identifier", "arguments", "arguments_list", "regexp", @@ -669,10 +671,10 @@ static const yytype_uint16 yytoknum[] = 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 124, 94, 38, 297, 298, 299, 300, 301, - 302, 303, 304, 43, 45, 42, 92, 37, 305, 126, - 306, 307, 123, 125, 58, 61, 46, 91, 93, 40, - 41, 44 + 295, 296, 297, 124, 94, 38, 298, 299, 300, 301, + 302, 303, 304, 305, 43, 45, 42, 92, 37, 306, + 126, 307, 308, 123, 125, 58, 61, 46, 91, 93, + 40, 41, 44 }; # endif @@ -681,7 +683,7 @@ static const yytype_uint16 yytoknum[] = #define yypact_value_is_default(Yystate) \ (!!((Yystate) == (-73))) -#define YYTABLE_NINF -95 +#define YYTABLE_NINF -96 #define yytable_value_is_error(Yytable_value) \ 0 @@ -690,27 +692,28 @@ static const yytype_uint16 yytoknum[] = STATE-NUM. */ static const yytype_int16 yypact[] = { - -73, 90, -73, -32, -10, -73, -73, 93, -73, -73, - -73, -73, 1, -73, -73, -73, -73, -49, 7, -36, - -73, 20, 26, -73, -28, 92, 46, 4, -73, 40, - 46, -73, 100, 119, 16, -73, 72, 100, -73, 77, - 83, -73, -73, -73, -73, 134, 59, -73, 48, -73, - -73, -73, 133, 136, -73, -18, -73, 88, 95, -73, - -73, 91, -73, -73, -73, -73, -73, -73, 102, -73, - -73, 126, 48, 126, 48, -44, -73, 85, -73, 127, - 297, -73, -73, 126, 110, 126, 126, 126, 126, 2, - 313, -73, -73, -73, 85, 111, 154, 172, 126, 48, - -73, -73, -6, 162, 126, 126, 126, 126, 126, 126, - 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, - 126, 60, 60, 313, 126, -73, 234, 252, 174, 194, - -73, 153, -6, -73, -73, -73, 270, 117, 120, 108, - 48, 48, -73, -73, -73, -73, 313, 328, 342, 349, - 313, 313, 313, 313, 313, 313, 113, 113, 53, 53, - -73, -73, -73, -73, -73, -73, -73, -73, 121, -73, - -73, -73, -73, 124, -73, -73, 48, 151, -73, -1, - 126, 125, -73, 108, -73, -73, 18, -73, 214, 126, - 129, -73, 143, -73, -1, -73, 63, 121, -73, 48, - -73, -73, 126, 144, 31, 313, 48, -73, 33, -73 + -73, 90, -73, -33, -16, -73, -73, 69, -73, -73, + -73, -73, 5, -73, -73, -73, -73, -42, 44, -38, + -73, 60, 61, -73, 21, 72, 79, 41, -73, 64, + 79, -73, 129, 141, 16, -73, 85, 129, -73, 80, + 96, -73, -73, -73, -73, 145, 81, -73, 48, -73, + -73, -73, 143, 150, -73, -10, -73, 104, 111, -73, + -73, 114, -73, -73, -73, -73, -73, -73, 103, -73, + -73, 125, 48, 125, 48, -34, -73, 68, -73, 148, + 293, -73, -73, 125, 116, 125, 125, 125, 125, 71, + 309, -73, -73, -73, 68, 133, 170, 172, 125, 48, + -73, -73, -7, 184, 125, 125, 125, 125, 125, 125, + 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, + 125, 152, 152, 309, 125, -73, 230, 248, 112, 190, + -73, 176, -7, -73, -73, -73, 266, 138, 139, 70, + 48, 48, -73, -73, -73, -73, 309, 324, 338, -44, + 309, 309, 309, 309, 309, 309, 136, 136, 27, 27, + -73, -73, -73, -73, -73, -73, -73, -73, -73, 144, + -73, -73, -73, -73, 147, -73, -73, 48, 168, -73, + 15, 125, 159, -73, 70, -73, -73, 54, -73, 210, + 125, 165, -73, 161, -73, 15, -73, 77, 144, -73, + 48, -73, -73, 125, 162, 56, 309, 48, -73, 58, + -73 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -723,31 +726,32 @@ static const yytype_uint8 yydefact[] = 23, 22, 12, 24, 0, 14, 0, 0, 10, 0, 13, 25, 0, 0, 0, 26, 0, 15, 32, 0, 0, 28, 27, 30, 31, 0, 34, 33, 0, 11, - 29, 38, 0, 0, 45, 59, 104, 106, 108, 101, - 102, 0, 103, 53, 98, 99, 95, 96, 0, 55, - 56, 0, 0, 0, 0, 109, 122, 16, 54, 0, - 80, 39, 39, 0, 0, 0, 0, 0, 0, 0, - 94, 110, 69, 119, 0, 54, 80, 0, 0, 49, - 72, 70, 0, 0, 0, 0, 0, 0, 0, 0, + 29, 38, 0, 0, 46, 60, 105, 107, 109, 102, + 103, 0, 104, 54, 99, 100, 96, 97, 0, 56, + 57, 0, 0, 0, 0, 110, 123, 16, 55, 0, + 81, 39, 39, 0, 0, 0, 0, 0, 0, 0, + 95, 111, 70, 120, 0, 55, 81, 0, 0, 50, + 73, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 35, 37, 60, 0, 61, 0, 0, 0, 0, - 62, 0, 0, 81, 97, 46, 0, 0, 50, 51, - 0, 0, 89, 87, 68, 57, 58, 118, 116, 117, - 78, 79, 74, 76, 75, 77, 120, 121, 111, 112, - 113, 114, 115, 42, 41, 43, 44, 40, 0, 105, - 107, 100, 63, 0, 47, 48, 0, 73, 71, 0, - 0, 0, 66, 52, 92, 93, 0, 90, 0, 0, - 0, 83, 0, 88, 0, 84, 0, 85, 64, 0, - 91, 82, 0, 0, 0, 86, 0, 67, 0, 65 + 0, 35, 37, 61, 0, 62, 0, 0, 0, 0, + 63, 0, 0, 82, 98, 47, 0, 0, 51, 52, + 0, 0, 90, 88, 69, 58, 59, 119, 117, 118, + 79, 80, 75, 77, 76, 78, 121, 122, 112, 113, + 114, 115, 116, 42, 41, 45, 43, 44, 40, 0, + 106, 108, 101, 64, 0, 48, 49, 0, 74, 72, + 0, 0, 0, 67, 53, 93, 94, 0, 91, 0, + 0, 0, 84, 0, 89, 0, 85, 0, 86, 65, + 0, 92, 83, 0, 0, 0, 87, 0, 68, 0, + 66 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -73, -73, 211, 212, -73, -73, -73, -73, -73, -73, - -73, -73, -73, -73, 189, -73, 183, -73, -73, 139, - -73, -73, -73, -73, 130, -48, -72, -73, -73, -73, - -73, -73, -73, 41, -73, 103, -73, -73, 29, 164, + -73, -73, 233, 234, -73, -73, -73, -73, -73, -73, + -73, -73, -73, -73, 208, -73, 202, -73, -73, 158, + -73, -73, -73, -73, 146, -48, -72, -73, -73, -73, + -73, -73, -73, 74, -73, 118, -73, -73, 57, 183, -67 }; @@ -756,8 +760,8 @@ static const yytype_int16 yydefgoto[] = { -1, 1, 5, 6, 17, 33, 25, 28, 40, 7, 15, 19, 21, 30, 31, 37, 38, 52, 53, 121, - 167, 75, 137, 138, 76, 94, 78, 181, 203, 192, - 141, 140, 190, 125, 196, 144, 179, 186, 187, 79, + 168, 75, 137, 138, 76, 94, 78, 182, 204, 193, + 141, 140, 191, 125, 197, 144, 180, 187, 188, 79, 80 }; @@ -766,137 +770,136 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 77, 90, 95, 130, 91, 4, 93, 96, 83, 11, - 184, 16, 131, 84, 185, 18, 123, 20, 126, 127, - 128, 129, 97, 98, 92, 99, 22, 139, 142, 8, - 23, 136, 41, 24, 132, 42, 26, 146, 147, 148, + 77, 90, 95, 11, 91, 4, 93, 96, 114, 115, + 116, 117, 118, 119, 120, 16, 123, 83, 126, 127, + 128, 129, 84, 18, 92, 22, 185, 139, 142, 8, + 186, 136, 41, 97, 98, 42, 99, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 43, 44, 29, 168, 54, 55, - 56, 57, 58, 143, 59, 60, 61, 62, 32, 63, - 45, 100, 101, 100, 101, 64, 65, 66, 67, 51, - -36, 68, 163, 164, 165, 166, 69, 70, 193, 194, - 2, 3, 177, 178, -17, -17, -17, 12, 13, 14, - 27, 207, 71, 209, 183, 34, 72, 73, 118, 119, - 120, 36, 54, 188, 56, 57, 58, 74, 59, 60, - 61, 62, 197, 63, 180, 100, 101, 4, 39, 64, - 65, 66, 67, 201, 202, 205, 54, 46, 56, 57, - 58, 48, 59, 60, 61, 62, 49, 63, -54, -54, - 50, 204, 81, 64, 65, 85, 71, 82, 208, 102, - 87, 73, 86, 105, 106, 107, 116, 117, 118, 119, - 120, 88, 114, 115, 116, 117, 118, 119, 120, 124, - 71, 133, 135, 63, 172, 73, -94, 175, 182, 103, - 104, 176, 101, 198, 189, 88, 105, 106, 107, 108, + 159, 160, 161, 162, 20, 43, 44, 169, 54, 55, + 56, 57, 58, 143, 59, 60, 61, 62, 24, 63, + 23, 45, 130, 12, 13, 14, 64, 65, 66, 67, + 27, 131, 68, 118, 119, 120, 26, 69, 70, 29, + 2, 3, 178, 179, -17, -17, -17, 100, 101, 100, + 101, 51, -36, 71, 132, 184, 32, 72, 73, 100, + 101, -55, -55, 54, 189, 56, 57, 58, 74, 59, + 60, 61, 62, 198, 63, 194, 195, 208, 4, 210, + 34, 64, 65, 66, 67, 54, 206, 56, 57, 58, + 36, 59, 60, 61, 62, 48, 63, 181, 202, 203, + 39, 46, 205, 64, 65, 105, 106, 107, 71, 209, + 49, 50, 81, 73, 114, 115, 116, 117, 118, 119, + 120, 82, 85, 88, 163, 164, 165, 166, 167, 86, + 71, 102, 135, 172, 87, 73, 124, 105, 106, 107, + 116, 117, 118, 119, 120, 88, 114, 115, 116, 117, + 118, 119, 120, -95, 133, 63, 103, 104, 173, 176, + 101, 177, 183, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 119, 120, 190, + 199, 200, 207, 105, 106, 107, 9, 10, 35, 47, + 122, 134, 114, 115, 116, 117, 118, 119, 120, 145, + 174, 89, 201, 105, 106, 107, 192, 0, 0, 0, + 0, 134, 114, 115, 116, 117, 118, 119, 120, 0, + 0, 0, 0, 105, 106, 107, 0, 0, 0, 0, + 0, 196, 114, 115, 116, 117, 118, 119, 120, 0, + 0, 105, 106, 107, 0, 0, 0, 0, 0, 170, + 114, 115, 116, 117, 118, 119, 120, 0, 0, 105, + 106, 107, 0, 0, 0, 0, 0, 171, 114, 115, + 116, 117, 118, 119, 120, 0, -95, 0, 0, 103, + 104, 0, 0, 0, 0, 175, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 199, 206, 9, 10, 105, 106, 107, 35, - 47, 122, 191, 200, 134, 114, 115, 116, 117, 118, - 119, 120, 89, 145, 0, 173, 105, 106, 107, 0, - 0, 0, 0, 0, 171, 114, 115, 116, 117, 118, - 119, 120, 0, 0, 0, 0, 105, 106, 107, 0, - 0, 0, 0, 0, 134, 114, 115, 116, 117, 118, - 119, 120, 0, 0, 0, 0, 105, 106, 107, 0, - 0, 0, 0, 0, 195, 114, 115, 116, 117, 118, - 119, 120, 0, 0, 105, 106, 107, 0, 0, 0, - 0, 0, 169, 114, 115, 116, 117, 118, 119, 120, - 0, 0, 105, 106, 107, 0, 0, 0, 0, 0, - 170, 114, 115, 116, 117, 118, 119, 120, 0, -94, - 0, 0, 103, 104, 0, 0, 0, 0, 174, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 105, 106, 107, 0, 0, - 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, - 120, 106, 107, 0, 0, 0, 0, 0, 0, 114, - 115, 116, 117, 118, 119, 120, 107, 0, 0, 0, - 0, 0, 0, 114, 115, 116, 117, 118, 119, 120, + 119, 120, 105, 106, 107, 0, 0, 0, 0, 0, + 0, 114, 115, 116, 117, 118, 119, 120, 106, 107, + 0, 0, 0, 0, 0, 0, 114, 115, 116, 117, + 118, 119, 120, 107, 0, 0, 0, 0, 0, 0, 114, 115, 116, 117, 118, 119, 120 }; static const yytype_int16 yycheck[] = { - 48, 68, 74, 1, 71, 37, 73, 74, 26, 19, - 11, 10, 10, 31, 15, 64, 83, 10, 85, 86, - 87, 88, 66, 67, 72, 69, 62, 99, 34, 61, - 10, 98, 16, 7, 32, 19, 64, 104, 105, 106, + 48, 68, 74, 19, 71, 38, 73, 74, 52, 53, + 54, 55, 56, 57, 58, 10, 83, 27, 85, 86, + 87, 88, 32, 65, 72, 63, 11, 99, 35, 62, + 15, 98, 16, 67, 68, 19, 70, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 38, 39, 10, 124, 10, 11, - 12, 13, 14, 69, 16, 17, 18, 19, 64, 21, - 54, 40, 41, 40, 41, 27, 28, 29, 30, 20, - 21, 33, 22, 23, 24, 25, 38, 39, 70, 71, - 0, 1, 140, 141, 4, 5, 6, 4, 5, 6, - 8, 70, 54, 70, 176, 65, 58, 59, 55, 56, - 57, 11, 10, 180, 12, 13, 14, 69, 16, 17, - 18, 19, 189, 21, 3, 40, 41, 37, 9, 27, - 28, 29, 30, 70, 71, 202, 10, 65, 12, 13, - 14, 64, 16, 17, 18, 19, 63, 21, 40, 41, - 16, 199, 19, 27, 28, 67, 54, 21, 206, 32, - 69, 59, 67, 42, 43, 44, 53, 54, 55, 56, - 57, 69, 51, 52, 53, 54, 55, 56, 57, 69, - 54, 70, 10, 21, 31, 59, 32, 70, 64, 35, - 36, 71, 41, 64, 69, 69, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 56, 57, 69, 69, 3, 3, 42, 43, 44, 30, - 37, 82, 181, 194, 70, 51, 52, 53, 54, 55, - 56, 57, 68, 103, -1, 132, 42, 43, 44, -1, - -1, -1, -1, -1, 70, 51, 52, 53, 54, 55, - 56, 57, -1, -1, -1, -1, 42, 43, 44, -1, - -1, -1, -1, -1, 70, 51, 52, 53, 54, 55, - 56, 57, -1, -1, -1, -1, 42, 43, 44, -1, - -1, -1, -1, -1, 70, 51, 52, 53, 54, 55, - 56, 57, -1, -1, 42, 43, 44, -1, -1, -1, - -1, -1, 68, 51, 52, 53, 54, 55, 56, 57, - -1, -1, 42, 43, 44, -1, -1, -1, -1, -1, - 68, 51, 52, 53, 54, 55, 56, 57, -1, 32, - -1, -1, 35, 36, -1, -1, -1, -1, 68, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 42, 43, 44, -1, -1, - -1, -1, -1, -1, 51, 52, 53, 54, 55, 56, - 57, 43, 44, -1, -1, -1, -1, -1, -1, 51, - 52, 53, 54, 55, 56, 57, 44, -1, -1, -1, - -1, -1, -1, 51, 52, 53, 54, 55, 56, 57, - 51, 52, 53, 54, 55, 56, 57 + 117, 118, 119, 120, 10, 39, 40, 124, 10, 11, + 12, 13, 14, 70, 16, 17, 18, 19, 7, 21, + 10, 55, 1, 4, 5, 6, 28, 29, 30, 31, + 8, 10, 34, 56, 57, 58, 65, 39, 40, 10, + 0, 1, 140, 141, 4, 5, 6, 41, 42, 41, + 42, 20, 21, 55, 33, 177, 65, 59, 60, 41, + 42, 41, 42, 10, 181, 12, 13, 14, 70, 16, + 17, 18, 19, 190, 21, 71, 72, 71, 38, 71, + 66, 28, 29, 30, 31, 10, 203, 12, 13, 14, + 11, 16, 17, 18, 19, 65, 21, 3, 71, 72, + 9, 66, 200, 28, 29, 43, 44, 45, 55, 207, + 64, 16, 19, 60, 52, 53, 54, 55, 56, 57, + 58, 21, 68, 70, 22, 23, 24, 25, 26, 68, + 55, 33, 10, 71, 70, 60, 70, 43, 44, 45, + 54, 55, 56, 57, 58, 70, 52, 53, 54, 55, + 56, 57, 58, 33, 71, 21, 36, 37, 32, 71, + 42, 72, 65, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 70, + 65, 70, 70, 43, 44, 45, 3, 3, 30, 37, + 82, 71, 52, 53, 54, 55, 56, 57, 58, 103, + 132, 68, 195, 43, 44, 45, 182, -1, -1, -1, + -1, 71, 52, 53, 54, 55, 56, 57, 58, -1, + -1, -1, -1, 43, 44, 45, -1, -1, -1, -1, + -1, 71, 52, 53, 54, 55, 56, 57, 58, -1, + -1, 43, 44, 45, -1, -1, -1, -1, -1, 69, + 52, 53, 54, 55, 56, 57, 58, -1, -1, 43, + 44, 45, -1, -1, -1, -1, -1, 69, 52, 53, + 54, 55, 56, 57, 58, -1, 33, -1, -1, 36, + 37, -1, -1, -1, -1, 69, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 43, 44, 45, -1, -1, -1, -1, -1, + -1, 52, 53, 54, 55, 56, 57, 58, 44, 45, + -1, -1, -1, -1, -1, -1, 52, 53, 54, 55, + 56, 57, 58, 45, -1, -1, -1, -1, -1, -1, + 52, 53, 54, 55, 56, 57, 58 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 73, 0, 1, 37, 74, 75, 81, 61, 74, - 75, 19, 4, 5, 6, 82, 10, 76, 64, 83, - 10, 84, 62, 10, 7, 78, 64, 8, 79, 10, - 85, 86, 64, 77, 65, 86, 11, 87, 88, 9, - 80, 16, 19, 38, 39, 54, 65, 88, 64, 63, - 16, 20, 89, 90, 10, 11, 12, 13, 14, 16, - 17, 18, 19, 21, 27, 28, 29, 30, 33, 38, - 39, 54, 58, 59, 69, 93, 96, 97, 98, 111, - 112, 19, 21, 26, 31, 67, 67, 69, 69, 111, - 112, 112, 97, 112, 97, 98, 112, 66, 67, 69, - 40, 41, 32, 35, 36, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 91, 91, 112, 69, 105, 112, 112, 112, 112, - 1, 10, 32, 70, 70, 10, 112, 94, 95, 98, - 103, 102, 34, 69, 107, 96, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 22, 23, 24, 25, 92, 112, 68, - 68, 70, 31, 107, 68, 70, 71, 97, 97, 108, - 3, 99, 64, 98, 11, 15, 109, 110, 112, 69, - 104, 105, 101, 70, 71, 70, 106, 112, 64, 69, - 110, 70, 71, 100, 97, 112, 69, 70, 97, 70 + 0, 74, 0, 1, 38, 75, 76, 82, 62, 75, + 76, 19, 4, 5, 6, 83, 10, 77, 65, 84, + 10, 85, 63, 10, 7, 79, 65, 8, 80, 10, + 86, 87, 65, 78, 66, 87, 11, 88, 89, 9, + 81, 16, 19, 39, 40, 55, 66, 89, 65, 64, + 16, 20, 90, 91, 10, 11, 12, 13, 14, 16, + 17, 18, 19, 21, 28, 29, 30, 31, 34, 39, + 40, 55, 59, 60, 70, 94, 97, 98, 99, 112, + 113, 19, 21, 27, 32, 68, 68, 70, 70, 112, + 113, 113, 98, 113, 98, 99, 113, 67, 68, 70, + 41, 42, 33, 36, 37, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, + 58, 92, 92, 113, 70, 106, 113, 113, 113, 113, + 1, 10, 33, 71, 71, 10, 113, 95, 96, 99, + 104, 103, 35, 70, 108, 97, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 22, 23, 24, 25, 26, 93, 113, + 69, 69, 71, 32, 108, 69, 71, 72, 98, 98, + 109, 3, 100, 65, 99, 11, 15, 110, 111, 113, + 70, 105, 106, 102, 71, 72, 71, 107, 113, 65, + 70, 111, 71, 72, 101, 98, 113, 70, 71, 98, + 71 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 72, 73, 73, 73, 73, 73, 73, 74, 76, - 77, 75, 78, 78, 79, 79, 80, 81, 81, 82, - 82, 83, 83, 84, 84, 85, 85, 86, 86, 86, - 86, 86, 87, 87, 89, 88, 90, 88, 88, 91, - 91, 92, 92, 92, 92, 93, 93, 93, 93, 94, - 94, 95, 95, 96, 97, 98, 98, 98, 98, 98, - 98, 98, 98, 99, 100, 98, 101, 98, 98, 98, - 102, 98, 103, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 104, 104, 105, 106, 106, 108, 107, 107, - 109, 109, 110, 110, 111, 111, 111, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112 + 0, 73, 74, 74, 74, 74, 74, 74, 75, 77, + 78, 76, 79, 79, 80, 80, 81, 82, 82, 83, + 83, 84, 84, 85, 85, 86, 86, 87, 87, 87, + 87, 87, 88, 88, 90, 89, 91, 89, 89, 92, + 92, 93, 93, 93, 93, 93, 94, 94, 94, 94, + 95, 95, 96, 96, 97, 98, 99, 99, 99, 99, + 99, 99, 99, 99, 100, 101, 99, 102, 99, 99, + 99, 103, 99, 104, 99, 99, 99, 99, 99, 99, + 99, 99, 99, 105, 105, 106, 107, 107, 109, 108, + 108, 110, 110, 111, 111, 112, 112, 112, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 113, 113, 113 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ @@ -906,15 +909,15 @@ static const yytype_uint8 yyr2[] = 0, 11, 0, 3, 0, 3, 3, 0, 2, 1, 1, 0, 2, 1, 2, 1, 2, 3, 3, 4, 3, 3, 1, 2, 0, 5, 0, 5, 3, 0, - 2, 1, 1, 1, 1, 1, 3, 4, 4, 0, - 1, 1, 3, 1, 1, 1, 1, 3, 3, 1, - 3, 3, 3, 0, 0, 11, 0, 9, 3, 2, - 0, 4, 0, 4, 3, 3, 3, 3, 3, 3, - 1, 3, 3, 1, 5, 1, 3, 0, 4, 1, - 1, 3, 1, 1, 1, 1, 1, 3, 1, 1, - 4, 1, 1, 1, 1, 4, 1, 4, 1, 1, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, - 3, 3, 1 + 2, 1, 1, 1, 1, 1, 1, 3, 4, 4, + 0, 1, 1, 3, 1, 1, 1, 1, 3, 3, + 1, 3, 3, 3, 0, 0, 11, 0, 9, 3, + 2, 0, 4, 0, 4, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 1, 5, 1, 3, 0, 4, + 1, 1, 3, 1, 1, 1, 1, 1, 3, 1, + 1, 4, 1, 1, 1, 1, 4, 1, 4, 1, + 1, 2, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 3, 3, 1 }; @@ -1342,69 +1345,69 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, void *yyscanner, Y switch (yytype) { case 10: /* _IDENTIFIER_ */ -#line 202 "grammar.y" /* yacc.c:1257 */ +#line 203 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1348 "grammar.c" /* yacc.c:1257 */ +#line 1351 "grammar.c" /* yacc.c:1257 */ break; case 11: /* _STRING_IDENTIFIER_ */ -#line 206 "grammar.y" /* yacc.c:1257 */ +#line 207 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1354 "grammar.c" /* yacc.c:1257 */ +#line 1357 "grammar.c" /* yacc.c:1257 */ break; case 12: /* _STRING_COUNT_ */ -#line 203 "grammar.y" /* yacc.c:1257 */ +#line 204 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1360 "grammar.c" /* yacc.c:1257 */ +#line 1363 "grammar.c" /* yacc.c:1257 */ break; case 13: /* _STRING_OFFSET_ */ -#line 204 "grammar.y" /* yacc.c:1257 */ +#line 205 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1366 "grammar.c" /* yacc.c:1257 */ +#line 1369 "grammar.c" /* yacc.c:1257 */ break; case 14: /* _STRING_LENGTH_ */ -#line 205 "grammar.y" /* yacc.c:1257 */ +#line 206 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1372 "grammar.c" /* yacc.c:1257 */ +#line 1375 "grammar.c" /* yacc.c:1257 */ break; case 15: /* _STRING_IDENTIFIER_WITH_WILDCARD_ */ -#line 207 "grammar.y" /* yacc.c:1257 */ +#line 208 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1378 "grammar.c" /* yacc.c:1257 */ +#line 1381 "grammar.c" /* yacc.c:1257 */ break; case 19: /* _TEXT_STRING_ */ -#line 208 "grammar.y" /* yacc.c:1257 */ +#line 209 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).sized_string)); ((*yyvaluep).sized_string) = NULL; } -#line 1384 "grammar.c" /* yacc.c:1257 */ +#line 1387 "grammar.c" /* yacc.c:1257 */ break; case 20: /* _HEX_STRING_ */ -#line 209 "grammar.y" /* yacc.c:1257 */ +#line 210 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).sized_string)); ((*yyvaluep).sized_string) = NULL; } -#line 1390 "grammar.c" /* yacc.c:1257 */ +#line 1393 "grammar.c" /* yacc.c:1257 */ break; case 21: /* _REGEXP_ */ -#line 210 "grammar.y" /* yacc.c:1257 */ +#line 211 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).sized_string)); ((*yyvaluep).sized_string) = NULL; } -#line 1396 "grammar.c" /* yacc.c:1257 */ +#line 1399 "grammar.c" /* yacc.c:1257 */ break; - case 94: /* arguments */ -#line 212 "grammar.y" /* yacc.c:1257 */ - { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1402 "grammar.c" /* yacc.c:1257 */ - break; - - case 95: /* arguments_list */ + case 95: /* arguments */ #line 213 "grammar.y" /* yacc.c:1257 */ { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } -#line 1408 "grammar.c" /* yacc.c:1257 */ +#line 1405 "grammar.c" /* yacc.c:1257 */ + break; + + case 96: /* arguments_list */ +#line 214 "grammar.y" /* yacc.c:1257 */ + { yr_free(((*yyvaluep).c_string)); ((*yyvaluep).c_string) = NULL; } +#line 1411 "grammar.c" /* yacc.c:1257 */ break; @@ -1670,7 +1673,7 @@ yyreduce: switch (yyn) { case 8: -#line 241 "grammar.y" /* yacc.c:1661 */ +#line 242 "grammar.y" /* yacc.c:1661 */ { int result = yr_parser_reduce_import(yyscanner, (yyvsp[0].sized_string)); @@ -1678,11 +1681,11 @@ yyreduce: fail_if(result != ERROR_SUCCESS); } -#line 1682 "grammar.c" /* yacc.c:1661 */ +#line 1685 "grammar.c" /* yacc.c:1661 */ break; case 9: -#line 253 "grammar.y" /* yacc.c:1661 */ +#line 254 "grammar.y" /* yacc.c:1661 */ { YR_RULE* rule = yr_parser_reduce_rule_declaration_phase_1( yyscanner, (int32_t) (yyvsp[-2].integer), (yyvsp[0].c_string)); @@ -1691,11 +1694,11 @@ yyreduce: (yyval.rule) = rule; } -#line 1695 "grammar.c" /* yacc.c:1661 */ +#line 1698 "grammar.c" /* yacc.c:1661 */ break; case 10: -#line 262 "grammar.y" /* yacc.c:1661 */ +#line 263 "grammar.y" /* yacc.c:1661 */ { YR_RULE* rule = (yyvsp[-4].rule); // rule created in phase 1 @@ -1703,11 +1706,11 @@ yyreduce: rule->metas = (yyvsp[-1].meta); rule->strings = (yyvsp[0].string); } -#line 1707 "grammar.c" /* yacc.c:1661 */ +#line 1710 "grammar.c" /* yacc.c:1661 */ break; case 11: -#line 270 "grammar.y" /* yacc.c:1661 */ +#line 271 "grammar.y" /* yacc.c:1661 */ { YR_RULE* rule = (yyvsp[-7].rule); // rule created in phase 1 @@ -1718,19 +1721,19 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 1722 "grammar.c" /* yacc.c:1661 */ +#line 1725 "grammar.c" /* yacc.c:1661 */ break; case 12: -#line 285 "grammar.y" /* yacc.c:1661 */ +#line 286 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = NULL; } -#line 1730 "grammar.c" /* yacc.c:1661 */ +#line 1733 "grammar.c" /* yacc.c:1661 */ break; case 13: -#line 289 "grammar.y" /* yacc.c:1661 */ +#line 290 "grammar.y" /* yacc.c:1661 */ { // Each rule have a list of meta-data info, consisting in a // sequence of YR_META structures. The last YR_META structure does @@ -1753,19 +1756,19 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 1757 "grammar.c" /* yacc.c:1661 */ +#line 1760 "grammar.c" /* yacc.c:1661 */ break; case 14: -#line 316 "grammar.y" /* yacc.c:1661 */ +#line 317 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = NULL; } -#line 1765 "grammar.c" /* yacc.c:1661 */ +#line 1768 "grammar.c" /* yacc.c:1661 */ break; case 15: -#line 320 "grammar.y" /* yacc.c:1661 */ +#line 321 "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 @@ -1788,43 +1791,43 @@ yyreduce: (yyval.string) = (yyvsp[0].string); } -#line 1792 "grammar.c" /* yacc.c:1661 */ +#line 1795 "grammar.c" /* yacc.c:1661 */ break; case 17: -#line 351 "grammar.y" /* yacc.c:1661 */ +#line 352 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = 0; } -#line 1798 "grammar.c" /* yacc.c:1661 */ +#line 1801 "grammar.c" /* yacc.c:1661 */ break; case 18: -#line 352 "grammar.y" /* yacc.c:1661 */ +#line 353 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = (yyvsp[-1].integer) | (yyvsp[0].integer); } -#line 1804 "grammar.c" /* yacc.c:1661 */ +#line 1807 "grammar.c" /* yacc.c:1661 */ break; case 19: -#line 357 "grammar.y" /* yacc.c:1661 */ +#line 358 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = RULE_GFLAGS_PRIVATE; } -#line 1810 "grammar.c" /* yacc.c:1661 */ +#line 1813 "grammar.c" /* yacc.c:1661 */ break; case 20: -#line 358 "grammar.y" /* yacc.c:1661 */ +#line 359 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = RULE_GFLAGS_GLOBAL; } -#line 1816 "grammar.c" /* yacc.c:1661 */ +#line 1819 "grammar.c" /* yacc.c:1661 */ break; case 21: -#line 364 "grammar.y" /* yacc.c:1661 */ +#line 365 "grammar.y" /* yacc.c:1661 */ { (yyval.c_string) = NULL; } -#line 1824 "grammar.c" /* yacc.c:1661 */ +#line 1827 "grammar.c" /* yacc.c:1661 */ break; case 22: -#line 368 "grammar.y" /* yacc.c:1661 */ +#line 369 "grammar.y" /* yacc.c:1661 */ { // Tags list is represented in the arena as a sequence // of null-terminated strings, the sequence ends with an @@ -1838,11 +1841,11 @@ yyreduce: (yyval.c_string) = (yyvsp[0].c_string); } -#line 1842 "grammar.c" /* yacc.c:1661 */ +#line 1845 "grammar.c" /* yacc.c:1661 */ break; case 23: -#line 386 "grammar.y" /* yacc.c:1661 */ +#line 387 "grammar.y" /* yacc.c:1661 */ { char* identifier; @@ -1855,11 +1858,11 @@ yyreduce: (yyval.c_string) = identifier; } -#line 1859 "grammar.c" /* yacc.c:1661 */ +#line 1862 "grammar.c" /* yacc.c:1661 */ break; case 24: -#line 399 "grammar.y" /* yacc.c:1661 */ +#line 400 "grammar.y" /* yacc.c:1661 */ { char* tag_name = (yyvsp[-1].c_string); size_t tag_length = tag_name != NULL ? strlen(tag_name) : 0; @@ -1891,23 +1894,23 @@ yyreduce: (yyval.c_string) = (yyvsp[-1].c_string); } -#line 1895 "grammar.c" /* yacc.c:1661 */ +#line 1898 "grammar.c" /* yacc.c:1661 */ break; case 25: -#line 435 "grammar.y" /* yacc.c:1661 */ +#line 436 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = (yyvsp[0].meta); } -#line 1901 "grammar.c" /* yacc.c:1661 */ +#line 1904 "grammar.c" /* yacc.c:1661 */ break; case 26: -#line 436 "grammar.y" /* yacc.c:1661 */ +#line 437 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = (yyvsp[-1].meta); } -#line 1907 "grammar.c" /* yacc.c:1661 */ +#line 1910 "grammar.c" /* yacc.c:1661 */ break; case 27: -#line 442 "grammar.y" /* yacc.c:1661 */ +#line 443 "grammar.y" /* yacc.c:1661 */ { SIZED_STRING* sized_string = (yyvsp[0].sized_string); @@ -1923,11 +1926,11 @@ yyreduce: fail_if((yyval.meta) == NULL); } -#line 1927 "grammar.c" /* yacc.c:1661 */ +#line 1930 "grammar.c" /* yacc.c:1661 */ break; case 28: -#line 458 "grammar.y" /* yacc.c:1661 */ +#line 459 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = yr_parser_reduce_meta_declaration( yyscanner, @@ -1940,11 +1943,11 @@ yyreduce: fail_if((yyval.meta) == NULL); } -#line 1944 "grammar.c" /* yacc.c:1661 */ +#line 1947 "grammar.c" /* yacc.c:1661 */ break; case 29: -#line 471 "grammar.y" /* yacc.c:1661 */ +#line 472 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = yr_parser_reduce_meta_declaration( yyscanner, @@ -1957,11 +1960,11 @@ yyreduce: fail_if((yyval.meta) == NULL); } -#line 1961 "grammar.c" /* yacc.c:1661 */ +#line 1964 "grammar.c" /* yacc.c:1661 */ break; case 30: -#line 484 "grammar.y" /* yacc.c:1661 */ +#line 485 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = yr_parser_reduce_meta_declaration( yyscanner, @@ -1974,11 +1977,11 @@ yyreduce: fail_if((yyval.meta) == NULL); } -#line 1978 "grammar.c" /* yacc.c:1661 */ +#line 1981 "grammar.c" /* yacc.c:1661 */ break; case 31: -#line 497 "grammar.y" /* yacc.c:1661 */ +#line 498 "grammar.y" /* yacc.c:1661 */ { (yyval.meta) = yr_parser_reduce_meta_declaration( yyscanner, @@ -1991,31 +1994,31 @@ yyreduce: fail_if((yyval.meta) == NULL); } -#line 1995 "grammar.c" /* yacc.c:1661 */ +#line 1998 "grammar.c" /* yacc.c:1661 */ break; case 32: -#line 513 "grammar.y" /* yacc.c:1661 */ +#line 514 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = (yyvsp[0].string); } -#line 2001 "grammar.c" /* yacc.c:1661 */ +#line 2004 "grammar.c" /* yacc.c:1661 */ break; case 33: -#line 514 "grammar.y" /* yacc.c:1661 */ +#line 515 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = (yyvsp[-1].string); } -#line 2007 "grammar.c" /* yacc.c:1661 */ +#line 2010 "grammar.c" /* yacc.c:1661 */ break; case 34: -#line 520 "grammar.y" /* yacc.c:1661 */ +#line 521 "grammar.y" /* yacc.c:1661 */ { compiler->current_line = yyget_lineno(yyscanner); } -#line 2015 "grammar.c" /* yacc.c:1661 */ +#line 2018 "grammar.c" /* yacc.c:1661 */ break; case 35: -#line 524 "grammar.y" /* yacc.c:1661 */ +#line 525 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = yr_parser_reduce_string_declaration( yyscanner, (int32_t) (yyvsp[0].integer), (yyvsp[-4].c_string), (yyvsp[-1].sized_string)); @@ -2026,19 +2029,19 @@ yyreduce: fail_if((yyval.string) == NULL); compiler->current_line = 0; } -#line 2030 "grammar.c" /* yacc.c:1661 */ +#line 2033 "grammar.c" /* yacc.c:1661 */ break; case 36: -#line 535 "grammar.y" /* yacc.c:1661 */ +#line 536 "grammar.y" /* yacc.c:1661 */ { compiler->current_line = yyget_lineno(yyscanner); } -#line 2038 "grammar.c" /* yacc.c:1661 */ +#line 2041 "grammar.c" /* yacc.c:1661 */ break; case 37: -#line 539 "grammar.y" /* yacc.c:1661 */ +#line 540 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = yr_parser_reduce_string_declaration( yyscanner, (int32_t) (yyvsp[0].integer) | STRING_GFLAGS_REGEXP, (yyvsp[-4].c_string), (yyvsp[-1].sized_string)); @@ -2050,11 +2053,11 @@ yyreduce: compiler->current_line = 0; } -#line 2054 "grammar.c" /* yacc.c:1661 */ +#line 2057 "grammar.c" /* yacc.c:1661 */ break; case 38: -#line 551 "grammar.y" /* yacc.c:1661 */ +#line 552 "grammar.y" /* yacc.c:1661 */ { (yyval.string) = yr_parser_reduce_string_declaration( yyscanner, STRING_GFLAGS_HEXADECIMAL, (yyvsp[-2].c_string), (yyvsp[0].sized_string)); @@ -2064,47 +2067,53 @@ yyreduce: fail_if((yyval.string) == NULL); } -#line 2068 "grammar.c" /* yacc.c:1661 */ +#line 2071 "grammar.c" /* yacc.c:1661 */ break; case 39: -#line 564 "grammar.y" /* yacc.c:1661 */ +#line 565 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = 0; } -#line 2074 "grammar.c" /* yacc.c:1661 */ +#line 2077 "grammar.c" /* yacc.c:1661 */ break; case 40: -#line 565 "grammar.y" /* yacc.c:1661 */ +#line 566 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = (yyvsp[-1].integer) | (yyvsp[0].integer); } -#line 2080 "grammar.c" /* yacc.c:1661 */ +#line 2083 "grammar.c" /* yacc.c:1661 */ break; case 41: -#line 570 "grammar.y" /* yacc.c:1661 */ +#line 571 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = STRING_GFLAGS_WIDE; } -#line 2086 "grammar.c" /* yacc.c:1661 */ +#line 2089 "grammar.c" /* yacc.c:1661 */ break; case 42: -#line 571 "grammar.y" /* yacc.c:1661 */ +#line 572 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = STRING_GFLAGS_ASCII; } -#line 2092 "grammar.c" /* yacc.c:1661 */ +#line 2095 "grammar.c" /* yacc.c:1661 */ break; case 43: -#line 572 "grammar.y" /* yacc.c:1661 */ +#line 573 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = STRING_GFLAGS_NO_CASE; } -#line 2098 "grammar.c" /* yacc.c:1661 */ +#line 2101 "grammar.c" /* yacc.c:1661 */ break; case 44: -#line 573 "grammar.y" /* yacc.c:1661 */ +#line 574 "grammar.y" /* yacc.c:1661 */ { (yyval.integer) = STRING_GFLAGS_FULL_WORD; } -#line 2104 "grammar.c" /* yacc.c:1661 */ +#line 2107 "grammar.c" /* yacc.c:1661 */ break; case 45: -#line 579 "grammar.y" /* yacc.c:1661 */ +#line 575 "grammar.y" /* yacc.c:1661 */ + { (yyval.integer) = STRING_GFLAGS_XOR; } +#line 2113 "grammar.c" /* yacc.c:1661 */ + break; + + case 46: +#line 581 "grammar.y" /* yacc.c:1661 */ { int var_index = yr_parser_lookup_loop_variable(yyscanner, (yyvsp[0].c_string)); @@ -2189,11 +2198,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 2193 "grammar.c" /* yacc.c:1661 */ +#line 2202 "grammar.c" /* yacc.c:1661 */ break; - case 46: -#line 664 "grammar.y" /* yacc.c:1661 */ + case 47: +#line 666 "grammar.y" /* yacc.c:1661 */ { YR_OBJECT* field = NULL; @@ -2239,11 +2248,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 2243 "grammar.c" /* yacc.c:1661 */ +#line 2252 "grammar.c" /* yacc.c:1661 */ break; - case 47: -#line 710 "grammar.y" /* yacc.c:1661 */ + case 48: +#line 712 "grammar.y" /* yacc.c:1661 */ { YR_OBJECT_ARRAY* array; YR_OBJECT_DICTIONARY* dict; @@ -2300,11 +2309,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 2304 "grammar.c" /* yacc.c:1661 */ +#line 2313 "grammar.c" /* yacc.c:1661 */ break; - case 48: -#line 768 "grammar.y" /* yacc.c:1661 */ + case 49: +#line 770 "grammar.y" /* yacc.c:1661 */ { YR_OBJECT_FUNCTION* function; char* args_fmt; @@ -2345,23 +2354,23 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 2349 "grammar.c" /* yacc.c:1661 */ - break; - - case 49: -#line 812 "grammar.y" /* yacc.c:1661 */ - { (yyval.c_string) = yr_strdup(""); } -#line 2355 "grammar.c" /* yacc.c:1661 */ +#line 2358 "grammar.c" /* yacc.c:1661 */ break; case 50: -#line 813 "grammar.y" /* yacc.c:1661 */ - { (yyval.c_string) = (yyvsp[0].c_string); } -#line 2361 "grammar.c" /* yacc.c:1661 */ +#line 814 "grammar.y" /* yacc.c:1661 */ + { (yyval.c_string) = yr_strdup(""); } +#line 2364 "grammar.c" /* yacc.c:1661 */ break; case 51: -#line 818 "grammar.y" /* yacc.c:1661 */ +#line 815 "grammar.y" /* yacc.c:1661 */ + { (yyval.c_string) = (yyvsp[0].c_string); } +#line 2370 "grammar.c" /* yacc.c:1661 */ + break; + + case 52: +#line 820 "grammar.y" /* yacc.c:1661 */ { (yyval.c_string) = (char*) yr_malloc(MAX_FUNCTION_ARGS + 1); @@ -2388,11 +2397,11 @@ yyreduce: fail_if((yyval.c_string) == NULL); } -#line 2392 "grammar.c" /* yacc.c:1661 */ +#line 2401 "grammar.c" /* yacc.c:1661 */ break; - case 52: -#line 845 "grammar.y" /* yacc.c:1661 */ + case 53: +#line 847 "grammar.y" /* yacc.c:1661 */ { if (strlen((yyvsp[-2].c_string)) == MAX_FUNCTION_ARGS) { @@ -2426,11 +2435,11 @@ yyreduce: (yyval.c_string) = (yyvsp[-2].c_string); } -#line 2430 "grammar.c" /* yacc.c:1661 */ +#line 2439 "grammar.c" /* yacc.c:1661 */ break; - case 53: -#line 883 "grammar.y" /* yacc.c:1661 */ + case 54: +#line 885 "grammar.y" /* yacc.c:1661 */ { SIZED_STRING* sized_string = (yyvsp[0].sized_string); RE* re; @@ -2468,11 +2477,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_REGEXP; } -#line 2472 "grammar.c" /* yacc.c:1661 */ +#line 2481 "grammar.c" /* yacc.c:1661 */ break; - case 54: -#line 925 "grammar.y" /* yacc.c:1661 */ + case 55: +#line 927 "grammar.y" /* yacc.c:1661 */ { if ((yyvsp[0].expression).type == EXPRESSION_TYPE_STRING) { @@ -2491,11 +2500,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2495 "grammar.c" /* yacc.c:1661 */ +#line 2504 "grammar.c" /* yacc.c:1661 */ break; - case 55: -#line 947 "grammar.y" /* yacc.c:1661 */ + case 56: +#line 949 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg( yyscanner, OP_PUSH, 1, NULL, NULL); @@ -2504,11 +2513,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2508 "grammar.c" /* yacc.c:1661 */ +#line 2517 "grammar.c" /* yacc.c:1661 */ break; - case 56: -#line 956 "grammar.y" /* yacc.c:1661 */ + case 57: +#line 958 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg( yyscanner, OP_PUSH, 0, NULL, NULL); @@ -2517,11 +2526,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2521 "grammar.c" /* yacc.c:1661 */ +#line 2530 "grammar.c" /* yacc.c:1661 */ break; - case 57: -#line 965 "grammar.y" /* yacc.c:1661 */ + case 58: +#line 967 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_STRING, "matches"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_REGEXP, "matches"); @@ -2536,11 +2545,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2540 "grammar.c" /* yacc.c:1661 */ +#line 2549 "grammar.c" /* yacc.c:1661 */ break; - case 58: -#line 980 "grammar.y" /* yacc.c:1661 */ + case 59: +#line 982 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_STRING, "contains"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_STRING, "contains"); @@ -2552,11 +2561,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2556 "grammar.c" /* yacc.c:1661 */ +#line 2565 "grammar.c" /* yacc.c:1661 */ break; - case 59: -#line 992 "grammar.y" /* yacc.c:1661 */ + case 60: +#line 994 "grammar.y" /* yacc.c:1661 */ { int result = yr_parser_reduce_string_identifier( yyscanner, @@ -2570,11 +2579,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2574 "grammar.c" /* yacc.c:1661 */ +#line 2583 "grammar.c" /* yacc.c:1661 */ break; - case 60: -#line 1006 "grammar.y" /* yacc.c:1661 */ + case 61: +#line 1008 "grammar.y" /* yacc.c:1661 */ { check_type_with_cleanup((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "at", yr_free((yyvsp[-2].c_string))); @@ -2587,11 +2596,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2591 "grammar.c" /* yacc.c:1661 */ +#line 2600 "grammar.c" /* yacc.c:1661 */ break; - case 61: -#line 1019 "grammar.y" /* yacc.c:1661 */ + case 62: +#line 1021 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_string_identifier( yyscanner, (yyvsp[-2].c_string), OP_FOUND_IN, UNDEFINED); @@ -2602,11 +2611,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2606 "grammar.c" /* yacc.c:1661 */ +#line 2615 "grammar.c" /* yacc.c:1661 */ break; - case 62: -#line 1030 "grammar.y" /* yacc.c:1661 */ + case 63: +#line 1032 "grammar.y" /* yacc.c:1661 */ { if (compiler->loop_depth > 0) { @@ -2616,11 +2625,11 @@ yyreduce: YYERROR; } -#line 2620 "grammar.c" /* yacc.c:1661 */ +#line 2629 "grammar.c" /* yacc.c:1661 */ break; - case 63: -#line 1040 "grammar.y" /* yacc.c:1661 */ + case 64: +#line 1042 "grammar.y" /* yacc.c:1661 */ { int var_index; @@ -2650,11 +2659,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 2654 "grammar.c" /* yacc.c:1661 */ +#line 2663 "grammar.c" /* yacc.c:1661 */ break; - case 64: -#line 1070 "grammar.y" /* yacc.c:1661 */ + case 65: +#line 1072 "grammar.y" /* yacc.c:1661 */ { int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth; uint8_t* addr; @@ -2689,11 +2698,11 @@ yyreduce: compiler->loop_identifier[compiler->loop_depth] = (yyvsp[-4].c_string); compiler->loop_depth++; } -#line 2693 "grammar.c" /* yacc.c:1661 */ +#line 2702 "grammar.c" /* yacc.c:1661 */ break; - case 65: -#line 1105 "grammar.y" /* yacc.c:1661 */ + case 66: +#line 1107 "grammar.y" /* yacc.c:1661 */ { int mem_offset; @@ -2772,11 +2781,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2776 "grammar.c" /* yacc.c:1661 */ +#line 2785 "grammar.c" /* yacc.c:1661 */ break; - case 66: -#line 1184 "grammar.y" /* yacc.c:1661 */ + case 67: +#line 1186 "grammar.y" /* yacc.c:1661 */ { int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth; uint8_t* addr; @@ -2806,11 +2815,11 @@ yyreduce: compiler->loop_identifier[compiler->loop_depth] = NULL; compiler->loop_depth++; } -#line 2810 "grammar.c" /* yacc.c:1661 */ +#line 2819 "grammar.c" /* yacc.c:1661 */ break; - case 67: -#line 1214 "grammar.y" /* yacc.c:1661 */ + case 68: +#line 1216 "grammar.y" /* yacc.c:1661 */ { int mem_offset; @@ -2859,31 +2868,31 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2863 "grammar.c" /* yacc.c:1661 */ +#line 2872 "grammar.c" /* yacc.c:1661 */ break; - case 68: -#line 1263 "grammar.y" /* yacc.c:1661 */ + case 69: +#line 1265 "grammar.y" /* yacc.c:1661 */ { yr_parser_emit(yyscanner, OP_OF, NULL); (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2873 "grammar.c" /* yacc.c:1661 */ +#line 2882 "grammar.c" /* yacc.c:1661 */ break; - case 69: -#line 1269 "grammar.y" /* yacc.c:1661 */ + case 70: +#line 1271 "grammar.y" /* yacc.c:1661 */ { yr_parser_emit(yyscanner, OP_NOT, NULL); (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2883 "grammar.c" /* yacc.c:1661 */ +#line 2892 "grammar.c" /* yacc.c:1661 */ break; - case 70: -#line 1275 "grammar.y" /* yacc.c:1661 */ + case 71: +#line 1277 "grammar.y" /* yacc.c:1661 */ { YR_FIXUP* fixup; void* jmp_destination_addr; @@ -2909,11 +2918,11 @@ yyreduce: fixup->next = compiler->fixup_stack_head; compiler->fixup_stack_head = fixup; } -#line 2913 "grammar.c" /* yacc.c:1661 */ +#line 2922 "grammar.c" /* yacc.c:1661 */ break; - case 71: -#line 1301 "grammar.y" /* yacc.c:1661 */ + case 72: +#line 1303 "grammar.y" /* yacc.c:1661 */ { YR_FIXUP* fixup; uint8_t* nop_addr; @@ -2940,11 +2949,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 2944 "grammar.c" /* yacc.c:1661 */ +#line 2953 "grammar.c" /* yacc.c:1661 */ break; - case 72: -#line 1328 "grammar.y" /* yacc.c:1661 */ + case 73: +#line 1330 "grammar.y" /* yacc.c:1661 */ { YR_FIXUP* fixup; void* jmp_destination_addr; @@ -2969,11 +2978,11 @@ yyreduce: fixup->next = compiler->fixup_stack_head; compiler->fixup_stack_head = fixup; } -#line 2973 "grammar.c" /* yacc.c:1661 */ +#line 2982 "grammar.c" /* yacc.c:1661 */ break; - case 73: -#line 1353 "grammar.y" /* yacc.c:1661 */ + case 74: +#line 1355 "grammar.y" /* yacc.c:1661 */ { YR_FIXUP* fixup; uint8_t* nop_addr; @@ -3000,11 +3009,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3004 "grammar.c" /* yacc.c:1661 */ +#line 3013 "grammar.c" /* yacc.c:1661 */ break; - case 74: -#line 1380 "grammar.y" /* yacc.c:1661 */ + case 75: +#line 1382 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "<", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3013,11 +3022,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3017 "grammar.c" /* yacc.c:1661 */ +#line 3026 "grammar.c" /* yacc.c:1661 */ break; - case 75: -#line 1389 "grammar.y" /* yacc.c:1661 */ + case 76: +#line 1391 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, ">", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3026,11 +3035,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3030 "grammar.c" /* yacc.c:1661 */ +#line 3039 "grammar.c" /* yacc.c:1661 */ break; - case 76: -#line 1398 "grammar.y" /* yacc.c:1661 */ + case 77: +#line 1400 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "<=", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3039,11 +3048,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3043 "grammar.c" /* yacc.c:1661 */ +#line 3052 "grammar.c" /* yacc.c:1661 */ break; - case 77: -#line 1407 "grammar.y" /* yacc.c:1661 */ + case 78: +#line 1409 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, ">=", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3052,11 +3061,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3056 "grammar.c" /* yacc.c:1661 */ +#line 3065 "grammar.c" /* yacc.c:1661 */ break; - case 78: -#line 1416 "grammar.y" /* yacc.c:1661 */ + case 79: +#line 1418 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "==", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3065,11 +3074,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3069 "grammar.c" /* yacc.c:1661 */ +#line 3078 "grammar.c" /* yacc.c:1661 */ break; - case 79: -#line 1425 "grammar.y" /* yacc.c:1661 */ + case 80: +#line 1427 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "!=", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3078,39 +3087,39 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_BOOLEAN; } -#line 3082 "grammar.c" /* yacc.c:1661 */ - break; - - case 80: -#line 1434 "grammar.y" /* yacc.c:1661 */ - { - (yyval.expression) = (yyvsp[0].expression); - } -#line 3090 "grammar.c" /* yacc.c:1661 */ +#line 3091 "grammar.c" /* yacc.c:1661 */ break; case 81: -#line 1438 "grammar.y" /* yacc.c:1661 */ +#line 1436 "grammar.y" /* yacc.c:1661 */ { - (yyval.expression) = (yyvsp[-1].expression); + (yyval.expression) = (yyvsp[0].expression); } -#line 3098 "grammar.c" /* yacc.c:1661 */ +#line 3099 "grammar.c" /* yacc.c:1661 */ break; case 82: -#line 1445 "grammar.y" /* yacc.c:1661 */ - { (yyval.integer) = INTEGER_SET_ENUMERATION; } -#line 3104 "grammar.c" /* yacc.c:1661 */ +#line 1440 "grammar.y" /* yacc.c:1661 */ + { + (yyval.expression) = (yyvsp[-1].expression); + } +#line 3107 "grammar.c" /* yacc.c:1661 */ break; case 83: -#line 1446 "grammar.y" /* yacc.c:1661 */ - { (yyval.integer) = INTEGER_SET_RANGE; } -#line 3110 "grammar.c" /* yacc.c:1661 */ +#line 1447 "grammar.y" /* yacc.c:1661 */ + { (yyval.integer) = INTEGER_SET_ENUMERATION; } +#line 3113 "grammar.c" /* yacc.c:1661 */ break; case 84: -#line 1452 "grammar.y" /* yacc.c:1661 */ +#line 1448 "grammar.y" /* yacc.c:1661 */ + { (yyval.integer) = INTEGER_SET_RANGE; } +#line 3119 "grammar.c" /* yacc.c:1661 */ + break; + + case 85: +#line 1454 "grammar.y" /* yacc.c:1661 */ { if ((yyvsp[-3].expression).type != EXPRESSION_TYPE_INTEGER) { @@ -3128,27 +3137,27 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3132 "grammar.c" /* yacc.c:1661 */ - break; - - case 85: -#line 1474 "grammar.y" /* yacc.c:1661 */ - { - if ((yyvsp[0].expression).type != EXPRESSION_TYPE_INTEGER) - { - yr_compiler_set_error_extra_info( - compiler, "wrong type for enumeration item"); - compiler->last_result = ERROR_WRONG_TYPE; - - } - - fail_if(compiler->last_result != ERROR_SUCCESS); - } -#line 3148 "grammar.c" /* yacc.c:1661 */ +#line 3141 "grammar.c" /* yacc.c:1661 */ break; case 86: -#line 1486 "grammar.y" /* yacc.c:1661 */ +#line 1476 "grammar.y" /* yacc.c:1661 */ + { + if ((yyvsp[0].expression).type != EXPRESSION_TYPE_INTEGER) + { + yr_compiler_set_error_extra_info( + compiler, "wrong type for enumeration item"); + compiler->last_result = ERROR_WRONG_TYPE; + + } + + fail_if(compiler->last_result != ERROR_SUCCESS); + } +#line 3157 "grammar.c" /* yacc.c:1661 */ + break; + + case 87: +#line 1488 "grammar.y" /* yacc.c:1661 */ { if ((yyvsp[0].expression).type != EXPRESSION_TYPE_INTEGER) { @@ -3159,77 +3168,77 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3163 "grammar.c" /* yacc.c:1661 */ - break; - - case 87: -#line 1501 "grammar.y" /* yacc.c:1661 */ - { - // Push end-of-list marker - yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL); - } #line 3172 "grammar.c" /* yacc.c:1661 */ break; - case 89: -#line 1507 "grammar.y" /* yacc.c:1661 */ + case 88: +#line 1503 "grammar.y" /* yacc.c:1661 */ + { + // Push end-of-list marker + yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL); + } +#line 3181 "grammar.c" /* yacc.c:1661 */ + break; + + case 90: +#line 1509 "grammar.y" /* yacc.c:1661 */ { yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL); yr_parser_emit_pushes_for_strings(yyscanner, "$*"); fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3183 "grammar.c" /* yacc.c:1661 */ - break; - - case 92: -#line 1524 "grammar.y" /* yacc.c:1661 */ - { - yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[0].c_string)); - yr_free((yyvsp[0].c_string)); - - fail_if(compiler->last_result != ERROR_SUCCESS); - } -#line 3194 "grammar.c" /* yacc.c:1661 */ +#line 3192 "grammar.c" /* yacc.c:1661 */ break; case 93: -#line 1531 "grammar.y" /* yacc.c:1661 */ +#line 1526 "grammar.y" /* yacc.c:1661 */ { yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[0].c_string)); yr_free((yyvsp[0].c_string)); fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3205 "grammar.c" /* yacc.c:1661 */ +#line 3203 "grammar.c" /* yacc.c:1661 */ break; - case 95: -#line 1543 "grammar.y" /* yacc.c:1661 */ + case 94: +#line 1533 "grammar.y" /* yacc.c:1661 */ { - yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL); + yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[0].c_string)); + yr_free((yyvsp[0].c_string)); + + fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3213 "grammar.c" /* yacc.c:1661 */ +#line 3214 "grammar.c" /* yacc.c:1661 */ break; case 96: -#line 1547 "grammar.y" /* yacc.c:1661 */ +#line 1545 "grammar.y" /* yacc.c:1661 */ { - yr_parser_emit_with_arg(yyscanner, OP_PUSH, 1, NULL, NULL); + yr_parser_emit_with_arg(yyscanner, OP_PUSH, UNDEFINED, NULL, NULL); } -#line 3221 "grammar.c" /* yacc.c:1661 */ +#line 3222 "grammar.c" /* yacc.c:1661 */ break; case 97: -#line 1555 "grammar.y" /* yacc.c:1661 */ +#line 1549 "grammar.y" /* yacc.c:1661 */ { - (yyval.expression) = (yyvsp[-1].expression); + yr_parser_emit_with_arg(yyscanner, OP_PUSH, 1, NULL, NULL); } -#line 3229 "grammar.c" /* yacc.c:1661 */ +#line 3230 "grammar.c" /* yacc.c:1661 */ break; case 98: -#line 1559 "grammar.y" /* yacc.c:1661 */ +#line 1557 "grammar.y" /* yacc.c:1661 */ + { + (yyval.expression) = (yyvsp[-1].expression); + } +#line 3238 "grammar.c" /* yacc.c:1661 */ + break; + + case 99: +#line 1561 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit( yyscanner, OP_FILESIZE, NULL); @@ -3239,11 +3248,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3243 "grammar.c" /* yacc.c:1661 */ +#line 3252 "grammar.c" /* yacc.c:1661 */ break; - case 99: -#line 1569 "grammar.y" /* yacc.c:1661 */ + case 100: +#line 1571 "grammar.y" /* yacc.c:1661 */ { yywarning(yyscanner, "Using deprecated \"entrypoint\" keyword. Use the \"entry_point\" " @@ -3257,11 +3266,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3261 "grammar.c" /* yacc.c:1661 */ +#line 3270 "grammar.c" /* yacc.c:1661 */ break; - case 100: -#line 1583 "grammar.y" /* yacc.c:1661 */ + case 101: +#line 1585 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-1].expression), EXPRESSION_TYPE_INTEGER, "intXXXX or uintXXXX"); @@ -3277,11 +3286,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3281 "grammar.c" /* yacc.c:1661 */ +#line 3290 "grammar.c" /* yacc.c:1661 */ break; - case 101: -#line 1599 "grammar.y" /* yacc.c:1661 */ + case 102: +#line 1601 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg( yyscanner, OP_PUSH, (yyvsp[0].integer), NULL, NULL); @@ -3291,11 +3300,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = (yyvsp[0].integer); } -#line 3295 "grammar.c" /* yacc.c:1661 */ +#line 3304 "grammar.c" /* yacc.c:1661 */ break; - case 102: -#line 1609 "grammar.y" /* yacc.c:1661 */ + case 103: +#line 1611 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg_double( yyscanner, OP_PUSH, (yyvsp[0].double_), NULL, NULL); @@ -3304,11 +3313,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_FLOAT; } -#line 3308 "grammar.c" /* yacc.c:1661 */ +#line 3317 "grammar.c" /* yacc.c:1661 */ break; - case 103: -#line 1618 "grammar.y" /* yacc.c:1661 */ + case 104: +#line 1620 "grammar.y" /* yacc.c:1661 */ { SIZED_STRING* sized_string; @@ -3333,11 +3342,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_STRING; (yyval.expression).value.sized_string = sized_string; } -#line 3337 "grammar.c" /* yacc.c:1661 */ +#line 3346 "grammar.c" /* yacc.c:1661 */ break; - case 104: -#line 1643 "grammar.y" /* yacc.c:1661 */ + case 105: +#line 1645 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_string_identifier( yyscanner, (yyvsp[0].c_string), OP_COUNT, UNDEFINED); @@ -3349,11 +3358,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3353 "grammar.c" /* yacc.c:1661 */ +#line 3362 "grammar.c" /* yacc.c:1661 */ break; - case 105: -#line 1655 "grammar.y" /* yacc.c:1661 */ + case 106: +#line 1657 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_string_identifier( yyscanner, (yyvsp[-3].c_string), OP_OFFSET, UNDEFINED); @@ -3365,11 +3374,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3369 "grammar.c" /* yacc.c:1661 */ +#line 3378 "grammar.c" /* yacc.c:1661 */ break; - case 106: -#line 1667 "grammar.y" /* yacc.c:1661 */ + case 107: +#line 1669 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg( yyscanner, OP_PUSH, 1, NULL, NULL); @@ -3385,11 +3394,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3389 "grammar.c" /* yacc.c:1661 */ +#line 3398 "grammar.c" /* yacc.c:1661 */ break; - case 107: -#line 1683 "grammar.y" /* yacc.c:1661 */ + case 108: +#line 1685 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_string_identifier( yyscanner, (yyvsp[-3].c_string), OP_LENGTH, UNDEFINED); @@ -3401,11 +3410,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3405 "grammar.c" /* yacc.c:1661 */ +#line 3414 "grammar.c" /* yacc.c:1661 */ break; - case 108: -#line 1695 "grammar.y" /* yacc.c:1661 */ + case 109: +#line 1697 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_emit_with_arg( yyscanner, OP_PUSH, 1, NULL, NULL); @@ -3421,11 +3430,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = UNDEFINED; } -#line 3425 "grammar.c" /* yacc.c:1661 */ +#line 3434 "grammar.c" /* yacc.c:1661 */ break; - case 109: -#line 1711 "grammar.y" /* yacc.c:1661 */ + case 110: +#line 1713 "grammar.y" /* yacc.c:1661 */ { if ((yyvsp[0].expression).type == EXPRESSION_TYPE_INTEGER) // loop identifier { @@ -3470,11 +3479,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3474 "grammar.c" /* yacc.c:1661 */ +#line 3483 "grammar.c" /* yacc.c:1661 */ break; - case 110: -#line 1756 "grammar.y" /* yacc.c:1661 */ + case 111: +#line 1758 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER | EXPRESSION_TYPE_FLOAT, "-"); @@ -3493,11 +3502,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3497 "grammar.c" /* yacc.c:1661 */ +#line 3506 "grammar.c" /* yacc.c:1661 */ break; - case 111: -#line 1775 "grammar.y" /* yacc.c:1661 */ + case 112: +#line 1777 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "+", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3532,11 +3541,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3536 "grammar.c" /* yacc.c:1661 */ +#line 3545 "grammar.c" /* yacc.c:1661 */ break; - case 112: -#line 1810 "grammar.y" /* yacc.c:1661 */ + case 113: +#line 1812 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "-", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3571,11 +3580,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3575 "grammar.c" /* yacc.c:1661 */ +#line 3584 "grammar.c" /* yacc.c:1661 */ break; - case 113: -#line 1845 "grammar.y" /* yacc.c:1661 */ + case 114: +#line 1847 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "*", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3609,11 +3618,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3613 "grammar.c" /* yacc.c:1661 */ +#line 3622 "grammar.c" /* yacc.c:1661 */ break; - case 114: -#line 1879 "grammar.y" /* yacc.c:1661 */ + case 115: +#line 1881 "grammar.y" /* yacc.c:1661 */ { compiler->last_result = yr_parser_reduce_operation( yyscanner, "\\", (yyvsp[-2].expression), (yyvsp[0].expression)); @@ -3638,11 +3647,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } -#line 3642 "grammar.c" /* yacc.c:1661 */ +#line 3651 "grammar.c" /* yacc.c:1661 */ break; - case 115: -#line 1904 "grammar.y" /* yacc.c:1661 */ + case 116: +#line 1906 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, "%"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "%"); @@ -3660,11 +3669,11 @@ yyreduce: fail_if(compiler->last_result != ERROR_SUCCESS); } } -#line 3664 "grammar.c" /* yacc.c:1661 */ +#line 3673 "grammar.c" /* yacc.c:1661 */ break; - case 116: -#line 1922 "grammar.y" /* yacc.c:1661 */ + case 117: +#line 1924 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, "^"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "^"); @@ -3674,11 +3683,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = OPERATION(^, (yyvsp[-2].expression).value.integer, (yyvsp[0].expression).value.integer); } -#line 3678 "grammar.c" /* yacc.c:1661 */ +#line 3687 "grammar.c" /* yacc.c:1661 */ break; - case 117: -#line 1932 "grammar.y" /* yacc.c:1661 */ + case 118: +#line 1934 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, "^"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "^"); @@ -3688,11 +3697,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = OPERATION(&, (yyvsp[-2].expression).value.integer, (yyvsp[0].expression).value.integer); } -#line 3692 "grammar.c" /* yacc.c:1661 */ +#line 3701 "grammar.c" /* yacc.c:1661 */ break; - case 118: -#line 1942 "grammar.y" /* yacc.c:1661 */ + case 119: +#line 1944 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, "|"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "|"); @@ -3702,11 +3711,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; (yyval.expression).value.integer = OPERATION(|, (yyvsp[-2].expression).value.integer, (yyvsp[0].expression).value.integer); } -#line 3706 "grammar.c" /* yacc.c:1661 */ +#line 3715 "grammar.c" /* yacc.c:1661 */ break; - case 119: -#line 1952 "grammar.y" /* yacc.c:1661 */ + case 120: +#line 1954 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "~"); @@ -3716,11 +3725,11 @@ yyreduce: (yyval.expression).value.integer = ((yyvsp[0].expression).value.integer == UNDEFINED) ? UNDEFINED : ~((yyvsp[0].expression).value.integer); } -#line 3720 "grammar.c" /* yacc.c:1661 */ +#line 3729 "grammar.c" /* yacc.c:1661 */ break; - case 120: -#line 1962 "grammar.y" /* yacc.c:1661 */ + case 121: +#line 1964 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, "<<"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, "<<"); @@ -3734,11 +3743,11 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; } -#line 3738 "grammar.c" /* yacc.c:1661 */ +#line 3747 "grammar.c" /* yacc.c:1661 */ break; - case 121: -#line 1976 "grammar.y" /* yacc.c:1661 */ + case 122: +#line 1978 "grammar.y" /* yacc.c:1661 */ { check_type((yyvsp[-2].expression), EXPRESSION_TYPE_INTEGER, ">>"); check_type((yyvsp[0].expression), EXPRESSION_TYPE_INTEGER, ">>"); @@ -3752,19 +3761,19 @@ yyreduce: (yyval.expression).type = EXPRESSION_TYPE_INTEGER; } -#line 3756 "grammar.c" /* yacc.c:1661 */ +#line 3765 "grammar.c" /* yacc.c:1661 */ break; - case 122: -#line 1990 "grammar.y" /* yacc.c:1661 */ + case 123: +#line 1992 "grammar.y" /* yacc.c:1661 */ { (yyval.expression) = (yyvsp[0].expression); } -#line 3764 "grammar.c" /* yacc.c:1661 */ +#line 3773 "grammar.c" /* yacc.c:1661 */ break; -#line 3768 "grammar.c" /* yacc.c:1661 */ +#line 3777 "grammar.c" /* yacc.c:1661 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -3992,5 +4001,5 @@ yyreturn: #endif return yyresult; } -#line 1995 "grammar.y" /* yacc.c:1906 */ +#line 1997 "grammar.y" /* yacc.c:1906 */ diff --git a/libyara/grammar.h b/libyara/grammar.h index a640dc80..08396640 100644 --- a/libyara/grammar.h +++ b/libyara/grammar.h @@ -66,34 +66,35 @@ extern int yara_yydebug; _REGEXP_ = 276, _ASCII_ = 277, _WIDE_ = 278, - _NOCASE_ = 279, - _FULLWORD_ = 280, - _AT_ = 281, - _FILESIZE_ = 282, - _ENTRYPOINT_ = 283, - _ALL_ = 284, - _ANY_ = 285, - _IN_ = 286, - _OF_ = 287, - _FOR_ = 288, - _THEM_ = 289, - _MATCHES_ = 290, - _CONTAINS_ = 291, - _IMPORT_ = 292, - _TRUE_ = 293, - _FALSE_ = 294, - _OR_ = 295, - _AND_ = 296, - _EQ_ = 297, - _NEQ_ = 298, - _LT_ = 299, - _LE_ = 300, - _GT_ = 301, - _GE_ = 302, - _SHIFT_LEFT_ = 303, - _SHIFT_RIGHT_ = 304, - _NOT_ = 305, - UNARY_MINUS = 306 + _XOR_ = 279, + _NOCASE_ = 280, + _FULLWORD_ = 281, + _AT_ = 282, + _FILESIZE_ = 283, + _ENTRYPOINT_ = 284, + _ALL_ = 285, + _ANY_ = 286, + _IN_ = 287, + _OF_ = 288, + _FOR_ = 289, + _THEM_ = 290, + _MATCHES_ = 291, + _CONTAINS_ = 292, + _IMPORT_ = 293, + _TRUE_ = 294, + _FALSE_ = 295, + _OR_ = 296, + _AND_ = 297, + _EQ_ = 298, + _NEQ_ = 299, + _LT_ = 300, + _LE_ = 301, + _GT_ = 302, + _GE_ = 303, + _SHIFT_LEFT_ = 304, + _SHIFT_RIGHT_ = 305, + _NOT_ = 306, + UNARY_MINUS = 307 }; #endif /* Tokens. */ @@ -118,41 +119,42 @@ extern int yara_yydebug; #define _REGEXP_ 276 #define _ASCII_ 277 #define _WIDE_ 278 -#define _NOCASE_ 279 -#define _FULLWORD_ 280 -#define _AT_ 281 -#define _FILESIZE_ 282 -#define _ENTRYPOINT_ 283 -#define _ALL_ 284 -#define _ANY_ 285 -#define _IN_ 286 -#define _OF_ 287 -#define _FOR_ 288 -#define _THEM_ 289 -#define _MATCHES_ 290 -#define _CONTAINS_ 291 -#define _IMPORT_ 292 -#define _TRUE_ 293 -#define _FALSE_ 294 -#define _OR_ 295 -#define _AND_ 296 -#define _EQ_ 297 -#define _NEQ_ 298 -#define _LT_ 299 -#define _LE_ 300 -#define _GT_ 301 -#define _GE_ 302 -#define _SHIFT_LEFT_ 303 -#define _SHIFT_RIGHT_ 304 -#define _NOT_ 305 -#define UNARY_MINUS 306 +#define _XOR_ 279 +#define _NOCASE_ 280 +#define _FULLWORD_ 281 +#define _AT_ 282 +#define _FILESIZE_ 283 +#define _ENTRYPOINT_ 284 +#define _ALL_ 285 +#define _ANY_ 286 +#define _IN_ 287 +#define _OF_ 288 +#define _FOR_ 289 +#define _THEM_ 290 +#define _MATCHES_ 291 +#define _CONTAINS_ 292 +#define _IMPORT_ 293 +#define _TRUE_ 294 +#define _FALSE_ 295 +#define _OR_ 296 +#define _AND_ 297 +#define _EQ_ 298 +#define _NEQ_ 299 +#define _LT_ 300 +#define _LE_ 301 +#define _GT_ 302 +#define _GE_ 303 +#define _SHIFT_LEFT_ 304 +#define _SHIFT_RIGHT_ 305 +#define _NOT_ 306 +#define UNARY_MINUS 307 /* Value type. */ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED union YYSTYPE { -#line 215 "grammar.y" /* yacc.c:1915 */ +#line 216 "grammar.y" /* yacc.c:1915 */ EXPRESSION expression; SIZED_STRING* sized_string; @@ -163,7 +165,7 @@ union YYSTYPE YR_META* meta; YR_RULE* rule; -#line 167 "grammar.h" /* yacc.c:1915 */ +#line 169 "grammar.h" /* yacc.c:1915 */ }; typedef union YYSTYPE YYSTYPE; diff --git a/libyara/grammar.y b/libyara/grammar.y index 8e280982..f7d50e4e 100644 --- a/libyara/grammar.y +++ b/libyara/grammar.y @@ -139,6 +139,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %token _REGEXP_ %token _ASCII_ %token _WIDE_ +%token _XOR_ %token _NOCASE_ %token _FULLWORD_ %token _AT_ @@ -571,6 +572,7 @@ string_modifier | _ASCII_ { $$ = STRING_GFLAGS_ASCII; } | _NOCASE_ { $$ = STRING_GFLAGS_NO_CASE; } | _FULLWORD_ { $$ = STRING_GFLAGS_FULL_WORD; } + | _XOR_ { $$ = STRING_GFLAGS_XOR; } ; diff --git a/libyara/include/yara/types.h b/libyara/include/yara/types.h index 0365fedb..c32b268e 100644 --- a/libyara/include/yara/types.h +++ b/libyara/include/yara/types.h @@ -67,6 +67,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define STRING_GFLAGS_GREEDY_REGEXP 0x10000 #define STRING_GFLAGS_DOT_ALL 0x20000 #define STRING_GFLAGS_DISABLED 0x40000 +#define STRING_GFLAGS_XOR 0x80000 #define STRING_IS_HEX(x) \ (((x)->g_flags) & STRING_GFLAGS_HEXADECIMAL) @@ -125,6 +126,9 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define STRING_IS_DISABLED(x) \ (((x)->g_flags) & STRING_GFLAGS_DISABLED) +#define STRING_IS_XOR(x) \ + (((x)->g_flags) & STRING_GFLAGS_XOR) + #define STRING_FOUND(x) \ ((x)->matches[yr_get_tidx()].tail != NULL) diff --git a/libyara/lexer.c b/libyara/lexer.c index fbe1a38e..fdf1b5f0 100644 --- a/libyara/lexer.c +++ b/libyara/lexer.c @@ -1,6 +1,6 @@ -#line 1 "lexer.c" +#line 2 "lexer.c" -#line 3 "lexer.c" +#line 4 "lexer.c" #define YY_INT_ALIGNED short int @@ -8,234 +8,12 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_MINOR_VERSION 5 +#define YY_FLEX_SUBMINOR_VERSION 35 #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. */ @@ -269,6 +47,7 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; +typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -276,6 +55,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -306,32 +86,38 @@ 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 */ -/* begin standard C++ headers. */ +#ifdef __cplusplus -/* TODO: this is always defined, so inline it */ +/* 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 #define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) #else -#define yynoreturn +#define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* 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. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -355,29 +141,25 @@ 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 yyrestart( yyin , yyscanner ) +#define YY_NEW_FILE yara_yyrestart(yyin ,yyscanner ) + #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -397,28 +179,21 @@ typedef size_t yy_size_t; #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 yylex. + * existing scanners that call yyless() from OUTSIDE yara_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. */ #define YY_LESS_LINENO(n) \ do { \ - int yyl;\ + yy_size_t yyl;\ for ( yyl = n; yyl < yyleng; ++yyl )\ 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) \ @@ -433,6 +208,7 @@ typedef size_t yy_size_t; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -447,12 +223,12 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - int yy_buf_size; + yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - int yy_n_chars; + yy_size_t yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to @@ -475,7 +251,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. */ @@ -492,7 +268,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by + * (via yara_yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -509,79 +285,86 @@ 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 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 ); +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 ); -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) +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 ); -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 ); +#define YY_FLUSH_BUFFER yara_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) -void *yyalloc ( yy_size_t , yyscan_t yyscanner ); -void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); -void yyfree ( void * , 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,yy_size_t 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 -#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (yyscanner); \ + yara_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + yara_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 ){\ - yyensure_buffer_stack (yyscanner); \ + yara_yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ + yara_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(yyscanner) (/*CONSTCOND*/1) +#define yara_yywrap(n) 1 #define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; + +typedef unsigned char 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 yynoreturn yy_fatal_error ( const 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 yy_fatal_error (yyconst 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 = (int) (yy_cp - yy_bp); \ + yyleng = (yy_size_t) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 74 -#define YY_END_OF_BUFFER 75 + +#define YY_NUM_RULES 75 +#define YY_END_OF_BUFFER 76 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -589,38 +372,38 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[245] = +static yyconst flex_int16_t yy_accept[248] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 75, 73, 72, 72, 48, 69, 46, 45, 73, 70, - 51, 51, 2, 73, 3, 47, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 73, 61, 62, 55, 74, 67, 68, 64, - 74, 42, 43, 39, 39, 48, 7, 46, 44, 45, - 1, 37, 40, 0, 51, 0, 0, 0, 0, 8, - 4, 6, 5, 9, 47, 50, 50, 50, 50, 25, - 50, 50, 50, 50, 50, 50, 50, 50, 26, 50, - 50, 50, 27, 24, 50, 50, 50, 50, 50, 50, + 76, 74, 73, 73, 49, 70, 47, 46, 74, 71, + 52, 52, 2, 74, 3, 48, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 74, 62, 63, 56, 75, 68, 69, + 65, 75, 43, 44, 40, 40, 49, 7, 47, 45, + 46, 1, 38, 41, 0, 52, 0, 0, 0, 0, + 8, 4, 6, 5, 9, 48, 51, 51, 51, 51, + 26, 51, 51, 51, 51, 51, 51, 51, 51, 27, + 51, 51, 51, 28, 25, 51, 51, 51, 51, 51, - 50, 0, 0, 61, 63, 58, 59, 57, 56, 63, - 67, 64, 64, 66, 65, 42, 38, 40, 52, 51, - 54, 53, 30, 23, 31, 50, 50, 50, 50, 50, - 29, 50, 50, 50, 50, 50, 50, 50, 50, 22, - 50, 50, 50, 50, 50, 50, 50, 71, 0, 0, - 0, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 49, 50, 13, 50, 50, 12, 50, - 28, 20, 16, 0, 0, 0, 0, 0, 71, 60, - 15, 50, 50, 50, 21, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 0, 0, 50, 50, 50, + 51, 51, 51, 0, 0, 62, 64, 59, 60, 58, + 57, 64, 68, 65, 65, 67, 66, 43, 39, 41, + 53, 52, 55, 54, 31, 24, 32, 51, 51, 51, + 51, 51, 30, 51, 51, 51, 51, 51, 51, 51, + 51, 23, 51, 51, 51, 51, 51, 51, 51, 17, + 72, 0, 0, 0, 51, 51, 51, 51, 51, 51, + 51, 51, 51, 51, 51, 51, 50, 51, 13, 51, + 51, 12, 51, 29, 21, 16, 0, 0, 0, 0, + 0, 72, 61, 15, 51, 51, 51, 22, 51, 51, + 51, 51, 51, 51, 51, 51, 51, 51, 0, 0, - 50, 50, 11, 36, 50, 49, 50, 18, 50, 50, - 0, 0, 0, 0, 0, 71, 50, 50, 50, 50, - 50, 50, 34, 10, 14, 0, 71, 0, 0, 0, - 50, 35, 50, 33, 17, 0, 0, 0, 0, 19, - 50, 41, 32, 0 + 51, 51, 51, 51, 51, 11, 37, 51, 50, 51, + 19, 51, 51, 0, 0, 0, 0, 0, 72, 51, + 51, 51, 51, 51, 51, 35, 10, 14, 0, 72, + 0, 0, 0, 51, 36, 51, 34, 18, 0, 0, + 0, 0, 20, 51, 42, 33, 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst flex_int32_t yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, @@ -652,7 +435,7 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[57] = +static yyconst flex_int32_t yy_meta[57] = { 0, 1, 2, 3, 2, 1, 4, 1, 1, 2, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 8, @@ -662,148 +445,148 @@ static const YY_CHAR yy_meta[57] = 11, 12, 11, 11, 1, 1 } ; -static const flex_int16_t yy_base[267] = +static yyconst flex_int16_t yy_base[270] = { 0, - 0, 0, 54, 55, 56, 59, 585, 583, 550, 547, - 545, 592, 592, 592, 511, 592, 0, 509, 500, 53, - 53, 59, 45, 485, 50, 0, 0, 51, 439, 439, - 51, 437, 32, 44, 431, 32, 428, 424, 419, 62, - 422, 419, 446, 0, 592, 592, 84, 0, 592, 62, - 445, 0, 592, 592, 443, 428, 592, 0, 592, 438, - 592, 592, 0, 102, 0, 421, 416, 124, 0, 592, - 592, 592, 592, 592, 0, 0, 341, 71, 347, 0, - 337, 331, 337, 336, 330, 334, 330, 328, 45, 324, - 323, 62, 0, 0, 330, 328, 322, 331, 317, 322, + 0, 0, 54, 55, 56, 59, 587, 586, 581, 579, + 560, 594, 594, 594, 535, 594, 0, 535, 522, 53, + 53, 59, 45, 497, 50, 0, 0, 51, 467, 464, + 51, 442, 32, 44, 438, 32, 432, 426, 426, 62, + 433, 427, 418, 447, 0, 594, 594, 84, 0, 594, + 62, 446, 0, 594, 594, 445, 433, 594, 0, 594, + 440, 594, 594, 0, 102, 0, 422, 421, 124, 0, + 594, 594, 594, 594, 594, 0, 0, 401, 71, 348, + 0, 338, 332, 338, 337, 331, 335, 331, 329, 45, + 325, 324, 62, 0, 0, 331, 329, 323, 332, 318, - 323, 92, 113, 0, 592, 592, 592, 592, 592, 0, - 0, 310, 592, 592, 592, 0, 592, 0, 136, 592, - 144, 0, 0, 0, 0, 316, 78, 309, 307, 315, - 0, 309, 316, 304, 297, 114, 301, 302, 301, 0, - 282, 235, 230, 227, 232, 219, 230, 592, 255, 161, - 0, 224, 223, 230, 208, 224, 212, 207, 225, 210, - 206, 236, 232, 213, 206, 0, 197, 211, 0, 197, - 0, 0, 0, 229, 226, 216, 0, 119, 0, 592, - 0, 189, 187, 181, 0, 184, 179, 181, 173, 181, - 179, 178, 177, 164, 173, 272, 133, 170, 166, 164, + 323, 330, 312, 92, 113, 0, 594, 594, 594, 594, + 594, 0, 0, 310, 594, 594, 594, 0, 594, 0, + 136, 594, 144, 0, 0, 0, 0, 316, 78, 309, + 307, 315, 0, 309, 316, 304, 297, 114, 301, 302, + 301, 0, 282, 235, 230, 227, 232, 219, 230, 0, + 594, 255, 161, 0, 224, 223, 230, 208, 224, 212, + 207, 225, 210, 206, 236, 232, 213, 206, 0, 197, + 211, 0, 197, 0, 0, 0, 229, 226, 216, 0, + 119, 0, 594, 0, 189, 187, 181, 0, 184, 179, + 181, 173, 181, 179, 178, 177, 164, 173, 272, 133, - 153, 160, 0, 0, 169, 0, 157, 0, 167, 155, - 0, 0, 327, 188, 134, 0, 148, 144, 143, 136, - 136, 145, 0, 0, 0, 156, 125, 157, 122, 172, - 69, 0, 64, 0, 0, 183, 178, 0, 189, 0, - 29, 592, 0, 592, 383, 396, 409, 422, 428, 433, - 441, 448, 453, 458, 469, 479, 491, 504, 516, 529, - 542, 548, 551, 561, 574, 580 + 170, 166, 164, 153, 160, 0, 0, 169, 0, 157, + 0, 167, 155, 0, 0, 327, 188, 134, 0, 148, + 144, 143, 136, 136, 145, 0, 0, 0, 156, 125, + 157, 122, 172, 69, 0, 64, 0, 0, 183, 178, + 0, 189, 0, 29, 594, 0, 594, 383, 396, 409, + 422, 428, 433, 441, 448, 453, 458, 469, 479, 491, + 504, 516, 529, 542, 548, 551, 561, 574, 580 } ; -static const flex_int16_t yy_def[267] = +static yyconst flex_int16_t yy_def[270] = { 0, - 244, 1, 245, 245, 246, 246, 247, 247, 248, 248, - 244, 244, 244, 244, 249, 244, 250, 251, 244, 244, - 252, 252, 244, 244, 244, 253, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 255, 256, 244, 244, 257, 258, 244, 244, - 259, 260, 244, 244, 244, 249, 244, 250, 244, 251, - 244, 244, 261, 244, 22, 244, 244, 244, 262, 244, - 244, 244, 244, 244, 253, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 247, 1, 248, 248, 249, 249, 250, 250, 251, 251, + 247, 247, 247, 247, 252, 247, 253, 254, 247, 247, + 255, 255, 247, 247, 247, 256, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 258, 259, 247, 247, 260, 261, 247, + 247, 262, 263, 247, 247, 247, 252, 247, 253, 247, + 254, 247, 247, 264, 247, 22, 247, 247, 247, 265, + 247, 247, 247, 247, 247, 256, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, - 254, 255, 244, 256, 244, 244, 244, 244, 244, 263, - 258, 244, 244, 244, 244, 260, 244, 261, 244, 244, - 244, 262, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 244, 264, 265, - 266, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 264, 244, 265, 176, 176, 176, 244, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 244, 176, 254, 254, 254, + 257, 257, 257, 258, 247, 259, 247, 247, 247, 247, + 247, 266, 261, 247, 247, 247, 247, 263, 247, 264, + 247, 247, 247, 265, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 247, 267, 268, 269, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 267, 247, 268, 179, + 179, 179, 247, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 247, 179, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 196, 196, 264, 176, 196, 196, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 264, 264, 176, 196, 196, - 254, 254, 254, 254, 254, 244, 264, 196, 196, 254, - 254, 244, 254, 0, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244 + 257, 257, 257, 257, 257, 257, 257, 257, 257, 257, + 257, 257, 257, 199, 199, 267, 179, 199, 199, 257, + 257, 257, 257, 257, 257, 257, 257, 257, 267, 267, + 179, 199, 199, 257, 257, 257, 257, 257, 247, 267, + 199, 199, 257, 257, 247, 257, 0, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247 } ; -static const flex_int16_t yy_nxt[649] = +static yyconst flex_int16_t yy_nxt[651] = { 0, 12, 13, 14, 13, 15, 16, 17, 18, 12, 12, 19, 20, 21, 22, 22, 22, 22, 22, 22, 22, 23, 24, 25, 26, 27, 27, 27, 27, 27, 12, 27, 28, 27, 29, 27, 30, 31, 32, 27, 33, 27, 34, 35, 36, 37, 38, 39, 40, 41, 27, - 42, 27, 27, 27, 43, 12, 45, 45, 49, 46, - 46, 49, 62, 64, 63, 70, 71, 50, 93, 64, - 50, 73, 74, 88, 89, 90, 243, 94, 135, 91, - 66, 67, 83, 47, 47, 51, 66, 67, 51, 106, - 84, 77, 136, 78, 85, 139, 68, 79, 80, 86, + 42, 43, 27, 27, 44, 12, 46, 46, 50, 47, + 47, 50, 63, 65, 64, 71, 72, 51, 94, 65, + 51, 74, 75, 89, 90, 91, 246, 95, 137, 92, + 67, 68, 84, 48, 48, 52, 67, 68, 52, 108, + 85, 78, 138, 79, 86, 141, 69, 80, 81, 87, - 98, 112, 244, 103, 69, 124, 241, 99, 113, 140, - 244, 240, 153, 107, 119, 119, 119, 119, 119, 119, - 119, 119, 149, 125, 150, 154, 108, 162, 196, 163, - 197, 109, 164, 239, 175, 110, 121, 121, 121, 121, - 121, 121, 196, 229, 197, 230, 236, 148, 119, 119, - 119, 119, 119, 119, 119, 119, 121, 121, 121, 121, - 121, 121, 177, 102, 177, 237, 196, 238, 197, 177, - 235, 234, 178, 177, 177, 177, 177, 177, 177, 177, - 177, 229, 233, 230, 236, 177, 177, 175, 242, 213, - 232, 231, 177, 177, 177, 177, 177, 177, 229, 228, + 99, 114, 247, 105, 70, 126, 244, 100, 115, 142, + 247, 243, 156, 109, 121, 121, 121, 121, 121, 121, + 121, 121, 152, 127, 153, 157, 110, 165, 199, 166, + 200, 111, 167, 242, 178, 112, 123, 123, 123, 123, + 123, 123, 199, 232, 200, 233, 239, 151, 121, 121, + 121, 121, 121, 121, 121, 121, 123, 123, 123, 123, + 123, 123, 180, 104, 180, 240, 199, 241, 200, 180, + 238, 237, 181, 180, 180, 180, 180, 180, 180, 180, + 180, 232, 236, 233, 239, 180, 180, 178, 245, 216, + 235, 234, 180, 180, 180, 180, 180, 180, 232, 231, - 230, 225, 224, 223, 222, 221, 220, 219, 218, 217, - 210, 209, 208, 207, 206, 205, 179, 177, 102, 177, - 204, 203, 202, 201, 177, 200, 199, 178, 177, 177, - 177, 177, 177, 177, 177, 177, 198, 102, 175, 195, - 177, 177, 194, 193, 192, 191, 164, 177, 177, 177, - 177, 177, 177, 164, 190, 189, 188, 187, 186, 185, - 184, 183, 182, 181, 175, 173, 136, 172, 171, 170, - 169, 179, 211, 212, 213, 212, 211, 211, 211, 211, - 212, 214, 211, 215, 212, 212, 212, 212, 212, 212, - 212, 212, 211, 211, 211, 211, 212, 212, 211, 211, + 233, 228, 227, 226, 225, 224, 223, 222, 221, 220, + 213, 212, 211, 210, 209, 208, 182, 180, 104, 180, + 207, 206, 205, 204, 180, 203, 202, 181, 180, 180, + 180, 180, 180, 180, 180, 180, 201, 104, 178, 198, + 180, 180, 197, 196, 195, 194, 167, 180, 180, 180, + 180, 180, 180, 167, 193, 192, 191, 190, 189, 188, + 187, 186, 185, 184, 178, 176, 138, 175, 174, 173, + 172, 182, 214, 215, 216, 215, 214, 214, 214, 214, + 215, 217, 214, 218, 215, 215, 215, 215, 215, 215, + 215, 215, 214, 214, 214, 214, 215, 215, 214, 214, - 211, 211, 211, 212, 212, 212, 212, 212, 212, 211, - 211, 211, 211, 211, 211, 211, 211, 211, 211, 211, - 211, 211, 211, 211, 211, 211, 211, 216, 213, 213, - 213, 168, 167, 166, 165, 213, 175, 161, 226, 213, - 213, 213, 213, 213, 213, 213, 213, 160, 159, 158, - 157, 213, 213, 156, 155, 152, 113, 147, 213, 213, - 213, 213, 213, 213, 146, 145, 144, 143, 142, 141, - 138, 137, 134, 133, 132, 131, 130, 129, 128, 127, - 126, 123, 227, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 48, 48, 48, 48, + 214, 214, 214, 215, 215, 215, 215, 215, 215, 214, + 214, 214, 214, 214, 214, 214, 214, 214, 214, 214, + 214, 214, 214, 214, 214, 214, 214, 219, 216, 216, + 216, 171, 170, 169, 168, 216, 178, 164, 229, 216, + 216, 216, 216, 216, 216, 216, 216, 163, 162, 161, + 160, 216, 216, 159, 158, 155, 115, 150, 216, 216, + 216, 216, 216, 216, 149, 148, 147, 146, 145, 144, + 143, 140, 139, 136, 135, 134, 133, 132, 131, 130, + 129, 128, 230, 45, 45, 45, 45, 45, 45, 45, + 45, 45, 45, 45, 45, 45, 49, 49, 49, 49, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 54, 54, 54, 54, 54, 54, 54, 54, - 54, 54, 54, 54, 54, 56, 56, 56, 56, 56, - 58, 120, 58, 58, 58, 60, 120, 59, 60, 244, - 60, 60, 60, 65, 117, 65, 115, 103, 101, 65, - 75, 100, 75, 75, 75, 76, 97, 76, 76, 76, - 102, 102, 96, 95, 92, 102, 102, 87, 102, 104, - 104, 82, 81, 104, 104, 104, 104, 104, 104, 104, - 104, 105, 105, 105, 105, 105, 105, 105, 105, 105, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 53, + 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, + 53, 53, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 57, 57, 57, 57, 57, + 59, 125, 59, 59, 59, 61, 122, 122, 61, 60, + 61, 61, 61, 66, 247, 66, 119, 117, 105, 66, + 76, 103, 76, 76, 76, 77, 102, 77, 77, 77, + 104, 104, 101, 98, 97, 104, 104, 96, 104, 106, + 106, 93, 88, 106, 106, 106, 106, 106, 106, 106, + 106, 107, 107, 107, 107, 107, 107, 107, 107, 107, - 105, 105, 105, 105, 111, 111, 72, 111, 111, 111, - 61, 111, 111, 111, 111, 111, 114, 114, 59, 114, - 114, 114, 114, 114, 114, 114, 114, 114, 114, 116, - 116, 116, 57, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 118, 118, 244, 118, 118, 118, 118, 118, - 118, 118, 118, 118, 118, 122, 55, 122, 151, 55, - 151, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 174, 176, 176, 176, 176, 176, 176, - 176, 176, 176, 176, 176, 176, 176, 180, 53, 180, - 53, 11, 244, 244, 244, 244, 244, 244, 244, 244, + 107, 107, 107, 107, 113, 113, 83, 113, 113, 113, + 82, 113, 113, 113, 113, 113, 116, 116, 73, 116, + 116, 116, 116, 116, 116, 116, 116, 116, 116, 118, + 118, 118, 62, 118, 118, 118, 118, 118, 118, 118, + 118, 118, 120, 120, 60, 120, 120, 120, 120, 120, + 120, 120, 120, 120, 120, 124, 58, 124, 154, 247, + 154, 177, 177, 177, 177, 177, 177, 177, 177, 177, + 177, 177, 177, 177, 179, 179, 179, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 179, 183, 56, 183, + 56, 54, 54, 11, 247, 247, 247, 247, 247, 247, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244 + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 } ; -static const flex_int16_t yy_chk[649] = +static yyconst flex_int16_t yy_chk[651] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -812,79 +595,79 @@ static const flex_int16_t yy_chk[649] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 5, 3, 4, 6, 20, 21, 20, 23, 23, 5, 36, 22, - 6, 25, 25, 33, 33, 34, 241, 36, 89, 34, - 21, 21, 31, 3, 4, 5, 22, 22, 6, 47, - 31, 28, 89, 28, 31, 92, 21, 28, 28, 31, + 6, 25, 25, 33, 33, 34, 244, 36, 90, 34, + 21, 21, 31, 3, 4, 5, 22, 22, 6, 48, + 31, 28, 90, 28, 31, 93, 21, 28, 28, 31, - 40, 50, 22, 102, 21, 78, 233, 40, 50, 92, - 22, 231, 127, 47, 64, 64, 64, 64, 64, 64, - 64, 64, 103, 78, 103, 127, 47, 136, 178, 136, - 178, 47, 136, 229, 227, 47, 68, 68, 68, 68, - 68, 68, 197, 215, 197, 215, 222, 102, 119, 119, - 119, 119, 119, 119, 119, 119, 121, 121, 121, 121, - 121, 121, 150, 150, 150, 226, 228, 226, 228, 150, - 221, 220, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 230, 219, 230, 236, 150, 150, 237, 236, 237, - 218, 217, 150, 150, 150, 150, 150, 150, 239, 214, + 40, 51, 22, 104, 21, 79, 236, 40, 51, 93, + 22, 234, 129, 48, 65, 65, 65, 65, 65, 65, + 65, 65, 105, 79, 105, 129, 48, 138, 181, 138, + 181, 48, 138, 232, 230, 48, 69, 69, 69, 69, + 69, 69, 200, 218, 200, 218, 225, 104, 121, 121, + 121, 121, 121, 121, 121, 121, 123, 123, 123, 123, + 123, 123, 153, 153, 153, 229, 231, 229, 231, 153, + 224, 223, 153, 153, 153, 153, 153, 153, 153, 153, + 153, 233, 222, 233, 239, 153, 153, 240, 239, 240, + 221, 220, 153, 153, 153, 153, 153, 153, 242, 217, - 239, 210, 209, 207, 205, 202, 201, 200, 199, 198, - 195, 194, 193, 192, 191, 190, 150, 176, 176, 176, - 189, 188, 187, 186, 176, 184, 183, 176, 176, 176, - 176, 176, 176, 176, 176, 176, 182, 175, 174, 170, - 176, 176, 168, 167, 165, 164, 163, 176, 176, 176, - 176, 176, 176, 162, 161, 160, 159, 158, 157, 156, - 155, 154, 153, 152, 149, 147, 146, 145, 144, 143, - 142, 176, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, + 242, 213, 212, 210, 208, 205, 204, 203, 202, 201, + 198, 197, 196, 195, 194, 193, 153, 179, 179, 179, + 192, 191, 190, 189, 179, 187, 186, 179, 179, 179, + 179, 179, 179, 179, 179, 179, 185, 178, 177, 173, + 179, 179, 171, 170, 168, 167, 166, 179, 179, 179, + 179, 179, 179, 165, 164, 163, 162, 161, 160, 159, + 158, 157, 156, 155, 152, 149, 148, 147, 146, 145, + 144, 179, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 196, 196, - 196, 196, 196, 196, 196, 196, 196, 196, 213, 213, - 213, 141, 139, 138, 137, 213, 213, 135, 213, 213, - 213, 213, 213, 213, 213, 213, 213, 134, 133, 132, - 130, 213, 213, 129, 128, 126, 112, 101, 213, 213, - 213, 213, 213, 213, 100, 99, 98, 97, 96, 95, - 91, 90, 88, 87, 86, 85, 84, 83, 82, 81, - 79, 77, 213, 245, 245, 245, 245, 245, 245, 245, - 245, 245, 245, 245, 245, 245, 246, 246, 246, 246, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 199, 199, + 199, 199, 199, 199, 199, 199, 199, 199, 216, 216, + 216, 143, 141, 140, 139, 216, 216, 137, 216, 216, + 216, 216, 216, 216, 216, 216, 216, 136, 135, 134, + 132, 216, 216, 131, 130, 128, 114, 103, 216, 216, + 216, 216, 216, 216, 102, 101, 100, 99, 98, 97, + 96, 92, 91, 89, 88, 87, 86, 85, 84, 83, + 82, 80, 216, 248, 248, 248, 248, 248, 248, 248, + 248, 248, 248, 248, 248, 248, 249, 249, 249, 249, + + 249, 249, 249, 249, 249, 249, 249, 249, 249, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 251, 251, 251, 251, 251, 251, 251, 251, + 251, 251, 251, 251, 251, 252, 252, 252, 252, 252, + 253, 78, 253, 253, 253, 254, 68, 67, 254, 61, + 254, 254, 254, 255, 57, 255, 56, 52, 44, 255, + 256, 43, 256, 256, 256, 257, 42, 257, 257, 257, + 258, 258, 41, 39, 38, 258, 258, 37, 258, 259, + 259, 35, 32, 259, 259, 259, 259, 259, 259, 259, + 259, 260, 260, 260, 260, 260, 260, 260, 260, 260, + + 260, 260, 260, 260, 261, 261, 30, 261, 261, 261, + 29, 261, 261, 261, 261, 261, 262, 262, 24, 262, + 262, 262, 262, 262, 262, 262, 262, 262, 262, 263, + 263, 263, 19, 263, 263, 263, 263, 263, 263, 263, + 263, 263, 264, 264, 18, 264, 264, 264, 264, 264, + 264, 264, 264, 264, 264, 265, 15, 265, 266, 11, + 266, 267, 267, 267, 267, 267, 267, 267, 267, 267, + 267, 267, 267, 267, 268, 268, 268, 268, 268, 268, + 268, 268, 268, 268, 268, 268, 268, 269, 10, 269, + 9, 8, 7, 247, 247, 247, 247, 247, 247, 247, - 246, 246, 246, 246, 246, 246, 246, 246, 246, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, - 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, - 248, 248, 248, 248, 248, 249, 249, 249, 249, 249, - 250, 67, 250, 250, 250, 251, 66, 60, 251, 56, - 251, 251, 251, 252, 55, 252, 51, 43, 42, 252, - 253, 41, 253, 253, 253, 254, 39, 254, 254, 254, - 255, 255, 38, 37, 35, 255, 255, 32, 255, 256, - 256, 30, 29, 256, 256, 256, 256, 256, 256, 256, - 256, 257, 257, 257, 257, 257, 257, 257, 257, 257, - - 257, 257, 257, 257, 258, 258, 24, 258, 258, 258, - 19, 258, 258, 258, 258, 258, 259, 259, 18, 259, - 259, 259, 259, 259, 259, 259, 259, 259, 259, 260, - 260, 260, 15, 260, 260, 260, 260, 260, 260, 260, - 260, 260, 261, 261, 11, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 262, 10, 262, 263, 9, - 263, 264, 264, 264, 264, 264, 264, 264, 264, 264, - 264, 264, 264, 264, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 266, 8, 266, - 7, 244, 244, 244, 244, 244, 244, 244, 244, 244, - - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244, 244, 244, - 244, 244, 244, 244, 244, 244, 244, 244 + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, + 247, 247, 247, 247, 247, 247, 247, 247, 247, 247 } ; /* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[75] = +static yyconst 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, 1, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, }; + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, }; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -1024,11 +807,13 @@ static int is_absolute_path( #endif } -#line 1027 "lexer.c" #define YY_NO_UNISTD_H 1 #define YY_NO_INPUT 1 -#line 1031 "lexer.c" + + + +#line 817 "lexer.c" #define INITIAL 0 #define str 1 @@ -1061,8 +846,8 @@ struct yyguts_t size_t yy_buffer_stack_max; /**< capacity of stack. */ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */ char yy_hold_char; - int yy_n_chars; - int yyleng_r; + yy_size_t yy_n_chars; + yy_size_t yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -1084,52 +869,48 @@ 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 yylex_init (yyscan_t* scanner); +int yara_yylex_init (yyscan_t* scanner); -int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); +int yara_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 yylex_destroy ( yyscan_t yyscanner ); +int yara_yylex_destroy (yyscan_t yyscanner ); -int yyget_debug ( yyscan_t yyscanner ); +int yara_yyget_debug (yyscan_t yyscanner ); -void yyset_debug ( int debug_flag , yyscan_t yyscanner ); +void yara_yyset_debug (int debug_flag ,yyscan_t yyscanner ); -YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); +YY_EXTRA_TYPE yara_yyget_extra (yyscan_t yyscanner ); -void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); +void yara_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); -FILE *yyget_in ( yyscan_t yyscanner ); +FILE *yara_yyget_in (yyscan_t yyscanner ); -void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); +void yara_yyset_in (FILE * in_str ,yyscan_t yyscanner ); -FILE *yyget_out ( yyscan_t yyscanner ); +FILE *yara_yyget_out (yyscan_t yyscanner ); -void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); +void yara_yyset_out (FILE * out_str ,yyscan_t yyscanner ); - int yyget_leng ( yyscan_t yyscanner ); +yy_size_t yara_yyget_leng (yyscan_t yyscanner ); -char *yyget_text ( yyscan_t yyscanner ); +char *yara_yyget_text (yyscan_t yyscanner ); -int yyget_lineno ( yyscan_t yyscanner ); +int yara_yyget_lineno (yyscan_t yyscanner ); -void yyset_lineno ( int _line_number , yyscan_t yyscanner ); +void yara_yyset_lineno (int line_number ,yyscan_t yyscanner ); -int yyget_column ( yyscan_t yyscanner ); +YYSTYPE * yara_yyget_lval (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 ); +void yara_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1137,41 +918,33 @@ void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( yyscan_t yyscanner ); +extern "C" int yara_yywrap (yyscan_t yyscanner ); #else -extern int yywrap ( yyscan_t yyscanner ); +extern int yara_yywrap (yyscan_t yyscanner ); #endif #endif -#ifndef YY_NO_UNPUT - -#endif - #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * , yyscan_t yyscanner); +static int yy_flex_strlen (yyconst 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 /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1179,7 +952,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, (size_t) yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1190,7 +963,7 @@ static int input ( yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + yy_size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1203,7 +976,7 @@ static int input ( yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -1244,10 +1017,10 @@ static int input ( yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex \ - (YYSTYPE * yylval_param , yyscan_t yyscanner); +extern int yara_yylex \ + (YYSTYPE * yylval_param ,yyscan_t yyscanner); -#define YY_DECL int yylex \ +#define YY_DECL int yara_yylex \ (YYSTYPE * yylval_param , yyscan_t yyscanner) #endif /* !YY_DECL */ @@ -1260,7 +1033,7 @@ extern int yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; +#define YY_BREAK break; #endif #define YY_RULE_SETUP \ @@ -1270,11 +1043,16 @@ extern int yylex \ */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; +#line 158 "lexer.l" + + +#line 1055 "lexer.c" + yylval = yylval_param; if ( !yyg->yy_init ) @@ -1295,21 +1073,15 @@ YY_DECL yyout = stdout; if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (yyscanner); + yara_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - yy_load_buffer_state( yyscanner ); + yara_yy_load_buffer_state(yyscanner ); } - { -#line 158 "lexer.l" - - -#line 1310 "lexer.c" - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -1325,7 +1097,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + register 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; @@ -1334,13 +1106,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 245 ) - yy_c = yy_meta[yy_c]; + if ( yy_current_state >= 248 ) + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 244 ); + while ( yy_current_state != 247 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -1351,10 +1123,10 @@ yy_find_action: if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - int yyl; + yy_size_t yyl; for ( yyl = 0; yyl < yyleng; ++yyl ) if ( yytext[yyl] == '\n' ) - + do{ yylineno++; yycolumn=0; }while(0) @@ -1455,142 +1227,147 @@ YY_RULE_SETUP case 17: YY_RULE_SETUP #line 176 "lexer.l" -{ return _FULLWORD_; } +{ return _XOR_; } YY_BREAK case 18: YY_RULE_SETUP #line 177 "lexer.l" -{ return _NOCASE_; } +{ return _FULLWORD_; } YY_BREAK case 19: YY_RULE_SETUP #line 178 "lexer.l" -{ return _CONDITION_; } +{ return _NOCASE_; } YY_BREAK case 20: YY_RULE_SETUP #line 179 "lexer.l" -{ return _TRUE_; } +{ return _CONDITION_; } YY_BREAK case 21: YY_RULE_SETUP #line 180 "lexer.l" -{ return _FALSE_; } +{ return _TRUE_; } YY_BREAK case 22: YY_RULE_SETUP #line 181 "lexer.l" -{ return _NOT_; } +{ return _FALSE_; } YY_BREAK case 23: YY_RULE_SETUP #line 182 "lexer.l" -{ return _AND_; } +{ return _NOT_; } YY_BREAK case 24: YY_RULE_SETUP #line 183 "lexer.l" -{ return _OR_; } +{ return _AND_; } YY_BREAK case 25: YY_RULE_SETUP #line 184 "lexer.l" -{ return _AT_; } +{ return _OR_; } YY_BREAK case 26: YY_RULE_SETUP #line 185 "lexer.l" -{ return _IN_; } +{ return _AT_; } YY_BREAK case 27: YY_RULE_SETUP #line 186 "lexer.l" -{ return _OF_; } +{ return _IN_; } YY_BREAK case 28: YY_RULE_SETUP #line 187 "lexer.l" -{ return _THEM_; } +{ return _OF_; } YY_BREAK case 29: YY_RULE_SETUP #line 188 "lexer.l" -{ return _FOR_; } +{ return _THEM_; } YY_BREAK case 30: YY_RULE_SETUP #line 189 "lexer.l" -{ return _ALL_; } +{ return _FOR_; } YY_BREAK case 31: YY_RULE_SETUP #line 190 "lexer.l" -{ return _ANY_; } +{ return _ALL_; } YY_BREAK case 32: YY_RULE_SETUP #line 191 "lexer.l" -{ return _ENTRYPOINT_; } +{ return _ANY_; } YY_BREAK case 33: YY_RULE_SETUP #line 192 "lexer.l" -{ return _FILESIZE_; } +{ return _ENTRYPOINT_; } YY_BREAK case 34: YY_RULE_SETUP #line 193 "lexer.l" -{ return _MATCHES_; } +{ return _FILESIZE_; } YY_BREAK case 35: YY_RULE_SETUP #line 194 "lexer.l" -{ return _CONTAINS_; } +{ return _MATCHES_; } YY_BREAK case 36: YY_RULE_SETUP #line 195 "lexer.l" -{ return _IMPORT_; } +{ return _CONTAINS_; } YY_BREAK case 37: YY_RULE_SETUP -#line 198 "lexer.l" -{ BEGIN(comment); } +#line 196 "lexer.l" +{ return _IMPORT_; } YY_BREAK case 38: YY_RULE_SETUP #line 199 "lexer.l" -{ BEGIN(INITIAL); } +{ BEGIN(comment); } YY_BREAK case 39: -/* rule 39 can match eol */ YY_RULE_SETUP #line 200 "lexer.l" -{ /* skip comments */ } +{ BEGIN(INITIAL); } YY_BREAK case 40: +/* rule 40 can match eol */ YY_RULE_SETUP -#line 203 "lexer.l" -{ /* skip single-line comments */ } +#line 201 "lexer.l" +{ /* skip comments */ } YY_BREAK case 41: YY_RULE_SETUP -#line 206 "lexer.l" +#line 204 "lexer.l" +{ /* skip single-line comments */ } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 207 "lexer.l" { yyextra->lex_buf_ptr = yyextra->lex_buf; yyextra->lex_buf_len = 0; BEGIN(include); } YY_BREAK -case 42: -/* rule 42 can match eol */ +case 43: +/* rule 43 can match eol */ YY_RULE_SETUP -#line 213 "lexer.l" +#line 214 "lexer.l" { yytext_to_buffer; } YY_BREAK -case 43: +case 44: YY_RULE_SETUP -#line 216 "lexer.l" +#line 217 "lexer.l" { if (compiler->include_callback != NULL) @@ -1676,9 +1453,9 @@ YY_RULE_SETUP } // Workaround for flex issue: https://github.com/westes/flex/issues/58 - yypush_buffer_state(YY_CURRENT_BUFFER, yyscanner); - yy_scan_string(included_rules, yyscanner); - yyset_lineno(1, yyscanner); + yara_yypush_buffer_state(YY_CURRENT_BUFFER,yyscanner); + yara_yy_scan_string(included_rules,yyscanner); + yara_yyset_lineno(1,yyscanner); if (compiler->include_free != NULL) { @@ -1722,13 +1499,13 @@ case YY_STATE_EOF(str): case YY_STATE_EOF(regexp): case YY_STATE_EOF(include): case YY_STATE_EOF(comment): -#line 343 "lexer.l" +#line 344 "lexer.l" { - YR_COMPILER* compiler = yyget_extra(yyscanner); + YR_COMPILER* compiler = yara_yyget_extra(yyscanner); _yr_compiler_pop_file_name(compiler); - yypop_buffer_state(yyscanner); + yara_yypop_buffer_state(yyscanner); if (!YY_CURRENT_BUFFER) { @@ -1736,9 +1513,9 @@ case YY_STATE_EOF(comment): } } YY_BREAK -case 44: +case 45: YY_RULE_SETUP -#line 357 "lexer.l" +#line 358 "lexer.l" { yylval->c_string = yr_strdup(yytext); @@ -1749,9 +1526,9 @@ YY_RULE_SETUP return _STRING_IDENTIFIER_WITH_WILDCARD_; } YY_BREAK -case 45: +case 46: YY_RULE_SETUP -#line 368 "lexer.l" +#line 369 "lexer.l" { yylval->c_string = yr_strdup(yytext); @@ -1762,9 +1539,9 @@ YY_RULE_SETUP return _STRING_IDENTIFIER_; } YY_BREAK -case 46: +case 47: YY_RULE_SETUP -#line 379 "lexer.l" +#line 380 "lexer.l" { yylval->c_string = yr_strdup(yytext); @@ -1781,9 +1558,9 @@ YY_RULE_SETUP return _STRING_COUNT_; } YY_BREAK -case 47: +case 48: YY_RULE_SETUP -#line 396 "lexer.l" +#line 397 "lexer.l" { yylval->c_string = yr_strdup(yytext); @@ -1800,9 +1577,9 @@ YY_RULE_SETUP return _STRING_OFFSET_; } YY_BREAK -case 48: +case 49: YY_RULE_SETUP -#line 413 "lexer.l" +#line 414 "lexer.l" { yylval->c_string = yr_strdup(yytext); @@ -1819,9 +1596,9 @@ YY_RULE_SETUP return _STRING_LENGTH_; } YY_BREAK -case 49: +case 50: YY_RULE_SETUP -#line 430 "lexer.l" +#line 431 "lexer.l" { char* text = yytext; @@ -1860,9 +1637,9 @@ YY_RULE_SETUP return _INTEGER_FUNCTION_; } YY_BREAK -case 50: +case 51: YY_RULE_SETUP -#line 469 "lexer.l" +#line 470 "lexer.l" { if (strlen(yytext) > 128) @@ -1876,9 +1653,9 @@ YY_RULE_SETUP return _IDENTIFIER_; } YY_BREAK -case 51: +case 52: YY_RULE_SETUP -#line 483 "lexer.l" +#line 484 "lexer.l" { char *endptr; @@ -1919,17 +1696,17 @@ YY_RULE_SETUP return _NUMBER_; } YY_BREAK -case 52: +case 53: YY_RULE_SETUP -#line 523 "lexer.l" +#line 524 "lexer.l" { yylval->double_ = atof(yytext); return _DOUBLE_; } YY_BREAK -case 53: +case 54: YY_RULE_SETUP -#line 528 "lexer.l" +#line 529 "lexer.l" { char *endptr; @@ -1946,9 +1723,9 @@ YY_RULE_SETUP return _NUMBER_; } YY_BREAK -case 54: +case 55: YY_RULE_SETUP -#line 544 "lexer.l" +#line 545 "lexer.l" { char *endptr; @@ -1965,9 +1742,9 @@ YY_RULE_SETUP return _NUMBER_; } YY_BREAK -case 55: +case 56: YY_RULE_SETUP -#line 561 "lexer.l" +#line 562 "lexer.l" { /* saw closing quote - all done */ alloc_sized_string(s, yyextra->lex_buf_len); @@ -1981,9 +1758,9 @@ YY_RULE_SETUP return _TEXT_STRING_; } YY_BREAK -case 56: +case 57: YY_RULE_SETUP -#line 575 "lexer.l" +#line 576 "lexer.l" { lex_check_space_ok("\t", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -1991,9 +1768,9 @@ YY_RULE_SETUP yyextra->lex_buf_len++; } YY_BREAK -case 57: +case 58: YY_RULE_SETUP -#line 583 "lexer.l" +#line 584 "lexer.l" { lex_check_space_ok("\n", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -2001,9 +1778,9 @@ YY_RULE_SETUP yyextra->lex_buf_len++; } YY_BREAK -case 58: +case 59: YY_RULE_SETUP -#line 591 "lexer.l" +#line 592 "lexer.l" { lex_check_space_ok("\"", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -2011,9 +1788,9 @@ YY_RULE_SETUP yyextra->lex_buf_len++; } YY_BREAK -case 59: +case 60: YY_RULE_SETUP -#line 599 "lexer.l" +#line 600 "lexer.l" { lex_check_space_ok("\\", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -2021,9 +1798,9 @@ YY_RULE_SETUP yyextra->lex_buf_len++; } YY_BREAK -case 60: +case 61: YY_RULE_SETUP -#line 607 "lexer.l" +#line 608 "lexer.l" { int result; @@ -2034,30 +1811,30 @@ YY_RULE_SETUP yyextra->lex_buf_len++; } YY_BREAK -case 61: -YY_RULE_SETUP -#line 618 "lexer.l" -{ yytext_to_buffer; } - YY_BREAK case 62: -/* rule 62 can match eol */ YY_RULE_SETUP -#line 621 "lexer.l" -{ - syntax_error("unterminated string"); -} +#line 619 "lexer.l" +{ yytext_to_buffer; } YY_BREAK case 63: /* rule 63 can match eol */ YY_RULE_SETUP -#line 626 "lexer.l" +#line 622 "lexer.l" +{ + syntax_error("unterminated string"); +} + YY_BREAK +case 64: +/* rule 64 can match eol */ +YY_RULE_SETUP +#line 627 "lexer.l" { syntax_error("illegal escape sequence"); } YY_BREAK -case 64: +case 65: YY_RULE_SETUP -#line 631 "lexer.l" +#line 632 "lexer.l" { if (yyextra->lex_buf_len > 0) @@ -2083,9 +1860,9 @@ YY_RULE_SETUP return _REGEXP_; } YY_BREAK -case 65: +case 66: YY_RULE_SETUP -#line 657 "lexer.l" +#line 658 "lexer.l" { lex_check_space_ok("/", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -2093,9 +1870,9 @@ YY_RULE_SETUP yyextra->lex_buf_len++ ; } YY_BREAK -case 66: +case 67: YY_RULE_SETUP -#line 665 "lexer.l" +#line 666 "lexer.l" { lex_check_space_ok("\\.", yyextra->lex_buf_len, LEX_BUF_SIZE); @@ -2108,22 +1885,22 @@ YY_RULE_SETUP yyextra->lex_buf_len += 2; } YY_BREAK -case 67: +case 68: YY_RULE_SETUP -#line 678 "lexer.l" +#line 679 "lexer.l" { yytext_to_buffer; } YY_BREAK -case 68: -/* rule 68 can match eol */ +case 69: +/* rule 69 can match eol */ YY_RULE_SETUP -#line 681 "lexer.l" +#line 682 "lexer.l" { syntax_error("unterminated regular expression"); } YY_BREAK -case 69: +case 70: YY_RULE_SETUP -#line 686 "lexer.l" +#line 687 "lexer.l" { yylval->sized_string = NULL; @@ -2132,9 +1909,9 @@ YY_RULE_SETUP BEGIN(str); } YY_BREAK -case 70: +case 71: YY_RULE_SETUP -#line 695 "lexer.l" +#line 696 "lexer.l" { yylval->sized_string = NULL; @@ -2143,10 +1920,10 @@ YY_RULE_SETUP BEGIN(regexp); } YY_BREAK -case 71: -/* rule 71 can match eol */ +case 72: +/* rule 72 can match eol */ YY_RULE_SETUP -#line 704 "lexer.l" +#line 705 "lexer.l" { // Match hex-digits with whitespace or comments. The latter are stripped // out by hex_lexer.l @@ -2159,15 +1936,15 @@ YY_RULE_SETUP return _HEX_STRING_; } YY_BREAK -case 72: -/* rule 72 can match eol */ +case 73: +/* rule 73 can match eol */ YY_RULE_SETUP -#line 717 "lexer.l" +#line 718 "lexer.l" /* skip whitespace */ YY_BREAK -case 73: +case 74: YY_RULE_SETUP -#line 719 "lexer.l" +#line 720 "lexer.l" { if (yytext[0] >= 32 && yytext[0] < 127) @@ -2180,12 +1957,12 @@ YY_RULE_SETUP } } YY_BREAK -case 74: +case 75: YY_RULE_SETUP -#line 731 "lexer.l" +#line 732 "lexer.l" ECHO; YY_BREAK -#line 2188 "lexer.c" +#line 1966 "lexer.c" case YY_END_OF_BUFFER: { @@ -2201,7 +1978,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 - * yylex(). If so, then we have to assure + * yara_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 @@ -2262,7 +2039,7 @@ ECHO; { yyg->yy_did_buffer_switch_on_eof = 0; - if ( yywrap( yyscanner ) ) + if ( yara_yywrap(yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -2315,8 +2092,7 @@ ECHO; "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ +} /* end of yara_yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2328,9 +2104,9 @@ ECHO; static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = yyg->yytext_ptr; - int number_to_move, i; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = yyg->yytext_ptr; + register 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] ) @@ -2359,7 +2135,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++); @@ -2372,21 +2148,21 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2395,12 +2171,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + yara_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; + b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2428,7 +2203,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin , yyscanner); + yara_yyrestart(yyin ,yyscanner); } else @@ -2442,15 +2217,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yy_size_t) (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. */ - 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 ); + 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 ); 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; @@ -2466,15 +2238,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_get_previous_state (yyscan_t yyscanner) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register 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 ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register 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; @@ -2483,10 +2255,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 245 ) - yy_c = yy_meta[yy_c]; + if ( yy_current_state >= 248 ) + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -2499,11 +2271,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) { - int yy_is_jam; + register int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ - char *yy_cp = yyg->yy_c_buf_p; + register char *yy_cp = yyg->yy_c_buf_p; - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -2512,20 +2284,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 245 ) - yy_c = yy_meta[yy_c]; + if ( yy_current_state >= 248 ) + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 244); + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_is_jam = (yy_current_state == 247); - (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) @@ -2551,7 +2318,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); + yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -2568,13 +2335,13 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - yyrestart( yyin , yyscanner); + yara_yyrestart(yyin ,yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( yyscanner ) ) + if ( yara_yywrap(yyscanner ) ) return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) @@ -2598,7 +2365,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) @@ -2613,34 +2380,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 yyrestart (FILE * input_file , yyscan_t yyscanner) + void yara_yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (yyscanner); + yara_yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); + yara_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); - yy_load_buffer_state( yyscanner ); + yara_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + yara_yy_load_buffer_state(yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void yara_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 - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + * yara_yypop_buffer_state(); + * yara_yypush_buffer_state(new_buffer); */ - yyensure_buffer_stack (yyscanner); + yara_yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2653,17 +2420,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( yyscanner ); + yara_yy_load_buffer_state(yyscanner ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (yara_yywrap()) processing, but the only time this flag + * is looked at is after yara_yywrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void yy_load_buffer_state (yyscan_t yyscanner) +static void yara_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; @@ -2678,35 +2445,35 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE yara_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + b = (YY_BUFFER_STATE) yara_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yara_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 *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); + b->yy_ch_buf = (char *) yara_yyalloc(b->yy_buf_size + 2 ,yyscanner ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yara_yy_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file , yyscanner); + yara_yy_init_buffer(b,file ,yyscanner); return b; } /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() + * @param b a buffer created with yara_yy_create_buffer() * @param yyscanner The scanner object. */ - void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void yara_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2717,28 +2484,28 @@ static void yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf , yyscanner ); + yara_yyfree((void *) b->yy_ch_buf ,yyscanner ); - yyfree( (void *) b , yyscanner ); + yara_yyfree((void *) b ,yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. + * such as during a yara_yyrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + static void yara_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flush_buffer( b , yyscanner); + yara_yy_flush_buffer(b ,yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yara_yy_init_buffer was _probably_ + * called from yara_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){ @@ -2755,7 +2522,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void yara_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -2776,7 +2543,7 @@ static void yy_load_buffer_state (yyscan_t yyscanner) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( yyscanner ); + yara_yy_load_buffer_state(yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -2785,15 +2552,15 @@ static void yy_load_buffer_state (yyscan_t yyscanner) * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void yara_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; - yyensure_buffer_stack(yyscanner); + yara_yyensure_buffer_stack(yyscanner); - /* This block is copied from yy_switch_to_buffer. */ + /* This block is copied from yara_yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -2807,8 +2574,8 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( yyscanner ); + /* copied from yara_yy_switch_to_buffer. */ + yara_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -2816,19 +2583,19 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) * The next element becomes the new top. * @param yyscanner The scanner object. */ -void yypop_buffer_state (yyscan_t yyscanner) +void yara_yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); + yara_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) { - yy_load_buffer_state( yyscanner ); + yara_yy_load_buffer_state(yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -2836,7 +2603,7 @@ void yypop_buffer_state (yyscan_t yyscanner) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (yyscan_t yyscanner) +static void yara_yyensure_buffer_stack (yyscan_t yyscanner) { yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -2847,15 +2614,15 @@ static void 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; /* After all that talk, this was set to 1 anyways... */ - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc + num_to_alloc = 1; + yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yara_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; @@ -2864,15 +2631,15 @@ static void 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. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; + int grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_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 yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yara_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*)); @@ -2884,9 +2651,9 @@ static void 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 yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE yara_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; @@ -2894,69 +2661,68 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscann 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 NULL; + return 0; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); + b = (YY_BUFFER_STATE) yara_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yara_yy_scan_buffer()" ); - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_size = 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 = NULL; + b->yy_input_file = 0; 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; - yy_switch_to_buffer( b , yyscanner ); + yara_yy_switch_to_buffer(b ,yyscanner ); return b; } -/** Setup the input buffer state to scan a string. The next call to yylex() will +/** Setup the input buffer state to scan a string. The next call to yara_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 - * yy_scan_bytes() instead. + * yara_yy_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE yara_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); + return yara_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); } -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to yara_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 bytes the byte buffer to scan + * @param 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 yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yara_yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n; - int i; + yy_size_t n, i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n , yyscanner ); + n = _yybytes_len + 2; + buf = (char *) yara_yyalloc(n ,yyscanner ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yara_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 = yy_scan_buffer( buf, n , yyscanner); + b = yara_yy_scan_buffer(buf,n ,yyscanner); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yara_yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -2970,11 +2736,9 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3000,7 +2764,7 @@ static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE yara_yyget_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; @@ -3009,10 +2773,10 @@ YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) /** Get the current line number. * @param yyscanner The scanner object. */ -int yyget_lineno (yyscan_t yyscanner) +int yara_yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -3022,10 +2786,10 @@ int yyget_lineno (yyscan_t yyscanner) /** Get the current column number. * @param yyscanner The scanner object. */ -int yyget_column (yyscan_t yyscanner) +int yara_yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -3035,7 +2799,7 @@ int yyget_column (yyscan_t yyscanner) /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *yyget_in (yyscan_t yyscanner) +FILE *yara_yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; @@ -3044,7 +2808,7 @@ FILE *yyget_in (yyscan_t yyscanner) /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *yyget_out (yyscan_t yyscanner) +FILE *yara_yyget_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; @@ -3053,7 +2817,7 @@ FILE *yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int yyget_leng (yyscan_t yyscanner) +yy_size_t yara_yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -3063,7 +2827,7 @@ int yyget_leng (yyscan_t yyscanner) * @param yyscanner The scanner object. */ -char *yyget_text (yyscan_t yyscanner) +char *yara_yyget_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; @@ -3073,81 +2837,81 @@ char *yyget_text (yyscan_t yyscanner) * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void yara_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 line number + * @param line_number * @param yyscanner The scanner object. */ -void yyset_lineno (int _line_number , yyscan_t yyscanner) +void yara_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( "yyset_lineno called with no buffer" ); + yy_fatal_error( "yara_yyset_lineno called with no buffer" , yyscanner); - yylineno = _line_number; + yylineno = line_number; } /** Set the current column. - * @param _column_no column number + * @param line_number * @param yyscanner The scanner object. */ -void yyset_column (int _column_no , yyscan_t yyscanner) +void yara_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( "yyset_column called with no buffer" ); + yy_fatal_error( "yara_yyset_column called with no buffer" , yyscanner); - 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 yy_switch_to_buffer + * @see yara_yy_switch_to_buffer */ -void yyset_in (FILE * _in_str , yyscan_t yyscanner) +void yara_yyset_in (FILE * in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = _in_str ; + yyin = in_str ; } -void yyset_out (FILE * _out_str , yyscan_t yyscanner) +void yara_yyset_out (FILE * out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = _out_str ; + yyout = out_str ; } -int yyget_debug (yyscan_t yyscanner) +int yara_yyget_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } -void yyset_debug (int _bdebug , yyscan_t yyscanner) +void yara_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 * yyget_lval (yyscan_t yyscanner) +YYSTYPE * yara_yyget_lval (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylval; } -void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +void yara_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; @@ -3155,18 +2919,20 @@ void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) /* User-visible API */ -/* yylex_init is special because it creates the scanner itself, so it is +/* yara_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 yylex_init(yyscan_t* ptr_yy_globals) + +int yara_yylex_init(yyscan_t* ptr_yy_globals) + { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) yara_yyalloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -3179,37 +2945,39 @@ int yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } -/* yylex_init_extra has the same functionality as yylex_init, but follows the +/* yara_yylex_init_extra has the same functionality as yara_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 yyalloc in + * The user defined value in the first argument will be available to yara_yyalloc in * the yyextra field. */ -int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) + +int yara_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + { struct yyguts_t dummy_yyguts; - yyset_extra (yy_user_defined, &dummy_yyguts); + yara_yyset_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - - *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - + + *ptr_yy_globals = (yyscan_t) yara_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)); - - yyset_extra (yy_user_defined, *ptr_yy_globals); - + + yara_yyset_extra (yy_user_defined, *ptr_yy_globals); + return yy_init_globals ( *ptr_yy_globals ); } @@ -3217,13 +2985,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 yylex_destroy(), so don't allocate here. + * This function is called from yara_yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = NULL; + yyg->yy_buffer_stack = 0; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = NULL; + yyg->yy_c_buf_p = (char *) 0; yyg->yy_init = 0; yyg->yy_start = 0; @@ -3236,42 +3004,42 @@ static int yy_init_globals (yyscan_t yyscanner) yyin = stdin; yyout = stdout; #else - yyin = NULL; - yyout = NULL; + yyin = (FILE *) 0; + yyout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by - * yylex_init() + * yara_yylex_init() */ return 0; } -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (yyscan_t yyscanner) +/* yara_yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yara_yylex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); + yara_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(yyscanner); + yara_yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - yyfree(yyg->yy_buffer_stack , yyscanner); + yara_yyfree(yyg->yy_buffer_stack ,yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - yyfree( yyg->yy_start_stack , yyscanner ); + yara_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 - * yylex() is called, initialization will occur. */ + * yara_yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ - yyfree ( yyscanner , yyscanner ); + yara_yyfree ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } @@ -3281,21 +3049,18 @@ int yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s , yyscan_t yyscanner) +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; @@ -3303,18 +3068,13 @@ static int yy_flex_strlen (const char * s , yyscan_t yyscanner) } #endif -void *yyalloc (yy_size_t size , yyscan_t yyscanner) +void *yara_yyalloc (yy_size_t size , yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - return malloc(size); + return (void *) malloc( size ); } -void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +void *yara_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 @@ -3322,19 +3082,18 @@ void *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 realloc(ptr, size); + return (void *) realloc( (char *) ptr, size ); } -void yyfree (void * ptr , yyscan_t yyscanner) +void yara_yyfree (void * ptr , yyscan_t yyscanner) { - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - (void)yyg; - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see yara_yyrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" -#line 731 "lexer.l" +#line 732 "lexer.l" + @@ -3343,7 +3102,7 @@ void yywarning( const char *message_fmt, ...) { - YR_COMPILER* compiler = yyget_extra(yyscanner); + YR_COMPILER* compiler = yara_yyget_extra(yyscanner); char* file_name; char message[512]; @@ -3364,7 +3123,7 @@ void yywarning( compiler->callback( YARA_ERROR_LEVEL_WARNING, file_name, - compiler->current_line ? compiler->current_line : yyget_lineno(yyscanner), + compiler->current_line ? compiler->current_line : yara_yyget_lineno(yyscanner), message, compiler->user_data); @@ -3376,7 +3135,7 @@ void yyfatal( yyscan_t yyscanner, const char *error_message) { - YR_COMPILER* compiler = yyget_extra(yyscanner); + YR_COMPILER* compiler = yara_yyget_extra(yyscanner); yyerror(yyscanner, compiler, error_message); longjmp(compiler->error_recovery, 1); @@ -3402,7 +3161,7 @@ void yyerror( if (compiler->current_line != 0) compiler->last_error_line = compiler->current_line; else - compiler->last_error_line = yyget_lineno(yyscanner); + compiler->last_error_line = yara_yyget_lineno(yyscanner); compiler->current_line = 0; @@ -3462,17 +3221,17 @@ int yr_lex_parse_rules_string( if (setjmp(compiler->error_recovery) != 0) return compiler->errors; - yylex_init(&yyscanner); + yara_yylex_init(&yyscanner); #if YYDEBUG yydebug = 1; #endif - yyset_extra(compiler, yyscanner); - yy_scan_string(rules_string, yyscanner); - yyset_lineno(1, yyscanner); + yara_yyset_extra(compiler,yyscanner); + yara_yy_scan_string(rules_string,yyscanner); + yara_yyset_lineno(1,yyscanner); yyparse(yyscanner, compiler); - yylex_destroy(yyscanner); + yara_yylex_destroy(yyscanner); return compiler->errors; } @@ -3489,16 +3248,16 @@ int yr_lex_parse_rules_file( if (setjmp(compiler->error_recovery) != 0) return compiler->errors; - yylex_init(&yyscanner); + yara_yylex_init(&yyscanner); #if YYDEBUG yydebug = 1; #endif - yyset_in(rules_file, yyscanner); - yyset_extra(compiler, yyscanner); + yara_yyset_in(rules_file,yyscanner); + yara_yyset_extra(compiler,yyscanner); yyparse(yyscanner, compiler); - yylex_destroy(yyscanner); + yara_yylex_destroy(yyscanner); return compiler->errors; } @@ -3516,13 +3275,13 @@ int yr_lex_parse_rules_fd( if (setjmp(compiler->error_recovery) != 0) return compiler->errors; - yylex_init(&yyscanner); + yara_yylex_init(&yyscanner); #if YYDEBUG yydebug = 1; #endif - yyset_extra(compiler, yyscanner); + yara_yyset_extra(compiler,yyscanner); while (1) { @@ -3542,13 +3301,12 @@ int yr_lex_parse_rules_fd( #endif if (len == 0) break; - yy_scan_bytes(buf, len, yyscanner); + yara_yy_scan_bytes(buf,len,yyscanner); } yyparse(yyscanner, compiler); - yylex_destroy(yyscanner); + yara_yylex_destroy(yyscanner); return compiler->errors; } - diff --git a/libyara/lexer.l b/libyara/lexer.l index 5f50d7fb..eadfdf44 100644 --- a/libyara/lexer.l +++ b/libyara/lexer.l @@ -173,6 +173,7 @@ octdigit [0-7] "strings" { return _STRINGS_; } "ascii" { return _ASCII_; } "wide" { return _WIDE_; } +"xor" { return _XOR_; } "fullword" { return _FULLWORD_; } "nocase" { return _NOCASE_; } "condition" { return _CONDITION_; } @@ -943,4 +944,3 @@ int yr_lex_parse_rules_fd( return compiler->errors; } - diff --git a/libyara/parser.c b/libyara/parser.c index 6a5808b4..bdfa6ad9 100644 --- a/libyara/parser.c +++ b/libyara/parser.c @@ -497,7 +497,8 @@ YR_STRING* yr_parser_reduce_string_declaration( if (strcmp(identifier,"$") == 0) string_flags |= STRING_GFLAGS_ANONYMOUS; - if (!(string_flags & STRING_GFLAGS_WIDE)) + if (!(string_flags & STRING_GFLAGS_WIDE) && + !(string_flags & STRING_GFLAGS_XOR)) string_flags |= STRING_GFLAGS_ASCII; // Hex strings are always handled as DOT_ALL regexps. diff --git a/libyara/scan.c b/libyara/scan.c index 55f8ca62..aea2cd10 100644 --- a/libyara/scan.c +++ b/libyara/scan.c @@ -58,6 +58,63 @@ typedef struct _CALLBACK_ARGS } CALLBACK_ARGS; +static int _yr_scan_xor_compare( + const uint8_t* data, + size_t data_size, + uint8_t* string, + size_t string_length) +{ + const uint8_t* s1 = data; + const uint8_t* s2 = string; + uint8_t k = 0; + + size_t i = 0; + + if (data_size < string_length) + return 0; + + // Calculate the xor key to compare with. *s1 is the start of the string we + // matched on and *s2 is the "plaintext" string, so *s1 ^ *s2 is the key to + // every *s2 as we compare. + k = *s1 ^ *s2; + + while (i < string_length && *s1++ == ((*s2++) ^ k)) + i++; + + return (int) ((i == string_length) ? i : 0); +} + +static int _yr_scan_xor_wcompare( + const uint8_t* data, + size_t data_size, + uint8_t* string, + size_t string_length) +{ + const uint8_t* s1 = data; + const uint8_t* s2 = string; + uint8_t k = 0; + + size_t i = 0; + + if (data_size < string_length * 2) + return 0; + + // Calculate the xor key to compare with. *s1 is the start of the string we + // matched on and *s2 is the "plaintext" string, so *s1 ^ *s2 is the key to + // every *s2 as we compare. + k = *s1 ^ *s2; + + while (i < string_length && *s1 == ((*s2) ^ k) && ((*(s1 + 1)) ^ k) == 0x00) + { + s1+=2; + s2++; + i++; + } + + return (int) ((i == string_length) ? i * 2 : 0); +} + + static int _yr_scan_compare( const uint8_t* data, size_t data_size, @@ -720,6 +777,28 @@ static int _yr_scan_verify_literal_match( string->string, string->length); } + + if (STRING_IS_XOR(string) && forward_matches == 0) + { + if (STRING_IS_WIDE(string)) + { + forward_matches = _yr_scan_xor_wcompare( + data + offset, + data_size - offset, + string->string, + string->length); + } + + if (forward_matches == 0) + { + forward_matches = _yr_scan_xor_compare( + data + offset, + data_size - offset, + string->string, + string->length); + } + } + } if (forward_matches == 0) diff --git a/tests/data/xor.out b/tests/data/xor.out new file mode 100644 index 0000000000000000000000000000000000000000..8ff15e4612cdf3ec3bf49606295fe89235660862 GIT binary patch literal 6383 zcmWm3S0E5T002-5*&>^`?7jC)$yWB>d+)tvrtGamR?6P9?7jCWdnMh7bj4+wsLvm?CN0QYGn7s#K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ugxuQKB_ElY5ATHgA0T=HhntI$^KT8UDa}2QPtf1tpEl$h-hleKFR&mT>Yu?`$>7_ zw{Oj#Veo*U=5L=*^9q`(3Thfo>uMSso3df>g5Yn>1!wu68!JCo*Pqo^H#IeWg24w~ ze{ab@FUV`C$g68Quc@oAZ^(hc4?m5*WrHrn2hG)z`wBZ-q^DR}D?o z)itFsOh9Z^W#QkVFV)Ro8f*X7H`dftm%%Uvk<~S2|B6eino7S_{A>AESy@#G!wkHs zsV==PDXVNOYc9Y3-dt5x`2~hKh^nnCxhXBKXee%}y7|^pUS9DPh6Q+AS6h5rR#IMH z^1br5`Fll0dC^^%bAal|H;Jur39%6g!O^WD!7(whNiaA;&6~)Cw)n)D@Wh~ZZLfo3 zV`GwGaDm#WxAE->anWIMA+hbjA@ANrr@-I_b#J5MIuhgGg~q>*=?Hoq9sMp91`jBI z7oFOfl=3ztCG1USL|9bR+c+4!pd$KRN>_4f)a%sH$gc3vw{N53Veo;E!Vmz>LBa2P(=sArGv0*tzI_uO z9`ON&Aovy>l+l;|K0M}qWN2ShWJE-GCJbZn{dGuse@0qZblTg9{x@$!L&HA8Faa$g zuhRzJr-!~vj|v}%j0y`2&4OVH>O;e_20wfZdHXRscrZ5l_3Mx{7-pa$EcD}0X4dPd ztam{}G4Db`UZ=w_2aVwonZqAH1i$$Z8!{Xn8x$0r0mA|`MTCDC$;u3h%#3+G@-8Mg zIOzRdSa5*6wDgeCpx0Tcuj4aE6XQRA%nF6U3G&m^UXKNbd`t<6`!JRemzDJ~3fi#DvHnZ{H++ zc$1OxBP}C2IVl!~DJV=zj{W&ACh>htX8g~r%!Gu*NEl||OL9`oLUe3GM(l^Ug^wQ+ z6BFLRFb7{#Qll4R-o>ZC%Sv3#%!-SPkAh(Vic(YFEyYI1rA2>CSo-iWK0fa4e~c;8 AO#lD@ literal 0 HcmV?d00001 diff --git a/tests/data/xornocase.out b/tests/data/xornocase.out new file mode 100644 index 0000000000000000000000000000000000000000..a34d65b15770f501c91ea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^VjF^gOBHL!Xwf2q3inm<@x_o CT}fjA literal 0 HcmV?d00001 diff --git a/tests/test-rules.c b/tests/test-rules.c index 829bbfdd..21855553 100644 --- a/tests/test-rules.c +++ b/tests/test-rules.c @@ -477,6 +477,38 @@ static void test_strings() condition:\n\ all of them\n\ }", "abcdef"); + + assert_true_rule_file( + "rule test {\n\ + strings:\n\ + $a = \"This program cannot\" xor\n\ + condition:\n\ + #a == 255\n\ + }", "tests/data/xor.out"); + + assert_true_rule_file( + "rule test {\n\ + strings:\n\ + $a = \"This program cannot\" xor ascii\n\ + condition:\n\ + #a == 256\n\ + }", "tests/data/xor.out"); + + assert_true_rule_file( + "rule test {\n\ + strings:\n\ + $a = \"This program cannot\" xor wide\n\ + condition:\n\ + #a == 256\n\ + }", "tests/data/xorwide.out"); + + assert_true_rule_file( + "rule test {\n\ + strings:\n\ + $a = \"ab\" xor nocase\n\ + condition:\n\ + #a == 1084\n\ + }", "tests/data/xornocase.out"); }