0030480: Visualization - Clear of Select3D_SensitiveGroup does not update internal...
[occt.git] / src / ExprIntrp / ExprIntrp.yacc
CommitLineData
b311480e 1/*
2/* Copyright (c) 1997-1999 Matra Datavision
973c2be1 3 Copyright (c) 1999-2014 OPEN CASCADE SAS
b311480e 4
973c2be1 5 This file is part of Open CASCADE Technology software library.
b311480e 6
d5f74e42 7 This library is free software; you can redistribute it and/or modify it under
8 the terms of the GNU Lesser General Public License version 2.1 as published
973c2be1 9 by the Free Software Foundation, with special exception defined in the file
10 OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 distribution for complete text of the license and disclaimer of any warranty.
b311480e 12
973c2be1 13 Alternatively, this file may be used under the terms of Open CASCADE
14 commercial license or contractual agreement.
b311480e 15*/
16
7fd59977 17%{
2a54ebbf 18#include <ExprIntrp_yaccintrf.hxx>
19
7fd59977 20extern void ExprIntrp_EndOfFuncDef();
21extern void ExprIntrp_EndOfRelation();
22extern void ExprIntrp_AssignVariable();
23extern void ExprIntrp_EndOfAssign();
24extern void ExprIntrp_Deassign();
25extern void ExprIntrp_SumOperator();
26extern void ExprIntrp_MinusOperator();
27extern void ExprIntrp_ProductOperator();
28extern void ExprIntrp_DivideOperator();
29extern void ExprIntrp_ExpOperator();
30extern void ExprIntrp_UnaryMinusOperator();
ab146989 31extern void ExprIntrp_UnaryPlusOperator();
7fd59977 32extern void ExprIntrp_VariableIdentifier();
33extern void ExprIntrp_NumValue();
34extern void ExprIntrp_EndFunction();
35extern void ExprIntrp_EndDerFunction();
36extern void ExprIntrp_EndDifferential();
37extern void ExprIntrp_EndDiffFunction();
38extern void ExprIntrp_EndFuncArg();
39extern void ExprIntrp_NextFuncArg();
40extern void ExprIntrp_StartFunction();
41extern void ExprIntrp_DefineFunction();
42extern void ExprIntrp_StartDerivate();
43extern void ExprIntrp_EndDerivate();
44extern void ExprIntrp_DiffVar();
45extern void ExprIntrp_DiffDegree();
46extern void ExprIntrp_VerDiffDegree();
47extern void ExprIntrp_DiffDegreeVar();
48extern void ExprIntrp_StartDifferential();
49extern void ExprIntrp_StartFunction();
50extern void ExprIntrp_EndFuncArg();
51extern void ExprIntrp_NextFuncArg();
52extern void ExprIntrp_VariableIdentifier();
53extern void ExprIntrp_Derivation();
54extern void ExprIntrp_EndDerivation();
55extern void ExprIntrp_DerivationValue();
56extern void ExprIntrp_ConstantIdentifier();
57extern void ExprIntrp_ConstantDefinition();
58extern void ExprIntrp_VariableIdentifier();
59extern void ExprIntrp_NumValue();
60extern void ExprIntrp_Sumator();
61extern void ExprIntrp_VariableIdentifier();
62extern void ExprIntrp_Productor();
63extern void ExprIntrp_EndOfEqual();
105aae76 64
105aae76 65// disable MSVC warnings in bison code
66#ifdef _MSC_VER
d5f74e42 67#pragma warning(disable:4131 4244 4127 4702)
105aae76 68#endif
69
7fd59977 70%}
71
72%token SUMOP MINUSOP DIVIDEOP EXPOP MULTOP PARENTHESIS BRACKET ENDPARENTHESIS ENDBRACKET VALUE IDENTIFIER COMMA DIFFERENTIAL DERIVATE DERIVKEY ASSIGNOP DEASSIGNKEY EQUALOP RELSEPARATOR CONSTKEY SUMKEY PRODKEY
73%start exprentry
74%left SUMOP MINUSOP
75%left DIVIDEOP MULTOP
76%left EXPOP
77%{
78%}
79%%
80
81exprentry : GenExpr
ab146989 82 | Assignment
7fd59977 83 | Deassignment
ab146989 84 | FunctionDefinition {ExprIntrp_EndOfFuncDef();}
85 | RelationList {ExprIntrp_EndOfRelation();}
86 ;
7fd59977 87
88Assignment : IDENTIFIER {ExprIntrp_AssignVariable();} ASSIGNOP GenExpr {ExprIntrp_EndOfAssign();}
ab146989 89 ;
7fd59977 90
91Deassignment : DEASSIGNKEY BRACKET IDENTIFIER {ExprIntrp_Deassign();} ENDBRACKET
92 ;
93
ab146989 94GenExpr : GenExpr SUMOP GenExpr {ExprIntrp_SumOperator();}
95 | GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();}
96 | GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();}
97 | GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();}
98 | GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();}
99 | PARENTHESIS GenExpr ENDPARENTHESIS
100 | BRACKET GenExpr ENDBRACKET
101 | MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
102 | SUMOP GenExpr {ExprIntrp_UnaryPlusOperator();}
103 | SingleExpr
7fd59977 104 | Derivation
105 | ConstantDefinition
106 | Sumator
107 | Productor
ab146989 108 ;
7fd59977 109
110SingleExpr : Single
ab146989 111 | Function
112 ;
7fd59977 113
114
ab146989 115Single : IDENTIFIER {ExprIntrp_VariableIdentifier();}
116 | VALUE {ExprIntrp_NumValue();}
117 ;
7fd59977 118
119Function : funcident PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndFunction();}
120 | DerFunctionId PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDerFunction();}
121 | DiffFuncId {ExprIntrp_EndDifferential();} PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDiffFunction();}
ab146989 122 ;
7fd59977 123
124ListGenExpr : GenExpr {ExprIntrp_EndFuncArg();}
ab146989 125 | GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr
126 ;
7fd59977 127
128funcident : IDENTIFIER {ExprIntrp_StartFunction();}
ab146989 129 ;
7fd59977 130
131FunctionDefinition : FunctionDef {ExprIntrp_DefineFunction();} ASSIGNOP GenExpr
ab146989 132 ;
7fd59977 133
134DerFunctionId : IDENTIFIER {ExprIntrp_StartDerivate();} DERIVATE {ExprIntrp_EndDerivate();}
135 ;
136
137DiffFuncId : DIFFERENTIAL DiffId DIVIDEOP DIFFERENTIAL IDENTIFIER {ExprIntrp_DiffVar();}
138 | DIFFERENTIAL VALUE {ExprIntrp_DiffDegree();} DiffId DIVIDEOP DIFFERENTIAL VALUE {ExprIntrp_VerDiffDegree();} IDENTIFIER {ExprIntrp_DiffDegreeVar();}
139 ;
140
141DiffId : IDENTIFIER {ExprIntrp_StartDifferential();}
142 | DiffFuncId
143 ;
144
ab146989 145FunctionDef : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
146 ;
7fd59977 147
ab146989 148ListArg : unarg {ExprIntrp_EndFuncArg();}
149 | unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
150 ;
7fd59977 151
ab146989 152unarg : IDENTIFIER {ExprIntrp_VariableIdentifier();}
153 ;
7fd59977 154
155Derivation : DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} ENDBRACKET {ExprIntrp_EndDerivation();}
156 | DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} COMMA VALUE {ExprIntrp_DerivationValue();} ENDBRACKET {ExprIntrp_EndDerivation();}
157 ;
158
159ConstantDefinition : CONSTKEY BRACKET IDENTIFIER {ExprIntrp_ConstantIdentifier();} COMMA VALUE {ExprIntrp_ConstantDefinition();} ENDBRACKET
160 ;
161
162Sumator : SUMKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Sumator();}
163 ;
164
165Productor : PRODKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Productor();}
166 ;
167
ab146989 168RelationList : SingleRelation
169 | SingleRelation RELSEPARATOR RelationList
170 | SingleRelation '\n' RelationList
171 ;
7fd59977 172
ab146989 173SingleRelation : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}
174 ;
7fd59977 175