怎么样使用正则表达式解析四则运算式?

怎么样使用正则表达式解析四则运算式?

测试如:
iif(rui(5.27778 * (2+0.7) / 1.257 + sqrt(9+6) + pow(2,4)) > rui(pow(sqrt(6+(7)),sqrt((5+3)))), sqrt(power(2+2,2)),sqrt(25))

注:rui无条件进1;

解析步骤:



Group Count: 16
Func: * (2+0.7)
Opts: *
Par1: 2+0.7


iif(rui(5.27778 *2.7 / 1.257 + sqrt(9+6) + pow(2,4)) > rui(pow(sqrt(6+(7)),sqrt((5+3)))), sqrt(power(2+2,2)),sqrt(25))
Group Count: 16
Func: +(7)
Opts: +
Par1: 7


iif(rui(5.27778 *2.7 / 1.257 + sqrt(9+6) + pow(2,4)) > rui(pow(sqrt(6+7),sqrt((5+3)))), sqrt(power(2+2,2)),sqrt(25))
5+3
5
+
3
8



Group Count: 16
Func: ((5+3)
Opts: (
Par1: 5+3


iif(rui(5.27778 *2.7 / 1.257 + sqrt(9+6) + pow(2,4)) > rui(pow(sqrt(6+7),sqrt(8))), sqrt(power(2+2,2)),sqrt(25))
9+6
9
+
6
15



FuncName: SQRT
Group Count: 11
Func: sqrt(9+6)
Par1: 9+6
Par2:
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + pow(2,4)) > rui(pow(sqrt(6+7),sqrt(8))), sqrt(power(2+2,2)),sqrt(25))
6+7
6
+
7
13



FuncName: SQRT
Group Count: 11
Func: sqrt(6+7)
Par1: 6+7
Par2:
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + pow(2,4)) > rui(pow(3.60555127546399,sqrt(8))), sqrt(power(2+2,2)),sqrt(25))


FuncName: SQRT
Group Count: 11
Func: sqrt(8)
Par1: 8
Par2:
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + pow(2,4)) > rui(pow(3.60555127546399,2.82842712474619)), sqrt(power(2+2,2)),sqrt(25))


FuncName: SQRT
Group Count: 11
Func: sqrt(25)
Par1: 25
Par2:
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + pow(2,4)) > rui(pow(3.60555127546399,2.82842712474619)), sqrt(power(2+2,2)),5)


FuncName: POW
Group Count: 21
Func: pow(2,4)
Par1: 2
Par2: 4
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + 16) > rui(pow(3.60555127546399,2.82842712474619)), sqrt(power(2+2,2)),5)


FuncName: POW
Group Count: 21
Func: pow(3.60555127546399,2.82842712474619)
Par1: 3.60555127546399
Par2: 2.82842712474619
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + 16) > rui(37.6143703719252), sqrt(power(2+2,2)),5)
2+2
2
+
2
4



FuncName: POW
Group Count: 21
Func: power(2+2,2)
Par1: 2+2
Par2: 2
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + 16) > rui(37.6143703719252), sqrt(16),5)


FuncName: SQRT
Group Count: 11
Func: sqrt(16)
Par1: 16
Par2:
Par3:
(:
):


iif(rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + 16) > rui(37.6143703719252), 4,5)
2.7 / 1.257
2.7
/
1.257
5.27778 *2.14797136038186 + 3.87298334620742 + 16



5.27778 *2.14797136038186
5.27778
*
2.14797136038186
11.3365202863962 + 3.87298334620742 + 16



11.3365202863962 + 3.87298334620742
11.3365202863962
+
3.87298334620742
15.2095036326036 + 16



15.2095036326036 + 16
15.2095036326036
+
16
31.2095036326036



FuncName: RUI
Group Count: 11
Func: rui(5.27778 *2.7 / 1.257 + 3.87298334620742 + 16)
Par1: 5.27778 *2.7 / 1.257 + 3.87298334620742 + 16
Par2:
Par3:
(:
):


iif(32 > rui(37.6143703719252), 4,5)


FuncName: RUI
Group Count: 11
Func: rui(37.6143703719252)
Par1: 37.6143703719252
Par2:
Par3:
(:
):


iif(32 > 38, 4,5)
32 > 38
32
>
38
0



FuncName: IIF
Group Count: 29
Func: iif(32 > 38, 4,5)
Par1: 32 > 38
Par2: 4
Par3: 5
(:
):


5

下载地址: http://download.csdn.net/source/163063