0031668: Visualization - WebGL sample doesn't work on Emscripten 1.39
[occt.git] / src / ExprIntrp / ExprIntrp.lex
CommitLineData
61043d3f 1/*
2
3 Copyright (c) 1997-1999 Matra Datavision
973c2be1 4 Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 5
973c2be1 6 This file is part of Open CASCADE Technology software library.
b311480e 7
d5f74e42 8 This library is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 10 by the Free Software Foundation, with special exception defined in the file
11 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 distribution for complete text of the license and disclaimer of any warranty.
b311480e 13
973c2be1 14 Alternatively, this file may be used under the terms of Open CASCADE
15 commercial license or contractual agreement.
b311480e 16*/
17
7fd59977 18%option yywrap
19%{
20#include <ExprIntrp.tab.h>
105aae76 21
2a54ebbf 22#include <ExprIntrp_yaccintrf.hxx>
23
7fd59977 24#define YY_SKIP_YYWRAP
25
26static YY_BUFFER_STATE ExprIntrp_bufstring;
27
2a54ebbf 28void ExprIntrp_start_string(const char* str)
7fd59977 29{
2a54ebbf 30 // depending on configuration and generator, yyconst may be defined as const or empty
31 ExprIntrp_bufstring = ExprIntrp_scan_string((yyconst char*)str);
7fd59977 32}
33
34void ExprIntrp_stop_string()
35{
36 ExprIntrp_delete_buffer(ExprIntrp_bufstring);
9fe1ada8 37 ExprIntrp_bufstring = (YY_BUFFER_STATE) 0;
7fd59977 38}
39
2a54ebbf 40static int yywrap()
7fd59977 41{
42 return 1;
43}
44
2a54ebbf 45// provide safe error handler (exception instead of exit())
46#define YY_FATAL_ERROR(msg) ExprIntrperror(msg)
47
105aae76 48#ifdef _MSC_VER
61043d3f 49// add includes for flex 2.91 (Linux version)
50#include <stdlib.h>
51#include <io.h>
52
f58f9b92 53// Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35)
54#define YY_NO_UNISTD_H
55
2a54ebbf 56// disable MSVC warnings in flex 2.89 and 2.5.35 code
57// Note that Intel compiler also defines _MSC_VER but has different warning ids
58#if defined(__INTEL_COMPILER)
59#pragma warning(disable:177 1786 1736)
1bd04b5a 60#elif defined(__clang__)
61#pragma GCC diagnostic ignored "-Wunused-function"
62#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
63#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
2a54ebbf 64#else
65#pragma warning(disable:4131 4244 4273 4127 4267)
66#endif
67
105aae76 68#endif
69
61043d3f 70#ifdef __GNUC__
71// add includes for flex 2.91 (Linux version)
72#include <unistd.h>
73
74// disable GCC warnings in flex 2.91 code
75#pragma GCC diagnostic ignored "-Wunused-function"
76#endif
77
7fd59977 78%}
79%%
80" " {;}
81"+" {return(SUMOP) ;}
82"-" {return(MINUSOP) ;}
83"/" {return(DIVIDEOP) ;}
84"^" {return(EXPOP) ;}
85"**" {return(EXPOP) ;}
86"*" {return(MULTOP) ;}
87"(" {return(PARENTHESIS);}
88"[" {return(BRACKET);}
89")" {return(ENDPARENTHESIS);}
90"]" {return(ENDBRACKET);}
91"," {return(COMMA);}
92"@" {return(DIFFERENTIAL);}
93"<-" {return(ASSIGNOP);}
94"=" {return(EQUALOP);}
95"Deassign" {return(DEASSIGNKEY);}
96"Deriv" {return(DERIVKEY);}
97"Const" {return(CONSTKEY);}
98"Sum" {return(SUMKEY);}
99"Prod" {return(PRODKEY);}
100[0-9.]+e[+|-]?[0-9]+ {ExprIntrp_SetResult(); return(VALUE);}
101[0-9.]+ {ExprIntrp_SetResult(); return(VALUE);}
102[a-zA-Z][a-zA-Z0-9_]* {ExprIntrp_SetResult(); return(IDENTIFIER);}
103";" {return(RELSEPARATOR);}
104"'"+ {ExprIntrp_SetDegree();return(DERIVATE);}