@@ -806,6 +806,13 @@ public Operand visitPERMUT_fun(final PERMUT_funContext context) {
806806 return Operand .Create (sum );
807807 }
808808
809+ public Operand visitPercentage_fun (Percentage_funContext context ) {
810+ Operand firstValue = this .visit (context .expr ()).ToNumber ("Function Percentage parameter is error!" );
811+ if (firstValue .IsError ()) { return firstValue ; }
812+
813+ return Operand .Create (firstValue .NumberValue () / 100.0 );
814+ }
815+
809816 private int F_base_gcd (List <Double > list ) {
810817 list = ShellSort (list );
811818 // list = list.OrderBy(q => q).ToList();
@@ -5325,12 +5332,27 @@ public Operand visitNULL_fun(final NULL_funContext context) {
53255332 }
53265333
53275334 public Operand visitPARAMETER_fun (final PARAMETER_funContext context ) {
5328- final Operand p = visit (context .parameter ()).ToText ("Function PARAMETER first parameter is error!" );
5329- if (p .IsError ())
5330- return p ;
53315335
5332- if (GetParameter != null ) {
5333- return GetParameter .apply (p .TextValue ());
5336+ TerminalNode node = context .PARAMETER ();
5337+ if (node != null ) {
5338+ return GetParameter .apply (node .getText ());
5339+ }
5340+ node = context .PARAMETER2 ();
5341+ if (node != null ) {
5342+ String str = node .getText ();
5343+ if (str .startsWith ("@" )) {
5344+ return GetParameter .apply (str .substring (1 ));
5345+ }
5346+ return GetParameter .apply (str .substring (1 , str .length ()- 1 ));
5347+ }
5348+ //防止 多重引用
5349+ if (context .expr ()!=null ) {
5350+ Operand p = this .visit (context .expr ()).ToText ("Function PARAMETER first parameter is error!" );
5351+ if (p .IsError ()) return p ;
5352+
5353+ if (GetParameter != null ) {
5354+ return GetParameter .apply (p .TextValue ());
5355+ }
53345356 }
53355357 return Operand .Error ("Function PARAMETER first parameter is error!" );
53365358 }
@@ -5348,18 +5370,20 @@ public Operand visitParameter2(final Parameter2Context context) {
53485370 }
53495371
53505372 public Operand visitGetJsonValue_fun (final GetJsonValue_funContext context ) {
5351- final Operand firstValue = visit (context .expr ());
5373+ final Operand firstValue = visit (context .expr (0 ));
53525374 if (firstValue .IsError ()) {
53535375 return firstValue ;
53545376 }
53555377
53565378 final Operand obj = firstValue ;
53575379 Operand op ;
5358- final ParameterContext p1 = context .parameter ();
5359- if (p1 != null ) {
5360- op = visit (p1 );
5380+ if (context .parameter2 ()!=null ) {
5381+ op = this .visit (context .parameter2 ());
53615382 } else {
5362- op = visit (context .parameter2 ());
5383+ op = this .visit (context .expr (1 ));
5384+ if (op .IsError ()) {
5385+ op = Operand .Create (context .expr (1 ).getText ());
5386+ }
53635387 }
53645388
53655389 if (obj .Type () == OperandType .ARRARY ) {
@@ -5763,4 +5787,8 @@ private static int removeWhiteSpace(char[] data) {
57635787 return newSize ;
57645788 }
57655789 }
5790+
5791+
5792+
5793+
57665794}
0 commit comments