From c340d24670e62db85df2efad04e72caebdd75c8c Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Mon, 19 Apr 2004 07:42:26 +0000 Subject: [PATCH] better test to check when to abort parsing --- Box/Main.cpp | 6 +++--- Fltk/Main.cpp | 6 +++--- Parser/Gmsh.tab.cpp | 6 +++--- Parser/Gmsh.y | 6 +++--- Parser/Gmsh.yy.cpp | 4 ++-- Parser/OpenFile.cpp | 7 ++----- 6 files changed, 16 insertions(+), 19 deletions(-) diff --git a/Box/Main.cpp b/Box/Main.cpp index 6640123f1a..bf435b2a05 100644 --- a/Box/Main.cpp +++ b/Box/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.37 2004-04-15 02:13:22 geuzaine Exp $ +// $Id: Main.cpp,v 1.38 2004-04-19 07:42:23 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -43,8 +43,8 @@ #include "CommandLine.h" #include "MinMax.h" -char yyname[256]; -int yyerrorstate; +char yyname[256] = ""; +int yyerrorstate = 0; Context_T CTX; Mesh M, *THEM = NULL, *LOCAL = NULL; diff --git a/Fltk/Main.cpp b/Fltk/Main.cpp index a1f3b8392c..70bd51f3b2 100644 --- a/Fltk/Main.cpp +++ b/Fltk/Main.cpp @@ -1,4 +1,4 @@ -// $Id: Main.cpp,v 1.60 2004-04-15 02:13:23 geuzaine Exp $ +// $Id: Main.cpp,v 1.61 2004-04-19 07:42:24 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -39,8 +39,8 @@ #include "CommandLine.h" #include "Numeric.h" -char yyname[256]=""; -int yyerrorstate=0; +char yyname[256] = ""; +int yyerrorstate = 0; Context_T CTX; Mesh M, *THEM = NULL, *LOCAL = NULL; GUI *WID = NULL; diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index d1850ace2d..06c10ed847 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -191,7 +191,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.185 2004-04-13 20:56:40 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.186 2004-04-19 07:42:24 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -8990,7 +8990,7 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer){ void yyerror(char *s){ Msg(GERROR, "'%s', line %d : %s (%s)", yyname, yylineno-1, s, yytext); - yyerrorstate=1; + yyerrorstate++; } void yymsg(int type, char *fmt, ...){ @@ -9003,5 +9003,5 @@ void yymsg(int type, char *fmt, ...){ Msg(type, "'%s', line %d : %s", yyname, yylineno-1, tmp); - if(type == GERROR) yyerrorstate=1; + if(type == GERROR) yyerrorstate++; } diff --git a/Parser/Gmsh.y b/Parser/Gmsh.y index 045e31950e..e82a9c80d8 100644 --- a/Parser/Gmsh.y +++ b/Parser/Gmsh.y @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.y,v 1.162 2004-03-30 18:17:09 geuzaine Exp $ +// $Id: Gmsh.y,v 1.163 2004-04-19 07:42:25 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -3875,7 +3875,7 @@ int PrintListOfDouble(char *format, List_T *list, char *buffer){ void yyerror(char *s){ Msg(GERROR, "'%s', line %d : %s (%s)", yyname, yylineno-1, s, yytext); - yyerrorstate=1; + yyerrorstate++; } void yymsg(int type, char *fmt, ...){ @@ -3888,5 +3888,5 @@ void yymsg(int type, char *fmt, ...){ Msg(type, "'%s', line %d : %s", yyname, yylineno-1, tmp); - if(type == GERROR) yyerrorstate=1; + if(type == GERROR) yyerrorstate++; } diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index cd8c0e4de6..b38e70bb6e 100644 --- a/Parser/Gmsh.yy.cpp +++ b/Parser/Gmsh.yy.cpp @@ -2,7 +2,7 @@ /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.184 2004-04-13 20:56:40 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.185 2004-04-19 07:42:26 geuzaine Exp $ */ #define FLEX_SCANNER @@ -1014,7 +1014,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.184 2004-04-13 20:56:40 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.185 2004-04-19 07:42:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 1e2f568fb1..16e2cb9e93 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.52 2004-04-13 18:49:25 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.53 2004-04-19 07:42:26 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -110,12 +110,9 @@ int ParseFile(char *f, int silent, int close) fgets(tmp, sizeof(tmp), yyin); fsetpos(yyin, &position); - int errorcount = 0; while(!feof(yyin)){ yyparse(); - if(yyerrorstate) - errorcount++; - if(errorcount > 20){ + if(yyerrorstate > 20){ Msg(GERROR, "Too many errors: aborting..."); break; } -- GitLab