0025329: ExprIntrp_GenExp can not parse unary plus
[occt.git] / src / ExprIntrp / ExprIntrp.yacc
old mode 100755 (executable)
new mode 100644 (file)
index beba617..9a3b476
@@ -1,25 +1,22 @@
 /* 
 /* Copyright (c) 1997-1999 Matra Datavision
- Copyright (c) 1999-2012 OPEN CASCADE SAS
+ Copyright (c) 1999-2014 OPEN CASCADE SAS
 
- The content of this file is subject to the Open CASCADE Technology Public
- License Version 6.5 (the "License"). You may not use the content of this file
- except in compliance with the License. Please obtain a copy of the License
- at http://www.opencascade.org and read it completely before using this file.
+ This file is part of Open CASCADE Technology software library.
 
- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
-
- The Original Code and all software distributed under the License is
- distributed on an "AS IS" basis, without warranty of any kind, and the
- Initial Developer hereby disclaims all such warranties, including without
- limitation, any warranties of merchantability, fitness for a particular
- purpose or non-infringement. Please see the License for the specific terms
- and conditions governing the rights and limitations under the License.
+ This library is free software; you can redistribute it and/or modify it under
+ the terms of the GNU Lesser General Public License version 2.1 as published
+ by the Free Software Foundation, with special exception defined in the file
+ OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+ distribution for complete text of the license and disclaimer of any warranty.
 
+ Alternatively, this file may be used under the terms of Open CASCADE
+ commercial license or contractual agreement.
 */ 
 
 %{
+#include <ExprIntrp_yaccintrf.hxx>
+
 extern void ExprIntrp_EndOfFuncDef();
 extern void ExprIntrp_EndOfRelation();
 extern void ExprIntrp_AssignVariable();
@@ -31,6 +28,7 @@ extern void ExprIntrp_ProductOperator();
 extern void ExprIntrp_DivideOperator();
 extern void ExprIntrp_ExpOperator();
 extern void ExprIntrp_UnaryMinusOperator();
+extern void ExprIntrp_UnaryPlusOperator();
 extern void ExprIntrp_VariableIdentifier();
 extern void ExprIntrp_NumValue();
 extern void ExprIntrp_EndFunction();
@@ -63,6 +61,12 @@ extern void ExprIntrp_Sumator();
 extern void ExprIntrp_VariableIdentifier();
 extern void ExprIntrp_Productor();
 extern void ExprIntrp_EndOfEqual();
+
+// disable MSVC warnings in bison code
+#ifdef _MSC_VER
+#pragma warning(disable:4131 4244 4127 4702)
+#endif
+
 %}
 
 %token SUMOP MINUSOP DIVIDEOP EXPOP MULTOP PARENTHESIS BRACKET ENDPARENTHESIS ENDBRACKET VALUE IDENTIFIER COMMA DIFFERENTIAL DERIVATE DERIVKEY ASSIGNOP DEASSIGNKEY EQUALOP RELSEPARATOR CONSTKEY SUMKEY PRODKEY
@@ -75,56 +79,57 @@ extern void ExprIntrp_EndOfEqual();
 %%
 
 exprentry          : GenExpr
-                  | Assignment  
+                   | Assignment  
                    | Deassignment
-                  | FunctionDefinition  {ExprIntrp_EndOfFuncDef();}
-                  | RelationList {ExprIntrp_EndOfRelation();}
-                  ;
+                   | FunctionDefinition  {ExprIntrp_EndOfFuncDef();}
+                   | RelationList {ExprIntrp_EndOfRelation();}
+                   ;
 
 Assignment         : IDENTIFIER {ExprIntrp_AssignVariable();} ASSIGNOP GenExpr {ExprIntrp_EndOfAssign();}
-                  ;
+                   ;
 
 Deassignment       : DEASSIGNKEY BRACKET IDENTIFIER {ExprIntrp_Deassign();} ENDBRACKET
                    ;
 
-GenExpr                   : GenExpr SUMOP  GenExpr {ExprIntrp_SumOperator();}
-                   | GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();} 
-                  | GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();} 
-                  | GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();} 
-                  | GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();} 
-                  | PARENTHESIS GenExpr ENDPARENTHESIS
-                  | BRACKET GenExpr ENDBRACKET
-                  | MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
-                  | SingleExpr
+GenExpr            : GenExpr SUMOP  GenExpr {ExprIntrp_SumOperator();}
+                   | GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();}
+                   | GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();}
+                   | GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();}
+                   | GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();}
+                   | PARENTHESIS GenExpr ENDPARENTHESIS
+                   | BRACKET GenExpr ENDBRACKET
+                   | MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
+                   | SUMOP GenExpr {ExprIntrp_UnaryPlusOperator();}
+                   | SingleExpr
                    | Derivation
                    | ConstantDefinition
                    | Sumator
                    | Productor
-                  ;
+                   ;
 
 SingleExpr         : Single
-                  | Function
-                  ;
+                   | Function
+                   ;
 
 
-Single            : IDENTIFIER  {ExprIntrp_VariableIdentifier();}
-                  | VALUE  {ExprIntrp_NumValue();}
-                  ;
+Single             : IDENTIFIER  {ExprIntrp_VariableIdentifier();}
+                   | VALUE  {ExprIntrp_NumValue();}
+                   ;
 
 Function           : funcident PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndFunction();}
                    | DerFunctionId PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDerFunction();}
                    | DiffFuncId {ExprIntrp_EndDifferential();} PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDiffFunction();}
-                  ;
+                   ;
 
 ListGenExpr        : GenExpr {ExprIntrp_EndFuncArg();} 
-                  | GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr 
-                  ;
+                   | GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr 
+                   ;
 
 funcident          : IDENTIFIER  {ExprIntrp_StartFunction();}
-                  ;
+                   ;
 
 FunctionDefinition : FunctionDef {ExprIntrp_DefineFunction();} ASSIGNOP GenExpr
-                  ;
+                   ;
 
 DerFunctionId      : IDENTIFIER {ExprIntrp_StartDerivate();} DERIVATE {ExprIntrp_EndDerivate();}
                    ;
@@ -137,15 +142,15 @@ DiffId             : IDENTIFIER {ExprIntrp_StartDifferential();}
                    | DiffFuncId
                    ;
 
-FunctionDef       : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
-                  ;
+FunctionDef        : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
+                   ;
 
-ListArg                   : unarg {ExprIntrp_EndFuncArg();}
-                  | unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
-                  ;
+ListArg            : unarg {ExprIntrp_EndFuncArg();}
+                   | unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
+                   ;
 
-unarg             : IDENTIFIER {ExprIntrp_VariableIdentifier();}
-                  ;
+unarg              : IDENTIFIER {ExprIntrp_VariableIdentifier();}
+                   ;
 
 Derivation         : DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} ENDBRACKET {ExprIntrp_EndDerivation();}
                    | DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} COMMA VALUE {ExprIntrp_DerivationValue();} ENDBRACKET {ExprIntrp_EndDerivation();}
@@ -160,11 +165,11 @@ Sumator            : SUMKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Variable
 Productor          : PRODKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Productor();}
                    ;
 
-RelationList      : SingleRelation 
-                  | SingleRelation RELSEPARATOR RelationList
-                  | SingleRelation '\n' RelationList
-                  ;
+RelationList       : SingleRelation 
+                   | SingleRelation RELSEPARATOR RelationList
+                   | SingleRelation '\n' RelationList
+                   ;
 
-SingleRelation    : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}
-                  ;
+SingleRelation     : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}
+                   ;