From 7e2e6ca176afbde66e1f5ae147470fd229da97de Mon Sep 17 00:00:00 2001 From: schodet Date: Wed, 8 Feb 2006 23:02:23 +0000 Subject: - restructuration du parser - création de ConfigParser - amélioration du report d'erreur - passage en 2006 --- i/marvin/src/config/parser.yy | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'i/marvin/src/config/parser.yy') diff --git a/i/marvin/src/config/parser.yy b/i/marvin/src/config/parser.yy index 1aeb986..dc2be24 100644 --- a/i/marvin/src/config/parser.yy +++ b/i/marvin/src/config/parser.yy @@ -1,9 +1,9 @@ %{ -// robert - programme du robot 2005. {{{ +// marvin - programme du robot 2006. {{{ // -// Copyright (C) 2005 Nicolas Schodet +// Copyright (C) 2006 Nicolas Schodet // -// Robot APB Team/Efrei 2005. +// Robot APB Team/Efrei 2006. // Web: http://assos.efrei.fr/robot/ // Email: robot AT efrei DOT fr // @@ -22,28 +22,25 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // // }}} -#define YYPARSE_PARAM scanner -#define YYLEX_PARAM scanner - #include "config/config.hh" #include "config/config_data.hh" -#include "config/parser_extra.hh" +#include "config/config_parser.hh" // Fichiers d'en-tête générés. #include "parser.hh" #include "lexer.hh" -#include // XXX à virer. - -void yyerror (const char *); - #undef yyextra #define yyextra (yyget_extra (scanner)) +void yyerror (void *scanner, const char *e); + %} %error-verbose %pure-parser +%lex-param {void *scanner} +%parse-param {void *scanner} %defines %union { char c; @@ -64,7 +61,6 @@ void yyerror (const char *); %token FLOAT %token ID STRING %token BOOLEAN -%token IMG DATA %type int_list %type float_list @@ -159,9 +155,11 @@ string_list: %% -void yyerror (const char *e) +/// Traite une erreur de Bison. +void +yyerror (void *scanner, const char *e) { - std::cerr << e << std::endl; + yyextra->error (e); } /* Shut up warning for this wrongly declared static function. */ -- cgit v1.2.3