diff libfdcore/fdd.l @ 918:46f9982b7d26

Use logging routines for configuration file parsing (based on patch by Thomas)
author Sebastien Decugis <sdecugis@freediameter.net>
date Tue, 12 Feb 2013 14:57:32 +0100
parents 4a9f08d6b6ba
children e5a09fab5ef3 51c15f98a965
line wrap: on
line diff
--- a/libfdcore/fdd.l	Wed Feb 06 15:52:34 2013 +0100
+++ b/libfdcore/fdd.l	Tue Feb 12 14:57:32 2013 +0100
@@ -51,7 +51,7 @@
 #define YY_USER_ACTION { 						\
 	yylloc->first_column = yylloc->last_column + 1; 		\
 	yylloc->last_column = yylloc->first_column + yyleng - 1;	\
-	TRACE_DEBUG(FULL, 						\
+	TRACE_DEBUG_ERROR( 						\
 		"(%d:%d-%d:%d) matched rule %d, length=%d, txt='%s'\n",	\
 		yylloc->first_line, yylloc->first_column, 		\
 		yylloc->last_line, yylloc->last_column, 		\
@@ -103,7 +103,7 @@
 				int ret = sscanf(yytext, "%i", &yylval->integer);
 				if (ret != 1) {
 					/* No matching: an error occurred */
-					fprintf(stderr, "Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
+					TRACE_DEBUG_ERROR("Unable to convert the value '%s' to a valid number: %s\n", yytext, strerror(errno));
 					return LEX_ERROR; /* trig an error in yacc parser */
 					/* Maybe we could REJECT instead of failing here? */
 				}
@@ -145,8 +145,8 @@
 	/* Unrecognized token */
 <*>[[:alnum:]]+		|	/* This rule is only useful to print a complete token in error messages */
 	/* Unrecognized character */
-<*>.			{ 
-				fprintf(stderr, "Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
+<*>.			{
+				TRACE_DEBUG_ERROR("Unrecognized text on line %d col %d: '%s'.\n", yylloc->first_line, yylloc->first_column, yytext);
 			 	return LEX_ERROR; 
 			}
 
"Welcome to our mercurial repository"