Skip to content
Snippets Groups Projects
Commit dc39f145 authored by Patrick Dular's avatar Patrick Dular
Browse files

(1) If and EndIf now allowed in comments and variable names (with alpha-char...

(1) If and EndIf now allowed in comments and variable names (with alpha-char before or after); (2) Else now possible in If EndIf; (3) Warning if orphan EndIf.
parent 42ea7309
No related branches found
No related tags found
No related merge requests found
......@@ -155,6 +155,7 @@ SetChanged return tSetChanged;
Exp return tExp;
Ellipsis return tEllipse;
Ellipse return tEllipse;
Else return tElse;
Extrude return tExtrude;
Elliptic return tElliptic;
EndFor return tEndFor;
......@@ -275,6 +276,7 @@ SyncModel return tSyncModel;
T2 return tText2D;
T3 return tText3D;
TestLevel return tTestLevel;
TextAttributes return tTextAttributes;
TIME return tTime;
Transfinite return tTransfinite;
......@@ -363,20 +365,89 @@ void skipline()
}
}
bool is_alpha(const int c)
{
return (c>='a' && c<='z') || (c>='A' && c<='Z') || c=='_';
}
void skip_until(const char *skip, const char *until)
{
int i, nb_skip;
int i, nb_skip = 0;
int l, l_skip, l_until;
char chars[256];
int c_next, c_next_skip, c_next_until, c_previous = 0;
l_skip = (skip)? strlen(skip) : 0;
l_until = strlen(until);
while(1){
while (1){
chars[0] = yyinput();
if(gmsheof(yyin)){
Msg::Error("Unexpected end of file");
return;
}
if(chars[0] == '/'){
c_next = yyinput();
if (c_next == '*') skipcomments();
else if(c_next == '/') skipline();
else unput(c_next);
}
if(!c_previous || !is_alpha(c_previous)){
if(chars[0] == until[0]) break;
if(skip && chars[0] == skip[0]) break;
}
c_previous = chars[0];
}
nb_skip = 0;
l = std::max(l_skip,l_until);
if(l >= (int)sizeof(chars)){
Msg::Error("Search pattern too long in skip_until");
return;
}
for(i=1; i<l; i++){
chars[i] = yyinput();
if(gmsheof(yyin)){
l = i;
break;
}
}
if(skip)
l_skip = strlen(skip);
else
l_skip = 0;
c_next = yyinput(); unput(c_next);
c_next_skip = (l_skip<l)? chars[l_skip] : c_next;
c_next_until = (l_until<l)? chars[l_until] : c_next;
if(!strncmp(chars,until,l_until) && !is_alpha(c_next_until)){
if(!nb_skip){
return;
}
else{
nb_skip--;
}
}
else if(skip && !strncmp(chars,skip,l_skip) && !is_alpha(c_next_skip)){
nb_skip++;
}
else{
for(i=1;i<l-1;i++){
unput(chars[l-i]);
}
}
}
}
void skip_until_test(const char *skip, const char *until, const char *until2, int *flag_until2)
{
int i, nb_skip = 0;
int l, l_skip, l_until, l_until2;
char chars[256];
int c_next, c_next_skip, c_next_until, c_next_until2, c_previous = 0;
l_skip = (skip)? strlen(skip) : 0;
l_until = strlen(until);
l_until2 = (until2)? strlen(until2) : 0;
while(1){
while (1){
......@@ -385,11 +456,22 @@ void skip_until(const char *skip, const char *until)
Msg::Error("Unexpected end of file");
return;
}
if(chars[0] == '/'){
c_next = yyinput();
if (c_next == '*') skipcomments();
else if(c_next == '/') skipline();
else unput(c_next);
}
if(!c_previous || !is_alpha(c_previous)){
if(chars[0] == until[0]) break;
if(skip && chars[0] == skip[0]) break;
if(until2 && chars[0] == until2[0]) break;
}
c_previous = chars[0];
}
l = std::max(l_skip,l_until);
l = std::max(l,l_until2);
if(l >= (int)sizeof(chars)){
Msg::Error("Search pattern too long in skip_until");
return;
......@@ -402,7 +484,18 @@ void skip_until(const char *skip, const char *until)
}
}
if(!strncmp(chars,until,l_until)){
c_next = yyinput(); unput(c_next);
c_next_skip = (l_skip<l)? chars[l_skip] : c_next;
c_next_until = (l_until<l)? chars[l_until] : c_next;
c_next_until2 = (l_until2<l)? chars[l_until2] : c_next;
if(!strncmp(chars,until2,l_until2) && !is_alpha(c_next_until2)){
if(!nb_skip){
*flag_until2 = 1;
return;
}
}
else if(!strncmp(chars,until,l_until) && !is_alpha(c_next_until)){
if(!nb_skip){
return;
}
......@@ -410,7 +503,7 @@ void skip_until(const char *skip, const char *until)
nb_skip--;
}
}
else if(skip && !strncmp(chars,skip,l_skip)){
else if(skip && !strncmp(chars,skip,l_skip) && !is_alpha(c_next_skip)){
nb_skip++;
}
else{
......
This diff is collapsed.
/* A Bison parser, made by GNU Bison 3.0.4. */
/* A Bison parser, made by GNU Bison 2.3. */
/* Bison interface for Yacc-like parsers in C
/* Skeleton interface for Bison's Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
......@@ -15,7 +16,9 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
......@@ -30,21 +33,12 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
#ifndef YY_GMSH_YY_GMSH_TAB_HPP_INCLUDED
# define YY_GMSH_YY_GMSH_TAB_HPP_INCLUDED
/* Debug traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
#if YYDEBUG
extern int gmsh_yydebug;
#endif
/* Token type. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
enum yytokentype
{
/* Put the tokens into the symbol table, so that GDB and other debuggers
know about them. */
enum yytokentype {
tDOUBLE = 258,
tSTRING = 259,
tBIGSTR = 260,
......@@ -56,186 +50,372 @@ extern int gmsh_yydebug;
tMPI_Size = 266,
tEuclidian = 267,
tCoordinates = 268,
tExp = 269,
tLog = 270,
tLog10 = 271,
tSqrt = 272,
tSin = 273,
tAsin = 274,
tCos = 275,
tAcos = 276,
tTan = 277,
tRand = 278,
tAtan = 279,
tAtan2 = 280,
tSinh = 281,
tCosh = 282,
tTanh = 283,
tFabs = 284,
tFloor = 285,
tCeil = 286,
tRound = 287,
tFmod = 288,
tModulo = 289,
tHypot = 290,
tList = 291,
tPrintf = 292,
tError = 293,
tStr = 294,
tSprintf = 295,
tStrCat = 296,
tStrPrefix = 297,
tStrRelative = 298,
tStrReplace = 299,
tFind = 300,
tStrFind = 301,
tStrCmp = 302,
tStrChoice = 303,
tUpperCase = 304,
tLowerCase = 305,
tLowerCaseIn = 306,
tTextAttributes = 307,
tBoundingBox = 308,
tDraw = 309,
tSetChanged = 310,
tToday = 311,
tFixRelativePath = 312,
tCurrentDirectory = 313,
tSyncModel = 314,
tNewModel = 315,
tOnelabAction = 316,
tOnelabRun = 317,
tCpu = 318,
tMemory = 319,
tTotalMemory = 320,
tCreateTopology = 321,
tCreateTopologyNoHoles = 322,
tDistanceFunction = 323,
tDefineConstant = 324,
tUndefineConstant = 325,
tDefineNumber = 326,
tDefineString = 327,
tSetNumber = 328,
tSetString = 329,
tPoint = 330,
tCircle = 331,
tEllipse = 332,
tLine = 333,
tSphere = 334,
tPolarSphere = 335,
tSurface = 336,
tSpline = 337,
tVolume = 338,
tCharacteristic = 339,
tLength = 340,
tParametric = 341,
tElliptic = 342,
tRefineMesh = 343,
tAdaptMesh = 344,
tRelocateMesh = 345,
tPlane = 346,
tRuled = 347,
tTransfinite = 348,
tComplex = 349,
tPhysical = 350,
tCompound = 351,
tPeriodic = 352,
tUsing = 353,
tPlugin = 354,
tDegenerated = 355,
tRecursive = 356,
tRotate = 357,
tTranslate = 358,
tSymmetry = 359,
tDilate = 360,
tExtrude = 361,
tLevelset = 362,
tAffine = 363,
tRecombine = 364,
tSmoother = 365,
tSplit = 366,
tDelete = 367,
tCoherence = 368,
tIntersect = 369,
tMeshAlgorithm = 370,
tReverse = 371,
tLayers = 372,
tScaleLast = 373,
tHole = 374,
tAlias = 375,
tAliasWithOptions = 376,
tCopyOptions = 377,
tQuadTriAddVerts = 378,
tQuadTriNoNewVerts = 379,
tQuadTriSngl = 380,
tQuadTriDbl = 381,
tRecombLaterals = 382,
tTransfQuadTri = 383,
tText2D = 384,
tText3D = 385,
tInterpolationScheme = 386,
tTime = 387,
tCombine = 388,
tBSpline = 389,
tBezier = 390,
tNurbs = 391,
tNurbsOrder = 392,
tNurbsKnots = 393,
tColor = 394,
tColorTable = 395,
tFor = 396,
tIn = 397,
tEndFor = 398,
tIf = 399,
tEndIf = 400,
tExit = 401,
tAbort = 402,
tField = 403,
tReturn = 404,
tCall = 405,
tMacro = 406,
tShow = 407,
tHide = 408,
tGetValue = 409,
tGetEnv = 410,
tGetString = 411,
tGetNumber = 412,
tHomology = 413,
tCohomology = 414,
tBetti = 415,
tSetOrder = 416,
tExists = 417,
tFileExists = 418,
tGMSH_MAJOR_VERSION = 419,
tGMSH_MINOR_VERSION = 420,
tGMSH_PATCH_VERSION = 421,
tGmshExecutableName = 422,
tSetPartition = 423,
tNameFromString = 424,
tStringFromName = 425,
tAFFECTPLUS = 426,
tAFFECTMINUS = 427,
tAFFECTTIMES = 428,
tAFFECTDIVIDE = 429,
tOR = 430,
tAND = 431,
tEQUAL = 432,
tNOTEQUAL = 433,
tLESSOREQUAL = 434,
tGREATEROREQUAL = 435,
tPLUSPLUS = 436,
tMINUSMINUS = 437,
UNARYPREC = 438
tTestLevel = 269,
tExp = 270,
tLog = 271,
tLog10 = 272,
tSqrt = 273,
tSin = 274,
tAsin = 275,
tCos = 276,
tAcos = 277,
tTan = 278,
tRand = 279,
tAtan = 280,
tAtan2 = 281,
tSinh = 282,
tCosh = 283,
tTanh = 284,
tFabs = 285,
tFloor = 286,
tCeil = 287,
tRound = 288,
tFmod = 289,
tModulo = 290,
tHypot = 291,
tList = 292,
tPrintf = 293,
tError = 294,
tStr = 295,
tSprintf = 296,
tStrCat = 297,
tStrPrefix = 298,
tStrRelative = 299,
tStrReplace = 300,
tFind = 301,
tStrFind = 302,
tStrCmp = 303,
tStrChoice = 304,
tUpperCase = 305,
tLowerCase = 306,
tLowerCaseIn = 307,
tTextAttributes = 308,
tBoundingBox = 309,
tDraw = 310,
tSetChanged = 311,
tToday = 312,
tFixRelativePath = 313,
tCurrentDirectory = 314,
tSyncModel = 315,
tNewModel = 316,
tOnelabAction = 317,
tOnelabRun = 318,
tCpu = 319,
tMemory = 320,
tTotalMemory = 321,
tCreateTopology = 322,
tCreateTopologyNoHoles = 323,
tDistanceFunction = 324,
tDefineConstant = 325,
tUndefineConstant = 326,
tDefineNumber = 327,
tDefineString = 328,
tSetNumber = 329,
tSetString = 330,
tPoint = 331,
tCircle = 332,
tEllipse = 333,
tLine = 334,
tSphere = 335,
tPolarSphere = 336,
tSurface = 337,
tSpline = 338,
tVolume = 339,
tCharacteristic = 340,
tLength = 341,
tParametric = 342,
tElliptic = 343,
tRefineMesh = 344,
tAdaptMesh = 345,
tRelocateMesh = 346,
tPlane = 347,
tRuled = 348,
tTransfinite = 349,
tComplex = 350,
tPhysical = 351,
tCompound = 352,
tPeriodic = 353,
tUsing = 354,
tPlugin = 355,
tDegenerated = 356,
tRecursive = 357,
tRotate = 358,
tTranslate = 359,
tSymmetry = 360,
tDilate = 361,
tExtrude = 362,
tLevelset = 363,
tAffine = 364,
tRecombine = 365,
tSmoother = 366,
tSplit = 367,
tDelete = 368,
tCoherence = 369,
tIntersect = 370,
tMeshAlgorithm = 371,
tReverse = 372,
tLayers = 373,
tScaleLast = 374,
tHole = 375,
tAlias = 376,
tAliasWithOptions = 377,
tCopyOptions = 378,
tQuadTriAddVerts = 379,
tQuadTriNoNewVerts = 380,
tQuadTriSngl = 381,
tQuadTriDbl = 382,
tRecombLaterals = 383,
tTransfQuadTri = 384,
tText2D = 385,
tText3D = 386,
tInterpolationScheme = 387,
tTime = 388,
tCombine = 389,
tBSpline = 390,
tBezier = 391,
tNurbs = 392,
tNurbsOrder = 393,
tNurbsKnots = 394,
tColor = 395,
tColorTable = 396,
tFor = 397,
tIn = 398,
tEndFor = 399,
tIf = 400,
tElse = 401,
tEndIf = 402,
tExit = 403,
tAbort = 404,
tField = 405,
tReturn = 406,
tCall = 407,
tMacro = 408,
tShow = 409,
tHide = 410,
tGetValue = 411,
tGetEnv = 412,
tGetString = 413,
tGetNumber = 414,
tHomology = 415,
tCohomology = 416,
tBetti = 417,
tSetOrder = 418,
tExists = 419,
tFileExists = 420,
tGMSH_MAJOR_VERSION = 421,
tGMSH_MINOR_VERSION = 422,
tGMSH_PATCH_VERSION = 423,
tGmshExecutableName = 424,
tSetPartition = 425,
tNameFromString = 426,
tStringFromName = 427,
tAFFECTDIVIDE = 428,
tAFFECTTIMES = 429,
tAFFECTMINUS = 430,
tAFFECTPLUS = 431,
tOR = 432,
tAND = 433,
tNOTEQUAL = 434,
tEQUAL = 435,
tGREATEROREQUAL = 436,
tLESSOREQUAL = 437,
UNARYPREC = 438,
tMINUSMINUS = 439,
tPLUSPLUS = 440
};
#endif
/* Tokens. */
#define tDOUBLE 258
#define tSTRING 259
#define tBIGSTR 260
#define tEND 261
#define tAFFECT 262
#define tDOTS 263
#define tPi 264
#define tMPI_Rank 265
#define tMPI_Size 266
#define tEuclidian 267
#define tCoordinates 268
#define tTestLevel 269
#define tExp 270
#define tLog 271
#define tLog10 272
#define tSqrt 273
#define tSin 274
#define tAsin 275
#define tCos 276
#define tAcos 277
#define tTan 278
#define tRand 279
#define tAtan 280
#define tAtan2 281
#define tSinh 282
#define tCosh 283
#define tTanh 284
#define tFabs 285
#define tFloor 286
#define tCeil 287
#define tRound 288
#define tFmod 289
#define tModulo 290
#define tHypot 291
#define tList 292
#define tPrintf 293
#define tError 294
#define tStr 295
#define tSprintf 296
#define tStrCat 297
#define tStrPrefix 298
#define tStrRelative 299
#define tStrReplace 300
#define tFind 301
#define tStrFind 302
#define tStrCmp 303
#define tStrChoice 304
#define tUpperCase 305
#define tLowerCase 306
#define tLowerCaseIn 307
#define tTextAttributes 308
#define tBoundingBox 309
#define tDraw 310
#define tSetChanged 311
#define tToday 312
#define tFixRelativePath 313
#define tCurrentDirectory 314
#define tSyncModel 315
#define tNewModel 316
#define tOnelabAction 317
#define tOnelabRun 318
#define tCpu 319
#define tMemory 320
#define tTotalMemory 321
#define tCreateTopology 322
#define tCreateTopologyNoHoles 323
#define tDistanceFunction 324
#define tDefineConstant 325
#define tUndefineConstant 326
#define tDefineNumber 327
#define tDefineString 328
#define tSetNumber 329
#define tSetString 330
#define tPoint 331
#define tCircle 332
#define tEllipse 333
#define tLine 334
#define tSphere 335
#define tPolarSphere 336
#define tSurface 337
#define tSpline 338
#define tVolume 339
#define tCharacteristic 340
#define tLength 341
#define tParametric 342
#define tElliptic 343
#define tRefineMesh 344
#define tAdaptMesh 345
#define tRelocateMesh 346
#define tPlane 347
#define tRuled 348
#define tTransfinite 349
#define tComplex 350
#define tPhysical 351
#define tCompound 352
#define tPeriodic 353
#define tUsing 354
#define tPlugin 355
#define tDegenerated 356
#define tRecursive 357
#define tRotate 358
#define tTranslate 359
#define tSymmetry 360
#define tDilate 361
#define tExtrude 362
#define tLevelset 363
#define tAffine 364
#define tRecombine 365
#define tSmoother 366
#define tSplit 367
#define tDelete 368
#define tCoherence 369
#define tIntersect 370
#define tMeshAlgorithm 371
#define tReverse 372
#define tLayers 373
#define tScaleLast 374
#define tHole 375
#define tAlias 376
#define tAliasWithOptions 377
#define tCopyOptions 378
#define tQuadTriAddVerts 379
#define tQuadTriNoNewVerts 380
#define tQuadTriSngl 381
#define tQuadTriDbl 382
#define tRecombLaterals 383
#define tTransfQuadTri 384
#define tText2D 385
#define tText3D 386
#define tInterpolationScheme 387
#define tTime 388
#define tCombine 389
#define tBSpline 390
#define tBezier 391
#define tNurbs 392
#define tNurbsOrder 393
#define tNurbsKnots 394
#define tColor 395
#define tColorTable 396
#define tFor 397
#define tIn 398
#define tEndFor 399
#define tIf 400
#define tElse 401
#define tEndIf 402
#define tExit 403
#define tAbort 404
#define tField 405
#define tReturn 406
#define tCall 407
#define tMacro 408
#define tShow 409
#define tHide 410
#define tGetValue 411
#define tGetEnv 412
#define tGetString 413
#define tGetNumber 414
#define tHomology 415
#define tCohomology 416
#define tBetti 417
#define tSetOrder 418
#define tExists 419
#define tFileExists 420
#define tGMSH_MAJOR_VERSION 421
#define tGMSH_MINOR_VERSION 422
#define tGMSH_PATCH_VERSION 423
#define tGmshExecutableName 424
#define tSetPartition 425
#define tNameFromString 426
#define tStringFromName 427
#define tAFFECTDIVIDE 428
#define tAFFECTTIMES 429
#define tAFFECTMINUS 430
#define tAFFECTPLUS 431
#define tOR 432
#define tAND 433
#define tNOTEQUAL 434
#define tEQUAL 435
#define tGREATEROREQUAL 436
#define tLESSOREQUAL 437
#define UNARYPREC 438
#define tMINUSMINUS 439
#define tPLUSPLUS 440
/* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
union YYSTYPE
{
#line 105 "Gmsh.y" /* yacc.c:1909 */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 109 "Gmsh.y"
{
char *c;
int i;
unsigned int u;
......@@ -243,18 +423,14 @@ union YYSTYPE
double v[5];
Shape s;
List_T *l;
#line 248 "Gmsh.tab.hpp" /* yacc.c:1909 */
};
typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
}
/* Line 1529 of yacc.c. */
#line 429 "Gmsh.tab.hpp"
YYSTYPE;
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
# define YYSTYPE_IS_TRIVIAL 1
#endif
extern YYSTYPE gmsh_yylval;
int gmsh_yyparse (void);
#endif /* !YY_GMSH_YY_GMSH_TAB_HPP_INCLUDED */
......@@ -69,8 +69,10 @@ static std::vector<double> *ViewValueList = 0;
static int *ViewNumList = 0;
static ExtrudeParams extr;
static gmshSurface *myGmshSurface = 0;
#define MAX_RECUR_TESTS 100
static int statusImbricatedTests[MAX_RECUR_TESTS];
#define MAX_RECUR_LOOPS 100
static int ImbricatedLoop = 0;
static int ImbricatedLoop = 0, ImbricatedTest = 0;
static gmshfpos_t yyposImbricatedLoopsTab[MAX_RECUR_LOOPS];
static int yylinenoImbricatedLoopsTab[MAX_RECUR_LOOPS];
static double LoopControlVariablesTab[MAX_RECUR_LOOPS][3];
......@@ -80,7 +82,9 @@ static std::map<std::string, std::vector<std::string> > charOptions;
void yyerror(const char *s);
void yymsg(int level, const char *fmt, ...);
bool is_alpha(const int c);
void skip_until(const char *skip, const char *until);
void skip_until_test(const char *skip, const char *until, const char *until2, int *flag_until2);
void assignVariable(const std::string &name, int index, int assignType,
double value);
void assignVariables(const std::string &name, List_T *indices, int assignType,
......@@ -115,7 +119,7 @@ struct doubleXstring{
%token <d> tDOUBLE
%token <c> tSTRING tBIGSTR
%token tEND tAFFECT tDOTS tPi tMPI_Rank tMPI_Size tEuclidian tCoordinates
%token tEND tAFFECT tDOTS tPi tMPI_Rank tMPI_Size tEuclidian tCoordinates tTestLevel
%token tExp tLog tLog10 tSqrt tSin tAsin tCos tAcos tTan tRand
%token tAtan tAtan2 tSinh tCosh tTanh tFabs tFloor tCeil tRound
%token tFmod tModulo tHypot tList
......@@ -142,7 +146,7 @@ struct doubleXstring{
%token tRecombLaterals tTransfQuadTri
%token tText2D tText3D tInterpolationScheme tTime tCombine
%token tBSpline tBezier tNurbs tNurbsOrder tNurbsKnots
%token tColor tColorTable tFor tIn tEndFor tIf tEndIf tExit tAbort
%token tColor tColorTable tFor tIn tEndFor tIf tElse tEndIf tExit tAbort
%token tField tReturn tCall tMacro tShow tHide tGetValue tGetEnv tGetString tGetNumber
%token tHomology tCohomology tBetti tSetOrder tExists tFileExists
%token tGMSH_MAJOR_VERSION tGMSH_MINOR_VERSION tGMSH_PATCH_VERSION
......@@ -3230,10 +3234,36 @@ Loop :
}
| tIf '(' FExpr ')'
{
if(!$3) skip_until("If", "EndIf");
ImbricatedTest++;
if(ImbricatedTest > MAX_RECUR_TESTS-1){
yymsg(0, "Reached maximum number of imbricated tests");
ImbricatedTest = MAX_RECUR_TESTS-1;
}
if(!$3){
statusImbricatedTests[ImbricatedTest] = 0; // Will be useful later for ElseIf
int flag_until2 = 0;
skip_until_test("If", "EndIf", "Else", &flag_until2);
if(!flag_until2)
ImbricatedTest--;
}
else{
statusImbricatedTests[ImbricatedTest] = 1;
}
}
| tElse
{
if (ImbricatedTest > 0 && statusImbricatedTests[ImbricatedTest]){
skip_until("If", "EndIf");
ImbricatedTest--;
}
}
| tEndIf
{
ImbricatedTest--;
if (ImbricatedTest < 0)
yymsg(1, "Orphan EndIf");
}
;
......@@ -4659,6 +4689,7 @@ FExpr_Single :
tDOUBLE { $$ = $1; }
| tPi { $$ = 3.141592653589793; }
| tTestLevel { $$ = (double)ImbricatedTest; }
| tMPI_Rank { $$ = Msg::GetCommRank(); }
| tMPI_Size { $$ = Msg::GetCommSize(); }
| tGMSH_MAJOR_VERSION { $$ = GetGmshMajorVersion(); }
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment