[Forensics-changes] [yara] 288/368: Extend the lexer to accept hex strings with inline comments.
Hilko Bengen
bengen at moszumanska.debian.org
Sat Jul 1 10:30:49 UTC 2017
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag v3.5.0
in repository yara.
commit 6e28b4ba02c9f3c898cb4738d743f82fd63fc613
Author: Christian Blichmann <cblichmann at google.com>
Date: Tue May 31 13:31:13 2016 +0200
Extend the lexer to accept hex strings with inline comments.
Example:
$hex1 = { 31 32 [-] // Inline comment
38 39 }
$hex2 = { 31 32 /* Inline comment */ [-] 38 39 }
$hex3 = { 31 32 /* Inline multi-line
comment */ [-] 38 39 }
---
libyara/hex_lexer.c | 166 ++++++++++++----------
libyara/hex_lexer.l | 5 +
libyara/lexer.c | 391 ++++++++++++++++++++++++++++++----------------------
libyara/lexer.l | 4 +-
tests/test-rules.c | 20 +++
5 files changed, 350 insertions(+), 236 deletions(-)
diff --git a/libyara/hex_lexer.c b/libyara/hex_lexer.c
index 58d1a36..b977b34 100644
--- a/libyara/hex_lexer.c
+++ b/libyara/hex_lexer.c
@@ -243,7 +243,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
- yy_size_t yy_n_chars;
+ int 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
@@ -381,8 +381,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
*yy_cp = '\0'; \
yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 14
-#define YY_END_OF_BUFFER 15
+#define YY_NUM_RULES 16
+#define YY_END_OF_BUFFER 17
/* This struct is not used in this scanner,
but its presence is necessary. */
struct yy_trans_info
@@ -390,11 +390,12 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[25] =
+static yyconst flex_int16_t yy_accept[35] =
{ 0,
- 0, 0, 0, 0, 15, 13, 11, 11, 12, 13,
- 13, 5, 10, 9, 9, 6, 7, 8, 1, 2,
- 3, 4, 7, 0
+ 0, 0, 0, 0, 0, 0, 17, 15, 13, 13,
+ 14, 15, 15, 15, 5, 16, 12, 11, 11, 8,
+ 9, 10, 0, 7, 1, 2, 3, 4, 9, 0,
+ 0, 7, 6, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
@@ -403,14 +404,14 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 1, 1, 1, 1, 1, 1, 1, 4,
- 4, 1, 1, 1, 5, 1, 1, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 1, 1, 1,
- 1, 1, 7, 1, 8, 8, 8, 8, 8, 8,
+ 4, 5, 1, 1, 6, 1, 7, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
+ 1, 1, 9, 1, 10, 10, 10, 10, 10, 10,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 9, 1, 10, 1, 1, 1, 8, 8, 8, 8,
+ 11, 1, 12, 1, 1, 1, 10, 10, 10, 10,
- 8, 8, 1, 1, 1, 1, 1, 1, 1, 1,
+ 10, 10, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 4, 4, 4, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -429,45 +430,52 @@ static yyconst YY_CHAR yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst YY_CHAR yy_meta[11] =
+static yyconst YY_CHAR yy_meta[13] =
{ 0,
- 1, 1, 1, 1, 1, 2, 2, 2, 1, 1
+ 1, 1, 2, 1, 1, 1, 1, 3, 3, 3,
+ 1, 1
} ;
-static yyconst flex_uint16_t yy_base[27] =
+static yyconst flex_uint16_t yy_base[40] =
{ 0,
- 0, 0, 10, 0, 27, 28, 28, 28, 28, 19,
- 18, 28, 28, 28, 28, 28, 18, 28, 28, 28,
- 28, 28, 17, 28, 20, 19
+ 0, 0, 0, 0, 12, 0, 46, 47, 47, 47,
+ 47, 20, 36, 35, 47, 47, 47, 47, 47, 47,
+ 35, 47, 37, 0, 47, 47, 47, 47, 33, 35,
+ 23, 0, 33, 47, 30, 26, 23, 33, 36
} ;
-static yyconst flex_int16_t yy_def[27] =
+static yyconst flex_int16_t yy_def[40] =
{ 0,
- 24, 1, 24, 3, 24, 24, 24, 24, 24, 25,
- 26, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 0, 24, 24
+ 34, 1, 35, 35, 34, 5, 34, 34, 34, 34,
+ 34, 34, 36, 37, 34, 34, 34, 34, 34, 34,
+ 34, 34, 38, 39, 34, 34, 34, 34, 34, 38,
+ 38, 39, 38, 0, 34, 34, 34, 34, 34
} ;
-static yyconst flex_uint16_t yy_nxt[39] =
+static yyconst flex_uint16_t yy_nxt[60] =
{ 0,
- 6, 7, 8, 9, 6, 10, 11, 10, 12, 6,
- 13, 14, 15, 13, 16, 17, 13, 13, 13, 18,
- 21, 19, 23, 23, 22, 20, 24, 5, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24
+ 8, 9, 10, 11, 8, 8, 12, 13, 14, 13,
+ 15, 8, 17, 18, 19, 17, 17, 20, 17, 21,
+ 17, 17, 17, 22, 23, 27, 24, 31, 25, 33,
+ 16, 16, 16, 30, 30, 30, 32, 31, 32, 31,
+ 29, 31, 29, 28, 26, 34, 7, 34, 34, 34,
+ 34, 34, 34, 34, 34, 34, 34, 34, 34
} ;
-static yyconst flex_int16_t yy_chk[39] =
+static yyconst flex_int16_t yy_chk[60] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 26, 25, 23, 17, 11, 10, 5, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 24, 24
+ 1, 1, 5, 5, 5, 5, 5, 5, 5, 5,
+ 5, 5, 5, 5, 12, 37, 12, 31, 36, 31,
+ 35, 35, 35, 38, 38, 38, 39, 33, 39, 30,
+ 29, 23, 21, 14, 13, 7, 34, 34, 34, 34,
+ 34, 34, 34, 34, 34, 34, 34, 34, 34
} ;
/* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[15] =
+static yyconst flex_int32_t yy_rule_can_match_eol[17] =
{ 0,
-0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, };
+0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, };
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@@ -535,10 +543,12 @@ with noyywrap then we can remove this pragma.
#define YY_NO_UNISTD_H 1
#define YY_NO_INPUT 1
-#line 539 "hex_lexer.c"
+
+#line 548 "hex_lexer.c"
#define INITIAL 0
-#define range 1
+#define comment 1
+#define range 2
#ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way
@@ -565,7 +575,7 @@ 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;
- yy_size_t yy_n_chars;
+ int yy_n_chars;
yy_size_t yyleng_r;
char *yy_c_buf_p;
int yy_init;
@@ -809,11 +819,11 @@ YY_DECL
}
{
-#line 80 "hex_lexer.l"
+#line 81 "hex_lexer.l"
-#line 817 "hex_lexer.c"
+#line 827 "hex_lexer.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -840,13 +850,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 >= 25 )
+ if ( yy_current_state >= 35 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 24 );
+ while ( yy_current_state != 34 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -880,7 +890,7 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
YY_RULE_SETUP
-#line 83 "hex_lexer.l"
+#line 84 "hex_lexer.l"
{
yylval->integer = xtoi(yytext);
@@ -889,7 +899,7 @@ YY_RULE_SETUP
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 89 "hex_lexer.l"
+#line 90 "hex_lexer.l"
{
yytext[1] = '0'; // replace ? by 0
@@ -899,7 +909,7 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 96 "hex_lexer.l"
+#line 97 "hex_lexer.l"
{
yytext[0] = '0'; // replace ? by 0
@@ -909,7 +919,7 @@ YY_RULE_SETUP
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 103 "hex_lexer.l"
+#line 104 "hex_lexer.l"
{
yylval->integer = 0x0000;
@@ -918,7 +928,7 @@ YY_RULE_SETUP
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 109 "hex_lexer.l"
+#line 110 "hex_lexer.l"
{
BEGIN(range);
@@ -926,75 +936,87 @@ YY_RULE_SETUP
}
YY_BREAK
case 6:
+/* rule 6 can match eol */
+YY_RULE_SETUP
+#line 116 "hex_lexer.l"
+// skip comments
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 118 "hex_lexer.l"
+// skip single-line comments
+ YY_BREAK
+case 8:
YY_RULE_SETUP
-#line 115 "hex_lexer.l"
+#line 120 "hex_lexer.l"
{
return yytext[0];
}
YY_BREAK
-case 7:
+case 9:
YY_RULE_SETUP
-#line 119 "hex_lexer.l"
+#line 124 "hex_lexer.l"
{
yylval->integer = atoi(yytext);
return _NUMBER_;
}
YY_BREAK
-case 8:
+case 10:
YY_RULE_SETUP
-#line 125 "hex_lexer.l"
+#line 130 "hex_lexer.l"
{
BEGIN(INITIAL);
return yytext[0];
}
YY_BREAK
-case 9:
-/* rule 9 can match eol */
+case 11:
+/* rule 11 can match eol */
YY_RULE_SETUP
-#line 131 "hex_lexer.l"
+#line 136 "hex_lexer.l"
// skip whitespaces
YY_BREAK
-case 10:
+case 12:
YY_RULE_SETUP
-#line 133 "hex_lexer.l"
+#line 138 "hex_lexer.l"
{
yyerror(yyscanner, lex_env, "invalid character in hex string jump");
yyterminate();
}
YY_BREAK
-case 11:
-/* rule 11 can match eol */
+case 13:
+/* rule 13 can match eol */
YY_RULE_SETUP
-#line 139 "hex_lexer.l"
+#line 144 "hex_lexer.l"
// skip whitespaces
YY_BREAK
-case 12:
+case 14:
YY_RULE_SETUP
-#line 141 "hex_lexer.l"
+#line 146 "hex_lexer.l"
{ // pass valid characters to the parser
return yytext[0];
}
YY_BREAK
-case 13:
+case 15:
YY_RULE_SETUP
-#line 146 "hex_lexer.l"
+#line 151 "hex_lexer.l"
{ // reject all other characters
yyerror(yyscanner, lex_env, "invalid character in hex string");
yyterminate();
}
YY_BREAK
-case 14:
+case 16:
YY_RULE_SETUP
-#line 152 "hex_lexer.l"
+#line 157 "hex_lexer.l"
ECHO;
YY_BREAK
-#line 997 "hex_lexer.c"
+#line 1018 "hex_lexer.c"
case YY_STATE_EOF(INITIAL):
+case YY_STATE_EOF(comment):
case YY_STATE_EOF(range):
yyterminate();
@@ -1252,9 +1274,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+ int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) hex_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()" );
@@ -1290,7 +1312,7 @@ 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 >= 25 )
+ if ( yy_current_state >= 35 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -1319,11 +1341,11 @@ 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 >= 25 )
+ if ( yy_current_state >= 35 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 24);
+ yy_is_jam = (yy_current_state == 34);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
@@ -1654,7 +1676,7 @@ static void hex_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...
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
yyg->yy_buffer_stack = (struct yy_buffer_state**)hex_yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
@@ -2145,7 +2167,7 @@ void hex_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 152 "hex_lexer.l"
+#line 157 "hex_lexer.l"
diff --git a/libyara/hex_lexer.l b/libyara/hex_lexer.l
index 5756390..99ea58b 100644
--- a/libyara/hex_lexer.l
+++ b/libyara/hex_lexer.l
@@ -75,6 +75,7 @@ digit [0-9]
letter [a-zA-Z]
hexdigit [a-fA-F0-9]
+%x comment
%x range
%%
@@ -112,6 +113,10 @@ hexdigit [a-fA-F0-9]
return yytext[0];
}
+"/*"(.|\n)*"*/" // skip comments
+
+"//".* // skip single-line comments
+
<range>\- {
return yytext[0];
}
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 4a8ce2b..fec474a 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -243,7 +243,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
- yy_size_t yy_n_chars;
+ int 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
@@ -390,7 +390,7 @@ struct yy_trans_info
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
};
-static yyconst flex_int16_t yy_accept[218] =
+static yyconst flex_int16_t yy_accept[243] =
{ 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
74, 72, 71, 71, 48, 68, 46, 45, 72, 69,
@@ -403,19 +403,22 @@ static yyconst flex_int16_t yy_accept[218] =
50, 50, 50, 50, 50, 50, 50, 26, 50, 50,
50, 27, 24, 50, 50, 50, 50, 50, 50, 50,
- 0, 60, 62, 57, 58, 56, 55, 62, 66, 63,
- 63, 65, 64, 42, 38, 40, 52, 51, 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, 70, 0, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 49, 50,
- 13, 50, 50, 12, 50, 28, 20, 16, 59, 15,
- 50, 50, 50, 21, 50, 50, 50, 50, 50, 50,
- 50, 50, 50, 50, 50, 50, 50, 50, 50, 11,
- 36, 50, 49, 50, 18, 50, 50, 50, 50, 50,
-
- 50, 50, 50, 34, 10, 14, 50, 35, 50, 33,
- 17, 0, 19, 50, 41, 32, 0
+ 0, 0, 60, 62, 57, 58, 56, 55, 62, 66,
+ 63, 63, 65, 64, 42, 38, 40, 52, 51, 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, 70, 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, 70, 59, 15, 50,
+ 50, 50, 21, 50, 50, 50, 50, 50, 50, 50,
+ 50, 50, 50, 0, 0, 50, 50, 50, 50, 50,
+
+ 11, 36, 50, 49, 50, 18, 50, 50, 0, 0,
+ 0, 0, 0, 70, 50, 50, 50, 50, 50, 50,
+ 34, 10, 14, 0, 70, 0, 0, 0, 50, 35,
+ 50, 33, 17, 0, 0, 0, 0, 19, 50, 41,
+ 32, 0
} ;
static yyconst YY_CHAR yy_ec[256] =
@@ -460,67 +463,73 @@ static yyconst YY_CHAR yy_meta[56] =
12, 11, 11, 1, 1
} ;
-static yyconst flex_uint16_t yy_base[238] =
+static yyconst flex_uint16_t yy_base[266] =
{ 0,
- 0, 0, 53, 54, 55, 58, 392, 391, 386, 385,
- 394, 399, 399, 399, 372, 399, 0, 382, 380, 52,
- 52, 58, 45, 369, 50, 0, 0, 48, 346, 346,
- 50, 347, 32, 61, 343, 32, 340, 336, 336, 59,
- 343, 342, 0, 0, 399, 399, 70, 0, 399, 61,
- 368, 0, 399, 399, 367, 357, 399, 0, 399, 367,
- 399, 399, 0, 109, 0, 351, 350, 0, 399, 399,
- 399, 399, 399, 0, 0, 334, 67, 340, 0, 330,
- 324, 330, 329, 323, 327, 323, 321, 58, 317, 316,
- 69, 0, 0, 323, 321, 315, 324, 310, 315, 322,
-
- 300, 0, 399, 399, 399, 399, 399, 0, 0, 308,
- 399, 399, 399, 0, 399, 0, 116, 399, 0, 0,
- 0, 0, 314, 102, 307, 305, 315, 0, 309, 316,
- 304, 306, 92, 312, 313, 312, 0, 293, 306, 301,
- 298, 303, 290, 301, 399, 0, 296, 295, 302, 280,
- 296, 283, 276, 292, 266, 251, 267, 262, 241, 211,
- 0, 202, 213, 0, 200, 0, 0, 0, 399, 0,
- 194, 201, 195, 0, 194, 185, 185, 177, 189, 186,
- 181, 179, 166, 171, 109, 105, 103, 92, 99, 0,
- 0, 108, 0, 96, 0, 106, 94, 96, 92, 98,
-
- 85, 84, 113, 0, 0, 0, 71, 0, 36, 0,
- 0, 108, 0, 28, 399, 0, 399, 149, 162, 175,
- 188, 194, 199, 207, 214, 219, 224, 235, 245, 257,
- 270, 282, 295, 308, 314, 317, 320
+ 0, 0, 53, 54, 55, 58, 343, 342, 337, 330,
+ 339, 640, 640, 640, 317, 640, 0, 327, 325, 52,
+ 52, 58, 45, 312, 50, 0, 0, 48, 289, 289,
+ 50, 290, 32, 61, 278, 32, 273, 269, 269, 59,
+ 276, 275, 298, 0, 640, 640, 70, 0, 640, 61,
+ 297, 0, 640, 640, 296, 286, 640, 0, 640, 296,
+ 640, 640, 0, 109, 0, 280, 279, 0, 640, 640,
+ 640, 640, 640, 0, 0, 263, 67, 269, 0, 259,
+ 253, 259, 258, 252, 256, 252, 250, 58, 246, 239,
+ 69, 0, 0, 246, 244, 238, 247, 231, 236, 243,
+
+ 63, 96, 0, 640, 640, 640, 640, 640, 0, 0,
+ 230, 640, 640, 640, 0, 640, 0, 116, 640, 0,
+ 0, 0, 0, 228, 102, 219, 217, 227, 0, 221,
+ 228, 213, 215, 123, 221, 222, 221, 0, 202, 215,
+ 210, 207, 212, 199, 210, 640, 234, 148, 0, 204,
+ 203, 210, 188, 204, 186, 181, 199, 184, 180, 207,
+ 209, 191, 184, 0, 167, 181, 0, 168, 0, 0,
+ 0, 199, 196, 202, 0, 101, 0, 640, 0, 160,
+ 167, 158, 0, 162, 157, 159, 151, 163, 161, 160,
+ 159, 146, 155, 256, 128, 152, 148, 146, 135, 142,
+
+ 0, 0, 151, 0, 139, 0, 143, 131, 310, 0,
+ 364, 164, 131, 0, 132, 128, 132, 135, 135, 166,
+ 0, 0, 0, 134, 149, 135, 136, 142, 78, 0,
+ 73, 0, 0, 108, 143, 0, 146, 0, 31, 640,
+ 0, 640, 419, 432, 445, 458, 464, 469, 477, 484,
+ 489, 494, 505, 515, 527, 540, 552, 565, 578, 584,
+ 587, 597, 610, 616, 626
} ;
-static yyconst flex_int16_t yy_def[238] =
+static yyconst flex_int16_t yy_def[266] =
{ 0,
- 217, 1, 218, 218, 219, 219, 220, 220, 221, 221,
- 217, 217, 217, 217, 222, 217, 223, 224, 217, 217,
- 225, 225, 217, 217, 217, 226, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 228, 229, 217, 217, 230, 231, 217, 217,
- 232, 233, 217, 217, 217, 222, 217, 223, 217, 224,
- 217, 217, 234, 217, 22, 217, 217, 235, 217, 217,
- 217, 217, 217, 226, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
-
- 228, 229, 217, 217, 217, 217, 217, 236, 231, 217,
- 217, 217, 217, 233, 217, 234, 217, 217, 235, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 217, 237, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 217, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
-
- 227, 227, 227, 227, 227, 227, 227, 227, 227, 227,
- 227, 217, 227, 227, 217, 227, 0, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217
+ 242, 1, 243, 243, 244, 244, 245, 245, 246, 246,
+ 242, 242, 242, 242, 247, 242, 248, 249, 242, 242,
+ 250, 250, 242, 242, 242, 251, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 253, 254, 242, 242, 255, 256, 242, 242,
+ 257, 258, 242, 242, 242, 247, 242, 248, 242, 249,
+ 242, 242, 259, 242, 22, 242, 242, 260, 242, 242,
+ 242, 242, 242, 251, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+
+ 253, 242, 254, 242, 242, 242, 242, 242, 261, 256,
+ 242, 242, 242, 242, 258, 242, 259, 242, 242, 260,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 242, 262, 263, 264, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 262, 242, 263, 174, 174, 174, 242, 252, 252,
+ 252, 252, 252, 252, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 265, 174, 252, 252, 252, 252, 252,
+
+ 252, 252, 252, 252, 252, 252, 252, 252, 265, 209,
+ 262, 174, 209, 209, 252, 252, 252, 252, 252, 252,
+ 252, 252, 252, 262, 262, 174, 209, 209, 252, 252,
+ 252, 252, 252, 242, 262, 209, 209, 252, 252, 242,
+ 252, 0, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242
} ;
-static yyconst flex_uint16_t yy_nxt[455] =
+static yyconst flex_uint16_t yy_nxt[696] =
{ 0,
12, 13, 14, 13, 15, 16, 17, 18, 12, 12,
19, 20, 21, 22, 22, 22, 22, 22, 22, 23,
@@ -529,52 +538,79 @@ static yyconst flex_uint16_t yy_nxt[455] =
34, 35, 36, 37, 38, 39, 40, 41, 27, 42,
27, 27, 27, 43, 12, 45, 45, 49, 46, 46,
49, 62, 64, 63, 69, 70, 50, 92, 64, 50,
- 72, 73, 87, 88, 216, 104, 93, 214, 66, 67,
+ 72, 73, 87, 88, 102, 105, 93, 241, 66, 67,
82, 47, 47, 51, 66, 67, 51, 76, 83, 77,
- 132, 89, 84, 78, 79, 90, 97, 85, 105, 110,
-
- 121, 136, 68, 98, 133, 157, 111, 158, 217, 212,
- 159, 106, 213, 215, 212, 137, 107, 211, 122, 210,
- 108, 117, 117, 117, 117, 117, 117, 117, 117, 117,
- 117, 117, 117, 117, 117, 148, 209, 208, 207, 206,
- 205, 204, 203, 202, 201, 200, 199, 198, 149, 44,
+ 133, 89, 84, 78, 79, 90, 97, 85, 106, 111,
+
+ 122, 137, 68, 98, 134, 147, 112, 148, 242, 234,
+ 194, 107, 195, 240, 239, 138, 108, 146, 123, 238,
+ 109, 118, 118, 118, 118, 118, 118, 118, 118, 118,
+ 118, 118, 118, 118, 118, 151, 160, 194, 161, 195,
+ 227, 162, 228, 235, 194, 236, 195, 237, 152, 175,
+ 101, 227, 173, 228, 211, 227, 175, 228, 173, 176,
+ 175, 175, 175, 175, 175, 175, 175, 234, 233, 232,
+ 231, 175, 175, 230, 229, 226, 223, 222, 175, 175,
+ 175, 175, 175, 175, 221, 220, 219, 218, 217, 216,
+ 215, 208, 207, 206, 205, 204, 203, 202, 201, 200,
+
+ 199, 198, 177, 175, 101, 197, 196, 101, 173, 193,
+ 175, 192, 191, 176, 175, 175, 175, 175, 175, 175,
+ 175, 190, 189, 162, 162, 175, 175, 188, 187, 186,
+ 185, 184, 175, 175, 175, 175, 175, 175, 183, 182,
+ 181, 180, 179, 173, 171, 134, 170, 169, 168, 167,
+ 166, 165, 164, 163, 159, 158, 177, 210, 211, 157,
+ 156, 155, 154, 153, 210, 212, 150, 213, 210, 210,
+ 210, 210, 210, 210, 210, 112, 145, 144, 143, 210,
+ 210, 142, 141, 140, 139, 136, 210, 210, 210, 210,
+ 210, 210, 135, 132, 131, 130, 129, 128, 127, 126,
+
+ 125, 124, 121, 119, 119, 59, 242, 116, 114, 102,
+ 214, 210, 211, 100, 99, 96, 95, 94, 210, 212,
+ 91, 213, 210, 210, 210, 210, 210, 210, 210, 86,
+ 81, 80, 71, 210, 210, 61, 59, 57, 242, 55,
+ 210, 210, 210, 210, 210, 210, 55, 53, 53, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 214, 211, 211, 242, 242, 242,
+ 242, 242, 211, 173, 242, 224, 211, 211, 211, 211,
+ 211, 211, 211, 242, 242, 242, 242, 211, 211, 242,
+ 242, 242, 242, 242, 211, 211, 211, 211, 211, 211,
+
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 225, 44,
44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
44, 44, 48, 48, 48, 48, 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, 242, 58, 58,
+ 58, 60, 242, 242, 60, 242, 60, 60, 60, 65,
+ 242, 65, 242, 242, 242, 65, 74, 242, 74, 74,
+
+ 74, 75, 242, 75, 75, 75, 101, 101, 242, 242,
+ 242, 101, 101, 242, 101, 103, 103, 242, 242, 103,
+ 103, 103, 103, 103, 103, 103, 103, 104, 104, 104,
+ 104, 104, 104, 104, 104, 104, 104, 104, 104, 104,
+ 110, 110, 242, 110, 110, 110, 242, 110, 110, 110,
+ 110, 110, 113, 113, 242, 113, 113, 113, 113, 113,
+ 113, 113, 113, 113, 113, 115, 115, 115, 242, 115,
+ 115, 115, 115, 115, 115, 115, 115, 115, 117, 117,
+ 242, 117, 117, 117, 117, 117, 117, 117, 117, 117,
+ 117, 120, 242, 120, 149, 242, 149, 172, 172, 172,
+
+ 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
+ 174, 174, 174, 174, 174, 174, 174, 174, 174, 174,
+ 174, 174, 174, 178, 242, 178, 209, 209, 209, 209,
+ 209, 209, 209, 209, 209, 209, 209, 209, 209, 11,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242
- 54, 56, 56, 56, 56, 56, 58, 197, 58, 58,
- 58, 60, 196, 195, 60, 194, 60, 60, 60, 65,
- 193, 65, 192, 191, 190, 65, 74, 189, 74, 74,
- 74, 75, 188, 75, 75, 75, 101, 101, 187, 186,
- 185, 184, 101, 183, 101, 102, 102, 182, 181, 102,
- 102, 102, 102, 102, 102, 102, 102, 103, 103, 103,
- 103, 103, 103, 103, 103, 103, 103, 103, 103, 103,
- 109, 109, 180, 109, 109, 109, 159, 109, 109, 109,
- 109, 109, 112, 112, 159, 112, 112, 112, 112, 112,
- 112, 112, 112, 112, 112, 114, 114, 114, 179, 114,
-
- 114, 114, 114, 114, 114, 114, 114, 114, 116, 116,
- 178, 116, 116, 116, 116, 116, 116, 116, 116, 116,
- 116, 119, 177, 119, 146, 176, 146, 169, 175, 169,
- 174, 173, 172, 171, 170, 168, 133, 167, 166, 165,
- 164, 163, 162, 161, 160, 156, 155, 154, 153, 152,
- 151, 150, 147, 111, 145, 144, 143, 142, 141, 140,
- 139, 138, 135, 134, 131, 130, 129, 128, 127, 126,
- 125, 124, 123, 120, 118, 118, 59, 217, 115, 113,
- 100, 99, 96, 95, 94, 91, 86, 81, 80, 71,
- 61, 59, 57, 217, 55, 55, 53, 53, 11, 217,
-
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217
} ;
-static yyconst flex_int16_t yy_chk[455] =
+static yyconst flex_int16_t yy_chk[696] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -583,49 +619,76 @@ static yyconst flex_int16_t yy_chk[455] =
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, 214, 47, 36, 209, 21, 21,
+ 25, 25, 33, 33, 101, 47, 36, 239, 21, 21,
31, 3, 4, 5, 22, 22, 6, 28, 31, 28,
88, 34, 31, 28, 28, 34, 40, 31, 47, 50,
- 77, 91, 21, 40, 88, 133, 50, 133, 22, 212,
- 133, 47, 207, 212, 203, 91, 47, 202, 77, 201,
- 47, 64, 64, 64, 64, 64, 64, 64, 117, 117,
- 117, 117, 117, 117, 117, 124, 200, 199, 198, 197,
- 196, 194, 192, 189, 188, 187, 186, 185, 124, 218,
- 218, 218, 218, 218, 218, 218, 218, 218, 218, 218,
- 218, 218, 219, 219, 219, 219, 219, 219, 219, 219,
- 219, 219, 219, 219, 219, 220, 220, 220, 220, 220,
- 220, 220, 220, 220, 220, 220, 220, 220, 221, 221,
- 221, 221, 221, 221, 221, 221, 221, 221, 221, 221,
-
- 221, 222, 222, 222, 222, 222, 223, 184, 223, 223,
- 223, 224, 183, 182, 224, 181, 224, 224, 224, 225,
- 180, 225, 179, 178, 177, 225, 226, 176, 226, 226,
- 226, 227, 175, 227, 227, 227, 228, 228, 173, 172,
- 171, 165, 228, 163, 228, 229, 229, 162, 160, 229,
- 229, 229, 229, 229, 229, 229, 229, 230, 230, 230,
- 230, 230, 230, 230, 230, 230, 230, 230, 230, 230,
- 231, 231, 159, 231, 231, 231, 158, 231, 231, 231,
- 231, 231, 232, 232, 157, 232, 232, 232, 232, 232,
- 232, 232, 232, 232, 232, 233, 233, 233, 156, 233,
-
- 233, 233, 233, 233, 233, 233, 233, 233, 234, 234,
- 155, 234, 234, 234, 234, 234, 234, 234, 234, 234,
- 234, 235, 154, 235, 236, 153, 236, 237, 152, 237,
- 151, 150, 149, 148, 147, 144, 143, 142, 141, 140,
- 139, 138, 136, 135, 134, 132, 131, 130, 129, 127,
- 126, 125, 123, 110, 101, 100, 99, 98, 97, 96,
- 95, 94, 90, 89, 87, 86, 85, 84, 83, 82,
- 81, 80, 78, 76, 67, 66, 60, 56, 55, 51,
- 42, 41, 39, 38, 37, 35, 32, 30, 29, 24,
- 19, 18, 15, 11, 10, 9, 8, 7, 217, 217,
-
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
- 217, 217, 217, 217
+ 77, 91, 21, 40, 88, 102, 50, 102, 22, 234,
+ 176, 47, 176, 234, 231, 91, 47, 101, 77, 229,
+ 47, 64, 64, 64, 64, 64, 64, 64, 118, 118,
+ 118, 118, 118, 118, 118, 125, 134, 195, 134, 195,
+ 213, 134, 213, 224, 226, 224, 226, 227, 125, 148,
+ 148, 228, 235, 228, 235, 237, 148, 237, 225, 148,
+ 148, 148, 148, 148, 148, 148, 148, 220, 219, 218,
+ 217, 148, 148, 216, 215, 212, 208, 207, 148, 148,
+ 148, 148, 148, 148, 205, 203, 200, 199, 198, 197,
+ 196, 193, 192, 191, 190, 189, 188, 187, 186, 185,
+
+ 184, 182, 148, 174, 174, 181, 180, 173, 172, 168,
+ 174, 166, 165, 174, 174, 174, 174, 174, 174, 174,
+ 174, 163, 162, 161, 160, 174, 174, 159, 158, 157,
+ 156, 155, 174, 174, 174, 174, 174, 174, 154, 153,
+ 152, 151, 150, 147, 145, 144, 143, 142, 141, 140,
+ 139, 137, 136, 135, 133, 132, 174, 194, 194, 131,
+ 130, 128, 127, 126, 194, 194, 124, 194, 194, 194,
+ 194, 194, 194, 194, 194, 111, 100, 99, 98, 194,
+ 194, 97, 96, 95, 94, 90, 194, 194, 194, 194,
+ 194, 194, 89, 87, 86, 85, 84, 83, 82, 81,
+
+ 80, 78, 76, 67, 66, 60, 56, 55, 51, 43,
+ 194, 209, 209, 42, 41, 39, 38, 37, 209, 209,
+ 35, 209, 209, 209, 209, 209, 209, 209, 209, 32,
+ 30, 29, 24, 209, 209, 19, 18, 15, 11, 10,
+ 209, 209, 209, 209, 209, 209, 9, 8, 7, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 209, 211, 211, 0, 0, 0,
+ 0, 0, 211, 211, 0, 211, 211, 211, 211, 211,
+ 211, 211, 211, 0, 0, 0, 0, 211, 211, 0,
+ 0, 0, 0, 0, 211, 211, 211, 211, 211, 211,
+
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 211, 243,
+ 243, 243, 243, 243, 243, 243, 243, 243, 243, 243,
+ 243, 243, 244, 244, 244, 244, 244, 244, 244, 244,
+ 244, 244, 244, 244, 244, 245, 245, 245, 245, 245,
+ 245, 245, 245, 245, 245, 245, 245, 245, 246, 246,
+ 246, 246, 246, 246, 246, 246, 246, 246, 246, 246,
+ 246, 247, 247, 247, 247, 247, 248, 0, 248, 248,
+ 248, 249, 0, 0, 249, 0, 249, 249, 249, 250,
+ 0, 250, 0, 0, 0, 250, 251, 0, 251, 251,
+
+ 251, 252, 0, 252, 252, 252, 253, 253, 0, 0,
+ 0, 253, 253, 0, 253, 254, 254, 0, 0, 254,
+ 254, 254, 254, 254, 254, 254, 254, 255, 255, 255,
+ 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 256, 256, 0, 256, 256, 256, 0, 256, 256, 256,
+ 256, 256, 257, 257, 0, 257, 257, 257, 257, 257,
+ 257, 257, 257, 257, 257, 258, 258, 258, 0, 258,
+ 258, 258, 258, 258, 258, 258, 258, 258, 259, 259,
+ 0, 259, 259, 259, 259, 259, 259, 259, 259, 259,
+ 259, 260, 0, 260, 261, 0, 261, 262, 262, 262,
+
+ 262, 262, 262, 262, 262, 262, 262, 262, 262, 262,
+ 263, 263, 263, 263, 263, 263, 263, 263, 263, 263,
+ 263, 263, 263, 264, 0, 264, 265, 265, 265, 265,
+ 265, 265, 265, 265, 265, 265, 265, 265, 265, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ 242, 242, 242, 242, 242
+
} ;
/* Table of booleans, true if rule could match eol. */
@@ -734,7 +797,7 @@ with noyywrap then we can remove this pragma.
-#line 738 "lexer.c"
+#line 801 "lexer.c"
#define INITIAL 0
#define str 1
@@ -767,7 +830,7 @@ 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;
- yy_size_t yy_n_chars;
+ int yy_n_chars;
yy_size_t yyleng_r;
char *yy_c_buf_p;
int yy_init;
@@ -1014,7 +1077,7 @@ YY_DECL
#line 111 "lexer.l"
-#line 1018 "lexer.c"
+#line 1081 "lexer.c"
while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
{
@@ -1041,13 +1104,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 >= 218 )
+ if ( yy_current_state >= 243 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
}
- while ( yy_current_state != 217 );
+ while ( yy_current_state != 242 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
@@ -1789,6 +1852,8 @@ case 70:
YY_RULE_SETUP
#line 594 "lexer.l"
{
+ // Match hex-digits with whitespace or comments. The latter are stripped
+ // out by hex_lexer.l
ALLOC_SIZED_STRING(s, strlen(yytext));
@@ -1801,12 +1866,12 @@ YY_RULE_SETUP
case 71:
/* rule 71 can match eol */
YY_RULE_SETUP
-#line 605 "lexer.l"
+#line 607 "lexer.l"
/* skip whitespace */
YY_BREAK
case 72:
YY_RULE_SETUP
-#line 607 "lexer.l"
+#line 609 "lexer.l"
{
if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1822,10 +1887,10 @@ YY_RULE_SETUP
YY_BREAK
case 73:
YY_RULE_SETUP
-#line 620 "lexer.l"
+#line 622 "lexer.l"
ECHO;
YY_BREAK
-#line 1829 "lexer.c"
+#line 1894 "lexer.c"
case YY_END_OF_BUFFER:
{
@@ -2081,9 +2146,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
+ if ((int) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
/* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
+ int 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()" );
@@ -2119,7 +2184,7 @@ 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 >= 218 )
+ if ( yy_current_state >= 243 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
@@ -2148,11 +2213,11 @@ 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 >= 218 )
+ if ( yy_current_state >= 243 )
yy_c = yy_meta[(unsigned int) yy_c];
}
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 217);
+ yy_is_jam = (yy_current_state == 242);
(void)yyg;
return yy_is_jam ? 0 : yy_current_state;
@@ -2483,7 +2548,7 @@ static void yara_yyensure_buffer_stack (yyscan_t yyscanner)
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
*/
- num_to_alloc = 1; // After all that talk, this was set to 1 anyways...
+ num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
yyg->yy_buffer_stack = (struct yy_buffer_state**)yara_yyalloc
(num_to_alloc * sizeof(struct yy_buffer_state*)
, yyscanner);
@@ -2974,7 +3039,7 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
#define YYTABLES_NAME "yytables"
-#line 620 "lexer.l"
+#line 622 "lexer.l"
diff --git a/libyara/lexer.l b/libyara/lexer.l
index 0ec9026..c33c93c 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -591,7 +591,9 @@ u?int(8|16|32)(be)? {
}
-\{({hexdigit}|[ \-|\?\[\]\(\)\n\t])+\} {
+\{(({hexdigit}|[ \-|\?\[\]\(\)\n\t]|\/\*[^*]*\*\/)+|\/\/.*)+\} {
+ // Match hex-digits with whitespace or comments. The latter are stripped
+ // out by hex_lexer.l
ALLOC_SIZED_STRING(s, strlen(yytext));
diff --git a/tests/test-rules.c b/tests/test-rules.c
index 471c933..36623b3 100644
--- a/tests/test-rules.c
+++ b/tests/test-rules.c
@@ -450,6 +450,26 @@ static void test_hex_strings()
assert_true_rule(
"rule test { \
+ strings: $a = { 31 32 [-] // Inline comment\n\
+ 38 39 } \
+ condition: $a }",
+ "1234567890");
+
+ assert_true_rule(
+ "rule test { \
+ strings: $a = { 31 32 /* Inline comment */ [-] 38 39 } \
+ condition: $a }",
+ "1234567890");
+
+ assert_true_rule(
+ "rule test { \
+ strings: $a = { 31 32 /* Inline multi-line\n\
+ comment */ [-] 38 39 } \
+ condition: $a }",
+ "1234567890");
+
+ assert_true_rule(
+ "rule test { \
strings: $a = { 31 32 [-] 33 34 [-] 38 39 } \
condition: $a }",
"1234567890");
--
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