mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
0025329: ExprIntrp_GenExp can not parse unary plus
Formatting Test case for issue CR25329
This commit is contained in:
parent
3910bc6501
commit
ab1469893c
@ -28,6 +28,7 @@ extern void ExprIntrp_ProductOperator();
|
|||||||
extern void ExprIntrp_DivideOperator();
|
extern void ExprIntrp_DivideOperator();
|
||||||
extern void ExprIntrp_ExpOperator();
|
extern void ExprIntrp_ExpOperator();
|
||||||
extern void ExprIntrp_UnaryMinusOperator();
|
extern void ExprIntrp_UnaryMinusOperator();
|
||||||
|
extern void ExprIntrp_UnaryPlusOperator();
|
||||||
extern void ExprIntrp_VariableIdentifier();
|
extern void ExprIntrp_VariableIdentifier();
|
||||||
extern void ExprIntrp_NumValue();
|
extern void ExprIntrp_NumValue();
|
||||||
extern void ExprIntrp_EndFunction();
|
extern void ExprIntrp_EndFunction();
|
||||||
@ -78,56 +79,57 @@ extern void ExprIntrp_EndOfEqual();
|
|||||||
%%
|
%%
|
||||||
|
|
||||||
exprentry : GenExpr
|
exprentry : GenExpr
|
||||||
| Assignment
|
| Assignment
|
||||||
| Deassignment
|
| Deassignment
|
||||||
| FunctionDefinition {ExprIntrp_EndOfFuncDef();}
|
| FunctionDefinition {ExprIntrp_EndOfFuncDef();}
|
||||||
| RelationList {ExprIntrp_EndOfRelation();}
|
| RelationList {ExprIntrp_EndOfRelation();}
|
||||||
;
|
;
|
||||||
|
|
||||||
Assignment : IDENTIFIER {ExprIntrp_AssignVariable();} ASSIGNOP GenExpr {ExprIntrp_EndOfAssign();}
|
Assignment : IDENTIFIER {ExprIntrp_AssignVariable();} ASSIGNOP GenExpr {ExprIntrp_EndOfAssign();}
|
||||||
;
|
;
|
||||||
|
|
||||||
Deassignment : DEASSIGNKEY BRACKET IDENTIFIER {ExprIntrp_Deassign();} ENDBRACKET
|
Deassignment : DEASSIGNKEY BRACKET IDENTIFIER {ExprIntrp_Deassign();} ENDBRACKET
|
||||||
;
|
;
|
||||||
|
|
||||||
GenExpr : GenExpr SUMOP GenExpr {ExprIntrp_SumOperator();}
|
GenExpr : GenExpr SUMOP GenExpr {ExprIntrp_SumOperator();}
|
||||||
| GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();}
|
| GenExpr MINUSOP GenExpr {ExprIntrp_MinusOperator();}
|
||||||
| GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();}
|
| GenExpr MULTOP GenExpr {ExprIntrp_ProductOperator();}
|
||||||
| GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();}
|
| GenExpr DIVIDEOP GenExpr {ExprIntrp_DivideOperator();}
|
||||||
| GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();}
|
| GenExpr EXPOP GenExpr {ExprIntrp_ExpOperator();}
|
||||||
| PARENTHESIS GenExpr ENDPARENTHESIS
|
| PARENTHESIS GenExpr ENDPARENTHESIS
|
||||||
| BRACKET GenExpr ENDBRACKET
|
| BRACKET GenExpr ENDBRACKET
|
||||||
| MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
|
| MINUSOP GenExpr {ExprIntrp_UnaryMinusOperator();}
|
||||||
| SingleExpr
|
| SUMOP GenExpr {ExprIntrp_UnaryPlusOperator();}
|
||||||
|
| SingleExpr
|
||||||
| Derivation
|
| Derivation
|
||||||
| ConstantDefinition
|
| ConstantDefinition
|
||||||
| Sumator
|
| Sumator
|
||||||
| Productor
|
| Productor
|
||||||
;
|
;
|
||||||
|
|
||||||
SingleExpr : Single
|
SingleExpr : Single
|
||||||
| Function
|
| Function
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
Single : IDENTIFIER {ExprIntrp_VariableIdentifier();}
|
Single : IDENTIFIER {ExprIntrp_VariableIdentifier();}
|
||||||
| VALUE {ExprIntrp_NumValue();}
|
| VALUE {ExprIntrp_NumValue();}
|
||||||
;
|
;
|
||||||
|
|
||||||
Function : funcident PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndFunction();}
|
Function : funcident PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndFunction();}
|
||||||
| DerFunctionId PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDerFunction();}
|
| DerFunctionId PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDerFunction();}
|
||||||
| DiffFuncId {ExprIntrp_EndDifferential();} PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDiffFunction();}
|
| DiffFuncId {ExprIntrp_EndDifferential();} PARENTHESIS ListGenExpr ENDPARENTHESIS {ExprIntrp_EndDiffFunction();}
|
||||||
;
|
;
|
||||||
|
|
||||||
ListGenExpr : GenExpr {ExprIntrp_EndFuncArg();}
|
ListGenExpr : GenExpr {ExprIntrp_EndFuncArg();}
|
||||||
| GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr
|
| GenExpr COMMA {ExprIntrp_NextFuncArg();} ListGenExpr
|
||||||
;
|
;
|
||||||
|
|
||||||
funcident : IDENTIFIER {ExprIntrp_StartFunction();}
|
funcident : IDENTIFIER {ExprIntrp_StartFunction();}
|
||||||
;
|
;
|
||||||
|
|
||||||
FunctionDefinition : FunctionDef {ExprIntrp_DefineFunction();} ASSIGNOP GenExpr
|
FunctionDefinition : FunctionDef {ExprIntrp_DefineFunction();} ASSIGNOP GenExpr
|
||||||
;
|
;
|
||||||
|
|
||||||
DerFunctionId : IDENTIFIER {ExprIntrp_StartDerivate();} DERIVATE {ExprIntrp_EndDerivate();}
|
DerFunctionId : IDENTIFIER {ExprIntrp_StartDerivate();} DERIVATE {ExprIntrp_EndDerivate();}
|
||||||
;
|
;
|
||||||
@ -140,15 +142,15 @@ DiffId : IDENTIFIER {ExprIntrp_StartDifferential();}
|
|||||||
| DiffFuncId
|
| DiffFuncId
|
||||||
;
|
;
|
||||||
|
|
||||||
FunctionDef : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
|
FunctionDef : IDENTIFIER {ExprIntrp_StartFunction();} BRACKET ListArg ENDBRACKET
|
||||||
;
|
;
|
||||||
|
|
||||||
ListArg : unarg {ExprIntrp_EndFuncArg();}
|
ListArg : unarg {ExprIntrp_EndFuncArg();}
|
||||||
| unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
|
| unarg COMMA {ExprIntrp_NextFuncArg();} ListArg
|
||||||
;
|
;
|
||||||
|
|
||||||
unarg : IDENTIFIER {ExprIntrp_VariableIdentifier();}
|
unarg : IDENTIFIER {ExprIntrp_VariableIdentifier();}
|
||||||
;
|
;
|
||||||
|
|
||||||
Derivation : DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} ENDBRACKET {ExprIntrp_EndDerivation();}
|
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();}
|
| DERIVKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_Derivation();} COMMA VALUE {ExprIntrp_DerivationValue();} ENDBRACKET {ExprIntrp_EndDerivation();}
|
||||||
@ -163,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();}
|
Productor : PRODKEY BRACKET GenExpr COMMA IDENTIFIER {ExprIntrp_VariableIdentifier();} COMMA GenExpr COMMA GenExpr COMMA VALUE {ExprIntrp_NumValue();} ENDBRACKET {ExprIntrp_Productor();}
|
||||||
;
|
;
|
||||||
|
|
||||||
RelationList : SingleRelation
|
RelationList : SingleRelation
|
||||||
| SingleRelation RELSEPARATOR RelationList
|
| SingleRelation RELSEPARATOR RelationList
|
||||||
| SingleRelation '\n' RelationList
|
| SingleRelation '\n' RelationList
|
||||||
;
|
;
|
||||||
|
|
||||||
SingleRelation : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}
|
SingleRelation : GenExpr EQUALOP GenExpr {ExprIntrp_EndOfEqual();}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -430,6 +430,12 @@ extern "C" void ExprIntrp_UnaryMinusOperator()
|
|||||||
ExprIntrp_Recept.Push(res->ShallowSimplified());
|
ExprIntrp_Recept.Push(res->ShallowSimplified());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void ExprIntrp_UnaryPlusOperator()
|
||||||
|
{
|
||||||
|
Handle(Expr_GeneralExpression) op = ExprIntrp_Recept.Pop();
|
||||||
|
ExprIntrp_Recept.Push(op);
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" void ExprIntrp_VariableIdentifier()
|
extern "C" void ExprIntrp_VariableIdentifier()
|
||||||
{
|
{
|
||||||
const TCollection_AsciiString& thename = ExprIntrp_GetResult();
|
const TCollection_AsciiString& thename = ExprIntrp_GetResult();
|
||||||
|
11
tests/bugs/fclasses/bug25329
Executable file
11
tests/bugs/fclasses/bug25329
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC25329"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# ExprIntrp_GenExp can not parse unary plus
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
pload QAcommands
|
||||||
|
|
||||||
|
OCC22611 "+1" 1
|
Loading…
x
Reference in New Issue
Block a user