[Forensics-changes] [yara] 107/160: Use flex 2.5.39 to avoid calls to exit() from inside the parser (issues #267 and #272)

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:29:23 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.4.0
in repository yara.

commit 24f79369f87607afc4ed7ba6ae5dd9b98716fd0f
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Wed May 6 12:44:53 2015 +0200

    Use flex 2.5.39 to avoid calls to exit() from inside the parser (issues #267 and #272)
---
 libyara/hex_lexer.c |  97 ++++++++++++++---------
 libyara/hex_lexer.l |  11 +++
 libyara/lexer.c     | 219 +++++++++++++++++++++++++++++-----------------------
 libyara/lexer.l     |  12 +++
 libyara/re_lexer.c  | 136 +++++++++++++++++++-------------
 libyara/re_lexer.l  |  12 +++
 6 files changed, 301 insertions(+), 186 deletions(-)

diff --git a/libyara/hex_lexer.c b/libyara/hex_lexer.c
index 8dcf32c..a04e036 100644
--- a/libyara/hex_lexer.c
+++ b/libyara/hex_lexer.c
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 39
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -54,7 +54,6 @@ 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
@@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -188,11 +189,18 @@ typedef size_t yy_size_t;
      */
     #define  YY_LESS_LINENO(n) \
             do { \
-                yy_size_t yyl;\
+                int 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) \
@@ -338,7 +346,7 @@ void hex_yyfree (void * ,yyscan_t yyscanner );
 
 /* Begin user sect3 */
 
-#define hex_yywrap(n) 1
+#define hex_yywrap(yyscanner) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -476,6 +484,17 @@ limitations under the License.
 /* Lexical analyzer for hex strings */
 #line 20 "hex_lexer.l"
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function hex_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
 
 #include <setjmp.h>
 
@@ -503,7 +522,7 @@ limitations under the License.
 #define YY_NO_UNISTD_H 1
 #define YY_NO_INPUT 1
 
-#line 507 "hex_lexer.c"
+#line 526 "hex_lexer.c"
 
 #define INITIAL 0
 #define range 1
@@ -595,6 +614,10 @@ int hex_yyget_lineno (yyscan_t yyscanner );
 
 void hex_yyset_lineno (int line_number ,yyscan_t yyscanner );
 
+int hex_yyget_column  (yyscan_t yyscanner );
+
+void hex_yyset_column (int column_no ,yyscan_t yyscanner );
+
 YYSTYPE * hex_yyget_lval (yyscan_t yyscanner );
 
 void hex_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -639,7 +662,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 fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -650,7 +673,7 @@ static int input (yyscan_t yyscanner );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		yy_size_t n; \
+		size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -735,12 +758,6 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 67 "hex_lexer.l"
-
-
-
-#line 743 "hex_lexer.c"
-
     yylval = yylval_param;
 
 	if ( !yyg->yy_init )
@@ -769,6 +786,13 @@ YY_DECL
 		hex_yy_load_buffer_state(yyscanner );
 		}
 
+	{
+#line 78 "hex_lexer.l"
+
+
+
+#line 795 "hex_lexer.c"
+
 	while ( 1 )		/* loops until end-of-file is reached */
 		{
 		yy_cp = yyg->yy_c_buf_p;
@@ -785,7 +809,7 @@ YY_DECL
 yy_match:
 		do
 			{
-			register 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;
@@ -834,7 +858,7 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 70 "hex_lexer.l"
+#line 81 "hex_lexer.l"
 {
 
   yylval->integer = xtoi(yytext);
@@ -843,7 +867,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 76 "hex_lexer.l"
+#line 87 "hex_lexer.l"
 {
 
   yytext[1] = '0'; // replace ? by 0
@@ -853,7 +877,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 83 "hex_lexer.l"
+#line 94 "hex_lexer.l"
 {
 
   yytext[0] = '0'; // replace ? by 0
@@ -863,7 +887,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 90 "hex_lexer.l"
+#line 101 "hex_lexer.l"
 {
 
   yylval->integer = 0x0000;
@@ -872,7 +896,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 96 "hex_lexer.l"
+#line 107 "hex_lexer.l"
 {
 
   BEGIN(range);
@@ -881,21 +905,21 @@ YY_RULE_SETUP
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 102 "hex_lexer.l"
+#line 113 "hex_lexer.l"
 {
   return yytext[0];
 }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 106 "hex_lexer.l"
+#line 117 "hex_lexer.l"
 {
   return yytext[0];
 }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 110 "hex_lexer.l"
+#line 121 "hex_lexer.l"
 {
 
   yylval->integer = atoi(yytext);
@@ -904,7 +928,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 116 "hex_lexer.l"
+#line 127 "hex_lexer.l"
 {
 
   BEGIN(INITIAL);
@@ -914,12 +938,12 @@ YY_RULE_SETUP
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 123 "hex_lexer.l"
+#line 134 "hex_lexer.l"
 // skip whitespace
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 126 "hex_lexer.l"
+#line 137 "hex_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -935,10 +959,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 139 "hex_lexer.l"
+#line 150 "hex_lexer.l"
 ECHO;
 	YY_BREAK
-#line 942 "hex_lexer.c"
+#line 966 "hex_lexer.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(range):
 	yyterminate();
@@ -1071,6 +1095,7 @@ case YY_STATE_EOF(range):
 			"fatal flex scanner internal error--no action found" );
 	} /* end of action switch */
 		} /* end of scanning one token */
+	} /* end of user's declarations */
 } /* end of hex_yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1134,7 +1159,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -1269,6 +1294,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 22);
 
+	(void)yyg;
 	return yy_is_jam ? 0 : yy_current_state;
 }
 
@@ -1321,7 +1347,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( hex_yywrap(yyscanner ) )
-						return 0;
+						return EOF;
 
 					if ( ! yyg->yy_did_buffer_switch_on_eof )
 						YY_NEW_FILE;
@@ -1677,8 +1703,8 @@ YY_BUFFER_STATE hex_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 
 /** Setup the input buffer state to scan the given bytes. The next call to hex_yylex() will
  * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
@@ -1686,7 +1712,8 @@ YY_BUFFER_STATE hex_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_
 {
 	YY_BUFFER_STATE b;
 	char *buf;
-	yy_size_t n, i;
+	yy_size_t n;
+	yy_size_t i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
@@ -1832,7 +1859,7 @@ void hex_yyset_lineno (int  line_number , yyscan_t yyscanner)
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "hex_yyset_lineno called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "hex_yyset_lineno called with no buffer" );
     
     yylineno = line_number;
 }
@@ -1847,7 +1874,7 @@ void hex_yyset_column (int  column_no , yyscan_t yyscanner)
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "hex_yyset_column called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "hex_yyset_column called with no buffer" );
     
     yycolumn = column_no;
 }
@@ -2071,7 +2098,7 @@ void hex_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 139 "hex_lexer.l"
+#line 150 "hex_lexer.l"
 
 
 
diff --git a/libyara/hex_lexer.l b/libyara/hex_lexer.l
index 4a18f82..50db5e2 100644
--- a/libyara/hex_lexer.l
+++ b/libyara/hex_lexer.l
@@ -18,6 +18,17 @@ limitations under the License.
 
 %{
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function hex_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
 
 #include <setjmp.h>
 
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 92bce24..b55c99f 100644
--- a/libyara/lexer.c
+++ b/libyara/lexer.c
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 39
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -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;
@@ -55,7 +54,6 @@ 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
@@ -86,6 +84,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -189,11 +189,18 @@ typedef size_t yy_size_t;
      */
     #define  YY_LESS_LINENO(n) \
             do { \
-                yy_size_t yyl;\
+                int 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) \
@@ -339,7 +346,7 @@ void yara_yyfree (void * ,yyscan_t yyscanner );
 
 /* Begin user sect3 */
 
-#define yara_yywrap(n) 1
+#define yara_yywrap(yyscanner) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -358,7 +365,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;
@@ -640,6 +647,18 @@ limitations under the License.
 /* Lexical analyzer for YARA */
 #line 20 "lexer.l"
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function yara_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
+
 #include <math.h>
 #include <stdio.h>
 #include <stdint.h>
@@ -698,7 +717,7 @@ limitations under the License.
 
 
 
-#line 702 "lexer.c"
+#line 721 "lexer.c"
 
 #define INITIAL 0
 #define str 1
@@ -793,6 +812,10 @@ int yara_yyget_lineno (yyscan_t yyscanner );
 
 void yara_yyset_lineno (int line_number ,yyscan_t yyscanner );
 
+int yara_yyget_column  (yyscan_t yyscanner );
+
+void yara_yyset_column (int column_no ,yyscan_t yyscanner );
+
 YYSTYPE * yara_yyget_lval (yyscan_t yyscanner );
 
 void yara_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -837,7 +860,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 fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -848,7 +871,7 @@ static int input (yyscan_t yyscanner );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		yy_size_t n; \
+		size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -933,11 +956,6 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 97 "lexer.l"
-
-
-#line 940 "lexer.c"
-
     yylval = yylval_param;
 
 	if ( !yyg->yy_init )
@@ -966,6 +984,12 @@ YY_DECL
 		yara_yy_load_buffer_state(yyscanner );
 		}
 
+	{
+#line 109 "lexer.l"
+
+
+#line 992 "lexer.c"
+
 	while ( 1 )		/* loops until end-of-file is reached */
 		{
 		yy_cp = yyg->yy_c_buf_p;
@@ -982,7 +1006,7 @@ YY_DECL
 yy_match:
 		do
 			{
-			register 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;
@@ -1031,203 +1055,203 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 99 "lexer.l"
+#line 111 "lexer.l"
 { return _LT_;          }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 100 "lexer.l"
+#line 112 "lexer.l"
 { return _GT_;          }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 101 "lexer.l"
+#line 113 "lexer.l"
 { return _LE_;          }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 102 "lexer.l"
+#line 114 "lexer.l"
 { return _GE_;          }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 103 "lexer.l"
+#line 115 "lexer.l"
 { return _EQ_;          }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 104 "lexer.l"
+#line 116 "lexer.l"
 { return _NEQ_;         }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 105 "lexer.l"
+#line 117 "lexer.l"
 { return _SHIFT_LEFT_;  }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 106 "lexer.l"
+#line 118 "lexer.l"
 { return _SHIFT_RIGHT_; }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 107 "lexer.l"
+#line 119 "lexer.l"
 { return _PRIVATE_;     }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 108 "lexer.l"
+#line 120 "lexer.l"
 { return _GLOBAL_;      }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 109 "lexer.l"
+#line 121 "lexer.l"
 { return _RULE_;        }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 110 "lexer.l"
+#line 122 "lexer.l"
 { return _META_;        }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 111 "lexer.l"
+#line 123 "lexer.l"
 { return _STRINGS_;     }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 112 "lexer.l"
+#line 124 "lexer.l"
 { return _ASCII_;       }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 113 "lexer.l"
+#line 125 "lexer.l"
 { return _WIDE_;        }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 114 "lexer.l"
+#line 126 "lexer.l"
 { return _FULLWORD_;    }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 115 "lexer.l"
+#line 127 "lexer.l"
 { return _NOCASE_;      }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 116 "lexer.l"
+#line 128 "lexer.l"
 { return _CONDITION_;   }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 117 "lexer.l"
+#line 129 "lexer.l"
 { return _TRUE_;        }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 118 "lexer.l"
+#line 130 "lexer.l"
 { return _FALSE_;       }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 119 "lexer.l"
+#line 131 "lexer.l"
 { return _NOT_;         }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 120 "lexer.l"
+#line 132 "lexer.l"
 { return _AND_;         }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 121 "lexer.l"
+#line 133 "lexer.l"
 { return _OR_;          }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 122 "lexer.l"
+#line 134 "lexer.l"
 { return _AT_;          }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 123 "lexer.l"
+#line 135 "lexer.l"
 { return _IN_;          }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 124 "lexer.l"
+#line 136 "lexer.l"
 { return _OF_;          }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 125 "lexer.l"
+#line 137 "lexer.l"
 { return _THEM_;        }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 126 "lexer.l"
+#line 138 "lexer.l"
 { return _FOR_;         }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 127 "lexer.l"
+#line 139 "lexer.l"
 { return _ALL_;         }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 128 "lexer.l"
+#line 140 "lexer.l"
 { return _ANY_;         }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 129 "lexer.l"
+#line 141 "lexer.l"
 { return _ENTRYPOINT_;  }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 130 "lexer.l"
+#line 142 "lexer.l"
 { return _FILESIZE_;    }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 131 "lexer.l"
+#line 143 "lexer.l"
 { return _MATCHES_;     }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 132 "lexer.l"
+#line 144 "lexer.l"
 { return _CONTAINS_;    }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 133 "lexer.l"
+#line 145 "lexer.l"
 { return _IMPORT_;      }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 136 "lexer.l"
+#line 148 "lexer.l"
 { BEGIN(comment);       }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 137 "lexer.l"
+#line 149 "lexer.l"
 { BEGIN(INITIAL);       }
 	YY_BREAK
 case 38:
 /* rule 38 can match eol */
 YY_RULE_SETUP
-#line 138 "lexer.l"
+#line 150 "lexer.l"
 { /* skip comments */   }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 141 "lexer.l"
+#line 153 "lexer.l"
 { /* skip single-line comments */ }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 144 "lexer.l"
+#line 156 "lexer.l"
 {
                           yyextra->lex_buf_ptr = yyextra->lex_buf;
                           yyextra->lex_buf_len = 0;
@@ -1237,12 +1261,12 @@ YY_RULE_SETUP
 case 41:
 /* rule 41 can match eol */
 YY_RULE_SETUP
-#line 151 "lexer.l"
+#line 163 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 154 "lexer.l"
+#line 166 "lexer.l"
 {
 
   char            buffer[1024];
@@ -1348,7 +1372,7 @@ case YY_STATE_EOF(str):
 case YY_STATE_EOF(regexp):
 case YY_STATE_EOF(include):
 case YY_STATE_EOF(comment):
-#line 256 "lexer.l"
+#line 268 "lexer.l"
 {
 
   YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
@@ -1370,7 +1394,7 @@ case YY_STATE_EOF(comment):
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 276 "lexer.l"
+#line 288 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1386,7 +1410,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
-#line 290 "lexer.l"
+#line 302 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1402,7 +1426,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 304 "lexer.l"
+#line 316 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1419,7 +1443,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 319 "lexer.l"
+#line 331 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1436,7 +1460,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
-#line 334 "lexer.l"
+#line 346 "lexer.l"
 {
 
   char* text = yytext;
@@ -1477,7 +1501,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 373 "lexer.l"
+#line 385 "lexer.l"
 {
 
   if (strlen(yytext) > 128)
@@ -1498,7 +1522,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 392 "lexer.l"
+#line 404 "lexer.l"
 {
 
   #ifdef _MSC_VER
@@ -1520,7 +1544,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 411 "lexer.l"
+#line 423 "lexer.l"
 {
   yylval->double_ = atof(yytext);
   return _DOUBLE_;
@@ -1528,7 +1552,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 416 "lexer.l"
+#line 428 "lexer.l"
 {
 
   yylval->integer = xtoi(yytext + 2);
@@ -1537,7 +1561,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 423 "lexer.l"
+#line 435 "lexer.l"
 {     /* saw closing quote - all done */
 
   *yyextra->lex_buf_ptr = '\0';
@@ -1553,7 +1577,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 437 "lexer.l"
+#line 449 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\t", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1563,7 +1587,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 445 "lexer.l"
+#line 457 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\n", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1573,7 +1597,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 453 "lexer.l"
+#line 465 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\"", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1583,7 +1607,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 461 "lexer.l"
+#line 473 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1593,7 +1617,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 469 "lexer.l"
+#line 481 "lexer.l"
 {
 
    int result;
@@ -1606,13 +1630,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 480 "lexer.l"
+#line 492 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 59:
 /* rule 59 can match eol */
 YY_RULE_SETUP
-#line 483 "lexer.l"
+#line 495 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "unterminated string");
@@ -1622,7 +1646,7 @@ YY_RULE_SETUP
 case 60:
 /* rule 60 can match eol */
 YY_RULE_SETUP
-#line 489 "lexer.l"
+#line 501 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "illegal escape sequence");
@@ -1630,7 +1654,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 495 "lexer.l"
+#line 507 "lexer.l"
 {
 
   if (yyextra->lex_buf_len == 0)
@@ -1658,7 +1682,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 521 "lexer.l"
+#line 533 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("/", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1668,7 +1692,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
-#line 529 "lexer.l"
+#line 541 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\.", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1679,13 +1703,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
-#line 538 "lexer.l"
+#line 550 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 65:
 /* rule 65 can match eol */
 YY_RULE_SETUP
-#line 541 "lexer.l"
+#line 553 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "unterminated regular expression");
@@ -1694,7 +1718,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 548 "lexer.l"
+#line 560 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1704,7 +1728,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 556 "lexer.l"
+#line 568 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1715,7 +1739,7 @@ YY_RULE_SETUP
 case 68:
 /* rule 68 can match eol */
 YY_RULE_SETUP
-#line 564 "lexer.l"
+#line 576 "lexer.l"
 {
 
   ALLOC_SIZED_STRING(s, strlen(yytext));
@@ -1729,12 +1753,12 @@ YY_RULE_SETUP
 case 69:
 /* rule 69 can match eol */
 YY_RULE_SETUP
-#line 575 "lexer.l"
+#line 587 "lexer.l"
 /* skip whitespace */
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 577 "lexer.l"
+#line 589 "lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1750,10 +1774,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 590 "lexer.l"
+#line 602 "lexer.l"
 ECHO;
 	YY_BREAK
-#line 1757 "lexer.c"
+#line 1781 "lexer.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1883,6 +1907,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 yara_yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1946,7 +1971,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -2081,6 +2106,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 214);
 
+	(void)yyg;
 	return yy_is_jam ? 0 : yy_current_state;
 }
 
@@ -2133,7 +2159,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( yara_yywrap(yyscanner ) )
-						return 0;
+						return EOF;
 
 					if ( ! yyg->yy_did_buffer_switch_on_eof )
 						YY_NEW_FILE;
@@ -2489,8 +2515,8 @@ YY_BUFFER_STATE yara_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 
 /** 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 bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
@@ -2498,7 +2524,8 @@ YY_BUFFER_STATE yara_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes
 {
 	YY_BUFFER_STATE b;
 	char *buf;
-	yy_size_t n, i;
+	yy_size_t n;
+	yy_size_t i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
@@ -2644,7 +2671,7 @@ void yara_yyset_lineno (int  line_number , yyscan_t yyscanner)
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "yara_yyset_lineno called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "yara_yyset_lineno called with no buffer" );
     
     yylineno = line_number;
 }
@@ -2659,7 +2686,7 @@ void yara_yyset_column (int  column_no , yyscan_t yyscanner)
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "yara_yyset_column called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "yara_yyset_column called with no buffer" );
     
     yycolumn = column_no;
 }
@@ -2883,7 +2910,7 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 590 "lexer.l"
+#line 602 "lexer.l"
 
 
 
diff --git a/libyara/lexer.l b/libyara/lexer.l
index d8acb00..68b662e 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -18,6 +18,18 @@ limitations under the License.
 
 %{
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function yara_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
+
 #include <math.h>
 #include <stdio.h>
 #include <stdint.h>
diff --git a/libyara/re_lexer.c b/libyara/re_lexer.c
index b9a416e..3a06c3a 100644
--- a/libyara/re_lexer.c
+++ b/libyara/re_lexer.c
@@ -9,7 +9,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 39
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -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;
@@ -55,7 +54,6 @@ 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
@@ -86,6 +84,8 @@ typedef unsigned int flex_uint32_t;
 #define UINT32_MAX             (4294967295U)
 #endif
 
+#endif /* ! C99 */
+
 #endif /* ! FLEXINT_H */
 
 #ifdef __cplusplus
@@ -189,11 +189,18 @@ typedef size_t yy_size_t;
      */
     #define  YY_LESS_LINENO(n) \
             do { \
-                yy_size_t yyl;\
+                int 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) \
@@ -339,7 +346,7 @@ void re_yyfree (void * ,yyscan_t yyscanner );
 
 /* Begin user sect3 */
 
-#define re_yywrap(n) 1
+#define re_yywrap(yyscanner) 1
 #define YY_SKIP_YYWRAP
 
 typedef unsigned char YY_CHAR;
@@ -358,7 +365,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;
@@ -504,6 +511,17 @@ limitations under the License.
 /* Lexical analyzer for regular expressions */
 #line 20 "re_lexer.l"
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function re_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
 #include <assert.h>
 #include <setjmp.h>
 
@@ -527,7 +545,7 @@ uint8_t read_escaped_char(yyscan_t yyscanner);
 
 #define YY_NO_UNISTD_H 1
 
-#line 531 "re_lexer.c"
+#line 549 "re_lexer.c"
 
 #define INITIAL 0
 #define char_class 1
@@ -619,6 +637,10 @@ int re_yyget_lineno (yyscan_t yyscanner );
 
 void re_yyset_lineno (int line_number ,yyscan_t yyscanner );
 
+int re_yyget_column  (yyscan_t yyscanner );
+
+void re_yyset_column (int column_no ,yyscan_t yyscanner );
+
 YYSTYPE * re_yyget_lval (yyscan_t yyscanner );
 
 void re_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
@@ -663,7 +685,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 fwrite( yytext, yyleng, 1, yyout )
+#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 #endif
 
 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
@@ -674,7 +696,7 @@ static int input (yyscan_t yyscanner );
 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 		{ \
 		int c = '*'; \
-		yy_size_t n; \
+		size_t n; \
 		for ( n = 0; n < max_size && \
 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 			buf[n] = (char) c; \
@@ -759,11 +781,6 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 62 "re_lexer.l"
-
-
-#line 766 "re_lexer.c"
-
     yylval = yylval_param;
 
 	if ( !yyg->yy_init )
@@ -792,6 +809,12 @@ YY_DECL
 		re_yy_load_buffer_state(yyscanner );
 		}
 
+	{
+#line 73 "re_lexer.l"
+
+
+#line 817 "re_lexer.c"
+
 	while ( 1 )		/* loops until end-of-file is reached */
 		{
 		yy_cp = yyg->yy_c_buf_p;
@@ -808,7 +831,7 @@ YY_DECL
 yy_match:
 		do
 			{
-			register 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;
@@ -857,7 +880,7 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 64 "re_lexer.l"
+#line 75 "re_lexer.l"
 {
 
   // Examples: {3,8} {0,5} {,5} {7,}
@@ -893,7 +916,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 98 "re_lexer.l"
+#line 109 "re_lexer.l"
 {
 
   // Example: {10}
@@ -913,7 +936,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 116 "re_lexer.l"
+#line 127 "re_lexer.l"
 {
 
   // Start of a negated character class. Example: [^abcd]
@@ -925,7 +948,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 125 "re_lexer.l"
+#line 136 "re_lexer.l"
 {
 
   // Start of character negated class containing a ].
@@ -940,7 +963,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 138 "re_lexer.l"
+#line 149 "re_lexer.l"
 {
 
   // Start of character class containing a ].
@@ -955,7 +978,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 151 "re_lexer.l"
+#line 162 "re_lexer.l"
 {
 
   // Start of character class. Example: [abcd]
@@ -968,7 +991,7 @@ YY_RULE_SETUP
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 161 "re_lexer.l"
+#line 172 "re_lexer.l"
 {
 
   // Any non-special character is passed as a CHAR token to the scanner.
@@ -979,63 +1002,63 @@ YY_RULE_SETUP
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 170 "re_lexer.l"
+#line 181 "re_lexer.l"
 {
   return _WORD_CHAR_;
 }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 175 "re_lexer.l"
+#line 186 "re_lexer.l"
 {
   return _NON_WORD_CHAR_;
 }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 180 "re_lexer.l"
+#line 191 "re_lexer.l"
 {
   return _SPACE_;
 }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 185 "re_lexer.l"
+#line 196 "re_lexer.l"
 {
   return _NON_SPACE_;
 }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 190 "re_lexer.l"
+#line 201 "re_lexer.l"
 {
   return _DIGIT_;
 }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 195 "re_lexer.l"
+#line 206 "re_lexer.l"
 {
   return _NON_DIGIT_;
 }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 200 "re_lexer.l"
+#line 211 "re_lexer.l"
 {
   return _WORD_BOUNDARY_;
 }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 204 "re_lexer.l"
+#line 215 "re_lexer.l"
 {
   return _NON_WORD_BOUNDARY_;
 }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 209 "re_lexer.l"
+#line 220 "re_lexer.l"
 {
 
   yyerror(yyscanner, lex_env, "backreferences are not allowed");
@@ -1044,7 +1067,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 216 "re_lexer.l"
+#line 227 "re_lexer.l"
 {
   yylval->integer = read_escaped_char(yyscanner);
   return _CHAR_;
@@ -1052,7 +1075,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 222 "re_lexer.l"
+#line 233 "re_lexer.l"
 {
 
   // End of character class.
@@ -1073,7 +1096,7 @@ YY_RULE_SETUP
 case 19:
 /* rule 19 can match eol */
 YY_RULE_SETUP
-#line 241 "re_lexer.l"
+#line 252 "re_lexer.l"
 {
 
   // A range inside a character class.
@@ -1110,7 +1133,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 276 "re_lexer.l"
+#line 287 "re_lexer.l"
 {
 
   char word_chars[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
@@ -1124,7 +1147,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 288 "re_lexer.l"
+#line 299 "re_lexer.l"
 {
 
   char word_chars[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x03,
@@ -1138,7 +1161,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 300 "re_lexer.l"
+#line 311 "re_lexer.l"
 {
 
   LEX_ENV->class_vector[' ' / 8] |= 1 << ' ' % 8;
@@ -1147,7 +1170,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 307 "re_lexer.l"
+#line 318 "re_lexer.l"
 {
 
   for (int i = 0; i < 32; i++)
@@ -1163,7 +1186,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 321 "re_lexer.l"
+#line 332 "re_lexer.l"
 {
 
   for (char c = '0'; c <= '9'; c++)
@@ -1172,7 +1195,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 328 "re_lexer.l"
+#line 339 "re_lexer.l"
 {
 
   for (int i = 0; i < 32; i++)
@@ -1192,7 +1215,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 346 "re_lexer.l"
+#line 357 "re_lexer.l"
 {
 
   uint8_t c = read_escaped_char(yyscanner);
@@ -1201,7 +1224,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 353 "re_lexer.l"
+#line 364 "re_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1219,7 +1242,7 @@ YY_RULE_SETUP
 }
 	YY_BREAK
 case YY_STATE_EOF(char_class):
-#line 370 "re_lexer.l"
+#line 381 "re_lexer.l"
 {
 
   // End of regexp reached while scanning a character class.
@@ -1230,7 +1253,7 @@ case YY_STATE_EOF(char_class):
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 379 "re_lexer.l"
+#line 390 "re_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1245,7 +1268,7 @@ YY_RULE_SETUP
 }
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
-#line 393 "re_lexer.l"
+#line 404 "re_lexer.l"
 {
 
   yyterminate();
@@ -1253,10 +1276,10 @@ case YY_STATE_EOF(INITIAL):
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 398 "re_lexer.l"
+#line 409 "re_lexer.l"
 ECHO;
 	YY_BREAK
-#line 1260 "re_lexer.c"
+#line 1283 "re_lexer.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1386,6 +1409,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 re_yylex */
 
 /* yy_get_next_buffer - try to read in a new buffer
@@ -1449,7 +1473,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) (yyg->yy_c_buf_p - b->yy_ch_buf);
@@ -1584,6 +1608,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 44);
 
+	(void)yyg;
 	return yy_is_jam ? 0 : yy_current_state;
 }
 
@@ -1636,7 +1661,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 				case EOB_ACT_END_OF_FILE:
 					{
 					if ( re_yywrap(yyscanner ) )
-						return 0;
+						return EOF;
 
 					if ( ! yyg->yy_did_buffer_switch_on_eof )
 						YY_NEW_FILE;
@@ -1992,8 +2017,8 @@ YY_BUFFER_STATE re_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner)
 
 /** Setup the input buffer state to scan the given bytes. The next call to re_yylex() will
  * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
+ * @param yybytes the byte buffer to scan
+ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
  * @param yyscanner The scanner object.
  * @return the newly allocated buffer state object.
  */
@@ -2001,7 +2026,8 @@ YY_BUFFER_STATE re_yy_scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_l
 {
 	YY_BUFFER_STATE b;
 	char *buf;
-	yy_size_t n, i;
+	yy_size_t n;
+	yy_size_t i;
     
 	/* Get memory for full buffer, including space for trailing EOB's. */
 	n = _yybytes_len + 2;
@@ -2147,7 +2173,7 @@ void re_yyset_lineno (int  line_number , yyscan_t yyscanner)
 
         /* lineno is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "re_yyset_lineno called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "re_yyset_lineno called with no buffer" );
     
     yylineno = line_number;
 }
@@ -2162,7 +2188,7 @@ void re_yyset_column (int  column_no , yyscan_t yyscanner)
 
         /* column is only valid if an input buffer exists. */
         if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "re_yyset_column called with no buffer" , yyscanner); 
+           YY_FATAL_ERROR( "re_yyset_column called with no buffer" );
     
     yycolumn = column_no;
 }
@@ -2386,7 +2412,7 @@ void re_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 398 "re_lexer.l"
+#line 409 "re_lexer.l"
 
 
 
diff --git a/libyara/re_lexer.l b/libyara/re_lexer.l
index ff61f84..f925b9e 100644
--- a/libyara/re_lexer.l
+++ b/libyara/re_lexer.l
@@ -18,6 +18,18 @@ limitations under the License.
 
 %{
 
+/* Disable warnings for unused functions in this file.
+
+As we redefine YY_FATAL_ERROR macro to use our own function re_yyfatal, the
+yy_fatal_error function generated by Flex is not actually used, causing a
+compiler warning. Flex doesn't offer any options to remove the yy_fatal_error
+function. When they include something like %option noyy_fatal_error as they do
+with noyywrap then we can remove this pragma.
+*/
+
+#pragma GCC diagnostic ignored "-Wunused-function"
+
+
 #include <assert.h>
 #include <setjmp.h>
 

-- 
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