[Forensics-changes] [yara] 79/407: Declare lexers as never-interactive

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:28:12 UTC 2017


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

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

commit ae6f8a4a680dddf4e810164ab6091363a2da4e6e
Author: Victor M. Alvarez <plusvic at gmail.com>
Date:   Tue Oct 7 13:51:58 2014 +0200

    Declare lexers as never-interactive
---
 libyara/hex_lexer.c |  56 +++++++---------
 libyara/hex_lexer.l |   1 +
 libyara/lexer.c     | 184 +++++++++++++++++++++++++---------------------------
 libyara/lexer.l     |   1 +
 libyara/re_lexer.c  |  90 ++++++++++++-------------
 libyara/re_lexer.l  |   1 +
 6 files changed, 156 insertions(+), 177 deletions(-)

diff --git a/libyara/hex_lexer.c b/libyara/hex_lexer.c
index f7ef2c7..cf28566 100644
--- a/libyara/hex_lexer.c
+++ b/libyara/hex_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;
@@ -504,7 +503,7 @@ limitations under the License.
 #define YY_NO_UNISTD_H 1
 #define YY_NO_INPUT 1
 
-#line 508 "hex_lexer.c"
+#line 507 "hex_lexer.c"
 
 #define INITIAL 0
 #define range 1
@@ -736,11 +735,11 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 66 "hex_lexer.l"
+#line 67 "hex_lexer.l"
 
 
 
-#line 744 "hex_lexer.c"
+#line 743 "hex_lexer.c"
 
     yylval = yylval_param;
 
@@ -801,16 +800,12 @@ yy_match:
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 28 );
+		while ( yy_current_state != 22 );
+		yy_cp = yyg->yy_last_accepting_cpos;
+		yy_current_state = yyg->yy_last_accepting_state;
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
-		if ( yy_act == 0 )
-			{ /* have to back up */
-			yy_cp = yyg->yy_last_accepting_cpos;
-			yy_current_state = yyg->yy_last_accepting_state;
-			yy_act = yy_accept[yy_current_state];
-			}
 
 		YY_DO_BEFORE_ACTION;
 
@@ -839,7 +834,7 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 69 "hex_lexer.l"
+#line 70 "hex_lexer.l"
 {
 
   yylval->integer = xtoi(yytext);
@@ -848,7 +843,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 75 "hex_lexer.l"
+#line 76 "hex_lexer.l"
 {
 
   yytext[1] = '0'; // replace ? by 0
@@ -858,7 +853,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 82 "hex_lexer.l"
+#line 83 "hex_lexer.l"
 {
 
   yytext[0] = '0'; // replace ? by 0
@@ -868,7 +863,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 89 "hex_lexer.l"
+#line 90 "hex_lexer.l"
 {
 
   yylval->integer = 0x0000;
@@ -877,7 +872,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 95 "hex_lexer.l"
+#line 96 "hex_lexer.l"
 {
 
   BEGIN(range);
@@ -886,21 +881,21 @@ YY_RULE_SETUP
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 101 "hex_lexer.l"
+#line 102 "hex_lexer.l"
 {
   return yytext[0];
 }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 105 "hex_lexer.l"
+#line 106 "hex_lexer.l"
 {
   return yytext[0];
 }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 109 "hex_lexer.l"
+#line 110 "hex_lexer.l"
 {
 
   yylval->integer = atoi(yytext);
@@ -909,7 +904,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 115 "hex_lexer.l"
+#line 116 "hex_lexer.l"
 {
 
   BEGIN(INITIAL);
@@ -919,12 +914,12 @@ YY_RULE_SETUP
 case 10:
 /* rule 10 can match eol */
 YY_RULE_SETUP
-#line 122 "hex_lexer.l"
+#line 123 "hex_lexer.l"
 // skip whitespace
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 125 "hex_lexer.l"
+#line 126 "hex_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -940,10 +935,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 138 "hex_lexer.l"
+#line 139 "hex_lexer.l"
 ECHO;
 	YY_BREAK
-#line 947 "hex_lexer.c"
+#line 942 "hex_lexer.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(range):
 	yyterminate();
@@ -1011,7 +1006,8 @@ case YY_STATE_EOF(range):
 
 			else
 				{
-				yy_cp = yyg->yy_c_buf_p;
+				yy_cp = yyg->yy_last_accepting_cpos;
+				yy_current_state = yyg->yy_last_accepting_state;
 				goto yy_find_action;
 				}
 			}
@@ -1472,10 +1468,6 @@ static void hex_yy_load_buffer_state  (yyscan_t yyscanner)
 	hex_yyfree((void *) b ,yyscanner );
 }
 
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a hex_yyrestart() or at EOF.
@@ -1500,7 +1492,7 @@ extern int isatty (int );
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+        b->yy_is_interactive = 0;
     
 	errno = oerrno;
 }
@@ -2079,7 +2071,7 @@ void hex_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 138 "hex_lexer.l"
+#line 139 "hex_lexer.l"
 
 
 
diff --git a/libyara/hex_lexer.l b/libyara/hex_lexer.l
index 7170beb..81e445e 100644
--- a/libyara/hex_lexer.l
+++ b/libyara/hex_lexer.l
@@ -49,6 +49,7 @@ limitations under the License.
 %option nounistd
 %option noinput
 %option nounput
+%option never-interactive
 %option yylineno
 %option prefix="hex_yy"
 
diff --git a/libyara/lexer.c b/libyara/lexer.c
index 45c632b..a0113bb 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
@@ -915,10 +914,10 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 82 "lexer.l"
+#line 83 "lexer.l"
 
 
-#line 922 "lexer.c"
+#line 921 "lexer.c"
 
     yylval = yylval_param;
 
@@ -979,16 +978,12 @@ yy_match:
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 357 );
+		while ( yy_current_state != 218 );
+		yy_cp = yyg->yy_last_accepting_cpos;
+		yy_current_state = yyg->yy_last_accepting_state;
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
-		if ( yy_act == 0 )
-			{ /* have to back up */
-			yy_cp = yyg->yy_last_accepting_cpos;
-			yy_current_state = yyg->yy_last_accepting_state;
-			yy_act = yy_accept[yy_current_state];
-			}
 
 		YY_DO_BEFORE_ACTION;
 
@@ -1017,233 +1012,233 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 84 "lexer.l"
+#line 85 "lexer.l"
 { return _LT_;          }
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 85 "lexer.l"
+#line 86 "lexer.l"
 { return _GT_;          }
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 86 "lexer.l"
+#line 87 "lexer.l"
 { return _LE_;          }
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 87 "lexer.l"
+#line 88 "lexer.l"
 { return _GE_;          }
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 88 "lexer.l"
+#line 89 "lexer.l"
 { return _EQ_;          }
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 89 "lexer.l"
+#line 90 "lexer.l"
 { return _NEQ_;         }
 	YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 90 "lexer.l"
+#line 91 "lexer.l"
 { return _SHIFT_LEFT_;  }
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 91 "lexer.l"
+#line 92 "lexer.l"
 { return _SHIFT_RIGHT_; }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 92 "lexer.l"
+#line 93 "lexer.l"
 { return _PRIVATE_;     }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 93 "lexer.l"
+#line 94 "lexer.l"
 { return _GLOBAL_;      }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 94 "lexer.l"
+#line 95 "lexer.l"
 { return _RULE_;        }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 95 "lexer.l"
+#line 96 "lexer.l"
 { return _META_;        }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 96 "lexer.l"
+#line 97 "lexer.l"
 { return _STRINGS_;     }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 97 "lexer.l"
+#line 98 "lexer.l"
 { return _ASCII_;       }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 98 "lexer.l"
+#line 99 "lexer.l"
 { return _WIDE_;        }
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 99 "lexer.l"
+#line 100 "lexer.l"
 { return _FULLWORD_;    }
 	YY_BREAK
 case 17:
 YY_RULE_SETUP
-#line 100 "lexer.l"
+#line 101 "lexer.l"
 { return _NOCASE_;      }
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 101 "lexer.l"
+#line 102 "lexer.l"
 { return _CONDITION_;   }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 102 "lexer.l"
+#line 103 "lexer.l"
 { return _TRUE_;        }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 103 "lexer.l"
+#line 104 "lexer.l"
 { return _FALSE_;       }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 104 "lexer.l"
+#line 105 "lexer.l"
 { return _NOT_;         }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 105 "lexer.l"
+#line 106 "lexer.l"
 { return _AND_;         }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 106 "lexer.l"
+#line 107 "lexer.l"
 { return _OR_;          }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 107 "lexer.l"
+#line 108 "lexer.l"
 { return _AT_;          }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 108 "lexer.l"
+#line 109 "lexer.l"
 { return _IN_;          }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 109 "lexer.l"
+#line 110 "lexer.l"
 { return _OF_;          }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 110 "lexer.l"
+#line 111 "lexer.l"
 { return _THEM_;        }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
-#line 111 "lexer.l"
+#line 112 "lexer.l"
 { return _FOR_;         }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
-#line 112 "lexer.l"
+#line 113 "lexer.l"
 { return _ALL_;         }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
-#line 113 "lexer.l"
+#line 114 "lexer.l"
 { return _ANY_;         }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
-#line 114 "lexer.l"
+#line 115 "lexer.l"
 { return _ENTRYPOINT_;  }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
-#line 115 "lexer.l"
+#line 116 "lexer.l"
 { return _FILESIZE_;    }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
-#line 116 "lexer.l"
+#line 117 "lexer.l"
 { return _UINT8_;       }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
-#line 117 "lexer.l"
+#line 118 "lexer.l"
 { return _UINT16_;      }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
-#line 118 "lexer.l"
+#line 119 "lexer.l"
 { return _UINT32_;      }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
-#line 119 "lexer.l"
+#line 120 "lexer.l"
 { return _INT8_;        }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
-#line 120 "lexer.l"
+#line 121 "lexer.l"
 { return _INT16_;       }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
-#line 121 "lexer.l"
+#line 122 "lexer.l"
 { return _INT32_;       }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
-#line 122 "lexer.l"
+#line 123 "lexer.l"
 { return _MATCHES_;     }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
-#line 123 "lexer.l"
+#line 124 "lexer.l"
 { return _CONTAINS_;    }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
-#line 124 "lexer.l"
+#line 125 "lexer.l"
 { return _IMPORT_;      }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
-#line 127 "lexer.l"
+#line 128 "lexer.l"
 { BEGIN(comment);       }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
-#line 128 "lexer.l"
+#line 129 "lexer.l"
 { BEGIN(INITIAL);       }
 	YY_BREAK
 case 44:
 /* rule 44 can match eol */
 YY_RULE_SETUP
-#line 129 "lexer.l"
+#line 130 "lexer.l"
 { /* skip comments */   }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
-#line 132 "lexer.l"
+#line 133 "lexer.l"
 { /* skip single-line comments */ }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
-#line 135 "lexer.l"
+#line 136 "lexer.l"
 {
                           yyextra->lex_buf_ptr = yyextra->lex_buf;
                           yyextra->lex_buf_len = 0;
@@ -1253,12 +1248,12 @@ YY_RULE_SETUP
 case 47:
 /* rule 47 can match eol */
 YY_RULE_SETUP
-#line 142 "lexer.l"
+#line 143 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
-#line 145 "lexer.l"
+#line 146 "lexer.l"
 {
 
   char            buffer[1024];
@@ -1364,7 +1359,7 @@ case YY_STATE_EOF(str):
 case YY_STATE_EOF(regexp):
 case YY_STATE_EOF(include):
 case YY_STATE_EOF(comment):
-#line 247 "lexer.l"
+#line 248 "lexer.l"
 {
 
   YR_COMPILER* compiler = yara_yyget_extra(yyscanner);
@@ -1386,7 +1381,7 @@ case YY_STATE_EOF(comment):
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
-#line 267 "lexer.l"
+#line 268 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1402,7 +1397,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
-#line 281 "lexer.l"
+#line 282 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1418,7 +1413,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
-#line 295 "lexer.l"
+#line 296 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1435,7 +1430,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
-#line 310 "lexer.l"
+#line 311 "lexer.l"
 {
 
   yylval->c_string = yr_strdup(yytext);
@@ -1452,7 +1447,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
-#line 325 "lexer.l"
+#line 326 "lexer.l"
 {
 
   if (strlen(yytext) > 128)
@@ -1473,7 +1468,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
-#line 344 "lexer.l"
+#line 345 "lexer.l"
 {
 
   yylval->integer = (size_t) atol(yytext);
@@ -1491,7 +1486,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
-#line 360 "lexer.l"
+#line 361 "lexer.l"
 {
 
   yylval->integer = xtoi(yytext + 2);
@@ -1500,7 +1495,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
-#line 367 "lexer.l"
+#line 368 "lexer.l"
 {     /* saw closing quote - all done */
 
   SIZED_STRING* s;
@@ -1526,7 +1521,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
-#line 391 "lexer.l"
+#line 392 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\t", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1536,7 +1531,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
-#line 399 "lexer.l"
+#line 400 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\n", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1546,7 +1541,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
-#line 407 "lexer.l"
+#line 408 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\"", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1556,7 +1551,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
-#line 415 "lexer.l"
+#line 416 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1566,7 +1561,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
-#line 423 "lexer.l"
+#line 424 "lexer.l"
 {
 
    int result;
@@ -1579,13 +1574,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
-#line 434 "lexer.l"
+#line 435 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 63:
 /* rule 63 can match eol */
 YY_RULE_SETUP
-#line 437 "lexer.l"
+#line 438 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "unterminated string");
@@ -1595,7 +1590,7 @@ YY_RULE_SETUP
 case 64:
 /* rule 64 can match eol */
 YY_RULE_SETUP
-#line 443 "lexer.l"
+#line 444 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "illegal escape sequence");
@@ -1603,7 +1598,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
-#line 449 "lexer.l"
+#line 450 "lexer.l"
 {
 
   SIZED_STRING* s;
@@ -1636,7 +1631,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
-#line 480 "lexer.l"
+#line 481 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("/", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1646,7 +1641,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
-#line 488 "lexer.l"
+#line 489 "lexer.l"
 {
 
   LEX_CHECK_SPACE_OK("\\.", yyextra->lex_buf_len, LEX_BUF_SIZE);
@@ -1657,13 +1652,13 @@ YY_RULE_SETUP
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
-#line 497 "lexer.l"
+#line 498 "lexer.l"
 { YYTEXT_TO_BUFFER; }
 	YY_BREAK
 case 69:
 /* rule 69 can match eol */
 YY_RULE_SETUP
-#line 500 "lexer.l"
+#line 501 "lexer.l"
 {
 
   yyerror(yyscanner, compiler, "unterminated regular expression");
@@ -1672,7 +1667,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
-#line 507 "lexer.l"
+#line 508 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1682,7 +1677,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
-#line 515 "lexer.l"
+#line 516 "lexer.l"
 {
 
   yyextra->lex_buf_ptr = yyextra->lex_buf;
@@ -1693,7 +1688,7 @@ YY_RULE_SETUP
 case 72:
 /* rule 72 can match eol */
 YY_RULE_SETUP
-#line 523 "lexer.l"
+#line 524 "lexer.l"
 {
 
   int len = strlen(yytext);
@@ -1711,12 +1706,12 @@ YY_RULE_SETUP
 case 73:
 /* rule 73 can match eol */
 YY_RULE_SETUP
-#line 538 "lexer.l"
+#line 539 "lexer.l"
 /* skip whitespace */
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
-#line 540 "lexer.l"
+#line 541 "lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1732,10 +1727,10 @@ YY_RULE_SETUP
 	YY_BREAK
 case 75:
 YY_RULE_SETUP
-#line 553 "lexer.l"
+#line 554 "lexer.l"
 ECHO;
 	YY_BREAK
-#line 1739 "lexer.c"
+#line 1734 "lexer.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1800,7 +1795,8 @@ ECHO;
 
 			else
 				{
-				yy_cp = yyg->yy_c_buf_p;
+				yy_cp = yyg->yy_last_accepting_cpos;
+				yy_current_state = yyg->yy_last_accepting_state;
 				goto yy_find_action;
 				}
 			}
@@ -2261,10 +2257,6 @@ static void yara_yy_load_buffer_state  (yyscan_t yyscanner)
 	yara_yyfree((void *) b ,yyscanner );
 }
 
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a yara_yyrestart() or at EOF.
@@ -2289,7 +2281,7 @@ extern int isatty (int );
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+        b->yy_is_interactive = 0;
     
 	errno = oerrno;
 }
@@ -2868,7 +2860,7 @@ void yara_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 553 "lexer.l"
+#line 554 "lexer.l"
 
 
 
diff --git a/libyara/lexer.l b/libyara/lexer.l
index f0a4c53..90cb416 100644
--- a/libyara/lexer.l
+++ b/libyara/lexer.l
@@ -63,6 +63,7 @@ limitations under the License.
 %option nounistd
 %option noinput
 %option nounput
+%option never-interactive
 %option yylineno
 %option prefix="yara_yy"
 %option outfile="lex.yy.c"
diff --git a/libyara/re_lexer.c b/libyara/re_lexer.c
index 4eaf829..e36f2de 100644
--- a/libyara/re_lexer.c
+++ b/libyara/re_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;
@@ -526,7 +525,7 @@ uint8_t read_escaped_char(yyscan_t yyscanner);
 
 #define YY_NO_UNISTD_H 1
 
-#line 530 "re_lexer.c"
+#line 529 "re_lexer.c"
 
 #define INITIAL 0
 #define char_class 1
@@ -758,10 +757,10 @@ YY_DECL
 	register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 61 "re_lexer.l"
+#line 62 "re_lexer.l"
 
 
-#line 765 "re_lexer.c"
+#line 764 "re_lexer.c"
 
     yylval = yylval_param;
 
@@ -822,16 +821,12 @@ yy_match:
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 			++yy_cp;
 			}
-		while ( yy_base[yy_current_state] != 91 );
+		while ( yy_current_state != 42 );
+		yy_cp = yyg->yy_last_accepting_cpos;
+		yy_current_state = yyg->yy_last_accepting_state;
 
 yy_find_action:
 		yy_act = yy_accept[yy_current_state];
-		if ( yy_act == 0 )
-			{ /* have to back up */
-			yy_cp = yyg->yy_last_accepting_cpos;
-			yy_current_state = yyg->yy_last_accepting_state;
-			yy_act = yy_accept[yy_current_state];
-			}
 
 		YY_DO_BEFORE_ACTION;
 
@@ -860,7 +855,7 @@ do_action:	/* This label is used only to access EOF actions. */
 
 case 1:
 YY_RULE_SETUP
-#line 63 "re_lexer.l"
+#line 64 "re_lexer.l"
 {
 
   // Examples: {3,8} {0,5} {,5} {7,}
@@ -896,7 +891,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 97 "re_lexer.l"
+#line 98 "re_lexer.l"
 {
 
   // Example: {10}
@@ -916,7 +911,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 115 "re_lexer.l"
+#line 116 "re_lexer.l"
 {
 
   // Start of a negated character class. Example: [^abcd]
@@ -928,7 +923,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 124 "re_lexer.l"
+#line 125 "re_lexer.l"
 {
 
   // Start of character negated class containing a ].
@@ -943,7 +938,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 137 "re_lexer.l"
+#line 138 "re_lexer.l"
 {
 
   // Start of character class containing a ].
@@ -958,7 +953,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 150 "re_lexer.l"
+#line 151 "re_lexer.l"
 {
 
   // Start of character class. Example: [abcd]
@@ -971,7 +966,7 @@ YY_RULE_SETUP
 case 7:
 /* rule 7 can match eol */
 YY_RULE_SETUP
-#line 160 "re_lexer.l"
+#line 161 "re_lexer.l"
 {
 
   // Any non-special character is passed as a CHAR token to the scanner.
@@ -982,49 +977,49 @@ YY_RULE_SETUP
 	YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 169 "re_lexer.l"
+#line 170 "re_lexer.l"
 {
   return _WORD_CHAR_;
 }
 	YY_BREAK
 case 9:
 YY_RULE_SETUP
-#line 174 "re_lexer.l"
+#line 175 "re_lexer.l"
 {
   return _NON_WORD_CHAR_;
 }
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 179 "re_lexer.l"
+#line 180 "re_lexer.l"
 {
   return _SPACE_;
 }
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 184 "re_lexer.l"
+#line 185 "re_lexer.l"
 {
   return _NON_SPACE_;
 }
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 189 "re_lexer.l"
+#line 190 "re_lexer.l"
 {
   return _DIGIT_;
 }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 194 "re_lexer.l"
+#line 195 "re_lexer.l"
 {
   return _NON_DIGIT_;
 }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 199 "re_lexer.l"
+#line 200 "re_lexer.l"
 {
 
   yyerror(yyscanner, lex_env, "backreferences are not allowed");
@@ -1033,7 +1028,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 206 "re_lexer.l"
+#line 207 "re_lexer.l"
 {
   yylval->integer = read_escaped_char(yyscanner);
   return _CHAR_;
@@ -1041,7 +1036,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 16:
 YY_RULE_SETUP
-#line 212 "re_lexer.l"
+#line 213 "re_lexer.l"
 {
 
   // End of character class.
@@ -1064,7 +1059,7 @@ YY_RULE_SETUP
 case 17:
 /* rule 17 can match eol */
 YY_RULE_SETUP
-#line 233 "re_lexer.l"
+#line 234 "re_lexer.l"
 {
 
   // A range inside a character class.
@@ -1103,7 +1098,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 18:
 YY_RULE_SETUP
-#line 270 "re_lexer.l"
+#line 271 "re_lexer.l"
 {
 
   int i;
@@ -1118,7 +1113,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
-#line 283 "re_lexer.l"
+#line 284 "re_lexer.l"
 {
 
   int i;
@@ -1133,7 +1128,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
-#line 296 "re_lexer.l"
+#line 297 "re_lexer.l"
 {
 
   LEX_ENV->class_vector[' ' / 8] |= 1 << ' ' % 8;
@@ -1142,7 +1137,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
-#line 303 "re_lexer.l"
+#line 304 "re_lexer.l"
 {
 
   int i;
@@ -1156,7 +1151,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
-#line 315 "re_lexer.l"
+#line 316 "re_lexer.l"
 {
 
   char c;
@@ -1167,7 +1162,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
-#line 324 "re_lexer.l"
+#line 325 "re_lexer.l"
 {
 
   int i;
@@ -1182,7 +1177,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
-#line 337 "re_lexer.l"
+#line 338 "re_lexer.l"
 {
 
   uint8_t c = read_escaped_char(yyscanner);
@@ -1191,7 +1186,7 @@ YY_RULE_SETUP
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
-#line 344 "re_lexer.l"
+#line 345 "re_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1209,7 +1204,7 @@ YY_RULE_SETUP
 }
 	YY_BREAK
 case YY_STATE_EOF(char_class):
-#line 361 "re_lexer.l"
+#line 362 "re_lexer.l"
 {
 
   // End of regexp reached while scanning a character class.
@@ -1220,7 +1215,7 @@ case YY_STATE_EOF(char_class):
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
-#line 370 "re_lexer.l"
+#line 371 "re_lexer.l"
 {
 
   if (yytext[0] >= 32 && yytext[0] < 127)
@@ -1235,7 +1230,7 @@ YY_RULE_SETUP
 }
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
-#line 384 "re_lexer.l"
+#line 385 "re_lexer.l"
 {
 
   yyterminate();
@@ -1243,10 +1238,10 @@ case YY_STATE_EOF(INITIAL):
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
-#line 389 "re_lexer.l"
+#line 390 "re_lexer.l"
 ECHO;
 	YY_BREAK
-#line 1250 "re_lexer.c"
+#line 1245 "re_lexer.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1311,7 +1306,8 @@ ECHO;
 
 			else
 				{
-				yy_cp = yyg->yy_c_buf_p;
+				yy_cp = yyg->yy_last_accepting_cpos;
+				yy_current_state = yyg->yy_last_accepting_state;
 				goto yy_find_action;
 				}
 			}
@@ -1772,10 +1768,6 @@ static void re_yy_load_buffer_state  (yyscan_t yyscanner)
 	re_yyfree((void *) b ,yyscanner );
 }
 
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
 /* Initializes or reinitializes a buffer.
  * This function is sometimes called more than once on the same buffer,
  * such as during a re_yyrestart() or at EOF.
@@ -1800,7 +1792,7 @@ extern int isatty (int );
         b->yy_bs_column = 0;
     }
 
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+        b->yy_is_interactive = 0;
     
 	errno = oerrno;
 }
@@ -2379,7 +2371,7 @@ void re_yyfree (void * ptr , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 389 "re_lexer.l"
+#line 390 "re_lexer.l"
 
 
 
diff --git a/libyara/re_lexer.l b/libyara/re_lexer.l
index bc98bfe..f2fa94e 100644
--- a/libyara/re_lexer.l
+++ b/libyara/re_lexer.l
@@ -45,6 +45,7 @@ uint8_t read_escaped_char(yyscan_t yyscanner);
 %option noyywrap
 %option nounistd
 %option nounput
+%option never-interactive
 %option yylineno
 %option prefix="re_yy"
 

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