diff --git a/Operand.cpp b/Operand.cpp index aee75f0..f24fb93 100644 --- a/Operand.cpp +++ b/Operand.cpp @@ -53,7 +53,16 @@ namespace jet { } else throw coreutils::Exception("Expecting ) at end of LEFT expression."); } else if(in.ifNextIgnoreCase("EXPR")) { - + if(!in.ifNext("(")) + throw coreutils::Exception("Expecting ( for LEFT parameters."); + Operand parm1(in, global, lvariables); + if(in.ifNext(")")) { + Operand op(in, global, lvariables); + string = op.string; + isNumber = op.isNumber; + boolean = op.boolean; + } else + throw coreutils::Exception("Expecting ) at end of EXPR expression."); } else if(in.ifNextIgnoreCase("RIGHT")) { } else if(in.ifNextIgnoreCase("TRIM")) { @@ -90,7 +99,8 @@ namespace jet { string = in.getTokenExclude("'"); in.ifNext("'"); isNumber = false; - } + } else + throw coreutils::Exception("operand is not valid."); in.skipWhitespace(); @@ -284,7 +294,6 @@ namespace jet { throw coreutils::Exception("operand is not a number."); } else return; - } } diff --git a/tests/testexpr.jet b/tests/testexpr.jet new file mode 100755 index 0000000..220ae99 --- /dev/null +++ b/tests/testexpr.jet @@ -0,0 +1,6 @@ +#!../jet-2.0 + + + +$[test2] + diff --git a/tests/testwhile.jet b/tests/testwhile.jet index a3c3628..95b0e3a 100755 --- a/tests/testwhile.jet +++ b/tests/testwhile.jet @@ -1,8 +1,8 @@ #!../jet-2.0 - + -->$[ix]<-- - +