[Forensics-changes] [yara] 278/415: Report regexp syntax errors with the correct line number
Hilko Bengen
bengen at moszumanska.debian.org
Thu Apr 3 05:43:14 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to branch debian
in repository yara.
commit 31f2983e880f9b0a72ca2d93f45c7beb6e835f9f
Author: Victor M. Alvarez <plusvic at gmail.com>
Date: Tue Dec 3 15:33:41 2013 +0100
Report regexp syntax errors with the correct line number
---
libyara/compiler.c | 1 +
libyara/grammar.c | 734 +++++++++++++++++++++++++++--------------------------
libyara/grammar.y | 13 +-
libyara/lexer.c | 17 +-
libyara/lexer.l | 8 +-
libyara/yara.h | 1 +
6 files changed, 401 insertions(+), 373 deletions(-)
diff --git a/libyara/compiler.c b/libyara/compiler.c
index c4f176d..8cfe879 100644
--- a/libyara/compiler.c
+++ b/libyara/compiler.c
@@ -44,6 +44,7 @@ int yr_compiler_create(
new_compiler->error_report_function = NULL;
new_compiler->last_error = ERROR_SUCCESS;
new_compiler->last_error_line = 0;
+ new_compiler->error_line = 0;
new_compiler->last_result = ERROR_SUCCESS;
new_compiler->file_stack_ptr = 0;
new_compiler->file_name_stack_ptr = 0;
diff --git a/libyara/grammar.c b/libyara/grammar.c
index ad1183d..a7b11d3 100644
--- a/libyara/grammar.c
+++ b/libyara/grammar.c
@@ -494,16 +494,16 @@ union yyalloc
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 2
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 425
+#define YYLAST 416
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 84
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 31
+#define YYNNTS 32
/* YYNRULES -- Number of rules. */
-#define YYNRULES 109
+#define YYNRULES 110
/* YYNRULES -- Number of states. */
-#define YYNSTATES 211
+#define YYNSTATES 212
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -557,14 +557,15 @@ static const yytype_uint16 yyprhs[] =
0, 0, 3, 4, 7, 11, 15, 25, 26, 30,
31, 35, 39, 40, 43, 45, 47, 48, 51, 53,
56, 58, 61, 65, 69, 73, 77, 79, 82, 87,
- 92, 96, 97, 100, 102, 104, 106, 108, 112, 114,
- 116, 118, 122, 126, 128, 132, 137, 141, 148, 149,
- 150, 162, 163, 173, 177, 181, 184, 188, 192, 196,
- 200, 204, 208, 212, 216, 220, 222, 224, 228, 230,
- 237, 239, 243, 244, 249, 251, 253, 257, 259, 261,
- 263, 265, 267, 271, 273, 275, 280, 285, 290, 295,
- 300, 305, 307, 309, 314, 316, 318, 322, 326, 330,
- 334, 338, 342, 346, 350, 353, 357, 361, 363, 365
+ 88, 94, 98, 99, 102, 104, 106, 108, 110, 114,
+ 116, 118, 120, 124, 128, 130, 134, 139, 143, 150,
+ 151, 152, 164, 165, 175, 179, 183, 186, 190, 194,
+ 198, 202, 206, 210, 214, 218, 222, 224, 226, 230,
+ 232, 239, 241, 245, 246, 251, 253, 255, 259, 261,
+ 263, 265, 267, 269, 273, 275, 277, 282, 287, 292,
+ 297, 302, 307, 309, 311, 316, 318, 320, 324, 328,
+ 332, 336, 340, 344, 348, 352, 355, 359, 363, 365,
+ 367
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -573,40 +574,40 @@ static const yytype_int8 yyrhs[] =
85, 0, -1, -1, 85, 86, -1, 85, 1, 86,
-1, 85, 1, 73, -1, 90, 3, 10, 92, 74,
87, 88, 89, 75, -1, -1, 6, 76, 94, -1,
- -1, 7, 76, 96, -1, 8, 76, 100, -1, -1,
+ -1, 7, 76, 96, -1, 8, 76, 101, -1, -1,
90, 91, -1, 4, -1, 5, -1, -1, 76, 93,
-1, 10, -1, 93, 10, -1, 95, -1, 94, 95,
-1, 10, 77, 18, -1, 10, 77, 16, -1, 10,
77, 50, -1, 10, 77, 51, -1, 97, -1, 96,
- 97, -1, 11, 77, 18, 98, -1, 11, 77, 20,
- 98, -1, 11, 77, 19, -1, -1, 98, 99, -1,
- 22, -1, 21, -1, 23, -1, 24, -1, 78, 100,
- 79, -1, 50, -1, 51, -1, 10, -1, 104, 44,
- 20, -1, 104, 45, 104, -1, 11, -1, 11, 25,
- 113, -1, 11, 25, 30, 113, -1, 11, 33, 106,
- -1, 11, 33, 37, 78, 18, 79, -1, -1, -1,
- 35, 112, 10, 33, 101, 105, 76, 102, 78, 100,
- 79, -1, -1, 35, 112, 34, 108, 76, 103, 78,
- 100, 79, -1, 112, 34, 108, -1, 32, 57, 114,
- -1, 71, 100, -1, 100, 53, 100, -1, 100, 52,
- 100, -1, 113, 63, 113, -1, 113, 61, 113, -1,
- 113, 62, 113, -1, 113, 60, 113, -1, 113, 59,
- 113, -1, 113, 57, 113, -1, 113, 58, 113, -1,
- 18, -1, 10, -1, 78, 107, 79, -1, 106, -1,
- 78, 113, 80, 80, 113, 79, -1, 113, -1, 107,
- 81, 113, -1, -1, 78, 109, 110, 79, -1, 36,
- -1, 111, -1, 110, 81, 111, -1, 11, -1, 14,
- -1, 113, -1, 28, -1, 29, -1, 78, 113, 79,
- -1, 26, -1, 27, -1, 38, 78, 113, 79, -1,
- 39, 78, 113, 79, -1, 40, 78, 113, 79, -1,
- 41, 78, 113, 79, -1, 42, 78, 113, 79, -1,
- 43, 78, 113, 79, -1, 16, -1, 12, -1, 13,
- 82, 113, 83, -1, 13, -1, 10, -1, 113, 66,
- 113, -1, 113, 67, 113, -1, 113, 68, 113, -1,
- 113, 69, 113, -1, 113, 70, 113, -1, 113, 56,
- 113, -1, 113, 54, 113, -1, 113, 55, 113, -1,
- 72, 113, -1, 113, 65, 113, -1, 113, 64, 113,
- -1, 47, -1, 48, -1, 49, -1
+ 97, -1, 11, 77, 18, 99, -1, -1, 11, 77,
+ 98, 20, 99, -1, 11, 77, 19, -1, -1, 99,
+ 100, -1, 22, -1, 21, -1, 23, -1, 24, -1,
+ 78, 101, 79, -1, 50, -1, 51, -1, 10, -1,
+ 105, 44, 20, -1, 105, 45, 105, -1, 11, -1,
+ 11, 25, 114, -1, 11, 25, 30, 114, -1, 11,
+ 33, 107, -1, 11, 33, 37, 78, 18, 79, -1,
+ -1, -1, 35, 113, 10, 33, 102, 106, 76, 103,
+ 78, 101, 79, -1, -1, 35, 113, 34, 109, 76,
+ 104, 78, 101, 79, -1, 113, 34, 109, -1, 32,
+ 57, 115, -1, 71, 101, -1, 101, 53, 101, -1,
+ 101, 52, 101, -1, 114, 63, 114, -1, 114, 61,
+ 114, -1, 114, 62, 114, -1, 114, 60, 114, -1,
+ 114, 59, 114, -1, 114, 57, 114, -1, 114, 58,
+ 114, -1, 18, -1, 10, -1, 78, 108, 79, -1,
+ 107, -1, 78, 114, 80, 80, 114, 79, -1, 114,
+ -1, 108, 81, 114, -1, -1, 78, 110, 111, 79,
+ -1, 36, -1, 112, -1, 111, 81, 112, -1, 11,
+ -1, 14, -1, 114, -1, 28, -1, 29, -1, 78,
+ 114, 79, -1, 26, -1, 27, -1, 38, 78, 114,
+ 79, -1, 39, 78, 114, 79, -1, 40, 78, 114,
+ 79, -1, 41, 78, 114, 79, -1, 42, 78, 114,
+ 79, -1, 43, 78, 114, 79, -1, 16, -1, 12,
+ -1, 13, 82, 114, 83, -1, 13, -1, 10, -1,
+ 114, 66, 114, -1, 114, 67, 114, -1, 114, 68,
+ 114, -1, 114, 69, 114, -1, 114, 70, 114, -1,
+ 114, 56, 114, -1, 114, 54, 114, -1, 114, 55,
+ 114, -1, 72, 114, -1, 114, 65, 114, -1, 114,
+ 64, 114, -1, 47, -1, 48, -1, 49, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
@@ -614,15 +615,16 @@ static const yytype_uint16 yyrline[] =
{
0, 159, 159, 160, 161, 162, 166, 183, 184, 212,
216, 244, 248, 249, 253, 254, 258, 259, 274, 284,
- 318, 319, 323, 339, 352, 365, 381, 382, 386, 399,
- 412, 428, 429, 433, 434, 435, 436, 440, 441, 445,
- 449, 479, 514, 518, 529, 540, 544, 555, 561, 598,
- 560, 697, 696, 765, 769, 772, 776, 780, 784, 788,
- 792, 796, 800, 804, 808, 815, 834, 848, 849, 853,
- 857, 858, 862, 861, 866, 873, 874, 877, 882, 889,
- 890, 894, 901, 902, 906, 910, 914, 918, 922, 926,
- 930, 934, 938, 949, 960, 974, 1001, 1005, 1009, 1013,
- 1017, 1021, 1025, 1029, 1033, 1037, 1041, 1047, 1048, 1049
+ 318, 319, 323, 339, 352, 365, 381, 382, 386, 400,
+ 399, 417, 433, 434, 438, 439, 440, 441, 445, 446,
+ 450, 454, 484, 519, 523, 534, 545, 549, 560, 566,
+ 603, 565, 702, 701, 770, 774, 777, 781, 785, 789,
+ 793, 797, 801, 805, 809, 813, 820, 839, 853, 854,
+ 858, 862, 863, 867, 866, 871, 878, 879, 882, 887,
+ 894, 895, 899, 906, 907, 911, 915, 919, 923, 927,
+ 931, 935, 939, 943, 954, 965, 979, 1006, 1010, 1014,
+ 1018, 1022, 1026, 1030, 1034, 1038, 1042, 1046, 1052, 1053,
+ 1054
};
#endif
@@ -647,9 +649,9 @@ static const char *const yytname[] =
"'.'", "','", "'['", "']'", "$accept", "rules", "rule", "meta",
"strings", "condition", "rule_modifiers", "rule_modifier", "tags",
"tag_list", "meta_declarations", "meta_declaration",
- "string_declarations", "string_declaration", "string_modifiers",
- "string_modifier", "boolean_expression", "@1", "@2", "@3", "text",
- "integer_set", "range", "integer_enumeration", "string_set", "@4",
+ "string_declarations", "string_declaration", "@1", "string_modifiers",
+ "string_modifier", "boolean_expression", "@2", "@3", "@4", "text",
+ "integer_set", "range", "integer_enumeration", "string_set", "@5",
"string_enumeration", "string_enumeration_item", "for_expression",
"expression", "type", 0
};
@@ -677,15 +679,16 @@ static const yytype_uint8 yyr1[] =
{
0, 84, 85, 85, 85, 85, 86, 87, 87, 88,
88, 89, 90, 90, 91, 91, 92, 92, 93, 93,
- 94, 94, 95, 95, 95, 95, 96, 96, 97, 97,
- 97, 98, 98, 99, 99, 99, 99, 100, 100, 100,
- 100, 100, 100, 100, 100, 100, 100, 100, 101, 102,
- 100, 103, 100, 100, 100, 100, 100, 100, 100, 100,
- 100, 100, 100, 100, 100, 104, 104, 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, 114, 114, 114
+ 94, 94, 95, 95, 95, 95, 96, 96, 97, 98,
+ 97, 97, 99, 99, 100, 100, 100, 100, 101, 101,
+ 101, 101, 101, 101, 101, 101, 101, 101, 101, 102,
+ 103, 101, 104, 101, 101, 101, 101, 101, 101, 101,
+ 101, 101, 101, 101, 101, 101, 105, 105, 106, 106,
+ 107, 108, 108, 110, 109, 109, 111, 111, 112, 112,
+ 113, 113, 113, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 115, 115,
+ 115
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
@@ -693,15 +696,16 @@ static const yytype_uint8 yyr2[] =
{
0, 2, 0, 2, 3, 3, 9, 0, 3, 0,
3, 3, 0, 2, 1, 1, 0, 2, 1, 2,
- 1, 2, 3, 3, 3, 3, 1, 2, 4, 4,
- 3, 0, 2, 1, 1, 1, 1, 3, 1, 1,
- 1, 3, 3, 1, 3, 4, 3, 6, 0, 0,
- 11, 0, 9, 3, 3, 2, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 1, 1, 3, 1, 6,
- 1, 3, 0, 4, 1, 1, 3, 1, 1, 1,
- 1, 1, 3, 1, 1, 4, 4, 4, 4, 4,
- 4, 1, 1, 4, 1, 1, 3, 3, 3, 3,
- 3, 3, 3, 3, 2, 3, 3, 1, 1, 1
+ 1, 2, 3, 3, 3, 3, 1, 2, 4, 0,
+ 5, 3, 0, 2, 1, 1, 1, 1, 3, 1,
+ 1, 1, 3, 3, 1, 3, 4, 3, 6, 0,
+ 0, 11, 0, 9, 3, 3, 2, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 1, 1, 3, 1,
+ 6, 1, 3, 0, 4, 1, 1, 3, 1, 1,
+ 1, 1, 1, 3, 1, 1, 4, 4, 4, 4,
+ 4, 4, 1, 1, 4, 1, 1, 3, 3, 3,
+ 3, 3, 3, 3, 3, 2, 3, 3, 1, 1,
+ 1
};
/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -713,33 +717,33 @@ static const yytype_uint8 yydefact[] =
15, 13, 16, 0, 0, 18, 17, 7, 19, 0,
9, 0, 0, 0, 0, 8, 20, 0, 0, 0,
0, 21, 0, 10, 26, 0, 6, 23, 22, 24,
- 25, 0, 27, 95, 43, 92, 94, 91, 65, 83,
- 84, 80, 81, 0, 0, 0, 0, 0, 0, 0,
- 0, 38, 39, 0, 0, 0, 11, 0, 0, 79,
- 31, 30, 31, 0, 0, 0, 0, 95, 0, 0,
- 79, 0, 0, 0, 0, 0, 0, 55, 104, 0,
- 79, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 25, 29, 27, 96, 44, 93, 95, 92, 66, 84,
+ 85, 81, 82, 0, 0, 0, 0, 0, 0, 0,
+ 0, 39, 40, 0, 0, 0, 11, 0, 0, 80,
+ 32, 31, 0, 0, 0, 0, 0, 96, 0, 0,
+ 80, 0, 0, 0, 0, 0, 0, 56, 105, 0,
+ 80, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 28, 29, 0, 44, 0, 0, 46,
- 0, 107, 108, 109, 54, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 37, 82, 57, 56, 41, 66,
- 42, 74, 72, 53, 102, 103, 101, 63, 64, 62,
- 61, 59, 60, 58, 106, 105, 96, 97, 98, 99,
- 100, 34, 33, 35, 36, 32, 45, 0, 0, 93,
- 48, 0, 85, 86, 87, 88, 89, 90, 0, 0,
- 0, 0, 51, 77, 78, 0, 75, 47, 0, 0,
- 0, 68, 0, 73, 0, 0, 0, 70, 49, 0,
- 76, 69, 67, 0, 0, 0, 71, 0, 52, 0,
- 50
+ 0, 0, 0, 28, 32, 0, 45, 0, 0, 47,
+ 0, 108, 109, 110, 55, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 38, 83, 58, 57, 42, 67,
+ 43, 75, 73, 54, 103, 104, 102, 64, 65, 63,
+ 62, 60, 61, 59, 107, 106, 97, 98, 99, 100,
+ 101, 35, 34, 36, 37, 33, 30, 46, 0, 0,
+ 94, 49, 0, 86, 87, 88, 89, 90, 91, 0,
+ 0, 0, 0, 52, 78, 79, 0, 76, 48, 0,
+ 0, 0, 69, 0, 74, 0, 0, 0, 71, 50,
+ 0, 77, 70, 68, 0, 0, 0, 72, 0, 53,
+ 0, 51
};
/* YYDEFGOTO[NTERM-NUM]. */
static const yytype_int16 yydefgoto[] =
{
-1, 1, 4, 20, 23, 29, 5, 11, 14, 16,
- 25, 26, 33, 34, 113, 165, 66, 181, 204, 192,
- 67, 190, 119, 196, 143, 178, 185, 186, 68, 69,
- 124
+ 25, 26, 33, 34, 72, 113, 165, 66, 182, 205,
+ 193, 67, 191, 119, 197, 143, 179, 186, 187, 68,
+ 69, 124
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -747,89 +751,88 @@ static const yytype_int16 yydefgoto[] =
#define YYPACT_NINF -77
static const yytype_int16 yypact[] =
{
- -77, 119, -77, -35, -77, 71, -77, -77, 6, -77,
- -77, -77, -43, 30, -12, -77, 50, 73, -77, 23,
- 114, 115, 52, 121, 54, 115, -77, 125, 56, 63,
- -14, -77, 64, 125, -77, 55, -77, -77, -77, -77,
- -77, 173, -77, 25, -7, -77, 69, -77, -77, -77,
- -77, -77, -77, 95, 127, 80, 83, 84, 93, 94,
- 97, -77, -77, 55, 168, 55, 33, 44, 130, 338,
- -77, -77, -77, 147, -15, 168, 149, -77, 168, -9,
- 355, 168, 168, 168, 168, 168, 168, -77, -77, -40,
- 193, 55, 55, 156, 62, -19, 168, 168, 168, 168,
- 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
- 168, 168, 168, 86, 86, 168, 355, 101, 168, -77,
- 47, -77, -77, -77, -77, 166, 150, -19, 210, 227,
- 244, 261, 278, 295, -77, -77, 129, -77, -77, -77,
- -77, -77, -77, -77, 319, 319, 319, 355, 355, 355,
- 355, 355, 355, 355, 78, 78, 169, 169, -77, -77,
- -77, -77, -77, -77, -77, -77, 355, 182, 148, -77,
- -77, 151, -77, -77, -77, -77, -77, -77, 9, 122,
- 143, 146, -77, -77, -77, -76, -77, -77, 168, 168,
- 153, -77, 163, -77, 9, 312, -72, 148, -77, 55,
- -77, -77, -77, 168, 164, -38, 355, 55, -77, 39,
- -77
+ -77, 120, -77, -35, -77, 188, -77, -77, 6, -77,
+ -77, -77, -43, 30, -12, -77, 50, 70, -77, 3,
+ 78, 81, 23, 114, 52, 81, -77, 131, 56, 74,
+ -14, -77, 93, 131, -77, 55, -77, -77, -77, -77,
+ -77, 134, -77, 25, -7, -77, 73, -77, -77, -77,
+ -77, -77, -77, 130, 118, 110, 116, 128, 150, 152,
+ 158, -77, -77, 55, 76, 55, 121, 139, 193, 329,
+ -77, -77, 238, 159, -15, 76, 160, -77, 76, -9,
+ 346, 76, 76, 76, 76, 76, 76, -77, -77, -40,
+ 184, 55, 55, 239, 62, -19, 76, 76, 76, 76,
+ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76,
+ 76, 76, 76, 141, -77, 76, 346, 182, 76, -77,
+ 112, -77, -77, -77, -77, 156, 228, -19, 201, 218,
+ 235, 252, 269, 286, -77, -77, 209, -77, -77, -77,
+ -77, -77, -77, -77, 43, 43, 43, 346, 346, 346,
+ 346, 346, 346, 346, 71, 71, 164, 164, -77, -77,
+ -77, -77, -77, -77, -77, -77, 141, 346, 246, 149,
+ -77, -77, 199, -77, -77, -77, -77, -77, -77, 9,
+ 197, 198, 203, -77, -77, -77, -76, -77, -77, 76,
+ 76, 216, -77, 215, -77, 9, 303, -72, 149, -77,
+ 55, -77, -77, -77, 76, 217, -38, 346, 55, -77,
+ 22, -77
};
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int16 yypgoto[] =
{
- -77, -77, 223, -77, -77, -77, -77, -77, -77, -77,
- -77, 218, -77, 211, 195, -77, -57, -77, -77, -77,
- 174, -77, 88, -77, 144, -77, -77, 76, 219, -54,
- -77
+ -77, -77, 274, -77, -77, -77, -77, -77, -77, -77,
+ -77, 254, -77, 261, -77, 195, -77, -57, -77, -77,
+ -77, 202, -77, 129, -77, 171, -77, -77, 115, 258,
+ -54, -77
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If zero, do what YYDEFACT says.
If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -67
+#define YYTABLE_NINF -68
static const yytype_int16 yytable[] =
{
- 80, 126, 37, 193, 38, 194, 87, 202, 89, 203,
+ 80, 126, 37, 194, 38, 195, 87, 203, 89, 204,
88, 90, 91, 92, 91, 92, 12, 141, 73, 116,
- 183, 120, 117, 184, 125, 127, 74, 128, 129, 130,
+ 184, 120, 117, 185, 125, 127, 74, 128, 129, 130,
131, 132, 133, 13, 136, 137, 39, 40, 6, 134,
- 15, 208, 144, 145, 146, 147, 148, 149, 150, 151,
+ 15, 209, 144, 145, 146, 147, 148, 149, 150, 151,
152, 153, 154, 155, 156, 157, 158, 159, 160, 142,
- 18, 166, 17, 118, 168, 43, 44, 45, 46, -66,
- -66, 47, 139, 48, 8, 9, 10, -40, -40, 19,
- 48, 49, 50, 51, 52, 91, 92, 53, 93, 94,
- 54, 91, 92, 55, 56, 57, 58, 59, 60, 21,
- -40, 96, 97, 98, -40, 61, 62, 161, 162, 163,
- 164, 106, 107, 108, 109, 110, 111, 112, 210, 2,
- 3, 22, -12, -12, -12, 24, 63, 64, 27, 28,
- 169, 30, 35, 65, 195, 197, 32, 77, 36, 45,
- 46, 41, 205, 47, 108, 109, 110, 111, 112, 206,
- 209, 75, 76, 49, 50, 51, 52, 77, 81, 45,
- 46, 82, 83, 47, 95, 55, 56, 57, 58, 59,
- 60, 84, 85, 49, 50, 86, 138, 115, 77, 167,
- 45, 46, 92, 170, 47, 55, 56, 57, 58, 59,
- 60, 70, 71, 72, 49, 50, 121, 122, 123, 64,
- 179, 187, 96, 97, 98, 78, 55, 56, 57, 58,
- 59, 60, 106, 107, 108, 109, 110, 111, 112, 64,
- 96, 97, 98, 188, 189, 78, 7, 182, 180, 198,
- 106, 107, 108, 109, 110, 111, 112, 110, 111, 112,
- 64, 199, 207, 31, 42, 135, 78, 96, 97, 98,
- 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
- 109, 110, 111, 112, 96, 97, 98, 114, 140, 191,
- 200, 171, 135, 79, 106, 107, 108, 109, 110, 111,
- 112, 96, 97, 98, 0, 0, 0, 0, 0, 172,
- 0, 106, 107, 108, 109, 110, 111, 112, 96, 97,
- 98, 0, 0, 0, 0, 0, 173, 0, 106, 107,
- 108, 109, 110, 111, 112, 96, 97, 98, 0, 0,
- 0, 0, 0, 174, 0, 106, 107, 108, 109, 110,
- 111, 112, 96, 97, 98, 0, 0, 0, 0, 0,
- 175, 0, 106, 107, 108, 109, 110, 111, 112, 96,
- 97, 98, 0, 0, 0, 0, 0, 176, 0, 106,
- 107, 108, 109, 110, 111, 112, 96, 97, 98, 0,
- 0, 0, 0, 0, 177, 0, 106, 107, 108, 109,
- 110, 111, 112, 106, 107, 108, 109, 110, 111, 112,
- 0, 201, 96, 97, 98, 99, 100, 101, 102, 103,
- 104, 105, 106, 107, 108, 109, 110, 111, 112, 96,
- 97, 98, 0, 0, 0, 0, 0, 0, 0, 106,
- 107, 108, 109, 110, 111, 112
+ 18, 167, 17, 118, 169, 43, 44, 45, 46, -67,
+ -67, 47, 139, 48, 91, 92, 19, -41, -41, 21,
+ 48, 49, 50, 51, 52, 22, 77, 53, 45, 46,
+ 54, 24, 47, 55, 56, 57, 58, 59, 60, 27,
+ -41, 211, 49, 50, -41, 61, 62, 106, 107, 108,
+ 109, 110, 111, 112, 55, 56, 57, 58, 59, 60,
+ 2, 3, 28, -12, -12, -12, 63, 64, 77, 30,
+ 45, 46, 35, 65, 47, 196, 198, 108, 109, 110,
+ 111, 112, 32, 206, 49, 50, 51, 52, 64, 36,
+ 207, 210, 70, 71, 78, 75, 55, 56, 57, 58,
+ 59, 60, 161, 162, 163, 164, 96, 97, 98, 77,
+ 41, 45, 46, 91, 92, 47, 106, 107, 108, 109,
+ 110, 111, 112, 93, 94, 49, 50, 76, 81, 115,
+ 64, 8, 9, 10, 82, 170, 78, 55, 56, 57,
+ 58, 59, 60, 96, 97, 98, 83, 121, 122, 123,
+ 96, 97, 98, 106, 107, 108, 109, 110, 111, 112,
+ 106, 107, 108, 109, 110, 111, 112, 95, 84, 181,
+ 85, 64, 110, 111, 112, 135, 86, 78, 96, 97,
+ 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
+ 108, 109, 110, 111, 112, 96, 97, 98, 114, 138,
+ 168, 171, 92, 135, 180, 106, 107, 108, 109, 110,
+ 111, 112, 96, 97, 98, 183, 188, 7, 189, 31,
+ 173, 190, 106, 107, 108, 109, 110, 111, 112, 96,
+ 97, 98, 199, 200, 42, 208, 140, 174, 172, 106,
+ 107, 108, 109, 110, 111, 112, 96, 97, 98, 166,
+ 201, 192, 79, 0, 175, 0, 106, 107, 108, 109,
+ 110, 111, 112, 96, 97, 98, 0, 0, 0, 0,
+ 0, 176, 0, 106, 107, 108, 109, 110, 111, 112,
+ 96, 97, 98, 0, 0, 0, 0, 0, 177, 0,
+ 106, 107, 108, 109, 110, 111, 112, 96, 97, 98,
+ 0, 0, 0, 0, 0, 178, 0, 106, 107, 108,
+ 109, 110, 111, 112, 0, 0, 0, 0, 0, 0,
+ 0, 0, 202, 96, 97, 98, 99, 100, 101, 102,
+ 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
+ 96, 97, 98, 0, 0, 0, 0, 0, 0, 0,
+ 106, 107, 108, 109, 110, 111, 112
};
static const yytype_int16 yycheck[] =
@@ -841,42 +844,41 @@ static const yytype_int16 yycheck[] =
10, 79, 96, 97, 98, 99, 100, 101, 102, 103,
104, 105, 106, 107, 108, 109, 110, 111, 112, 78,
10, 115, 74, 78, 118, 10, 11, 12, 13, 44,
- 45, 16, 10, 18, 3, 4, 5, 52, 53, 6,
- 18, 26, 27, 28, 29, 52, 53, 32, 44, 45,
- 35, 52, 53, 38, 39, 40, 41, 42, 43, 76,
- 75, 54, 55, 56, 79, 50, 51, 21, 22, 23,
- 24, 64, 65, 66, 67, 68, 69, 70, 79, 0,
- 1, 7, 3, 4, 5, 10, 71, 72, 76, 8,
- 83, 77, 76, 78, 188, 189, 11, 10, 75, 12,
- 13, 77, 199, 16, 66, 67, 68, 69, 70, 203,
- 207, 82, 57, 26, 27, 28, 29, 10, 78, 12,
- 13, 78, 78, 16, 34, 38, 39, 40, 41, 42,
- 43, 78, 78, 26, 27, 78, 20, 30, 10, 78,
- 12, 13, 53, 33, 16, 38, 39, 40, 41, 42,
- 43, 18, 19, 20, 26, 27, 47, 48, 49, 72,
- 18, 79, 54, 55, 56, 78, 38, 39, 40, 41,
- 42, 43, 64, 65, 66, 67, 68, 69, 70, 72,
- 54, 55, 56, 80, 78, 78, 3, 76, 80, 76,
- 64, 65, 66, 67, 68, 69, 70, 68, 69, 70,
- 72, 78, 78, 25, 33, 79, 78, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 54, 55, 56, 72, 94, 181,
- 194, 127, 79, 54, 64, 65, 66, 67, 68, 69,
- 70, 54, 55, 56, -1, -1, -1, -1, -1, 79,
- -1, 64, 65, 66, 67, 68, 69, 70, 54, 55,
- 56, -1, -1, -1, -1, -1, 79, -1, 64, 65,
- 66, 67, 68, 69, 70, 54, 55, 56, -1, -1,
- -1, -1, -1, 79, -1, 64, 65, 66, 67, 68,
- 69, 70, 54, 55, 56, -1, -1, -1, -1, -1,
- 79, -1, 64, 65, 66, 67, 68, 69, 70, 54,
- 55, 56, -1, -1, -1, -1, -1, 79, -1, 64,
- 65, 66, 67, 68, 69, 70, 54, 55, 56, -1,
- -1, -1, -1, -1, 79, -1, 64, 65, 66, 67,
- 68, 69, 70, 64, 65, 66, 67, 68, 69, 70,
- -1, 79, 54, 55, 56, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, 54,
- 55, 56, -1, -1, -1, -1, -1, -1, -1, 64,
- 65, 66, 67, 68, 69, 70
+ 45, 16, 10, 18, 52, 53, 6, 52, 53, 76,
+ 18, 26, 27, 28, 29, 7, 10, 32, 12, 13,
+ 35, 10, 16, 38, 39, 40, 41, 42, 43, 76,
+ 75, 79, 26, 27, 79, 50, 51, 64, 65, 66,
+ 67, 68, 69, 70, 38, 39, 40, 41, 42, 43,
+ 0, 1, 8, 3, 4, 5, 71, 72, 10, 77,
+ 12, 13, 76, 78, 16, 189, 190, 66, 67, 68,
+ 69, 70, 11, 200, 26, 27, 28, 29, 72, 75,
+ 204, 208, 18, 19, 78, 82, 38, 39, 40, 41,
+ 42, 43, 21, 22, 23, 24, 54, 55, 56, 10,
+ 77, 12, 13, 52, 53, 16, 64, 65, 66, 67,
+ 68, 69, 70, 44, 45, 26, 27, 57, 78, 30,
+ 72, 3, 4, 5, 78, 83, 78, 38, 39, 40,
+ 41, 42, 43, 54, 55, 56, 78, 47, 48, 49,
+ 54, 55, 56, 64, 65, 66, 67, 68, 69, 70,
+ 64, 65, 66, 67, 68, 69, 70, 34, 78, 80,
+ 78, 72, 68, 69, 70, 79, 78, 78, 54, 55,
+ 56, 57, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 54, 55, 56, 20, 20,
+ 78, 33, 53, 79, 18, 64, 65, 66, 67, 68,
+ 69, 70, 54, 55, 56, 76, 79, 3, 80, 25,
+ 79, 78, 64, 65, 66, 67, 68, 69, 70, 54,
+ 55, 56, 76, 78, 33, 78, 94, 79, 127, 64,
+ 65, 66, 67, 68, 69, 70, 54, 55, 56, 114,
+ 195, 182, 54, -1, 79, -1, 64, 65, 66, 67,
+ 68, 69, 70, 54, 55, 56, -1, -1, -1, -1,
+ -1, 79, -1, 64, 65, 66, 67, 68, 69, 70,
+ 54, 55, 56, -1, -1, -1, -1, -1, 79, -1,
+ 64, 65, 66, 67, 68, 69, 70, 54, 55, 56,
+ -1, -1, -1, -1, -1, 79, -1, 64, 65, 66,
+ 67, 68, 69, 70, -1, -1, -1, -1, -1, -1,
+ -1, -1, 79, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 54, 55, 56, -1, -1, -1, -1, -1, -1, -1,
+ 64, 65, 66, 67, 68, 69, 70
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -889,22 +891,22 @@ static const yytype_uint8 yystos[] =
77, 95, 11, 96, 97, 76, 75, 16, 18, 50,
51, 77, 97, 10, 11, 12, 13, 16, 18, 26,
27, 28, 29, 32, 35, 38, 39, 40, 41, 42,
- 43, 50, 51, 71, 72, 78, 100, 104, 112, 113,
- 18, 19, 20, 25, 33, 82, 57, 10, 78, 112,
- 113, 78, 78, 78, 78, 78, 78, 100, 113, 100,
- 113, 52, 53, 44, 45, 34, 54, 55, 56, 57,
+ 43, 50, 51, 71, 72, 78, 101, 105, 113, 114,
+ 18, 19, 98, 25, 33, 82, 57, 10, 78, 113,
+ 114, 78, 78, 78, 78, 78, 78, 101, 114, 101,
+ 114, 52, 53, 44, 45, 34, 54, 55, 56, 57,
58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 98, 98, 30, 113, 37, 78, 106,
- 113, 47, 48, 49, 114, 113, 10, 34, 113, 113,
- 113, 113, 113, 113, 79, 79, 100, 100, 20, 10,
- 104, 36, 78, 108, 113, 113, 113, 113, 113, 113,
- 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
- 113, 21, 22, 23, 24, 99, 113, 78, 113, 83,
- 33, 108, 79, 79, 79, 79, 79, 79, 109, 18,
- 80, 101, 76, 11, 14, 110, 111, 79, 80, 78,
- 105, 106, 103, 79, 81, 113, 107, 113, 76, 78,
- 111, 79, 79, 81, 102, 100, 113, 78, 79, 100,
- 79
+ 68, 69, 70, 99, 20, 30, 114, 37, 78, 107,
+ 114, 47, 48, 49, 115, 114, 10, 34, 114, 114,
+ 114, 114, 114, 114, 79, 79, 101, 101, 20, 10,
+ 105, 36, 78, 109, 114, 114, 114, 114, 114, 114,
+ 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
+ 114, 21, 22, 23, 24, 100, 99, 114, 78, 114,
+ 83, 33, 109, 79, 79, 79, 79, 79, 79, 110,
+ 18, 80, 102, 76, 11, 14, 111, 112, 79, 80,
+ 78, 106, 107, 104, 79, 81, 114, 108, 114, 76,
+ 78, 112, 79, 79, 81, 103, 101, 114, 78, 79,
+ 101, 79
};
#define yyerrok (yyerrstatus = 0)
@@ -1421,47 +1423,47 @@ yydestruct (yymsg, yytype, yyvaluep, yyscanner)
case 10: /* "_IDENTIFIER_" */
#line 138 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1425 "grammar.c"
+#line 1427 "grammar.c"
break;
case 11: /* "_STRING_IDENTIFIER_" */
#line 139 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1430 "grammar.c"
+#line 1432 "grammar.c"
break;
case 12: /* "_STRING_COUNT_" */
#line 140 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1435 "grammar.c"
+#line 1437 "grammar.c"
break;
case 13: /* "_STRING_OFFSET_" */
#line 141 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1440 "grammar.c"
+#line 1442 "grammar.c"
break;
case 14: /* "_STRING_IDENTIFIER_WITH_WILDCARD_" */
#line 142 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1445 "grammar.c"
+#line 1447 "grammar.c"
break;
case 15: /* "_ANONYMOUS_STRING_" */
#line 143 "grammar.y"
{ yr_free((yyvaluep->c_string)); };
-#line 1450 "grammar.c"
+#line 1452 "grammar.c"
break;
case 18: /* "_TEXTSTRING_" */
#line 144 "grammar.y"
{ yr_free((yyvaluep->sized_string)); };
-#line 1455 "grammar.c"
+#line 1457 "grammar.c"
break;
case 19: /* "_HEXSTRING_" */
#line 145 "grammar.y"
{ yr_free((yyvaluep->sized_string)); };
-#line 1460 "grammar.c"
+#line 1462 "grammar.c"
break;
case 20: /* "_REGEXP_" */
#line 146 "grammar.y"
{ yr_free((yyvaluep->sized_string)); };
-#line 1465 "grammar.c"
+#line 1467 "grammar.c"
break;
default:
@@ -2048,21 +2050,29 @@ yyreduce:
case 29:
#line 400 "grammar.y"
{
+ YR_COMPILER* compiler = yyget_extra(yyscanner);
+ compiler->error_line = yyget_lineno(yyscanner);
+ }
+ break;
+
+ case 30:
+#line 405 "grammar.y"
+ {
(yyval.string) = yr_parser_reduce_string_declaration(
yyscanner,
- (yyvsp[(4) - (4)].integer) | STRING_GFLAGS_REGEXP,
- (yyvsp[(1) - (4)].c_string),
- (yyvsp[(3) - (4)].sized_string));
+ (yyvsp[(5) - (5)].integer) | STRING_GFLAGS_REGEXP,
+ (yyvsp[(1) - (5)].c_string),
+ (yyvsp[(4) - (5)].sized_string));
- yr_free((yyvsp[(1) - (4)].c_string));
- yr_free((yyvsp[(3) - (4)].sized_string));
+ yr_free((yyvsp[(1) - (5)].c_string));
+ yr_free((yyvsp[(4) - (5)].sized_string));
ERROR_IF((yyval.string) == NULL);
}
break;
- case 30:
-#line 413 "grammar.y"
+ case 31:
+#line 418 "grammar.y"
{
(yyval.string) = yr_parser_reduce_string_declaration(
yyscanner,
@@ -2077,52 +2087,52 @@ yyreduce:
}
break;
- case 31:
-#line 428 "grammar.y"
+ case 32:
+#line 433 "grammar.y"
{ (yyval.integer) = 0; }
break;
- case 32:
-#line 429 "grammar.y"
+ case 33:
+#line 434 "grammar.y"
{ (yyval.integer) = (yyvsp[(1) - (2)].integer) | (yyvsp[(2) - (2)].integer); }
break;
- case 33:
-#line 433 "grammar.y"
+ case 34:
+#line 438 "grammar.y"
{ (yyval.integer) = STRING_GFLAGS_WIDE; }
break;
- case 34:
-#line 434 "grammar.y"
+ case 35:
+#line 439 "grammar.y"
{ (yyval.integer) = STRING_GFLAGS_ASCII; }
break;
- case 35:
-#line 435 "grammar.y"
+ case 36:
+#line 440 "grammar.y"
{ (yyval.integer) = STRING_GFLAGS_NO_CASE; }
break;
- case 36:
-#line 436 "grammar.y"
+ case 37:
+#line 441 "grammar.y"
{ (yyval.integer) = STRING_GFLAGS_FULL_WORD; }
break;
- case 38:
-#line 442 "grammar.y"
+ case 39:
+#line 447 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, 1, NULL);
}
break;
- case 39:
-#line 446 "grammar.y"
+ case 40:
+#line 451 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, 0, NULL);
}
break;
- case 40:
-#line 450 "grammar.y"
+ case 41:
+#line 455 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
YR_RULE* rule;
@@ -2154,8 +2164,8 @@ yyreduce:
}
break;
- case 41:
-#line 480 "grammar.y"
+ case 42:
+#line 485 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
SIZED_STRING* sized_string = (yyvsp[(3) - (3)].sized_string);
@@ -2192,15 +2202,15 @@ yyreduce:
}
break;
- case 42:
-#line 515 "grammar.y"
+ case 43:
+#line 520 "grammar.y"
{
yr_parser_emit(yyscanner, CONTAINS, NULL);
}
break;
- case 43:
-#line 519 "grammar.y"
+ case 44:
+#line 524 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2213,8 +2223,8 @@ yyreduce:
}
break;
- case 44:
-#line 530 "grammar.y"
+ case 45:
+#line 535 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2227,15 +2237,15 @@ yyreduce:
}
break;
- case 45:
-#line 541 "grammar.y"
+ case 46:
+#line 546 "grammar.y"
{
yr_free((yyvsp[(1) - (4)].c_string));
}
break;
- case 46:
-#line 545 "grammar.y"
+ case 47:
+#line 550 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2248,16 +2258,16 @@ yyreduce:
}
break;
- case 47:
-#line 556 "grammar.y"
+ case 48:
+#line 561 "grammar.y"
{
yr_free((yyvsp[(1) - (6)].c_string));
yr_free((yyvsp[(5) - (6)].sized_string));
}
break;
- case 48:
-#line 561 "grammar.y"
+ case 49:
+#line 566 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int result = ERROR_SUCCESS;
@@ -2296,8 +2306,8 @@ yyreduce:
}
break;
- case 49:
-#line 598 "grammar.y"
+ case 50:
+#line 603 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
@@ -2333,8 +2343,8 @@ yyreduce:
}
break;
- case 50:
-#line 632 "grammar.y"
+ case 51:
+#line 637 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset;
@@ -2401,8 +2411,8 @@ yyreduce:
}
break;
- case 51:
-#line 697 "grammar.y"
+ case 52:
+#line 702 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset = LOOP_LOCAL_VARS * compiler->loop_depth;
@@ -2429,8 +2439,8 @@ yyreduce:
}
break;
- case 52:
-#line 722 "grammar.y"
+ case 53:
+#line 727 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int mem_offset;
@@ -2476,91 +2486,91 @@ yyreduce:
}
break;
- case 53:
-#line 766 "grammar.y"
+ case 54:
+#line 771 "grammar.y"
{
yr_parser_emit(yyscanner, OF, NULL);
}
break;
- case 54:
-#line 770 "grammar.y"
+ case 55:
+#line 775 "grammar.y"
{
}
break;
- case 55:
-#line 773 "grammar.y"
+ case 56:
+#line 778 "grammar.y"
{
yr_parser_emit(yyscanner, NOT, NULL);
}
break;
- case 56:
-#line 777 "grammar.y"
+ case 57:
+#line 782 "grammar.y"
{
yr_parser_emit(yyscanner, AND, NULL);
}
break;
- case 57:
-#line 781 "grammar.y"
+ case 58:
+#line 786 "grammar.y"
{
yr_parser_emit(yyscanner, OR, NULL);
}
break;
- case 58:
-#line 785 "grammar.y"
+ case 59:
+#line 790 "grammar.y"
{
yr_parser_emit(yyscanner, LT, NULL);
}
break;
- case 59:
-#line 789 "grammar.y"
+ case 60:
+#line 794 "grammar.y"
{
yr_parser_emit(yyscanner, GT, NULL);
}
break;
- case 60:
-#line 793 "grammar.y"
+ case 61:
+#line 798 "grammar.y"
{
yr_parser_emit(yyscanner, LE, NULL);
}
break;
- case 61:
-#line 797 "grammar.y"
+ case 62:
+#line 802 "grammar.y"
{
yr_parser_emit(yyscanner, GE, NULL);
}
break;
- case 62:
-#line 801 "grammar.y"
+ case 63:
+#line 806 "grammar.y"
{
yr_parser_emit(yyscanner, EQ, NULL);
}
break;
- case 63:
-#line 805 "grammar.y"
+ case 64:
+#line 810 "grammar.y"
{
yr_parser_emit(yyscanner, EQ, NULL);
}
break;
- case 64:
-#line 809 "grammar.y"
+ case 65:
+#line 814 "grammar.y"
{
yr_parser_emit(yyscanner, NEQ, NULL);
}
break;
- case 65:
-#line 816 "grammar.y"
+ case 66:
+#line 821 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
SIZED_STRING* sized_string = (yyvsp[(1) - (1)].sized_string);
@@ -2581,8 +2591,8 @@ yyreduce:
}
break;
- case 66:
-#line 835 "grammar.y"
+ case 67:
+#line 840 "grammar.y"
{
int result = yr_parser_reduce_external(
yyscanner,
@@ -2595,126 +2605,126 @@ yyreduce:
}
break;
- case 67:
-#line 848 "grammar.y"
+ case 68:
+#line 853 "grammar.y"
{ (yyval.integer) = INTEGER_SET_ENUMERATION; }
break;
- case 68:
-#line 849 "grammar.y"
+ case 69:
+#line 854 "grammar.y"
{ (yyval.integer) = INTEGER_SET_RANGE; }
break;
- case 72:
-#line 862 "grammar.y"
+ case 73:
+#line 867 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
}
break;
- case 74:
-#line 867 "grammar.y"
+ case 75:
+#line 872 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
yr_parser_emit_pushes_for_strings(yyscanner, "$*");
}
break;
- case 77:
-#line 878 "grammar.y"
+ case 78:
+#line 883 "grammar.y"
{
yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
yr_free((yyvsp[(1) - (1)].c_string));
}
break;
- case 78:
-#line 883 "grammar.y"
+ case 79:
+#line 888 "grammar.y"
{
yr_parser_emit_pushes_for_strings(yyscanner, (yyvsp[(1) - (1)].c_string));
yr_free((yyvsp[(1) - (1)].c_string));
}
break;
- case 80:
-#line 891 "grammar.y"
+ case 81:
+#line 896 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, UNDEFINED, NULL);
}
break;
- case 81:
-#line 895 "grammar.y"
+ case 82:
+#line 900 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, 1, NULL);
}
break;
- case 83:
-#line 903 "grammar.y"
+ case 84:
+#line 908 "grammar.y"
{
yr_parser_emit(yyscanner, SIZE, NULL);
}
break;
- case 84:
-#line 907 "grammar.y"
+ case 85:
+#line 912 "grammar.y"
{
yr_parser_emit(yyscanner, ENTRYPOINT, NULL);
}
break;
- case 85:
-#line 911 "grammar.y"
+ case 86:
+#line 916 "grammar.y"
{
yr_parser_emit(yyscanner, INT8, NULL);
}
break;
- case 86:
-#line 915 "grammar.y"
+ case 87:
+#line 920 "grammar.y"
{
yr_parser_emit(yyscanner, INT16, NULL);
}
break;
- case 87:
-#line 919 "grammar.y"
+ case 88:
+#line 924 "grammar.y"
{
yr_parser_emit(yyscanner, INT32, NULL);
}
break;
- case 88:
-#line 923 "grammar.y"
+ case 89:
+#line 928 "grammar.y"
{
yr_parser_emit(yyscanner, UINT8, NULL);
}
break;
- case 89:
-#line 927 "grammar.y"
+ case 90:
+#line 932 "grammar.y"
{
yr_parser_emit(yyscanner, UINT16, NULL);
}
break;
- case 90:
-#line 931 "grammar.y"
+ case 91:
+#line 936 "grammar.y"
{
yr_parser_emit(yyscanner, UINT32, NULL);
}
break;
- case 91:
-#line 935 "grammar.y"
+ case 92:
+#line 940 "grammar.y"
{
yr_parser_emit_with_arg(yyscanner, PUSH, (yyvsp[(1) - (1)].integer), NULL);
}
break;
- case 92:
-#line 939 "grammar.y"
+ case 93:
+#line 944 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2727,8 +2737,8 @@ yyreduce:
}
break;
- case 93:
-#line 950 "grammar.y"
+ case 94:
+#line 955 "grammar.y"
{
int result = yr_parser_reduce_string_identifier(
yyscanner,
@@ -2741,8 +2751,8 @@ yyreduce:
}
break;
- case 94:
-#line 961 "grammar.y"
+ case 95:
+#line 966 "grammar.y"
{
int result = yr_parser_emit_with_arg(yyscanner, PUSH, 1, NULL);
@@ -2758,8 +2768,8 @@ yyreduce:
}
break;
- case 95:
-#line 975 "grammar.y"
+ case 96:
+#line 980 "grammar.y"
{
YR_COMPILER* compiler = yyget_extra(yyscanner);
int var_index;
@@ -2788,78 +2798,78 @@ yyreduce:
}
break;
- case 96:
-#line 1002 "grammar.y"
+ case 97:
+#line 1007 "grammar.y"
{
yr_parser_emit(yyscanner, ADD, NULL);
}
break;
- case 97:
-#line 1006 "grammar.y"
+ case 98:
+#line 1011 "grammar.y"
{
yr_parser_emit(yyscanner, SUB, NULL);
}
break;
- case 98:
-#line 1010 "grammar.y"
+ case 99:
+#line 1015 "grammar.y"
{
yr_parser_emit(yyscanner, MUL, NULL);
}
break;
- case 99:
-#line 1014 "grammar.y"
+ case 100:
+#line 1019 "grammar.y"
{
yr_parser_emit(yyscanner, DIV, NULL);
}
break;
- case 100:
-#line 1018 "grammar.y"
+ case 101:
+#line 1023 "grammar.y"
{
yr_parser_emit(yyscanner, MOD, NULL);
}
break;
- case 101:
-#line 1022 "grammar.y"
+ case 102:
+#line 1027 "grammar.y"
{
yr_parser_emit(yyscanner, XOR, NULL);
}
break;
- case 102:
-#line 1026 "grammar.y"
+ case 103:
+#line 1031 "grammar.y"
{
yr_parser_emit(yyscanner, AND, NULL);
}
break;
- case 103:
-#line 1030 "grammar.y"
+ case 104:
+#line 1035 "grammar.y"
{
yr_parser_emit(yyscanner, OR, NULL);
}
break;
- case 104:
-#line 1034 "grammar.y"
+ case 105:
+#line 1039 "grammar.y"
{
yr_parser_emit(yyscanner, NEG, NULL);
}
break;
- case 105:
-#line 1038 "grammar.y"
+ case 106:
+#line 1043 "grammar.y"
{
yr_parser_emit(yyscanner, SHL, NULL);
}
break;
- case 106:
-#line 1042 "grammar.y"
+ case 107:
+#line 1047 "grammar.y"
{
yr_parser_emit(yyscanner, SHR, NULL);
}
@@ -2867,7 +2877,7 @@ yyreduce:
/* Line 1267 of yacc.c. */
-#line 2871 "grammar.c"
+#line 2881 "grammar.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -3081,7 +3091,7 @@ yyreturn:
}
-#line 1052 "grammar.y"
+#line 1057 "grammar.y"
diff --git a/libyara/grammar.y b/libyara/grammar.y
index 7c5f2b2..049c2bc 100644
--- a/libyara/grammar.y
+++ b/libyara/grammar.y
@@ -396,16 +396,21 @@ string_declaration : _STRING_IDENTIFIER_ '=' _TEXTSTRING_ string_modifiers
ERROR_IF($$ == NULL);
}
- | _STRING_IDENTIFIER_ '=' _REGEXP_ string_modifiers
+ | _STRING_IDENTIFIER_ '='
+ {
+ YR_COMPILER* compiler = yyget_extra(yyscanner);
+ compiler->error_line = yyget_lineno(yyscanner);
+ }
+ _REGEXP_ string_modifiers
{
$$ = yr_parser_reduce_string_declaration(
yyscanner,
- $4 | STRING_GFLAGS_REGEXP,
+ $5 | STRING_GFLAGS_REGEXP,
$1,
- $3);
+ $4);
yr_free($1);
- yr_free($3);
+ yr_free($4);
ERROR_IF($$ == NULL);
}
diff --git a/libyara/lexer.c b/libyara/lexer.c
index a31794a..5c34846 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -47,7 +47,6 @@ 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;
@@ -358,7 +357,7 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*/
#define YY_DO_BEFORE_ACTION \
yyg->yytext_ptr = yy_bp; \
- yyleng = (yy_size_t) (yy_cp - yy_bp); \
+ yyleng = (size_t) (yy_cp - yy_bp); \
yyg->yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
@@ -680,7 +679,7 @@ limitations under the License.
-#line 684 "lexer.c"
+#line 683 "lexer.c"
#define INITIAL 0
#define str 1
@@ -918,7 +917,7 @@ YY_DECL
#line 79 "lexer.l"
-#line 922 "lexer.c"
+#line 921 "lexer.c"
yylval = yylval_param;
@@ -1695,7 +1694,7 @@ YY_RULE_SETUP
#line 496 "lexer.l"
ECHO;
YY_BREAK
-#line 1699 "lexer.c"
+#line 1698 "lexer.c"
case YY_END_OF_BUFFER:
{
@@ -2846,7 +2845,13 @@ void yyerror(yyscan_t yyscanner, const char *error_message)
*/
compiler->errors++;
- compiler->last_error_line = yara_yyget_lineno(yyscanner);
+
+ if (compiler->error_line != 0)
+ compiler->last_error_line = compiler->error_line;
+ else
+ compiler->last_error_line = yara_yyget_lineno(yyscanner);
+
+ compiler->error_line = 0;
if (compiler->file_name_stack_ptr > 0)
{
diff --git a/libyara/lexer.l b/libyara/lexer.l
index 4259756..2654c1d 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -509,7 +509,13 @@ void yyerror(yyscan_t yyscanner, const char *error_message)
*/
compiler->errors++;
- compiler->last_error_line = yyget_lineno(yyscanner);
+
+ if (compiler->error_line != 0)
+ compiler->last_error_line = compiler->error_line;
+ else
+ compiler->last_error_line = yyget_lineno(yyscanner);
+
+ compiler->error_line = 0;
if (compiler->file_name_stack_ptr > 0)
{
diff --git a/libyara/yara.h b/libyara/yara.h
index 2acb72e..b634cc7 100644
--- a/libyara/yara.h
+++ b/libyara/yara.h
@@ -509,6 +509,7 @@ typedef struct _YR_COMPILER
int last_result;
YR_REPORT_FUNC error_report_function;
int errors;
+ int error_line;
int last_error;
int last_error_line;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git
More information about the forensics-changes
mailing list