From 09ffc82a60b550a964789f848f7400f798e28b8b Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine <cgeuzaine@ulg.ac.be> Date: Wed, 3 Mar 2004 22:23:43 +0000 Subject: [PATCH] Fixed '//' with EOF before '\n' bug --- Parser/Gmsh.l | 29 +-- Parser/Gmsh.tab.cpp | 2 +- Parser/Gmsh.yy.cpp | 457 ++++++++++++++++++++++---------------------- 3 files changed, 251 insertions(+), 237 deletions(-) diff --git a/Parser/Gmsh.l b/Parser/Gmsh.l index 2ed10db681..94dab0087a 100644 --- a/Parser/Gmsh.l +++ b/Parser/Gmsh.l @@ -1,5 +1,5 @@ %{ -// $Id: Gmsh.l,v 1.54 2004-02-28 00:48:50 geuzaine Exp $ +// $Id: Gmsh.l,v 1.55 2004-03-03 22:23:42 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -31,7 +31,6 @@ #include "CAD.h" #include "Gmsh.tab.hpp" -char TmpString[1024]; int yywhere = INFILE; int yylineno = 1; @@ -322,11 +321,11 @@ solid {skipline();return tSolid;} int yywrap() {return 1;} -void skipcomments(void) { +void skipcomments(void){ int c; while (1) { - while ((c=yyinput()) != '*'){ + while ((c = yyinput()) != '*'){ if(c == EOF){ Msg(GERROR, "End of file in commented region"); return; @@ -340,15 +339,20 @@ void skipcomments(void) { void parsestring(char endchar){ int c, i; + char tmp[1024]; - c = yyinput(); i = 0; - while (c != endchar) { - TmpString[i++] = c; - c = yyinput(); + while ((c = yyinput()) != endchar) { + if(c == EOF){ + Msg(GERROR, "End of file in string"); + break; + } + else{ + tmp[i++] = (char)c; + } } - TmpString[i++] = '\0'; - yylval.c = strsave(TmpString); + tmp[i] = '\0'; + yylval.c = strsave(tmp); } char *strsave(char *ptr){ @@ -356,7 +360,10 @@ char *strsave(char *ptr){ } void skipline(void){ - while (yyinput() != '\n'); + int c; + while ((c = yyinput()) != '\n'){ + if(c == EOF) return; + } } void skip_until(char *skip, char *until){ diff --git a/Parser/Gmsh.tab.cpp b/Parser/Gmsh.tab.cpp index 02eaadcd53..b951e8eada 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.182 2004-02-28 00:48:50 geuzaine Exp $ +// $Id: Gmsh.tab.cpp,v 1.183 2004-03-03 22:23: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 f65103ed55..1c29057880 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.181 2004-02-28 00:48:55 geuzaine Exp $ + * $Header: /cvsroot/gmsh/Parser/Gmsh.yy.cpp,v 1.182 2004-03-03 22:23:43 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.181 2004-02-28 00:48:55 geuzaine Exp $ +// $Id: Gmsh.yy.cpp,v 1.182 2004-03-03 22:23:43 geuzaine Exp $ // // Copyright (C) 1997-2004 C. Geuzaine, J.-F. Remacle // @@ -1046,7 +1046,6 @@ char *yytext; #include "CAD.h" #include "Gmsh.tab.hpp" -char TmpString[1024]; int yywhere = INFILE; int yylineno = 1; @@ -1076,7 +1075,7 @@ void skipline(void); && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); -#line 1080 "Gmsh.yy.cpp" +#line 1079 "Gmsh.yy.cpp" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1227,10 +1226,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 81 "Gmsh.l" +#line 80 "Gmsh.l" -#line 1234 "Gmsh.yy.cpp" +#line 1233 "Gmsh.yy.cpp" if ( yy_init ) { @@ -1315,1036 +1314,1036 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 83 "Gmsh.l" +#line 82 "Gmsh.l" /* none */; YY_BREAK case 2: YY_RULE_SETUP -#line 84 "Gmsh.l" +#line 83 "Gmsh.l" return tEND; YY_BREAK case 3: YY_RULE_SETUP -#line 85 "Gmsh.l" +#line 84 "Gmsh.l" skipcomments(); YY_BREAK case 4: YY_RULE_SETUP -#line 86 "Gmsh.l" +#line 85 "Gmsh.l" skipline(); YY_BREAK case 5: YY_RULE_SETUP -#line 87 "Gmsh.l" +#line 86 "Gmsh.l" {parsestring('\"'); return tBIGSTR;} YY_BREAK case 6: YY_RULE_SETUP -#line 88 "Gmsh.l" +#line 87 "Gmsh.l" {parsestring('\''); return tBIGSTR;} YY_BREAK case 7: YY_RULE_SETUP -#line 89 "Gmsh.l" +#line 88 "Gmsh.l" {yylval.d = NEWREG(); return tDOUBLE;} YY_BREAK case 8: YY_RULE_SETUP -#line 90 "Gmsh.l" +#line 89 "Gmsh.l" {yylval.d = NEWPOINT(); return tDOUBLE;} YY_BREAK case 9: YY_RULE_SETUP -#line 91 "Gmsh.l" +#line 90 "Gmsh.l" {yylval.d = NEWLINE(); return tDOUBLE;} YY_BREAK case 10: YY_RULE_SETUP -#line 92 "Gmsh.l" +#line 91 "Gmsh.l" {yylval.d = NEWLINE(); return tDOUBLE;} YY_BREAK case 11: YY_RULE_SETUP -#line 93 "Gmsh.l" +#line 92 "Gmsh.l" {yylval.d = NEWSURFACE(); return tDOUBLE;} YY_BREAK case 12: YY_RULE_SETUP -#line 94 "Gmsh.l" +#line 93 "Gmsh.l" {yylval.d = NEWVOLUME(); return tDOUBLE;} YY_BREAK case 13: YY_RULE_SETUP -#line 95 "Gmsh.l" +#line 94 "Gmsh.l" return tAFFECT; YY_BREAK case 14: YY_RULE_SETUP -#line 96 "Gmsh.l" +#line 95 "Gmsh.l" return tAFFECTPLUS; YY_BREAK case 15: YY_RULE_SETUP -#line 97 "Gmsh.l" +#line 96 "Gmsh.l" return tAFFECTMINUS; YY_BREAK case 16: YY_RULE_SETUP -#line 98 "Gmsh.l" +#line 97 "Gmsh.l" return tAFFECTTIMES; YY_BREAK case 17: YY_RULE_SETUP -#line 99 "Gmsh.l" +#line 98 "Gmsh.l" return tAFFECTDIVIDE; YY_BREAK case 18: YY_RULE_SETUP -#line 100 "Gmsh.l" +#line 99 "Gmsh.l" return tDOTS; YY_BREAK case 19: YY_RULE_SETUP -#line 101 "Gmsh.l" +#line 100 "Gmsh.l" return tDOTS; YY_BREAK case 20: YY_RULE_SETUP -#line 102 "Gmsh.l" +#line 101 "Gmsh.l" return tCROSSPRODUCT; YY_BREAK case 21: YY_RULE_SETUP -#line 103 "Gmsh.l" +#line 102 "Gmsh.l" return tOR; YY_BREAK case 22: YY_RULE_SETUP -#line 104 "Gmsh.l" +#line 103 "Gmsh.l" return tAND; YY_BREAK case 23: YY_RULE_SETUP -#line 105 "Gmsh.l" +#line 104 "Gmsh.l" return tPLUSPLUS; YY_BREAK case 24: YY_RULE_SETUP -#line 106 "Gmsh.l" +#line 105 "Gmsh.l" return tMINUSMINUS; YY_BREAK case 25: YY_RULE_SETUP -#line 107 "Gmsh.l" +#line 106 "Gmsh.l" return tEQUAL; YY_BREAK case 26: YY_RULE_SETUP -#line 108 "Gmsh.l" +#line 107 "Gmsh.l" return tNOTEQUAL; YY_BREAK case 27: YY_RULE_SETUP -#line 109 "Gmsh.l" +#line 108 "Gmsh.l" return tAPPROXEQUAL; YY_BREAK case 28: YY_RULE_SETUP -#line 110 "Gmsh.l" +#line 109 "Gmsh.l" return tLESSOREQUAL; YY_BREAK case 29: YY_RULE_SETUP -#line 111 "Gmsh.l" +#line 110 "Gmsh.l" return tGREATEROREQUAL; YY_BREAK case 30: YY_RULE_SETUP -#line 113 "Gmsh.l" +#line 112 "Gmsh.l" return tAcos; YY_BREAK case 31: YY_RULE_SETUP -#line 114 "Gmsh.l" +#line 113 "Gmsh.l" return tAcos; YY_BREAK case 32: YY_RULE_SETUP -#line 115 "Gmsh.l" +#line 114 "Gmsh.l" return tAsin; YY_BREAK case 33: YY_RULE_SETUP -#line 116 "Gmsh.l" +#line 115 "Gmsh.l" return tAsin; YY_BREAK case 34: YY_RULE_SETUP -#line 117 "Gmsh.l" +#line 116 "Gmsh.l" return tAtan; YY_BREAK case 35: YY_RULE_SETUP -#line 118 "Gmsh.l" +#line 117 "Gmsh.l" return tAtan; YY_BREAK case 36: YY_RULE_SETUP -#line 119 "Gmsh.l" +#line 118 "Gmsh.l" return tAtan2; YY_BREAK case 37: YY_RULE_SETUP -#line 120 "Gmsh.l" +#line 119 "Gmsh.l" return tAtan2; YY_BREAK case 38: YY_RULE_SETUP -#line 121 "Gmsh.l" +#line 120 "Gmsh.l" return tAttractor; YY_BREAK case 39: YY_RULE_SETUP -#line 123 "Gmsh.l" +#line 122 "Gmsh.l" return tBezier; YY_BREAK case 40: YY_RULE_SETUP -#line 124 "Gmsh.l" +#line 123 "Gmsh.l" return tBump; YY_BREAK case 41: YY_RULE_SETUP -#line 125 "Gmsh.l" +#line 124 "Gmsh.l" return tBSpline; YY_BREAK case 42: YY_RULE_SETUP -#line 126 "Gmsh.l" +#line 125 "Gmsh.l" return tBounds; YY_BREAK case 43: YY_RULE_SETUP -#line 128 "Gmsh.l" +#line 127 "Gmsh.l" return tCeil; YY_BREAK case 44: YY_RULE_SETUP -#line 129 "Gmsh.l" +#line 128 "Gmsh.l" return tCombine; YY_BREAK case 45: YY_RULE_SETUP -#line 130 "Gmsh.l" +#line 129 "Gmsh.l" return tCosh; YY_BREAK case 46: YY_RULE_SETUP -#line 131 "Gmsh.l" +#line 130 "Gmsh.l" return tCos; YY_BREAK case 47: YY_RULE_SETUP -#line 132 "Gmsh.l" +#line 131 "Gmsh.l" return tCharacteristic; YY_BREAK case 48: YY_RULE_SETUP -#line 133 "Gmsh.l" +#line 132 "Gmsh.l" return tCircle; YY_BREAK case 49: YY_RULE_SETUP -#line 134 "Gmsh.l" +#line 133 "Gmsh.l" return tCoherence; YY_BREAK case 50: YY_RULE_SETUP -#line 135 "Gmsh.l" +#line 134 "Gmsh.l" return tComplex; YY_BREAK case 51: YY_RULE_SETUP -#line 136 "Gmsh.l" +#line 135 "Gmsh.l" return tColor; YY_BREAK case 52: YY_RULE_SETUP -#line 137 "Gmsh.l" +#line 136 "Gmsh.l" return tColorTable; YY_BREAK case 53: YY_RULE_SETUP -#line 138 "Gmsh.l" +#line 137 "Gmsh.l" return tSpline; YY_BREAK case 54: YY_RULE_SETUP -#line 139 "Gmsh.l" +#line 138 "Gmsh.l" return tCall; YY_BREAK case 55: YY_RULE_SETUP -#line 141 "Gmsh.l" +#line 140 "Gmsh.l" return tDelete; YY_BREAK case 56: YY_RULE_SETUP -#line 142 "Gmsh.l" +#line 141 "Gmsh.l" return tDilate; YY_BREAK case 57: YY_RULE_SETUP -#line 143 "Gmsh.l" +#line 142 "Gmsh.l" return tDuplicata; YY_BREAK case 58: YY_RULE_SETUP -#line 144 "Gmsh.l" +#line 143 "Gmsh.l" return tDraw; YY_BREAK case 59: YY_RULE_SETUP -#line 146 "Gmsh.l" +#line 145 "Gmsh.l" return tExp; YY_BREAK case 60: YY_RULE_SETUP -#line 147 "Gmsh.l" +#line 146 "Gmsh.l" return tEllipse; YY_BREAK case 61: YY_RULE_SETUP -#line 148 "Gmsh.l" +#line 147 "Gmsh.l" return tEllipse; YY_BREAK case 62: YY_RULE_SETUP -#line 149 "Gmsh.l" +#line 148 "Gmsh.l" return tExtrude; YY_BREAK case 63: YY_RULE_SETUP -#line 150 "Gmsh.l" +#line 149 "Gmsh.l" return tElliptic; YY_BREAK case 64: YY_RULE_SETUP -#line 151 "Gmsh.l" +#line 150 "Gmsh.l" return tEndFor; YY_BREAK case 65: YY_RULE_SETUP -#line 152 "Gmsh.l" +#line 151 "Gmsh.l" return tEndIf; YY_BREAK case 66: YY_RULE_SETUP -#line 153 "Gmsh.l" +#line 152 "Gmsh.l" return tExit; YY_BREAK case 67: YY_RULE_SETUP -#line 155 "Gmsh.l" +#line 154 "Gmsh.l" return tFabs; YY_BREAK case 68: YY_RULE_SETUP -#line 156 "Gmsh.l" +#line 155 "Gmsh.l" return tFloor; YY_BREAK case 69: YY_RULE_SETUP -#line 157 "Gmsh.l" +#line 156 "Gmsh.l" return tFmod; YY_BREAK case 70: YY_RULE_SETUP -#line 158 "Gmsh.l" +#line 157 "Gmsh.l" return tFor; YY_BREAK case 71: YY_RULE_SETUP -#line 159 "Gmsh.l" +#line 158 "Gmsh.l" return tFunction; YY_BREAK case 72: YY_RULE_SETUP -#line 161 "Gmsh.l" +#line 160 "Gmsh.l" return tHide; YY_BREAK case 73: YY_RULE_SETUP -#line 162 "Gmsh.l" +#line 161 "Gmsh.l" return tHypot; YY_BREAK case 74: YY_RULE_SETUP -#line 164 "Gmsh.l" +#line 163 "Gmsh.l" return tIn; YY_BREAK case 75: YY_RULE_SETUP -#line 165 "Gmsh.l" +#line 164 "Gmsh.l" return tIf; YY_BREAK case 76: YY_RULE_SETUP -#line 166 "Gmsh.l" +#line 165 "Gmsh.l" return tIntersect; YY_BREAK case 77: YY_RULE_SETUP -#line 168 "Gmsh.l" +#line 167 "Gmsh.l" return tKnots; YY_BREAK case 78: YY_RULE_SETUP -#line 170 "Gmsh.l" +#line 169 "Gmsh.l" return tLength; YY_BREAK case 79: YY_RULE_SETUP -#line 171 "Gmsh.l" +#line 170 "Gmsh.l" return tLine; YY_BREAK case 80: YY_RULE_SETUP -#line 172 "Gmsh.l" +#line 171 "Gmsh.l" return tLoop; YY_BREAK case 81: YY_RULE_SETUP -#line 173 "Gmsh.l" +#line 172 "Gmsh.l" return tLog; YY_BREAK case 82: YY_RULE_SETUP -#line 174 "Gmsh.l" +#line 173 "Gmsh.l" return tLog10; YY_BREAK case 83: YY_RULE_SETUP -#line 175 "Gmsh.l" +#line 174 "Gmsh.l" return tLayers; YY_BREAK case 84: YY_RULE_SETUP -#line 177 "Gmsh.l" +#line 176 "Gmsh.l" return tModulo; YY_BREAK case 85: YY_RULE_SETUP -#line 178 "Gmsh.l" +#line 177 "Gmsh.l" return tMPI_Rank; YY_BREAK case 86: YY_RULE_SETUP -#line 179 "Gmsh.l" +#line 178 "Gmsh.l" return tMPI_Size; YY_BREAK case 87: YY_RULE_SETUP -#line 181 "Gmsh.l" +#line 180 "Gmsh.l" return tNurbs; YY_BREAK case 88: YY_RULE_SETUP -#line 183 "Gmsh.l" +#line 182 "Gmsh.l" return tOrder; YY_BREAK case 89: YY_RULE_SETUP -#line 185 "Gmsh.l" +#line 184 "Gmsh.l" return tPhysical; YY_BREAK case 90: YY_RULE_SETUP -#line 186 "Gmsh.l" +#line 185 "Gmsh.l" return tPi; YY_BREAK case 91: YY_RULE_SETUP -#line 187 "Gmsh.l" +#line 186 "Gmsh.l" return tPlane; YY_BREAK case 92: YY_RULE_SETUP -#line 188 "Gmsh.l" +#line 187 "Gmsh.l" return tPoint; YY_BREAK case 93: YY_RULE_SETUP -#line 189 "Gmsh.l" +#line 188 "Gmsh.l" return tProgression; YY_BREAK case 94: YY_RULE_SETUP -#line 190 "Gmsh.l" +#line 189 "Gmsh.l" return tProgression; YY_BREAK case 95: YY_RULE_SETUP -#line 191 "Gmsh.l" +#line 190 "Gmsh.l" return tParametric; YY_BREAK case 96: YY_RULE_SETUP -#line 192 "Gmsh.l" +#line 191 "Gmsh.l" return tPrintf; YY_BREAK case 97: YY_RULE_SETUP -#line 193 "Gmsh.l" +#line 192 "Gmsh.l" return tPlugin; YY_BREAK case 98: YY_RULE_SETUP -#line 195 "Gmsh.l" +#line 194 "Gmsh.l" return tRecombine; YY_BREAK case 99: YY_RULE_SETUP -#line 196 "Gmsh.l" +#line 195 "Gmsh.l" return tRotate; YY_BREAK case 100: YY_RULE_SETUP -#line 197 "Gmsh.l" +#line 196 "Gmsh.l" return tRuled; YY_BREAK case 101: YY_RULE_SETUP -#line 198 "Gmsh.l" +#line 197 "Gmsh.l" return tRand; YY_BREAK case 102: YY_RULE_SETUP -#line 199 "Gmsh.l" +#line 198 "Gmsh.l" return tReturn; YY_BREAK case 103: YY_RULE_SETUP -#line 201 "Gmsh.l" +#line 200 "Gmsh.l" return tSqrt; YY_BREAK case 104: YY_RULE_SETUP -#line 202 "Gmsh.l" +#line 201 "Gmsh.l" return tSin; YY_BREAK case 105: YY_RULE_SETUP -#line 203 "Gmsh.l" +#line 202 "Gmsh.l" return tSinh; YY_BREAK case 106: YY_RULE_SETUP -#line 204 "Gmsh.l" +#line 203 "Gmsh.l" return tSpline; YY_BREAK case 107: YY_RULE_SETUP -#line 205 "Gmsh.l" +#line 204 "Gmsh.l" return tSurface; YY_BREAK case 108: YY_RULE_SETUP -#line 206 "Gmsh.l" +#line 205 "Gmsh.l" return tSymmetry; YY_BREAK case 109: YY_RULE_SETUP -#line 207 "Gmsh.l" +#line 206 "Gmsh.l" return tSprintf; YY_BREAK case 110: YY_RULE_SETUP -#line 208 "Gmsh.l" +#line 207 "Gmsh.l" return tStrCat; YY_BREAK case 111: YY_RULE_SETUP -#line 209 "Gmsh.l" +#line 208 "Gmsh.l" return tStrPrefix; YY_BREAK case 112: YY_RULE_SETUP -#line 210 "Gmsh.l" +#line 209 "Gmsh.l" return tShow; YY_BREAK case 113: YY_RULE_SETUP -#line 212 "Gmsh.l" +#line 211 "Gmsh.l" return tTriangulation; YY_BREAK case 114: YY_RULE_SETUP -#line 213 "Gmsh.l" +#line 212 "Gmsh.l" return tTransfinite; YY_BREAK case 115: YY_RULE_SETUP -#line 214 "Gmsh.l" +#line 213 "Gmsh.l" return tTranslate; YY_BREAK case 116: YY_RULE_SETUP -#line 215 "Gmsh.l" +#line 214 "Gmsh.l" return tTanh; YY_BREAK case 117: YY_RULE_SETUP -#line 216 "Gmsh.l" +#line 215 "Gmsh.l" return tTan; YY_BREAK case 118: YY_RULE_SETUP -#line 217 "Gmsh.l" +#line 216 "Gmsh.l" return tTrimmed; YY_BREAK case 119: YY_RULE_SETUP -#line 219 "Gmsh.l" +#line 218 "Gmsh.l" return tUsing; YY_BREAK case 120: YY_RULE_SETUP -#line 221 "Gmsh.l" +#line 220 "Gmsh.l" return tVolume; YY_BREAK case 121: YY_RULE_SETUP -#line 223 "Gmsh.l" +#line 222 "Gmsh.l" return tWith; YY_BREAK case 122: YY_RULE_SETUP -#line 225 "Gmsh.l" +#line 224 "Gmsh.l" return tScalarPoint; YY_BREAK case 123: YY_RULE_SETUP -#line 226 "Gmsh.l" +#line 225 "Gmsh.l" return tVectorPoint; YY_BREAK case 124: YY_RULE_SETUP -#line 227 "Gmsh.l" +#line 226 "Gmsh.l" return tTensorPoint; YY_BREAK case 125: YY_RULE_SETUP -#line 228 "Gmsh.l" +#line 227 "Gmsh.l" return tScalarLine; YY_BREAK case 126: YY_RULE_SETUP -#line 229 "Gmsh.l" +#line 228 "Gmsh.l" return tVectorLine; YY_BREAK case 127: YY_RULE_SETUP -#line 230 "Gmsh.l" +#line 229 "Gmsh.l" return tTensorLine; YY_BREAK case 128: YY_RULE_SETUP -#line 231 "Gmsh.l" +#line 230 "Gmsh.l" return tScalarTriangle; YY_BREAK case 129: YY_RULE_SETUP -#line 232 "Gmsh.l" +#line 231 "Gmsh.l" return tVectorTriangle; YY_BREAK case 130: YY_RULE_SETUP -#line 233 "Gmsh.l" +#line 232 "Gmsh.l" return tTensorTriangle; YY_BREAK case 131: YY_RULE_SETUP -#line 234 "Gmsh.l" +#line 233 "Gmsh.l" return tScalarQuadrangle; YY_BREAK case 132: YY_RULE_SETUP -#line 235 "Gmsh.l" +#line 234 "Gmsh.l" return tVectorQuadrangle; YY_BREAK case 133: YY_RULE_SETUP -#line 236 "Gmsh.l" +#line 235 "Gmsh.l" return tTensorQuadrangle; YY_BREAK case 134: YY_RULE_SETUP -#line 237 "Gmsh.l" +#line 236 "Gmsh.l" return tScalarTetrahedron; YY_BREAK case 135: YY_RULE_SETUP -#line 238 "Gmsh.l" +#line 237 "Gmsh.l" return tVectorTetrahedron; YY_BREAK case 136: YY_RULE_SETUP -#line 239 "Gmsh.l" +#line 238 "Gmsh.l" return tTensorTetrahedron; YY_BREAK case 137: YY_RULE_SETUP -#line 240 "Gmsh.l" +#line 239 "Gmsh.l" return tScalarHexahedron; YY_BREAK case 138: YY_RULE_SETUP -#line 241 "Gmsh.l" +#line 240 "Gmsh.l" return tVectorHexahedron; YY_BREAK case 139: YY_RULE_SETUP -#line 242 "Gmsh.l" +#line 241 "Gmsh.l" return tTensorHexahedron; YY_BREAK case 140: YY_RULE_SETUP -#line 243 "Gmsh.l" +#line 242 "Gmsh.l" return tScalarPrism; YY_BREAK case 141: YY_RULE_SETUP -#line 244 "Gmsh.l" +#line 243 "Gmsh.l" return tVectorPrism; YY_BREAK case 142: YY_RULE_SETUP -#line 245 "Gmsh.l" +#line 244 "Gmsh.l" return tTensorPrism; YY_BREAK case 143: YY_RULE_SETUP -#line 246 "Gmsh.l" +#line 245 "Gmsh.l" return tScalarPyramid; YY_BREAK case 144: YY_RULE_SETUP -#line 247 "Gmsh.l" +#line 246 "Gmsh.l" return tVectorPyramid; YY_BREAK case 145: YY_RULE_SETUP -#line 248 "Gmsh.l" +#line 247 "Gmsh.l" return tTensorPyramid; YY_BREAK case 146: YY_RULE_SETUP -#line 249 "Gmsh.l" +#line 248 "Gmsh.l" return tText2D; YY_BREAK case 147: YY_RULE_SETUP -#line 250 "Gmsh.l" +#line 249 "Gmsh.l" return tText3D; YY_BREAK case 148: YY_RULE_SETUP -#line 253 "Gmsh.l" +#line 252 "Gmsh.l" return tCARTESIAN_POINT; YY_BREAK case 149: YY_RULE_SETUP -#line 254 "Gmsh.l" +#line 253 "Gmsh.l" return tB_SPLINE_SURFACE_WITH_KNOTS; YY_BREAK case 150: YY_RULE_SETUP -#line 255 "Gmsh.l" +#line 254 "Gmsh.l" return tB_SPLINE_CURVE_WITH_KNOTS; YY_BREAK case 151: YY_RULE_SETUP -#line 256 "Gmsh.l" +#line 255 "Gmsh.l" return tUNSPECIFIED; YY_BREAK case 152: YY_RULE_SETUP -#line 257 "Gmsh.l" +#line 256 "Gmsh.l" return tCONTINUOUS; YY_BREAK case 153: YY_RULE_SETUP -#line 258 "Gmsh.l" +#line 257 "Gmsh.l" return tFALSE; YY_BREAK case 154: YY_RULE_SETUP -#line 259 "Gmsh.l" +#line 258 "Gmsh.l" return tTRUE; YY_BREAK case 155: YY_RULE_SETUP -#line 260 "Gmsh.l" +#line 259 "Gmsh.l" return tU; YY_BREAK case 156: YY_RULE_SETUP -#line 261 "Gmsh.l" +#line 260 "Gmsh.l" return tV; YY_BREAK case 157: YY_RULE_SETUP -#line 262 "Gmsh.l" +#line 261 "Gmsh.l" return tORIENTED_EDGE; YY_BREAK case 158: YY_RULE_SETUP -#line 263 "Gmsh.l" +#line 262 "Gmsh.l" return tEDGE_CURVE; YY_BREAK case 159: YY_RULE_SETUP -#line 264 "Gmsh.l" +#line 263 "Gmsh.l" return tEDGE_LOOP; YY_BREAK case 160: YY_RULE_SETUP -#line 265 "Gmsh.l" +#line 264 "Gmsh.l" return tELLIPSE; YY_BREAK case 161: YY_RULE_SETUP -#line 266 "Gmsh.l" +#line 265 "Gmsh.l" return tVERTEX_POINT; YY_BREAK case 162: YY_RULE_SETUP -#line 267 "Gmsh.l" +#line 266 "Gmsh.l" return tFACE_OUTER_BOUND; YY_BREAK case 163: YY_RULE_SETUP -#line 268 "Gmsh.l" +#line 267 "Gmsh.l" return tFACE_BOUND; YY_BREAK case 164: YY_RULE_SETUP -#line 269 "Gmsh.l" +#line 268 "Gmsh.l" return tADVANCED_FACE; YY_BREAK case 165: YY_RULE_SETUP -#line 270 "Gmsh.l" +#line 269 "Gmsh.l" return tLine; YY_BREAK case 166: YY_RULE_SETUP -#line 271 "Gmsh.l" +#line 270 "Gmsh.l" return tVECTOR; YY_BREAK case 167: YY_RULE_SETUP -#line 272 "Gmsh.l" +#line 271 "Gmsh.l" return tDIRECTION; YY_BREAK case 168: YY_RULE_SETUP -#line 273 "Gmsh.l" +#line 272 "Gmsh.l" return tAXIS2_PLACEMENT_3D; YY_BREAK case 169: YY_RULE_SETUP -#line 274 "Gmsh.l" +#line 273 "Gmsh.l" return tPLANE; YY_BREAK case 170: YY_RULE_SETUP -#line 275 "Gmsh.l" +#line 274 "Gmsh.l" return tHEADER; YY_BREAK case 171: YY_RULE_SETUP -#line 276 "Gmsh.l" +#line 275 "Gmsh.l" return tDATA; YY_BREAK case 172: YY_RULE_SETUP -#line 277 "Gmsh.l" +#line 276 "Gmsh.l" return tFILE_SCHEMA; YY_BREAK case 173: YY_RULE_SETUP -#line 278 "Gmsh.l" +#line 277 "Gmsh.l" return tFILE_NAME; YY_BREAK case 174: YY_RULE_SETUP -#line 279 "Gmsh.l" +#line 278 "Gmsh.l" return tFILE_DESCRIPTION; YY_BREAK case 175: YY_RULE_SETUP -#line 280 "Gmsh.l" +#line 279 "Gmsh.l" return tISO; YY_BREAK case 176: YY_RULE_SETUP -#line 281 "Gmsh.l" +#line 280 "Gmsh.l" return tENDISO; YY_BREAK case 177: YY_RULE_SETUP -#line 282 "Gmsh.l" +#line 281 "Gmsh.l" return tENDSEC; YY_BREAK case 178: YY_RULE_SETUP -#line 283 "Gmsh.l" +#line 282 "Gmsh.l" return tCLOSED_SHELL; YY_BREAK case 179: YY_RULE_SETUP -#line 284 "Gmsh.l" +#line 283 "Gmsh.l" return tADVANCED_BREP_SHAPE_REPRESENTATION; YY_BREAK case 180: YY_RULE_SETUP -#line 285 "Gmsh.l" +#line 284 "Gmsh.l" return tMANIFOLD_SOLID_BREP; YY_BREAK case 181: YY_RULE_SETUP -#line 286 "Gmsh.l" +#line 285 "Gmsh.l" return tCYLINDRICAL_SURFACE; YY_BREAK case 182: YY_RULE_SETUP -#line 287 "Gmsh.l" +#line 286 "Gmsh.l" return tCONICAL_SURFACE; YY_BREAK case 183: YY_RULE_SETUP -#line 288 "Gmsh.l" +#line 287 "Gmsh.l" return tTOROIDAL_SURFACE; YY_BREAK case 184: YY_RULE_SETUP -#line 289 "Gmsh.l" +#line 288 "Gmsh.l" return tCIRCLE; YY_BREAK case 185: YY_RULE_SETUP -#line 290 "Gmsh.l" +#line 289 "Gmsh.l" return tTRIMMED_CURVE; YY_BREAK case 186: YY_RULE_SETUP -#line 291 "Gmsh.l" +#line 290 "Gmsh.l" return tGEOMETRIC_SET; YY_BREAK case 187: YY_RULE_SETUP -#line 292 "Gmsh.l" +#line 291 "Gmsh.l" return tCOMPOSITE_CURVE_SEGMENT; YY_BREAK case 188: YY_RULE_SETUP -#line 293 "Gmsh.l" +#line 292 "Gmsh.l" return tCOMPOSITE_CURVE; YY_BREAK case 189: YY_RULE_SETUP -#line 294 "Gmsh.l" +#line 293 "Gmsh.l" return tPRODUCT_DEFINITION; YY_BREAK case 190: YY_RULE_SETUP -#line 295 "Gmsh.l" +#line 294 "Gmsh.l" return tPRODUCT_DEFINITION_SHAPE; YY_BREAK case 191: YY_RULE_SETUP -#line 296 "Gmsh.l" +#line 295 "Gmsh.l" return tSHAPE_DEFINITION_REPRESENTATION; YY_BREAK case 192: YY_RULE_SETUP -#line 298 "Gmsh.l" +#line 297 "Gmsh.l" return tVertex; YY_BREAK case 193: YY_RULE_SETUP -#line 299 "Gmsh.l" +#line 298 "Gmsh.l" return tFacet; YY_BREAK case 194: YY_RULE_SETUP -#line 300 "Gmsh.l" +#line 299 "Gmsh.l" return tNormal; YY_BREAK case 195: YY_RULE_SETUP -#line 301 "Gmsh.l" +#line 300 "Gmsh.l" return tOuter; YY_BREAK case 196: YY_RULE_SETUP -#line 302 "Gmsh.l" +#line 301 "Gmsh.l" return tLoopSTL; YY_BREAK case 197: YY_RULE_SETUP -#line 303 "Gmsh.l" +#line 302 "Gmsh.l" return tEndLoop; YY_BREAK case 198: YY_RULE_SETUP -#line 304 "Gmsh.l" +#line 303 "Gmsh.l" return tEndFacet; YY_BREAK case 199: YY_RULE_SETUP -#line 305 "Gmsh.l" +#line 304 "Gmsh.l" {skipline();return tEndSolid;} YY_BREAK case 200: YY_RULE_SETUP -#line 306 "Gmsh.l" +#line 305 "Gmsh.l" {skipline();return tSolid;} YY_BREAK case 201: YY_RULE_SETUP -#line 308 "Gmsh.l" +#line 307 "Gmsh.l" {yylval.d = (double)atoi((char*)(yytext+1)); return tDOUBLE;} YY_BREAK case 202: -#line 311 "Gmsh.l" +#line 310 "Gmsh.l" case 203: -#line 312 "Gmsh.l" +#line 311 "Gmsh.l" case 204: -#line 313 "Gmsh.l" +#line 312 "Gmsh.l" case 205: YY_RULE_SETUP -#line 313 "Gmsh.l" +#line 312 "Gmsh.l" {yylval.d = atof((char *)yytext); return tDOUBLE;} YY_BREAK case 206: YY_RULE_SETUP -#line 315 "Gmsh.l" +#line 314 "Gmsh.l" {yylval.c = strsave((char*)yytext); return tSTRING;} YY_BREAK case 207: YY_RULE_SETUP -#line 317 "Gmsh.l" +#line 316 "Gmsh.l" return yytext[0]; YY_BREAK case 208: YY_RULE_SETUP -#line 319 "Gmsh.l" +#line 318 "Gmsh.l" ECHO; YY_BREAK -#line 2348 "Gmsh.yy.cpp" +#line 2347 "Gmsh.yy.cpp" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3230,18 +3229,18 @@ int main() return 0; } #endif -#line 319 "Gmsh.l" +#line 318 "Gmsh.l" #undef yywrap int yywrap() {return 1;} -void skipcomments(void) { +void skipcomments(void){ int c; while (1) { - while ((c=yyinput()) != '*'){ + while ((c = yyinput()) != '*'){ if(c == EOF){ Msg(GERROR, "End of file in commented region"); return; @@ -3255,15 +3254,20 @@ void skipcomments(void) { void parsestring(char endchar){ int c, i; + char tmp[1024]; - c = yyinput(); i = 0; - while (c != endchar) { - TmpString[i++] = c; - c = yyinput(); + while ((c = yyinput()) != endchar) { + if(c == EOF){ + Msg(GERROR, "End of file in string"); + break; + } + else{ + tmp[i++] = (char)c; + } } - TmpString[i++] = '\0'; - yylval.c = strsave(TmpString); + tmp[i] = '\0'; + yylval.c = strsave(tmp); } char *strsave(char *ptr){ @@ -3271,7 +3275,10 @@ char *strsave(char *ptr){ } void skipline(void){ - while (yyinput() != '\n'); + int c; + while ((c = yyinput()) != '\n'){ + if(c == EOF) return; + } } void skip_until(char *skip, char *until){ -- GitLab