changeset 262:08b94ee23e9e

Fix a token definition for multiple empty lines
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 11 Dec 2008 10:56:13 +0900
parents b57b797e15fd
children a8dfd5135757
files extensions/rt_default/rtd_tok.l extensions/sec_nosec/sns_token.l waaad/conf-token.l
diffstat 3 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/extensions/rt_default/rtd_tok.l	Thu Dec 11 10:18:33 2008 +0900
+++ b/extensions/rt_default/rtd_tok.l	Thu Dec 11 10:56:13 2008 +0900
@@ -45,9 +45,9 @@
 #include "rtd_gram.h"
 
 /* Update the column information */
-#define YY_USER_ACTION { 					\
-	yylloc->first_column = yylloc->last_column + 1; 	\
-	yylloc->last_column = yylloc->first_column + yyleng - 1;\
+#define YY_USER_ACTION { 						\
+	yylloc->first_column = yylloc->last_column + 1; 		\
+	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
 }
 
 /* Avoid warning with newer flex */
@@ -68,13 +68,13 @@
 				yylloc->last_column=0; 
 			}
 	 
-	/* Eat all spaces */
-[[:space:]]+		;
+	/* Eat all spaces but not new lines */
+([[:space:]]{-}[\n])+	;
 	/* Eat all comments */
 #.*$			;
 
 	/* Recognize any integer */
-[[:digit:]]+		{
+[-]?[[:digit:]]+		{
 				/* Convert this to an integer value */
 				int ret=0;
 				ret = sscanf(yytext, "%i", &yylval->integer);
@@ -145,7 +145,7 @@
 [*=>;]			{ return yytext[0]; }
 
 	/* Unrecognized sequence, if it did not match any previous pattern */
-[^[:space:]\n]		{ 
+[^[:space:]"*=>;\n]+	{ 
 				log_error("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
 			 	return LEX_ERROR; 
 			}
--- a/extensions/sec_nosec/sns_token.l	Thu Dec 11 10:18:33 2008 +0900
+++ b/extensions/sec_nosec/sns_token.l	Thu Dec 11 10:56:13 2008 +0900
@@ -69,8 +69,8 @@
 				yylloc->last_column=0; 
 			}
 	 
-	/* Eat all spaces */
-[[:space:]]+		;
+	/* Eat all spaces but not new lines */
+([[:space:]]{-}[\n])+	;
 	/* Eat all comments */
 #.*$			;
 
--- a/waaad/conf-token.l	Thu Dec 11 10:18:33 2008 +0900
+++ b/waaad/conf-token.l	Thu Dec 11 10:56:13 2008 +0900
@@ -50,13 +50,13 @@
 /* Update the column information */
 #ifdef DEBUG_LEX
 #define YY_USER_ACTION { 						\
+	yylloc->first_column = yylloc->last_column + 1; 		\
+	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
 	TRACE_DEBUG(FULL, 						\
 		"(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n",	\
 		yylloc->first_line, yylloc->first_column, 		\
 		yylloc->last_line, yylloc->last_column, 		\
 		yy_act, yyleng, yytext); 				\
-	yylloc->first_column = yylloc->last_column + 1; 		\
-	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
 }
 #else /* DEBUG_LEX */
 #define YY_USER_ACTION { 						\
@@ -89,7 +89,7 @@
 				yylloc->last_column=0; 
 			} 
 
-<*>[[:space:]]		; /* Eat all spaces */
+<*>([[:space:]]{-}[\n])+	; /* Eat all spaces, not new lines */
 <*>#.*$			; /* Eat all comments */
 
 {qstring}		{
"Welcome to our mercurial repository"