0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / ExprIntrp / ExprIntrp.lex
1 /*
2
3  Copyright (c) 1997-1999 Matra Datavision
4  Copyright (c) 1999-2014 OPEN CASCADE SAS
5
6  This file is part of Open CASCADE Technology software library.
7
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
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.
13
14  Alternatively, this file may be used under the terms of Open CASCADE
15  commercial license or contractual agreement.
16 */ 
17
18 %option yywrap
19 %{
20 #include <ExprIntrp.tab.h>
21
22 #include <ExprIntrp_yaccintrf.hxx>
23
24 #define YY_SKIP_YYWRAP
25
26 static YY_BUFFER_STATE ExprIntrp_bufstring;
27
28 void ExprIntrp_start_string(const char* str)
29 {
30   // depending on configuration and generator, yyconst may be defined as const or empty
31   ExprIntrp_bufstring = ExprIntrp_scan_string((yyconst char*)str);
32 }
33
34 void ExprIntrp_stop_string()
35 {
36   ExprIntrp_delete_buffer(ExprIntrp_bufstring);
37   ExprIntrp_bufstring = (YY_BUFFER_STATE) 0;
38 }
39
40 static int yywrap()
41 {
42   return 1;
43 }
44
45 // provide safe error handler (exception instead of exit())
46 #define YY_FATAL_ERROR(msg) ExprIntrperror(msg)
47
48 #ifdef _MSC_VER
49 // add includes for flex 2.91 (Linux version)
50 #include <stdlib.h>
51 #include <io.h>
52
53 // Avoid includion of unistd.h if parser is generated on Linux (flex 2.5.35)
54 #define YY_NO_UNISTD_H
55
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)
60 #else
61 #pragma warning(disable:4131 4244 4273 4127 4267)
62 #endif
63
64 #endif
65
66 #ifdef __GNUC__
67 // add includes for flex 2.91 (Linux version)
68 #include <unistd.h>
69
70 // disable GCC warnings in flex 2.91 code
71 #pragma GCC diagnostic ignored "-Wunused-function"
72 #endif
73
74 %}
75 %%
76 " "             {;}
77 "+"             {return(SUMOP) ;}
78 "-"             {return(MINUSOP) ;}
79 "/"             {return(DIVIDEOP) ;}
80 "^"             {return(EXPOP) ;}
81 "**"            {return(EXPOP) ;}
82 "*"             {return(MULTOP) ;}
83 "("             {return(PARENTHESIS);}
84 "["             {return(BRACKET);}
85 ")"             {return(ENDPARENTHESIS);}
86 "]"             {return(ENDBRACKET);}
87 ","             {return(COMMA);}
88 "@"             {return(DIFFERENTIAL);}
89 "<-"            {return(ASSIGNOP);}
90 "="             {return(EQUALOP);}
91 "Deassign"      {return(DEASSIGNKEY);}
92 "Deriv"         {return(DERIVKEY);}
93 "Const"         {return(CONSTKEY);}
94 "Sum"           {return(SUMKEY);}
95 "Prod"          {return(PRODKEY);}
96 [0-9.]+e[+|-]?[0-9]+ {ExprIntrp_SetResult(); return(VALUE);}
97 [0-9.]+         {ExprIntrp_SetResult(); return(VALUE);}
98 [a-zA-Z][a-zA-Z0-9_]*   {ExprIntrp_SetResult(); return(IDENTIFIER);}
99 ";"             {return(RELSEPARATOR);}
100 "'"+            {ExprIntrp_SetDegree();return(DERIVATE);}