From 320ae905b067aa591922da50a25a15a99316aad0 Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Fri, 2 Jul 2004 20:48:42 +0000 Subject: [PATCH] force a buffer flush when we abort the parser due to too many errors --- Parser/Gmsh.l | 3 ++- Parser/Gmsh.tab.cpp | 2 +- Parser/Gmsh.yy.cpp | 5 +++-- Parser/OpenFile.cpp | 3 ++- Parser/Parser.h | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Parser/Gmsh.l b/Parser/Gmsh.l index 0a9923bf4e..d1be3477f5 100644 --- a/Parser/Gmsh.l +++ b/Parser/Gmsh.l @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.l,v 1.56 2004-05-30 21:21:41 geuzaine Exp $ +// $Id: Gmsh.l,v 1.57 2004-07-02 20:48:42 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -421,3 +421,4 @@ void skip_until(char *skip, char *until){ } } +void force_yyflush() { YY_FLUSH_BUFFER; } diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 1d125e459b..fc589d71d4 100644 --- a/Parser/Gmsh.tab.cpp +++ b/Parser/Gmsh.tab.cpp @@ -192,7 +192,7 @@ #line 1 "Gmsh.y" -// $Id: Gmsh.tab.cpp,v 1.198 2004-07-02 02:40:43 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.199 2004-07-02 20:48:42 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // diff --git a/Parser/Gmsh.yy.cpp b/Parser/Gmsh.yy.cpp index 5c28d463ad..c3f5143ec9 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.197 2004-07-02 02:40:47 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.198 2004-07-02 20:48:42 geuzaine Exp $ */ #define FLEX_SCANNER @@ -1019,7 +1019,7 @@ char *yytext; #line 1 "Gmsh.l" #define INITIAL 0 #line 2 "Gmsh.l" -// $Id: Gmsh.yy.cpp,v 1.197 2004-07-02 02:40:47 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.198 2004-07-02 20:48:42 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -3345,3 +3345,4 @@ void skip_until(char *skip, char *until){ } } +void force_yyflush() { YY_FLUSH_BUFFER; } diff --git a/Parser/OpenFile.cpp b/Parser/OpenFile.cpp index 510408b0d5..4eff8d4710 100644 --- a/Parser/OpenFile.cpp +++ b/Parser/OpenFile.cpp @@ -1,4 +1,4 @@ -// $Id: OpenFile.cpp,v 1.59 2004-06-17 21:16:58 geuzaine Exp $ +// $Id: OpenFile.cpp,v 1.60 2004-07-02 20:48:42 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -124,6 +124,7 @@ int ParseFile(char *f, int silent, int close, int warn_if_missing) yyparse(); if(yyerrorstate > 20){ Msg(GERROR, "Too many errors: aborting..."); + force_yyflush(); break; } } diff --git a/Parser/Parser.h b/Parser/Parser.h index 980fcc0cbc..2e7c6a934a 100644 --- a/Parser/Parser.h +++ b/Parser/Parser.h @@ -33,6 +33,7 @@ extern Tree_T *Symbol_T; int yyparse (void); int yylex (); +void force_yyflush(); extern FILE *yyin; extern int yylineno; -- GitLab