Skip to content
Snippets Groups Projects
Commit 2336aeb7 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

fix parser to work with new flex and bison (1.28 -> 2.3)
parent 12e0b725
No related branches found
No related tags found
No related merge requests found
%{ %{
// $Id: Gmsh.l,v 1.92 2007-09-10 04:47:04 geuzaine Exp $ // $Id: Gmsh.l,v 1.93 2008-01-09 08:17:12 geuzaine Exp $
// //
// Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle // Copyright (C) 1997-2007 C. Geuzaine, J.-F. Remacle
// //
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "Gmsh.tab.hpp" #include "Gmsh.tab.hpp"
char yyname[256] = ""; char yyname[256] = "";
int yylineno = 1;
int yyerrorstate = 0; int yyerrorstate = 0;
int yyviewindex = 0; int yyviewindex = 0;
...@@ -40,10 +39,7 @@ char *strsave(char *ptr); ...@@ -40,10 +39,7 @@ char *strsave(char *ptr);
void skipcomments(void); void skipcomments(void);
void skipline(void); void skipline(void);
#define YY_ALWAYS_INTERACTIVE 1
#define YY_INPUT(buf,result,max_size) \ #define YY_INPUT(buf,result,max_size) \
if ( yy_current_buffer->yy_is_interactive ) \
{ \ { \
int c = '*', n; \ int c = '*', n; \
for ( n = 0; n < max_size && \ for ( n = 0; n < max_size && \
...@@ -57,9 +53,6 @@ void skipline(void); ...@@ -57,9 +53,6 @@ void skipline(void);
Msg(FATAL, "Input in flex scanner failed"); \ Msg(FATAL, "Input in flex scanner failed"); \
result = n; \ result = n; \
} \ } \
else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
&& ferror( yyin ) ) \
Msg(FATAL, "Input in flex scanner failed");
%} %}
...@@ -70,13 +63,6 @@ digit [0-9] ...@@ -70,13 +63,6 @@ digit [0-9]
exp [Ee][-+]?{digit}+ exp [Ee][-+]?{digit}+
string {alpha}({alpha}|{digit})* string {alpha}({alpha}|{digit})*
%e 2000
%p 7000
%n 2000
%k 1500
%a 7000
%o 7000
%% %%
[\ \t\n\r\f] /* none */; [\ \t\n\r\f] /* none */;
...@@ -258,7 +244,8 @@ TIME return tTime; ...@@ -258,7 +244,8 @@ TIME return tTime;
int yywrap() {return 1;} int yywrap() {return 1;}
void skipcomments(void){ void skipcomments(void)
{
int c; int c;
while (1) { while (1) {
...@@ -274,7 +261,8 @@ void skipcomments(void){ ...@@ -274,7 +261,8 @@ void skipcomments(void){
} }
} }
void parsestring(char endchar){ void parsestring(char endchar)
{
int c; int c;
char tmp[1024]; char tmp[1024];
...@@ -298,18 +286,21 @@ void parsestring(char endchar){ ...@@ -298,18 +286,21 @@ void parsestring(char endchar){
yylval.c = strsave(tmp); yylval.c = strsave(tmp);
} }
char *strsave(char *ptr){ char *strsave(char *ptr)
{
return((char*)strcpy((char*)malloc(strlen(ptr)+1),ptr)); return((char*)strcpy((char*)malloc(strlen(ptr)+1),ptr));
} }
void skipline(void){ void skipline(void)
{
int c; int c;
while ((c = yyinput()) != '\n'){ while ((c = yyinput()) != '\n'){
if(c == EOF) return; if(c == EOF) return;
} }
} }
void skip_until(char *skip, char *until){ void skip_until(char *skip, char *until)
{
int i, nb_skip; int i, nb_skip;
int l, l_skip, l_until; int l, l_skip, l_until;
char chars[256]; char chars[256];
......
This diff is collapsed.
typedef union { /* A Bison parser, made by GNU Bison 2.3. */
/* Skeleton interface for Bison's Yacc-like parsers in C
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
it under the terms of the GNU General Public License as published by
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
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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, 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
under terms of your choice, so long as that work isn't itself a
parser generator using the skeleton or a modified version thereof
as a parser skeleton. Alternatively, if you modify or redistribute
the parser skeleton itself, you may (at your option) remove this
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
/* Tokens. */
#ifndef YYTOKENTYPE
# define 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,
tEND = 261,
tAFFECT = 262,
tDOTS = 263,
tPi = 264,
tMPI_Rank = 265,
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,
tFmod = 287,
tModulo = 288,
tHypot = 289,
tPrintf = 290,
tSprintf = 291,
tStrCat = 292,
tStrPrefix = 293,
tStrRelative = 294,
tBoundingBox = 295,
tDraw = 296,
tToday = 297,
tPoint = 298,
tCircle = 299,
tEllipse = 300,
tLine = 301,
tSphere = 302,
tPolarSphere = 303,
tSurface = 304,
tSpline = 305,
tVolume = 306,
tCharacteristic = 307,
tLength = 308,
tParametric = 309,
tElliptic = 310,
tPlane = 311,
tRuled = 312,
tTransfinite = 313,
tComplex = 314,
tPhysical = 315,
tUsing = 316,
tBump = 317,
tProgression = 318,
tPlugin = 319,
tRotate = 320,
tTranslate = 321,
tSymmetry = 322,
tDilate = 323,
tExtrude = 324,
tDuplicata = 325,
tLoop = 326,
tRecombine = 327,
tDelete = 328,
tCoherence = 329,
tIntersect = 330,
tBoundary = 331,
tAttractor = 332,
tLayers = 333,
tHole = 334,
tAlias = 335,
tAliasWithOptions = 336,
tText2D = 337,
tText3D = 338,
tInterpolationScheme = 339,
tTime = 340,
tCombine = 341,
tBSpline = 342,
tBezier = 343,
tNurbs = 344,
tOrder = 345,
tKnots = 346,
tColor = 347,
tColorTable = 348,
tFor = 349,
tIn = 350,
tEndFor = 351,
tIf = 352,
tEndIf = 353,
tExit = 354,
tField = 355,
tThreshold = 356,
tStructured = 357,
tLatLon = 358,
tGrad = 359,
tPostView = 360,
tReturn = 361,
tCall = 362,
tFunction = 363,
tShow = 364,
tHide = 365,
tGetValue = 366,
tGMSH_MAJOR_VERSION = 367,
tGMSH_MINOR_VERSION = 368,
tGMSH_PATCH_VERSION = 369,
tAFFECTDIVIDE = 370,
tAFFECTTIMES = 371,
tAFFECTMINUS = 372,
tAFFECTPLUS = 373,
tOR = 374,
tAND = 375,
tNOTEQUAL = 376,
tEQUAL = 377,
tGREATEROREQUAL = 378,
tLESSOREQUAL = 379,
UNARYPREC = 380,
tMINUSMINUS = 381,
tPLUSPLUS = 382
};
#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 tExp 269
#define tLog 270
#define tLog10 271
#define tSqrt 272
#define tSin 273
#define tAsin 274
#define tCos 275
#define tAcos 276
#define tTan 277
#define tRand 278
#define tAtan 279
#define tAtan2 280
#define tSinh 281
#define tCosh 282
#define tTanh 283
#define tFabs 284
#define tFloor 285
#define tCeil 286
#define tFmod 287
#define tModulo 288
#define tHypot 289
#define tPrintf 290
#define tSprintf 291
#define tStrCat 292
#define tStrPrefix 293
#define tStrRelative 294
#define tBoundingBox 295
#define tDraw 296
#define tToday 297
#define tPoint 298
#define tCircle 299
#define tEllipse 300
#define tLine 301
#define tSphere 302
#define tPolarSphere 303
#define tSurface 304
#define tSpline 305
#define tVolume 306
#define tCharacteristic 307
#define tLength 308
#define tParametric 309
#define tElliptic 310
#define tPlane 311
#define tRuled 312
#define tTransfinite 313
#define tComplex 314
#define tPhysical 315
#define tUsing 316
#define tBump 317
#define tProgression 318
#define tPlugin 319
#define tRotate 320
#define tTranslate 321
#define tSymmetry 322
#define tDilate 323
#define tExtrude 324
#define tDuplicata 325
#define tLoop 326
#define tRecombine 327
#define tDelete 328
#define tCoherence 329
#define tIntersect 330
#define tBoundary 331
#define tAttractor 332
#define tLayers 333
#define tHole 334
#define tAlias 335
#define tAliasWithOptions 336
#define tText2D 337
#define tText3D 338
#define tInterpolationScheme 339
#define tTime 340
#define tCombine 341
#define tBSpline 342
#define tBezier 343
#define tNurbs 344
#define tOrder 345
#define tKnots 346
#define tColor 347
#define tColorTable 348
#define tFor 349
#define tIn 350
#define tEndFor 351
#define tIf 352
#define tEndIf 353
#define tExit 354
#define tField 355
#define tThreshold 356
#define tStructured 357
#define tLatLon 358
#define tGrad 359
#define tPostView 360
#define tReturn 361
#define tCall 362
#define tFunction 363
#define tShow 364
#define tHide 365
#define tGetValue 366
#define tGMSH_MAJOR_VERSION 367
#define tGMSH_MINOR_VERSION 368
#define tGMSH_PATCH_VERSION 369
#define tAFFECTDIVIDE 370
#define tAFFECTTIMES 371
#define tAFFECTMINUS 372
#define tAFFECTPLUS 373
#define tOR 374
#define tAND 375
#define tNOTEQUAL 376
#define tEQUAL 377
#define tGREATEROREQUAL 378
#define tLESSOREQUAL 379
#define UNARYPREC 380
#define tMINUSMINUS 381
#define tPLUSPLUS 382
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
#line 76 "Gmsh.y"
{
char *c; char *c;
int i; int i;
unsigned int u; unsigned int u;
...@@ -6,132 +307,14 @@ typedef union { ...@@ -6,132 +307,14 @@ typedef union {
double v[5]; double v[5];
Shape s; Shape s;
List_T *l; List_T *l;
} YYSTYPE; }
#define tDOUBLE 257 /* Line 1529 of yacc.c. */
#define tSTRING 258 #line 313 "Gmsh.tab.hpp"
#define tBIGSTR 259 YYSTYPE;
#define tEND 260 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
#define tAFFECT 261 # define YYSTYPE_IS_DECLARED 1
#define tDOTS 262 # define YYSTYPE_IS_TRIVIAL 1
#define tPi 263 #endif
#define tMPI_Rank 264
#define tMPI_Size 265
#define tEuclidian 266
#define tCoordinates 267
#define tExp 268
#define tLog 269
#define tLog10 270
#define tSqrt 271
#define tSin 272
#define tAsin 273
#define tCos 274
#define tAcos 275
#define tTan 276
#define tRand 277
#define tAtan 278
#define tAtan2 279
#define tSinh 280
#define tCosh 281
#define tTanh 282
#define tFabs 283
#define tFloor 284
#define tCeil 285
#define tFmod 286
#define tModulo 287
#define tHypot 288
#define tPrintf 289
#define tSprintf 290
#define tStrCat 291
#define tStrPrefix 292
#define tStrRelative 293
#define tBoundingBox 294
#define tDraw 295
#define tToday 296
#define tPoint 297
#define tCircle 298
#define tEllipse 299
#define tLine 300
#define tSphere 301
#define tPolarSphere 302
#define tSurface 303
#define tSpline 304
#define tVolume 305
#define tCharacteristic 306
#define tLength 307
#define tParametric 308
#define tElliptic 309
#define tPlane 310
#define tRuled 311
#define tTransfinite 312
#define tComplex 313
#define tPhysical 314
#define tUsing 315
#define tBump 316
#define tProgression 317
#define tPlugin 318
#define tRotate 319
#define tTranslate 320
#define tSymmetry 321
#define tDilate 322
#define tExtrude 323
#define tDuplicata 324
#define tLoop 325
#define tRecombine 326
#define tDelete 327
#define tCoherence 328
#define tIntersect 329
#define tBoundary 330
#define tAttractor 331
#define tLayers 332
#define tHole 333
#define tAlias 334
#define tAliasWithOptions 335
#define tText2D 336
#define tText3D 337
#define tInterpolationScheme 338
#define tTime 339
#define tCombine 340
#define tBSpline 341
#define tBezier 342
#define tNurbs 343
#define tOrder 344
#define tKnots 345
#define tColor 346
#define tColorTable 347
#define tFor 348
#define tIn 349
#define tEndFor 350
#define tIf 351
#define tEndIf 352
#define tExit 353
#define tField 354
#define tThreshold 355
#define tStructured 356
#define tLatLon 357
#define tGrad 358
#define tPostView 359
#define tReturn 360
#define tCall 361
#define tFunction 362
#define tShow 363
#define tHide 364
#define tGetValue 365
#define tGMSH_MAJOR_VERSION 366
#define tGMSH_MINOR_VERSION 367
#define tGMSH_PATCH_VERSION 368
#define tAFFECTPLUS 369
#define tAFFECTMINUS 370
#define tAFFECTTIMES 371
#define tAFFECTDIVIDE 372
#define tOR 373
#define tAND 374
#define tEQUAL 375
#define tNOTEQUAL 376
#define tLESSOREQUAL 377
#define tGREATEROREQUAL 378
#define tPLUSPLUS 379
#define tMINUSMINUS 380
#define UNARYPREC 381
extern YYSTYPE yylval; extern YYSTYPE yylval;
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