From 16a2e8645619f27282179ba2773b105cf225a1b1 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 4 Dec 2001 15:36:28 +0000 Subject: Improved messages produced on getting a syntax error in an expression FossilOrigin-Name: 7496369e64da3d9b0b5a574f2fc8ed8c607e81d7 --- ChangeLog | 15 ++ generic/tclParseExpr.c | 138 +++++++++++------ tests/compExpr-old.test | 92 +++++------ tests/compExpr.test | 44 ++---- tests/compile.test | 6 +- tests/expr-old.test | 54 +++---- tests/expr.test | 92 +++++------ tests/for.test | 5 +- tests/if.test | 24 +-- tests/parseExpr.test | 404 ++++++++++++++++++++++++------------------------ tests/while.test | 18 +-- 11 files changed, 447 insertions(+), 445 deletions(-) diff --git a/ChangeLog b/ChangeLog index f63bb58..e3c7687 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2001-12-04 Donal K. Fellows + + * tests/compExpr-old.test, tests/compExpr.test, tests/compile.test: + * tests/expr-old.test, tests/expr.test, tests/for.test: + * tests/while.test, tests/if.test: Rewrite to handle more specific + syntax errors. + * tests/parseExpr.test: Rewrite to get rid of dup test numbers and + handle more specific syntax errors. + * generic/tclParseExpr.c (LogSyntaxError): Added a detail message + argument to help explain what the syntax error is. + (Tcl_ParseExpr, ParseCondExpr, ParsePrimaryExpr): Added detail + messages. + (UNKNOWN_CHAR): New lexeme for characters that are always illegal + in expressions outside strings. + 2001-12-03 Donal K. Fellows * doc/expr.n: Various documentation improvements in relation to diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c index f37c626..fa50209 100644 --- a/generic/tclParseExpr.c +++ b/generic/tclParseExpr.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParseExpr.c,v 1.9 2001/10/01 15:31:51 msofer Exp $ + * RCS: @(#) $Id: tclParseExpr.c,v 1.10 2001/12/04 15:36:29 dkf Exp $ */ #include "tclInt.h" @@ -71,6 +71,8 @@ typedef struct ParseInfo { * Definitions of the different lexemes that appear in expressions. The * order of these must match the corresponding entries in the * operatorStrings array below. + * + * Basic lexemes: */ #define LITERAL 0 @@ -84,42 +86,47 @@ typedef struct ParseInfo { #define COMMA 8 #define END 9 #define UNKNOWN 10 +#define UNKNOWN_CHAR 11 /* - * Binary operators: + * Binary numeric operators: */ -#define MULT 11 -#define DIVIDE 12 -#define MOD 13 -#define PLUS 14 -#define MINUS 15 -#define LEFT_SHIFT 16 -#define RIGHT_SHIFT 17 -#define LESS 18 -#define GREATER 19 -#define LEQ 20 -#define GEQ 21 -#define EQUAL 22 -#define NEQ 23 -#define BIT_AND 24 -#define BIT_XOR 25 -#define BIT_OR 26 -#define AND 27 -#define OR 28 -#define QUESTY 29 -#define COLON 30 +#define MULT 12 +#define DIVIDE 13 +#define MOD 14 +#define PLUS 15 +#define MINUS 16 +#define LEFT_SHIFT 17 +#define RIGHT_SHIFT 18 +#define LESS 19 +#define GREATER 20 +#define LEQ 21 +#define GEQ 22 +#define EQUAL 23 +#define NEQ 24 +#define BIT_AND 25 +#define BIT_XOR 26 +#define BIT_OR 27 +#define AND 28 +#define OR 29 +#define QUESTY 30 +#define COLON 31 /* * Unary operators. Unary minus and plus are represented by the (binary) * lexemes MINUS and PLUS. */ -#define NOT 31 -#define BIT_NOT 32 +#define NOT 32 +#define BIT_NOT 33 + +/* + * Binary string operators: + */ -#define STREQ 33 -#define STRNEQ 34 +#define STREQ 34 +#define STRNEQ 35 /* * Mapping from lexemes to strings; used for debugging messages. These @@ -129,7 +136,7 @@ typedef struct ParseInfo { #ifdef TCL_COMPILE_DEBUG static char *lexemeStrings[] = { "LITERAL", "FUNCNAME", - "[", "{", "(", ")", "$", "\"", ",", "END", "UNKNOWN", + "[", "{", "(", ")", "$", "\"", ",", "END", "UNKNOWN", "UNKNOWN_CHAR", "*", "/", "%", "+", "-", "<<", ">>", "<", ">", "<=", ">=", "==", "!=", "&", "^", "|", "&&", "||", "?", ":", @@ -142,7 +149,8 @@ static char *lexemeStrings[] = { */ static int GetLexeme _ANSI_ARGS_((ParseInfo *infoPtr)); -static void LogSyntaxError _ANSI_ARGS_((ParseInfo *infoPtr)); +static void LogSyntaxError _ANSI_ARGS_((ParseInfo *infoPtr, + char *extraInfo)); static int ParseAddExpr _ANSI_ARGS_((ParseInfo *infoPtr)); static int ParseBitAndExpr _ANSI_ARGS_((ParseInfo *infoPtr)); static int ParseBitOrExpr _ANSI_ARGS_((ParseInfo *infoPtr)); @@ -157,8 +165,8 @@ static int ParseRelationalExpr _ANSI_ARGS_((ParseInfo *infoPtr)); static int ParseShiftExpr _ANSI_ARGS_((ParseInfo *infoPtr)); static int ParseUnaryExpr _ANSI_ARGS_((ParseInfo *infoPtr)); static void PrependSubExprTokens _ANSI_ARGS_((char *op, - int opBytes, char *src, int srcBytes, - int firstIndex, ParseInfo *infoPtr)); + int opBytes, char *src, int srcBytes, + int firstIndex, ParseInfo *infoPtr)); /* * Macro used to debug the execution of the recursive descent parser used @@ -281,7 +289,7 @@ Tcl_ParseExpr(interp, string, numBytes, parsePtr) goto error; } if (info.lexeme != END) { - LogSyntaxError(&info); + LogSyntaxError(&info, "extra tokens at end of expression"); goto error; } string[numBytes] = (char) savedChar; @@ -387,7 +395,7 @@ ParseCondExpr(infoPtr) return code; } if (infoPtr->lexeme != COLON) { - LogSyntaxError(infoPtr); + LogSyntaxError(infoPtr, "missing colon from ternary conditional"); return TCL_ERROR; } code = GetLexeme(infoPtr); /* skip over the ':' */ @@ -1148,7 +1156,8 @@ ParsePrimaryExpr(infoPtr) return code; } if (infoPtr->lexeme != CLOSE_PAREN) { - goto syntaxError; + LogSyntaxError(infoPtr, "looking for close parenthesis"); + return TCL_ERROR; } code = GetLexeme(infoPtr); /* skip over the ')' */ if (code != TCL_OK) { @@ -1378,7 +1387,9 @@ ParsePrimaryExpr(infoPtr) return code; } if (infoPtr->lexeme != OPEN_PAREN) { - goto syntaxError; + LogSyntaxError(infoPtr, + "expected a parenthesis enclosing function arguments"); + return TCL_ERROR; } code = GetLexeme(infoPtr); /* skip over '(' */ if (code != TCL_OK) { @@ -1397,7 +1408,9 @@ ParsePrimaryExpr(infoPtr) return code; } } else if (infoPtr->lexeme != CLOSE_PAREN) { - goto syntaxError; + LogSyntaxError(infoPtr, + "missing close parenthesis at end of function call"); + return TCL_ERROR; } } @@ -1406,8 +1419,37 @@ ParsePrimaryExpr(infoPtr) exprTokenPtr->numComponents = parsePtr->numTokens - firstIndex; break; + case COMMA: + LogSyntaxError(infoPtr, + "commas can only separate function arguments"); + return TCL_ERROR; + case END: + LogSyntaxError(infoPtr, "premature end of expression"); + return TCL_ERROR; + case UNKNOWN: + LogSyntaxError(infoPtr, "single equality character not legal in expressions"); + return TCL_ERROR; + case UNKNOWN_CHAR: + LogSyntaxError(infoPtr, "character not legal in expressions"); + return TCL_ERROR; + case QUESTY: + LogSyntaxError(infoPtr, "unexpected ternary 'then' separator"); + return TCL_ERROR; + case COLON: + LogSyntaxError(infoPtr, "unexpected ternary 'else' separator"); + return TCL_ERROR; + default: - goto syntaxError; +#ifdef TCL_COMPILE_DEBUG + { + char buf[64]; + sprintf(buf, "unexpected operator %s", lexemeStrings[lexeme]); + LogSyntaxError(infoPtr, buf); + } +#else + LogSyntaxError(infoPtr, "unexpected operator"); +#endif + return TCL_ERROR; } /* @@ -1420,10 +1462,6 @@ ParsePrimaryExpr(infoPtr) } parsePtr->term = infoPtr->next; return TCL_OK; - - syntaxError: - LogSyntaxError(infoPtr); - return TCL_ERROR; } /* @@ -1823,7 +1861,7 @@ GetLexeme(infoPtr) } return TCL_OK; } - infoPtr->lexeme = UNKNOWN; + infoPtr->lexeme = UNKNOWN_CHAR; return TCL_OK; } } @@ -1903,23 +1941,31 @@ PrependSubExprTokens(op, opBytes, src, srcBytes, firstIndex, infoPtr) * * Side effects: * Sets the interpreter result to an error message describing the - * expression that was being parsed when the error occurred. + * expression that was being parsed when the error occurred, and why + * the parser considers that to be a syntax error at all. * *---------------------------------------------------------------------- */ static void -LogSyntaxError(infoPtr) +LogSyntaxError(infoPtr, extraInfo) ParseInfo *infoPtr; /* Holds the parse state for the * expression being parsed. */ + char *extraInfo; /* String to provide extra information + * about the syntax error. */ { int numBytes = (infoPtr->lastChar - infoPtr->originalExpr); char buffer[100]; - sprintf(buffer, "syntax error in expression \"%.*s\"", - ((numBytes > 60)? 60 : numBytes), infoPtr->originalExpr); + if (numBytes > 60) { + sprintf(buffer, "syntax error in expression \"%.60s...\"", + infoPtr->originalExpr); + } else { + sprintf(buffer, "syntax error in expression \"%s\"", + infoPtr->originalExpr); + } Tcl_AppendStringsToObj(Tcl_GetObjResult(infoPtr->parsePtr->interp), - buffer, (char *) NULL); + buffer, ": ", extraInfo, (char *) NULL); infoPtr->parsePtr->errorType = TCL_PARSE_SYNTAX; infoPtr->parsePtr->term = infoPtr->start; } diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test index f7bb24f..ea54db1 100644 --- a/tests/compExpr-old.test +++ b/tests/compExpr-old.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr-old.test,v 1.5 2000/04/10 17:18:57 ericm Exp $ +# RCS: @(#) $Id: compExpr-old.test,v 1.6 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -135,11 +135,11 @@ test expr-2.1 {TclCompileExpr: are builtin functions registered?} { test expr-2.2 {TclCompileExpr: error in expr} { catch {expr 2**3} msg set msg -} {syntax error in expression "2**3"} +} {syntax error in expression "2**3": unexpected operator} test expr-2.3 {TclCompileExpr: junk after legal expr} { catch {expr 7*[llength "a b"]foo} msg set msg -} {syntax error in expression "7*2foo"} +} {syntax error in expression "7*2foo": extra tokens at end of expression} test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} { expr {0001} } 1 @@ -148,17 +148,17 @@ test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1 test expr-3.2 {CompileCondExpr: error in lor expr} { catch {expr x||3} msg set msg -} {syntax error in expression "x||3"} +} {syntax error in expression "x||3": expected a parenthesis enclosing function arguments} test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44 test expr-3.4 {CompileCondExpr: error compiling true arm} { catch {expr 3>2?2**3:66} msg set msg -} {syntax error in expression "3>2?2**3:66"} +} {syntax error in expression "3>2?2**3:66": unexpected operator} test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66 test expr-3.6 {CompileCondExpr: error compiling false arm} { catch {expr 2>3?44:2**3} msg set msg -} {syntax error in expression "2>3?44:2**3"} +} {syntax error in expression "2>3?44:2**3": unexpected operator} test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {nonPortable} { puts "Note: doing test expr-3.7 which can take several minutes to run" hello_world @@ -174,18 +174,18 @@ test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1 test expr-4.2 {CompileLorExpr: error in land expr} { catch {expr x&&3} msg set msg -} {syntax error in expression "x&&3"} +} {syntax error in expression "x&&3": expected a parenthesis enclosing function arguments} test expr-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1 test expr-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1 test expr-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1 test expr-4.6 {CompileLorExpr: error compiling lor arm} { catch {expr 2**3||4.0} msg set msg -} {syntax error in expression "2**3||4.0"} +} {syntax error in expression "2**3||4.0": unexpected operator} test expr-4.7 {CompileLorExpr: error compiling lor arm} { catch {expr 1.3||2**3} msg set msg -} {syntax error in expression "1.3||2**3"} +} {syntax error in expression "1.3||2**3": unexpected operator} test expr-4.8 {CompileLorExpr: error compiling lor arms} { list [catch {expr {"a"||"b"}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -199,7 +199,7 @@ test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23 test expr-5.2 {CompileLandExpr: error in bitor expr} { catch {expr x|3} msg set msg -} {syntax error in expression "x|3"} +} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments} test expr-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0 test expr-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0 test expr-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1 @@ -207,11 +207,11 @@ test expr-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1 test expr-5.7 {CompileLandExpr: error compiling land arm} { catch {expr 2**3&&4.0} msg set msg -} {syntax error in expression "2**3&&4.0"} +} {syntax error in expression "2**3&&4.0": unexpected operator} test expr-5.8 {CompileLandExpr: error compiling land arm} { catch {expr 1.3&&2**3} msg set msg -} {syntax error in expression "1.3&&2**3"} +} {syntax error in expression "1.3&&2**3": unexpected operator} test expr-5.9 {CompileLandExpr: error compiling land arm} { list [catch {expr {"a"&&"b"}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -225,7 +225,7 @@ test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3 test expr-6.2 {CompileBitXorExpr: error in bitand expr} { catch {expr x|3} msg set msg -} {syntax error in expression "x|3"} +} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments} test expr-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20 test expr-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19 test expr-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7 @@ -233,11 +233,11 @@ test expr-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8 test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} { catch {expr 2**3|6} msg set msg -} {syntax error in expression "2**3|6"} +} {syntax error in expression "2**3|6": unexpected operator} test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} { catch {expr 2^x} msg set msg -} {syntax error in expression "2^x"} +} {syntax error in expression "2^x": expected a parenthesis enclosing function arguments} test expr-6.9 {CompileBitXorExpr: runtime error in bitxor arm} { list [catch {expr {24.0^3}} msg] $msg } {1 {can't use floating-point value as operand of "^"}} @@ -252,7 +252,7 @@ test expr-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0 test expr-7.5 {CompileBitAndExpr: error in equality expr} { catch {expr x==3} msg set msg -} {syntax error in expression "x==3"} +} {syntax error in expression "x==3": expected a parenthesis enclosing function arguments} test expr-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3 test expr-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82 test expr-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2 @@ -260,11 +260,11 @@ test expr-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7 test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} { catch {expr 2**3&6} msg set msg -} {syntax error in expression "2**3&6"} +} {syntax error in expression "2**3&6": unexpected operator} test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} { catch {expr 2&x} msg set msg -} {syntax error in expression "2&x"} +} {syntax error in expression "2&x": expected a parenthesis enclosing function arguments} test expr-7.12 {CompileBitAndExpr: runtime error in bitand arm} { list [catch {expr {24.0&3}} msg] $msg } {1 {can't use floating-point value as operand of "&"}} @@ -279,7 +279,7 @@ test expr-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0 test expr-8.5 {CompileEqualityExpr: error in relational expr} { catch {expr x>3} msg set msg -} {syntax error in expression "x>3"} +} {syntax error in expression "x>3": expected a parenthesis enclosing function arguments} test expr-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0 test expr-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1 test expr-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1 @@ -287,11 +287,11 @@ test expr-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1 test expr-8.10 {CompileEqualityExpr: error compiling equality arm} { catch {expr 2**3==6} msg set msg -} {syntax error in expression "2**3==6"} +} {syntax error in expression "2**3==6": unexpected operator} test expr-8.11 {CompileEqualityExpr: error compiling equality arm} { catch {expr 2!=x} msg set msg -} {syntax error in expression "2!=x"} +} {syntax error in expression "2!=x": expected a parenthesis enclosing function arguments} test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12 @@ -314,17 +314,17 @@ if {0x80000000 > 0} { test expr-9.6 {CompileRelationalExpr: error in shift expr} { catch {expr x>>3} msg set msg -} {syntax error in expression "x>>3"} +} {syntax error in expression "x>>3": expected a parenthesis enclosing function arguments} test expr-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1 test expr-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1 test expr-9.9 {CompileRelationalExpr: error compiling relational arm} { catch {expr 2**3>6} msg set msg -} {syntax error in expression "2**3>6"} +} {syntax error in expression "2**3>6": unexpected operator} test expr-9.10 {CompileRelationalExpr: error compiling relational arm} { catch {expr 2>0x3} 31 test expr-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936 test expr-10.8 {CompileShiftExpr: error compiling shift arm} { catch {expr 2**3>>6} msg set msg -} {syntax error in expression "2**3>>6"} +} {syntax error in expression "2**3>>6": unexpected operator} test expr-10.9 {CompileShiftExpr: error compiling shift arm} { catch {expr 2<>43}} msg] $msg } {1 {can't use floating-point value as operand of ">>"}} @@ -358,17 +358,17 @@ test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6 test expr-11.5 {CompileAddExpr: error in multiply expr} { catch {expr x*3} msg set msg -} {syntax error in expression "x*3"} +} {syntax error in expression "x*3": expected a parenthesis enclosing function arguments} test expr-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258 test expr-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239 test expr-11.8 {CompileAddExpr: error compiling add arm} { catch {expr 2**3+6} msg set msg -} {syntax error in expression "2**3+6"} +} {syntax error in expression "2**3+6": unexpected operator} test expr-11.9 {CompileAddExpr: error compiling add arm} { catch {expr 2-x} msg set msg -} {syntax error in expression "2-x"} +} {syntax error in expression "2-x": expected a parenthesis enclosing function arguments} test expr-11.10 {CompileAddExpr: runtime error} { list [catch {expr {24.0+"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "+"}} @@ -389,17 +389,17 @@ test expr-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936 test expr-12.5 {CompileMultiplyExpr: error in unary expr} { catch {expr ~x} msg set msg -} {syntax error in expression "~x"} +} {syntax error in expression "~x": expected a parenthesis enclosing function arguments} test expr-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765 test expr-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2 test expr-12.8 {CompileMultiplyExpr: error compiling multiply arm} { catch {expr 2*3%%6} msg set msg -} {syntax error in expression "2*3%%6"} +} {syntax error in expression "2*3%%6": unexpected operator} test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} { catch {expr 2*x} msg set msg -} {syntax error in expression "2*x"} +} {syntax error in expression "2*x": expected a parenthesis enclosing function arguments} test expr-12.10 {CompileMultiplyExpr: runtime error} { list [catch {expr {24.0*"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "*"}} @@ -417,11 +417,11 @@ test expr-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0 test expr-13.8 {CompileUnaryExpr: error compiling unary expr} { catch {expr ~x} msg set msg -} {syntax error in expression "~x"} +} {syntax error in expression "~x": expected a parenthesis enclosing function arguments} test expr-13.9 {CompileUnaryExpr: error compiling unary expr} { catch {expr !1.x} msg set msg -} {syntax error in expression "!1.x"} +} {syntax error in expression "!1.x": extra tokens at end of expression} test expr-13.10 {CompileUnaryExpr: runtime error} { list [catch {expr {~"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "~"}} @@ -533,7 +533,7 @@ test expr-14.26 {CompilePrimaryExpr: math function primary} { test expr-14.27 {CompilePrimaryExpr: error in math function primary} { catch {expr sinh::(2.0)} msg set errorInfo -} {syntax error in expression "sinh::(2.0)" +} {syntax error in expression "sinh::(2.0)": expected a parenthesis enclosing function arguments while compiling "expr sinh::(2.0)"} test expr-14.28 {CompilePrimaryExpr: subexpression primary} { @@ -550,7 +550,7 @@ test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} { test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} { catch {expr 2+(3*(4+5)} msg set errorInfo -} {syntax error in expression "2+(3*(4+5)" +} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis while compiling "expr 2+(3*(4+5)"} test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} { @@ -560,14 +560,14 @@ test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} { test expr-14.32 {CompilePrimaryExpr: unexpected token} { catch {expr @} msg set errorInfo -} {syntax error in expression "@" +} {syntax error in expression "@": character not legal in expressions while compiling "expr @"} test expr-15.1 {CompileMathFuncCall: missing parenthesis} { catch {expr sinh2.0)} msg set errorInfo -} {syntax error in expression "sinh2.0)" +} {syntax error in expression "sinh2.0)": expected a parenthesis enclosing function arguments while compiling "expr sinh2.0)"} test expr-15.2 {CompileMathFuncCall: unknown math function} { @@ -597,7 +597,7 @@ test expr-15.5 {CompileMathFuncCall: too few arguments} { test expr-15.6 {CompileMathFuncCall: missing ')'} { catch {expr sin(1} msg set errorInfo -} {syntax error in expression "sin(1" +} {syntax error in expression "sin(1": missing close parenthesis at end of function call while compiling "expr sin(1"} if $gotT1 { @@ -676,15 +676,3 @@ if {[info exists a]} { } ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/compExpr.test b/tests/compExpr.test index fed14c9..54e5de0 100644 --- a/tests/compExpr.test +++ b/tests/compExpr.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compExpr.test,v 1.4 2000/04/10 17:18:58 ericm Exp $ +# RCS: @(#) $Id: compExpr.test,v 1.5 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -30,7 +30,7 @@ test compExpr-1.1 {TclCompileExpr procedure, successful expr parse and compile} } 3 test compExpr-1.2 {TclCompileExpr procedure, error parsing expr} { list [catch {expr 1+2+} msg] $msg -} {1 {syntax error in expression "1+2+"}} +} {1 {syntax error in expression "1+2+": premature end of expression}} test compExpr-1.3 {TclCompileExpr procedure, error compiling expr} { list [catch {expr "foo(123)"} msg] $msg } {1 {unknown math function "foo"}} @@ -46,7 +46,7 @@ test compExpr-2.1 {CompileSubExpr procedure, TCL_TOKEN_WORD parse token} { } 0 test compExpr-2.2 {CompileSubExpr procedure, error compiling TCL_TOKEN_WORD parse token} { list [catch {expr {"00[expr 1+]" + 17}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.3 {CompileSubExpr procedure, TCL_TOKEN_TEXT parse token} { expr {{12345}} } 12345 @@ -89,7 +89,7 @@ test compExpr-2.13 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse catch {unset a} set a 15 list [catch {expr {27 || "$a[expr 1+]00"}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.14 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, op found} { expr {5*6} } 30 @@ -157,16 +157,16 @@ test compExpr-2.34 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special } 2 test compExpr-2.35 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} { list [catch {expr {+[expr 1+]}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.36 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} { expr {4+2} } 6 test compExpr-2.37 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} { list [catch {expr {[expr 1+]+5}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.38 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, error in special operator} { list [catch {expr {5+[expr 1+]}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.39 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} { expr {-2} } -2 @@ -182,7 +182,7 @@ test compExpr-2.42 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse catch {unset a} set a 15 list [catch {expr {27 || "$a[expr 1+]00"}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-2.43 {CompileSubExpr procedure, TCL_TOKEN_OPERATOR token, special operator} { catch {unset a} set a false @@ -197,7 +197,7 @@ test compExpr-2.45 {CompileSubExpr procedure, error in TCL_TOKEN_SUB_EXPR parse catch {unset a} set a 15 list [catch {expr {1? 54 : "$a[expr 1+]00"}} msg] $msg -} {1 {syntax error in expression "1+"}} +} {1 {syntax error in expression "1+": premature end of expression}} test compExpr-3.1 {CompileLandOrLorExpr procedure, numeric 1st operand} { catch {unset a} @@ -211,7 +211,7 @@ test compExpr-3.2 {CompileLandOrLorExpr procedure, nonnumeric 1st operand} { } 0 test compExpr-3.3 {CompileSubExpr procedure, error in 1st operand} { list [catch {expr {[expr *2]||0}} msg] $msg -} {1 {syntax error in expression "*2"}} +} {1 {syntax error in expression "*2": unexpected operator}} test compExpr-3.4 {CompileLandOrLorExpr procedure, result is 1 or 0} { catch {unset a} catch {unset b} @@ -241,7 +241,7 @@ test compExpr-3.8 {CompileLandOrLorExpr procedure, nonnumeric 2nd operand} { } 0 test compExpr-3.9 {CompileLandOrLorExpr procedure, error in 2nd operand} { list [catch {expr {0||[expr %2]}} msg] $msg -} {1 {syntax error in expression "%2"}} +} {1 {syntax error in expression "%2": unexpected operator}} test compExpr-3.10 {CompileLandOrLorExpr procedure, long lor/land arm} { set a "abcdefghijkl" set i 7 @@ -260,7 +260,7 @@ test compExpr-4.2 {CompileCondExpr procedure, complex test, convert to numeric} } -54 test compExpr-4.3 {CompileCondExpr procedure, error in test} { list [catch {expr {[expr *2]? +1 : -1}} msg] $msg -} {1 {syntax error in expression "*2"}} +} {1 {syntax error in expression "*2": unexpected operator}} test compExpr-4.4 {CompileCondExpr procedure, simple "true" clause} { catch {unset a} set a no @@ -273,7 +273,7 @@ test compExpr-4.5 {CompileCondExpr procedure, convert "true" clause to numeric} } no test compExpr-4.6 {CompileCondExpr procedure, error in "true" clause} { list [catch {expr {1? [expr *2] : -127}} msg] $msg -} {1 {syntax error in expression "*2"}} +} {1 {syntax error in expression "*2": unexpected operator}} test compExpr-4.7 {CompileCondExpr procedure, simple "false" clause} { catch {unset a} set a no @@ -286,7 +286,7 @@ test compExpr-4.8 {CompileCondExpr procedure, convert "false" clause to numeric} } 83 test compExpr-4.9 {CompileCondExpr procedure, error in "false" clause} { list [catch {expr {1? 15 : [expr *2]}} msg] $msg -} {1 {syntax error in expression "*2"}} +} {1 {syntax error in expression "*2": unexpected operator}} test compExpr-5.1 {CompileMathFuncCall procedure, math function found} { format %.6g [expr atan2(1.0, 2.0)] @@ -310,7 +310,7 @@ test compExpr-5.6 {CompileMathFuncCall procedure, complex argument} { } 9.97424 test compExpr-5.7 {CompileMathFuncCall procedure, error in argument} { list [catch {expr {sinh(2.*)}} msg] $msg -} {1 {syntax error in expression "sinh(2.*)"}} +} {1 {syntax error in expression "sinh(2.*)": unexpected operator}} test compExpr-5.8 {CompileMathFuncCall procedure, too many arguments} { list [catch {expr {sinh(2.0, 3.0)}} msg] $msg } {1 {too many arguments for math function}} @@ -320,22 +320,10 @@ test compExpr-5.9 {CompileMathFuncCall procedure, too many arguments} { test compExpr-6.1 {LogSyntaxError procedure, error in expr longer than 60 chars} { list [catch {expr {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1 foo 3} msg] $msg -} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012"}} +} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": extra tokens at end of expression}} # cleanup catch {unset a} catch {unset b} ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/compile.test b/tests/compile.test index 5e77875..72024b8 100644 --- a/tests/compile.test +++ b/tests/compile.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: compile.test,v 1.15 2001/11/23 01:25:58 das Exp $ +# RCS: @(#) $Id: compile.test,v 1.16 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -230,11 +230,11 @@ test compile-11.6 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { test compile-11.7 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { proc p {} { set r [list foobar] ; expr !a } list [catch {p} msg] $msg -} {1 {syntax error in expression "!a"}} +} {1 {syntax error in expression "!a": expected a parenthesis enclosing function arguments}} test compile-11.8 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { proc p {} { set r [list foobar] ; expr {!a} } list [catch {p} msg] $msg -} {1 {syntax error in expression "!a"}} +} {1 {syntax error in expression "!a": expected a parenthesis enclosing function arguments}} test compile-11.9 {Tcl_Append*: ensure Tcl_ResetResult is used properly} { proc p {} { set r [list foobar] ; llength "\{" } list [catch {p} msg] $msg diff --git a/tests/expr-old.test b/tests/expr-old.test index f0efffb..368ec44 100644 --- a/tests/expr-old.test +++ b/tests/expr-old.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr-old.test,v 1.11 2001/04/09 09:45:01 dkf Exp $ +# RCS: @(#) $Id: expr-old.test,v 1.12 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -440,10 +440,10 @@ test expr-old-26.1 {error conditions} { } {1 {can't use non-numeric string as operand of "+"}} test expr-old-26.2 {error conditions} { list [catch {expr 2+4*} msg] $msg -} {1 {syntax error in expression "2+4*"}} +} {1 {syntax error in expression "2+4*": premature end of expression}} test expr-old-26.3 {error conditions} { list [catch {expr 2+4*(} msg] $msg -} {1 {syntax error in expression "2+4*("}} +} {1 {syntax error in expression "2+4*(": premature end of expression}} catch {unset _non_existent_} test expr-old-26.4 {error conditions} { list [catch {expr 2+$_non_existent_} msg] $msg @@ -457,7 +457,7 @@ test expr-old-26.6 {error conditions} { } {1 {can't use non-numeric string as operand of "+"}} test expr-old-26.7 {error conditions} { list [catch {expr {2+(4}} msg] $msg -} {1 {syntax error in expression "2+(4"}} +} {1 {syntax error in expression "2+(4": looking for close parenthesis}} test expr-old-26.8 {error conditions} { list [catch {expr 2/0} msg] $msg $errorCode } {1 {divide by zero} {ARITH DIVZERO {divide by zero}}} @@ -469,31 +469,31 @@ test expr-old-26.10 {error conditions} { } {1 {divide by zero} {ARITH DIVZERO {divide by zero}}} test expr-old-26.11 {error conditions} { list [catch {expr 2#} msg] $msg -} {1 {syntax error in expression "2#"}} +} {1 {syntax error in expression "2#": extra tokens at end of expression}} test expr-old-26.12 {error conditions} { list [catch {expr a.b} msg] $msg -} {1 {syntax error in expression "a.b"}} +} {1 {syntax error in expression "a.b": expected a parenthesis enclosing function arguments}} test expr-old-26.13 {error conditions} { list [catch {expr {"a"/"b"}} msg] $msg } {1 {can't use non-numeric string as operand of "/"}} test expr-old-26.14 {error conditions} { list [catch {expr 2:3} msg] $msg -} {1 {syntax error in expression "2:3"}} +} {1 {syntax error in expression "2:3": extra tokens at end of expression}} test expr-old-26.15 {error conditions} { list [catch {expr a@b} msg] $msg -} {1 {syntax error in expression "a@b"}} +} {1 {syntax error in expression "a@b": expected a parenthesis enclosing function arguments}} test expr-old-26.16 {error conditions} { list [catch {expr a[b} msg] $msg } {1 {missing close-bracket}} test expr-old-26.17 {error conditions} { list [catch {expr a`b} msg] $msg -} {1 {syntax error in expression "a`b"}} +} {1 {syntax error in expression "a`b": expected a parenthesis enclosing function arguments}} test expr-old-26.18 {error conditions} { list [catch {expr \"a\"\{b} msg] $msg -} {1 syntax\ error\ in\ expression\ \"\"a\"\{b\"} +} {1 syntax\ error\ in\ expression\ \"\"a\"\{b\":\ extra\ tokens\ at\ end\ of\ expression} test expr-old-26.19 {error conditions} { list [catch {expr a} msg] $msg -} {1 {syntax error in expression "a"}} +} {1 {syntax error in expression "a": expected a parenthesis enclosing function arguments}} test expr-old-26.20 {error conditions} { list [catch expr msg] $msg } {1 {wrong # args: should be "expr arg ?arg ...?"}} @@ -543,10 +543,10 @@ test expr-old-27.10 {cancelled evaluation} { } {0 0} test expr-old-27.11 {cancelled evaluation} { list [catch {expr {0 && foo}} msg] $msg -} {1 {syntax error in expression "0 && foo"}} +} {1 {syntax error in expression "0 && foo": expected a parenthesis enclosing function arguments}} test expr-old-27.12 {cancelled evaluation} { list [catch {expr {0 ? 1 : foo}} msg] $msg -} {1 {syntax error in expression "0 ? 1 : foo"}} +} {1 {syntax error in expression "0 ? 1 : foo": expected a parenthesis enclosing function arguments}} # Tcl_ExprBool as used in "if" statements @@ -646,13 +646,13 @@ test expr-old-31.1 {multiple arguments to expr command} { } 73 test expr-old-31.2 {multiple arguments to expr command} { list [catch {expr 2 + (3 + 4} msg] $msg -} {1 {syntax error in expression "2 + (3 + 4"}} +} {1 {syntax error in expression "2 + (3 + 4": looking for close parenthesis}} test expr-old-31.3 {multiple arguments to expr command} { list [catch {expr 2 + 3 +} msg] $msg -} {1 {syntax error in expression "2 + 3 +"}} +} {1 {syntax error in expression "2 + 3 +": premature end of expression}} test expr-old-31.4 {multiple arguments to expr command} { list [catch {expr 2 + 3 )} msg] $msg -} {1 {syntax error in expression "2 + 3 )"}} +} {1 {syntax error in expression "2 + 3 )": extra tokens at end of expression}} # Math functions @@ -850,19 +850,19 @@ test expr-old-34.1 {errors in math functions} { } {1 {unknown math function "func_2"}} test expr-old-34.2 {errors in math functions} { list [catch {expr func|(1.0)} msg] $msg -} {1 {syntax error in expression "func|(1.0)"}} +} {1 {syntax error in expression "func|(1.0)": expected a parenthesis enclosing function arguments}} test expr-old-34.3 {errors in math functions} { list [catch {expr {hypot("a b", 2.0)}} msg] $msg } {1 {argument to math function didn't have numeric value}} test expr-old-34.4 {errors in math functions} { list [catch {expr hypot(1.0 2.0)} msg] $msg -} {1 {syntax error in expression "hypot(1.0 2.0)"}} +} {1 {syntax error in expression "hypot(1.0 2.0)": missing close parenthesis at end of function call}} test expr-old-34.5 {errors in math functions} { list [catch {expr hypot(1.0, 2.0} msg] $msg -} {1 {syntax error in expression "hypot(1.0, 2.0"}} +} {1 {syntax error in expression "hypot(1.0, 2.0": missing close parenthesis at end of function call}} test expr-old-34.6 {errors in math functions} { list [catch {expr hypot(1.0 ,} msg] $msg -} {1 {syntax error in expression "hypot(1.0 ,"}} +} {1 {syntax error in expression "hypot(1.0 ,": premature end of expression}} test expr-old-34.7 {errors in math functions} { list [catch {expr hypot(1.0)} msg] $msg } {1 {too few arguments for math function}} @@ -950,7 +950,7 @@ if {[info commands testexprstring] == {}} { test expr-old-38.1 {Verify Tcl_ExprString's basic operation} { list [testexprstring "1+4"] [testexprstring "2*3+4.2"] \ [catch {testexprstring "1+"} msg] $msg -} {5 10.2 1 {syntax error in expression "1+"}} +} {5 10.2 1 {syntax error in expression "1+": premature end of expression}} } # Special test for Pentium arithmetic bug of 1994: @@ -965,15 +965,3 @@ if {(4195835.0 - (4195835.0/3145727.0)*3145727.0) == 256.0} { # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/expr.test b/tests/expr.test index b4487e3..2233e53 100644 --- a/tests/expr.test +++ b/tests/expr.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: expr.test,v 1.12 2001/04/09 09:48:41 dkf Exp $ +# RCS: @(#) $Id: expr.test,v 1.13 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -138,11 +138,11 @@ test expr-2.1 {TclCompileExpr: are builtin functions registered?} { test expr-2.2 {TclCompileExpr: error in expr} { catch {expr 2**3} msg set msg -} {syntax error in expression "2**3"} +} {syntax error in expression "2**3": unexpected operator} test expr-2.3 {TclCompileExpr: junk after legal expr} { catch {expr 7*[llength "a b"]foo} msg set msg -} {syntax error in expression "7*2foo"} +} {syntax error in expression "7*2foo": extra tokens at end of expression} test expr-2.4 {TclCompileExpr: numeric expr string rep == formatted int rep} { expr {0001} } 1 @@ -151,17 +151,17 @@ test expr-3.1 {CompileCondExpr: just lor expr} {expr 3||0} 1 test expr-3.2 {CompileCondExpr: error in lor expr} { catch {expr x||3} msg set msg -} {syntax error in expression "x||3"} +} {syntax error in expression "x||3": expected a parenthesis enclosing function arguments} test expr-3.3 {CompileCondExpr: test true arm} {expr 3>2?44:66} 44 test expr-3.4 {CompileCondExpr: error compiling true arm} { catch {expr 3>2?2**3:66} msg set msg -} {syntax error in expression "3>2?2**3:66"} +} {syntax error in expression "3>2?2**3:66": unexpected operator} test expr-3.5 {CompileCondExpr: test false arm} {expr 2>3?44:66} 66 test expr-3.6 {CompileCondExpr: error compiling false arm} { catch {expr 2>3?44:2**3} msg set msg -} {syntax error in expression "2>3?44:2**3"} +} {syntax error in expression "2>3?44:2**3": unexpected operator} test expr-3.7 {CompileCondExpr: long arms & nested cond exprs} {unixOnly nonPortable} { puts "Note: doing test expr-3.7 which can take several minutes to run" hello_world @@ -177,18 +177,18 @@ test expr-4.1 {CompileLorExpr: just land expr} {expr 1.3&&3.3} 1 test expr-4.2 {CompileLorExpr: error in land expr} { catch {expr x&&3} msg set msg -} {syntax error in expression "x&&3"} +} {syntax error in expression "x&&3": expected a parenthesis enclosing function arguments} test expr-4.3 {CompileLorExpr: simple lor exprs} {expr 0||1.0} 1 test expr-4.4 {CompileLorExpr: simple lor exprs} {expr 3.0||0.0} 1 test expr-4.5 {CompileLorExpr: simple lor exprs} {expr 0||0||1} 1 test expr-4.6 {CompileLorExpr: error compiling lor arm} { catch {expr 2**3||4.0} msg set msg -} {syntax error in expression "2**3||4.0"} +} {syntax error in expression "2**3||4.0": unexpected operator} test expr-4.7 {CompileLorExpr: error compiling lor arm} { catch {expr 1.3||2**3} msg set msg -} {syntax error in expression "1.3||2**3"} +} {syntax error in expression "1.3||2**3": unexpected operator} test expr-4.8 {CompileLorExpr: error compiling lor arms} { list [catch {expr {"a"||"b"}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -202,7 +202,7 @@ test expr-5.1 {CompileLandExpr: just bitor expr} {expr 7|0x13} 23 test expr-5.2 {CompileLandExpr: error in bitor expr} { catch {expr x|3} msg set msg -} {syntax error in expression "x|3"} +} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments} test expr-5.3 {CompileLandExpr: simple land exprs} {expr 0&&1.0} 0 test expr-5.4 {CompileLandExpr: simple land exprs} {expr 0&&0} 0 test expr-5.5 {CompileLandExpr: simple land exprs} {expr 3.0&&1.2} 1 @@ -210,11 +210,11 @@ test expr-5.6 {CompileLandExpr: simple land exprs} {expr 1&&1&&2} 1 test expr-5.7 {CompileLandExpr: error compiling land arm} { catch {expr 2**3&&4.0} msg set msg -} {syntax error in expression "2**3&&4.0"} +} {syntax error in expression "2**3&&4.0": unexpected operator} test expr-5.8 {CompileLandExpr: error compiling land arm} { catch {expr 1.3&&2**3} msg set msg -} {syntax error in expression "1.3&&2**3"} +} {syntax error in expression "1.3&&2**3": unexpected operator} test expr-5.9 {CompileLandExpr: error compiling land arm} { list [catch {expr {"a"&&"b"}} msg] $msg } {1 {expected boolean value but got "a"}} @@ -228,7 +228,7 @@ test expr-6.1 {CompileBitXorExpr: just bitand expr} {expr 7&0x13} 3 test expr-6.2 {CompileBitXorExpr: error in bitand expr} { catch {expr x|3} msg set msg -} {syntax error in expression "x|3"} +} {syntax error in expression "x|3": expected a parenthesis enclosing function arguments} test expr-6.3 {CompileBitXorExpr: simple bitxor exprs} {expr 7^0x13} 20 test expr-6.4 {CompileBitXorExpr: simple bitxor exprs} {expr 3^0x10} 19 test expr-6.5 {CompileBitXorExpr: simple bitxor exprs} {expr 0^7} 7 @@ -236,11 +236,11 @@ test expr-6.6 {CompileBitXorExpr: simple bitxor exprs} {expr -1^7} -8 test expr-6.7 {CompileBitXorExpr: error compiling bitxor arm} { catch {expr 2**3|6} msg set msg -} {syntax error in expression "2**3|6"} +} {syntax error in expression "2**3|6": unexpected operator} test expr-6.8 {CompileBitXorExpr: error compiling bitxor arm} { catch {expr 2^x} msg set msg -} {syntax error in expression "2^x"} +} {syntax error in expression "2^x": expected a parenthesis enclosing function arguments} test expr-6.9 {CompileBitXorExpr: runtime error in bitxor arm} { list [catch {expr {24.0^3}} msg] $msg } {1 {can't use floating-point value as operand of "^"}} @@ -255,7 +255,7 @@ test expr-7.4 {CompileBitAndExpr: just equality expr} {expr {"abc" == "abd"}} 0 test expr-7.5 {CompileBitAndExpr: error in equality expr} { catch {expr x==3} msg set msg -} {syntax error in expression "x==3"} +} {syntax error in expression "x==3": expected a parenthesis enclosing function arguments} test expr-7.6 {CompileBitAndExpr: simple bitand exprs} {expr 7&0x13} 3 test expr-7.7 {CompileBitAndExpr: simple bitand exprs} {expr 0xf2&0x53} 82 test expr-7.8 {CompileBitAndExpr: simple bitand exprs} {expr 3&6} 2 @@ -263,11 +263,11 @@ test expr-7.9 {CompileBitAndExpr: simple bitand exprs} {expr -1&-7} -7 test expr-7.10 {CompileBitAndExpr: error compiling bitand arm} { catch {expr 2**3&6} msg set msg -} {syntax error in expression "2**3&6"} +} {syntax error in expression "2**3&6": unexpected operator} test expr-7.11 {CompileBitAndExpr: error compiling bitand arm} { catch {expr 2&x} msg set msg -} {syntax error in expression "2&x"} +} {syntax error in expression "2&x": expected a parenthesis enclosing function arguments} test expr-7.12 {CompileBitAndExpr: runtime error in bitand arm} { list [catch {expr {24.0&3}} msg] $msg } {1 {can't use floating-point value as operand of "&"}} @@ -279,7 +279,7 @@ test expr-7.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0 test expr-7.20 {CompileBitAndExpr: error in equality expr} { catch {expr xne3} msg set msg -} {syntax error in expression "xne3"} +} {syntax error in expression "xne3": expected a parenthesis enclosing function arguments} test expr-8.1 {CompileEqualityExpr: just relational expr} {expr 3>=2} 1 test expr-8.2 {CompileEqualityExpr: just relational expr} {expr 2<=2.1} 1 @@ -288,7 +288,7 @@ test expr-8.4 {CompileEqualityExpr: just relational expr} {expr {"0y"<"0x12"}} 0 test expr-8.5 {CompileEqualityExpr: error in relational expr} { catch {expr x>3} msg set msg -} {syntax error in expression "x>3"} +} {syntax error in expression "x>3": expected a parenthesis enclosing function arguments} test expr-8.6 {CompileEqualityExpr: simple equality exprs} {expr 7==0x13} 0 test expr-8.7 {CompileEqualityExpr: simple equality exprs} {expr -0xf2!=0x53} 1 test expr-8.8 {CompileEqualityExpr: simple equality exprs} {expr {"12398712938788234-1298379" != ""}} 1 @@ -296,11 +296,11 @@ test expr-8.9 {CompileEqualityExpr: simple equality exprs} {expr -1!="abc"} 1 test expr-8.10 {CompileEqualityExpr: error compiling equality arm} { catch {expr 2**3==6} msg set msg -} {syntax error in expression "2**3==6"} +} {syntax error in expression "2**3==6": unexpected operator} test expr-8.11 {CompileEqualityExpr: error compiling equality arm} { catch {expr 2!=x} msg set msg -} {syntax error in expression "2!=x"} +} {syntax error in expression "2!=x": expected a parenthesis enclosing function arguments} test expr-8.14 {CompileBitAndExpr: equality expr} {expr {"a"eq"a"}} 1 test expr-8.14 {CompileBitAndExpr: equality expr} {expr {"\374" eq "ü"}} 1 test expr-8.14 {CompileBitAndExpr: equality expr} {expr 3eq2} 0 @@ -310,14 +310,14 @@ test expr-8.17 {CompileBitAndExpr: equality expr} {expr 01eq1} 0 test expr-8.18 {CompileBitAndExpr: equality expr} {expr {"abc" eq "abd"}} 0 test expr-8.19 {CompileBitAndExpr: equality expr} {expr {"abc" ne "abd"}} 1 test expr-8.20 {CompileBitAndExpr: error in equality expr} { - catch {expr xne3} msg + catch {expr x ne3} msg set msg -} {syntax error in expression "xne3"} -test expr-8.20 {CompileBitAndExpr: error in equality expr} { +} {syntax error in expression "x ne3": expected a parenthesis enclosing function arguments} +test expr-8.21 {CompileBitAndExpr: error in equality expr} { # These should be ""ed to avoid the error catch {expr a eq b} msg set msg -} {syntax error in expression "a eq b"} +} {syntax error in expression "a eq b": expected a parenthesis enclosing function arguments} test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12 test expr-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63 @@ -339,17 +339,17 @@ if {0x80000000 > 0} { test expr-9.6 {CompileRelationalExpr: error in shift expr} { catch {expr x>>3} msg set msg -} {syntax error in expression "x>>3"} +} {syntax error in expression "x>>3": expected a parenthesis enclosing function arguments} test expr-9.7 {CompileRelationalExpr: simple relational exprs} {expr 0xff>=+0x3} 1 test expr-9.8 {CompileRelationalExpr: simple relational exprs} {expr -0xf2<0x3} 1 test expr-9.9 {CompileRelationalExpr: error compiling relational arm} { catch {expr 2**3>6} msg set msg -} {syntax error in expression "2**3>6"} +} {syntax error in expression "2**3>6": unexpected operator} test expr-9.10 {CompileRelationalExpr: error compiling relational arm} { catch {expr 2>0x3} 31 test expr-10.7 {CompileShiftExpr: simple shift exprs} {expr -0xf2<<0x3} -1936 test expr-10.8 {CompileShiftExpr: error compiling shift arm} { catch {expr 2**3>>6} msg set msg -} {syntax error in expression "2**3>>6"} +} {syntax error in expression "2**3>>6": unexpected operator} test expr-10.9 {CompileShiftExpr: error compiling shift arm} { catch {expr 2<>43}} msg] $msg } {1 {can't use floating-point value as operand of ">>"}} @@ -383,17 +383,17 @@ test expr-11.4 {CompileAddExpr: just multiply expr} {expr 7891%0123} 6 test expr-11.5 {CompileAddExpr: error in multiply expr} { catch {expr x*3} msg set msg -} {syntax error in expression "x*3"} +} {syntax error in expression "x*3": expected a parenthesis enclosing function arguments} test expr-11.6 {CompileAddExpr: simple add exprs} {expr 0xff++0x3} 258 test expr-11.7 {CompileAddExpr: simple add exprs} {expr -0xf2--0x3} -239 test expr-11.8 {CompileAddExpr: error compiling add arm} { catch {expr 2**3+6} msg set msg -} {syntax error in expression "2**3+6"} +} {syntax error in expression "2**3+6": unexpected operator} test expr-11.9 {CompileAddExpr: error compiling add arm} { catch {expr 2-x} msg set msg -} {syntax error in expression "2-x"} +} {syntax error in expression "2-x": expected a parenthesis enclosing function arguments} test expr-11.10 {CompileAddExpr: runtime error} { list [catch {expr {24.0+"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "+"}} @@ -414,17 +414,17 @@ test expr-12.4 {CompileMultiplyExpr: just unary expr} {expr ~0xff00ff} -16711936 test expr-12.5 {CompileMultiplyExpr: error in unary expr} { catch {expr ~x} msg set msg -} {syntax error in expression "~x"} +} {syntax error in expression "~x": expected a parenthesis enclosing function arguments} test expr-12.6 {CompileMultiplyExpr: simple multiply exprs} {expr 0xff*0x3} 765 test expr-12.7 {CompileMultiplyExpr: simple multiply exprs} {expr -0xf2%-0x3} -2 test expr-12.8 {CompileMultiplyExpr: error compiling multiply arm} { catch {expr 2*3%%6} msg set msg -} {syntax error in expression "2*3%%6"} +} {syntax error in expression "2*3%%6": unexpected operator} test expr-12.9 {CompileMultiplyExpr: error compiling multiply arm} { catch {expr 2*x} msg set msg -} {syntax error in expression "2*x"} +} {syntax error in expression "2*x": expected a parenthesis enclosing function arguments} test expr-12.10 {CompileMultiplyExpr: runtime error} { list [catch {expr {24.0*"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "*"}} @@ -442,11 +442,11 @@ test expr-13.7 {CompileUnaryExpr: unary exprs} {expr !0xef} 0 test expr-13.8 {CompileUnaryExpr: error compiling unary expr} { catch {expr ~x} msg set msg -} {syntax error in expression "~x"} +} {syntax error in expression "~x": expected a parenthesis enclosing function arguments} test expr-13.9 {CompileUnaryExpr: error compiling unary expr} { catch {expr !1.x} msg set msg -} {syntax error in expression "!1.x"} +} {syntax error in expression "!1.x": extra tokens at end of expression} test expr-13.10 {CompileUnaryExpr: runtime error} { list [catch {expr {~"xx"}} msg] $msg } {1 {can't use non-numeric string as operand of "~"}} @@ -563,7 +563,7 @@ test expr-14.26 {CompilePrimaryExpr: math function primary} { test expr-14.27 {CompilePrimaryExpr: error in math function primary} { catch {expr sinh::(2.0)} msg set errorInfo -} {syntax error in expression "sinh::(2.0)" +} {syntax error in expression "sinh::(2.0)": expected a parenthesis enclosing function arguments while compiling "expr sinh::(2.0)"} test expr-14.28 {CompilePrimaryExpr: subexpression primary} { @@ -580,7 +580,7 @@ test expr-14.29 {CompilePrimaryExpr: error in subexpression primary} { test expr-14.30 {CompilePrimaryExpr: missing paren in subexpression primary} { catch {expr 2+(3*(4+5)} msg set errorInfo -} {syntax error in expression "2+(3*(4+5)" +} {syntax error in expression "2+(3*(4+5)": looking for close parenthesis while compiling "expr 2+(3*(4+5)"} test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} { @@ -590,14 +590,14 @@ test expr-14.31 {CompilePrimaryExpr: just var ref in subexpression primary} { test expr-14.32 {CompilePrimaryExpr: unexpected token} { catch {expr @} msg set errorInfo -} {syntax error in expression "@" +} {syntax error in expression "@": character not legal in expressions while compiling "expr @"} test expr-15.1 {CompileMathFuncCall: missing parenthesis} { catch {expr sinh2.0)} msg set errorInfo -} {syntax error in expression "sinh2.0)" +} {syntax error in expression "sinh2.0)": expected a parenthesis enclosing function arguments while compiling "expr sinh2.0)"} test expr-15.2 {CompileMathFuncCall: unknown math function} { @@ -627,7 +627,7 @@ test expr-15.5 {CompileMathFuncCall: too few arguments} { test expr-15.6 {CompileMathFuncCall: missing ')'} { catch {expr sin(1} msg set errorInfo -} {syntax error in expression "sin(1" +} {syntax error in expression "sin(1": missing close parenthesis at end of function call while compiling "expr sin(1"} if $gotT1 { @@ -733,7 +733,7 @@ test expr-20.2 {double invocation of variable traces} { list [catch {expr "$exprtracevar + 20"} a] $a \ [catch {expr "$exprtracevar + 20"} b] $b \ [unset exprtracevar exprtracecounter] -} {1 {syntax error in expression "1 oops 10 + 20"} 0 32 {}} +} {1 {syntax error in expression "1 oops 10 + 20": extra tokens at end of expression} 0 32 {}} test expr-20.3 {broken substitution of integer digits} { # fails with 8.0.x, but not 8.1b2 list [set a 000; expr 0x1$a] [set a 1; expr ${a}000] diff --git a/tests/for.test b/tests/for.test index 95ed356..95ba8d0 100644 --- a/tests/for.test +++ b/tests/for.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: for.test,v 1.7 2001/09/19 18:17:54 hobbs Exp $ +# RCS: @(#) $Id: for.test,v 1.8 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -668,7 +668,7 @@ test for-6.6 {Tcl_ForObjCmd: error in initial command} { test for-6.7 {Tcl_ForObjCmd: error in test expression} { set z for list [catch {$z {set i 0} {i < 5} {incr i} {body}} msg] $msg $errorInfo -} {1 {syntax error in expression "i < 5"} {syntax error in expression "i < 5" +} {1 {syntax error in expression "i < 5": expected a parenthesis enclosing function arguments} {syntax error in expression "i < 5": expected a parenthesis enclosing function arguments while executing "$z {set i 0} {i < 5} {incr i} {body}"}} test for-6.8 {Tcl_ForObjCmd: test expression is enclosed in quotes} { @@ -775,4 +775,3 @@ test for-6.16 {Tcl_ForObjCmd: for command result} { # cleanup ::tcltest::cleanupTests return - diff --git a/tests/if.test b/tests/if.test index 5cb269d..1c79ef2 100644 --- a/tests/if.test +++ b/tests/if.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: if.test,v 1.6 2001/09/19 18:17:54 hobbs Exp $ +# RCS: @(#) $Id: if.test,v 1.7 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -28,7 +28,7 @@ test if-1.2 {TclCompileIfCmd: error in if/elseif test} { } {1 {error in condition}} test if-1.3 {TclCompileIfCmd: error in if/elseif test} { list [catch {if {1+}} msg] $msg $errorInfo -} {1 {syntax error in expression "1+"} {syntax error in expression "1+" +} {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression ("if" test expression) while compiling "if {1+}"}} @@ -180,7 +180,7 @@ test if-2.3 {TclCompileIfCmd: missing expression after "elseif"} { test if-2.4 {TclCompileIfCmd: error in expression after "elseif"} { set a {} list [catch {if 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo -} {1 {syntax error in expression "1>"} {syntax error in expression "1>" +} {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression ("if" test expression) while compiling "if 3>4 {set a 1} elseif {1>}"}} @@ -512,7 +512,7 @@ test if-5.2 {if cmd with computed command names: error in if/elseif test} { test if-5.3 {if cmd with computed command names: error in if/elseif test} { set z if list [catch {$z {1+}} msg] $msg $errorInfo -} {1 {syntax error in expression "1+"} {syntax error in expression "1+" +} {1 {syntax error in expression "1+": premature end of expression} {syntax error in expression "1+": premature end of expression while executing "$z {1+}"}} test if-5.4 {if cmd with computed command names: if/elseif test in braces} { @@ -680,7 +680,7 @@ test if-6.4 {if cmd with computed command names: error in expression after "else set z if set a {} list [catch {$z 3>4 {set a 1} elseif {1>}} msg] $msg $errorInfo -} {1 {syntax error in expression "1>"} {syntax error in expression "1>" +} {1 {syntax error in expression "1>": premature end of expression} {syntax error in expression "1>": premature end of expression while executing "$z 3>4 {set a 1} elseif {1>}"}} test if-6.5 {if cmd with computed command names: test jumpFalse instruction replacement after long "elseif" body} { @@ -1108,20 +1108,8 @@ test if-10.6 {double invocation of variable traces} { list [catch {if "$iftracevar + 20" {}} a] $a \ [catch {if "$iftracevar + 20" {}} b] $b \ [unset iftracevar iftracecounter] -} {1 {syntax error in expression "1 oops 10 + 20"} 0 {} {}} +} {1 {syntax error in expression "1 oops 10 + 20": extra tokens at end of expression} 0 {} {}} # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/parseExpr.test b/tests/parseExpr.test index 8b2afbc..0f9fb7e 100644 --- a/tests/parseExpr.test +++ b/tests/parseExpr.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: parseExpr.test,v 1.5 2000/04/10 17:19:02 ericm Exp $ +# RCS: @(#) $Id: parseExpr.test,v 1.6 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -27,35 +27,40 @@ if {[info commands testexprparser] == {}} { return } +# Some tests only work if wide integers (>32bit) are not found to be +# integers at all. +set ::tcltest::testConstraints(wideIntegerUnparsed) \ + [expr {-1 == 0xffffffff}] + test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} { testexprparser [bytestring "1+2\0 +3"] -1 } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} { testexprparser "1 + 2" -1 } {- {} 0 subexpr {1 + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {nonPortable} { +test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {wideIntegerUnparsed} { list [catch {testexprparser {12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} { list [catch {testexprparser {foo+} -1} msg] $msg -} {1 {syntax error in expression "foo+"}} +} {1 {syntax error in expression "foo+": expected a parenthesis enclosing function arguments}} test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} { list [catch {testexprparser {1+2 345} -1} msg] $msg -} {1 {syntax error in expression "1+2 345"}} +} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}} test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} { testexprparser {2>3? 1 : 0} -1 } {- {} 0 subexpr {2>3? 1 : 0} 11 operator ? 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} { list [catch {testexprparser {0 || foo} -1} msg] $msg -} {1 {syntax error in expression "0 || foo"}} +} {1 {syntax error in expression "0 || foo": expected a parenthesis enclosing function arguments}} test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} { testexprparser {1+2} -1 } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} { testexprparser {1+2 ? 3 : 4} -1 } {- {} 0 subexpr {1+2 ? 3 : 4} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {nonPortable} { +test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {wideIntegerUnparsed} { list [catch {testexprparser {1+2 ? 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} { @@ -63,30 +68,30 @@ test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} { } {- {} 0 subexpr {1? 3 : 4} 7 operator ? 0 subexpr 1 1 text 1 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} { list [catch {testexprparser {1? fred : martha} -1} msg] $msg -} {1 {syntax error in expression "1? fred : martha"}} +} {1 {syntax error in expression "1? fred : martha": expected a parenthesis enclosing function arguments}} test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} { list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg -} {1 {syntax error in expression "1? 2 martha 3"}} +} {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}} test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} { testexprparser {27||3? 3 : 4&&9} -1 } {- {} 0 subexpr {27||3? 3 : 4&&9} 15 operator ? 0 subexpr 27||3 5 operator || 0 subexpr 27 1 text 27 0 subexpr 3 1 text 3 0 subexpr 3 1 text 3 0 subexpr 4&&9 5 operator && 0 subexpr 4 1 text 4 0 subexpr 9 1 text 9 0 {}} test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} { list [catch {testexprparser {1? 2 : martha} -1} msg] $msg -} {1 {syntax error in expression "1? 2 : martha"}} +} {1 {syntax error in expression "1? 2 : martha": expected a parenthesis enclosing function arguments}} test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} { testexprparser {1&&2 || 3} -1 } {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} { list [catch {testexprparser {1&&foo || 3} -1} msg] $msg -} {1 {syntax error in expression "1&&foo || 3"}} +} {1 {syntax error in expression "1&&foo || 3": expected a parenthesis enclosing function arguments}} test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} { testexprparser {1&&2? 1 : 0} -1 } {- {} 0 subexpr {1&&2? 1 : 0} 11 operator ? 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} { testexprparser {1&&2 || 3} -1 } {- {} 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {nonPortable} { +test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {wideIntegerUnparsed} { list [catch {testexprparser {1&&2 || 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} { @@ -94,21 +99,21 @@ test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} { } {- {} 0 subexpr {1&&2 || 3 || 4} 13 operator || 0 subexpr {1&&2 || 3} 9 operator || 0 subexpr 1&&2 5 operator && 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg -} {1 {syntax error in expression "1&&2 || 3 || martha"}} +} {1 {syntax error in expression "1&&2 || 3 || martha": expected a parenthesis enclosing function arguments}} test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} { testexprparser {1|2 && 3} -1 } {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} { list [catch {testexprparser {1&&foo && 3} -1} msg] $msg -} {1 {syntax error in expression "1&&foo && 3"}} +} {1 {syntax error in expression "1&&foo && 3": expected a parenthesis enclosing function arguments}} test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} { testexprparser {1|2? 1 : 0} -1 } {- {} 0 subexpr {1|2? 1 : 0} 11 operator ? 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} { testexprparser {1|2 && 3} -1 } {- {} 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {nonPortable} { +test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {wideIntegerUnparsed} { list [catch {testexprparser {1|2 && 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} { @@ -116,21 +121,21 @@ test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} { } {- {} 0 subexpr {1|2 && 3 && 4} 13 operator && 0 subexpr {1|2 && 3} 9 operator && 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg -} {1 {syntax error in expression "1|2 && 3 && martha"}} +} {1 {syntax error in expression "1|2 && 3 && martha": expected a parenthesis enclosing function arguments}} test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} { testexprparser {1^2 | 3} -1 } {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} { list [catch {testexprparser {1|foo | 3} -1} msg] $msg -} {1 {syntax error in expression "1|foo | 3"}} +} {1 {syntax error in expression "1|foo | 3": expected a parenthesis enclosing function arguments}} test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} { testexprparser {1^2? 1 : 0} -1 } {- {} 0 subexpr {1^2? 1 : 0} 11 operator ? 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} { testexprparser {1^2 | 3} -1 } {- {} 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {nonPortable} { +test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {wideIntegerUnparsed} { list [catch {testexprparser {1^2 | 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} { @@ -138,21 +143,21 @@ test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} { } {- {} 0 subexpr {1^2 | 3 | 4} 13 operator | 0 subexpr {1^2 | 3} 9 operator | 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg -} {1 {syntax error in expression "1^2 | 3 | martha"}} +} {1 {syntax error in expression "1^2 | 3 | martha": expected a parenthesis enclosing function arguments}} test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} { testexprparser {1&2 ^ 3} -1 } {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} { list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg -} {1 {syntax error in expression "1^foo ^ 3"}} +} {1 {syntax error in expression "1^foo ^ 3": expected a parenthesis enclosing function arguments}} test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} { testexprparser {1&2? 1 : 0} -1 } {- {} 0 subexpr {1&2? 1 : 0} 11 operator ? 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} { testexprparser {1&2 ^ 3} -1 } {- {} 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {nonPortable} { +test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {wideIntegerUnparsed} { list [catch {testexprparser {1&2 ^ 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} { @@ -160,21 +165,21 @@ test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} { } {- {} 0 subexpr {1&2 ^ 3 ^ 4} 13 operator ^ 0 subexpr {1&2 ^ 3} 9 operator ^ 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg -} {1 {syntax error in expression "1&2 ^ 3 ^ martha"}} +} {1 {syntax error in expression "1&2 ^ 3 ^ martha": expected a parenthesis enclosing function arguments}} test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} { testexprparser {1==2 & 3} -1 } {- {} 0 subexpr {1==2 & 3} 9 operator & 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} { list [catch {testexprparser {1!=foo & 3} -1} msg] $msg -} {1 {syntax error in expression "1!=foo & 3"}} +} {1 {syntax error in expression "1!=foo & 3": expected a parenthesis enclosing function arguments}} test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} { testexprparser {1==2? 1 : 0} -1 } {- {} 0 subexpr {1==2? 1 : 0} 11 operator ? 0 subexpr 1==2 5 operator == 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} { testexprparser {1>2 & 3} -1 } {- {} 0 subexpr {1>2 & 3} 9 operator & 0 subexpr 1>2 5 operator > 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {nonPortable} { +test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {wideIntegerUnparsed} { list [catch {testexprparser {1==2 & 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} { @@ -182,457 +187,454 @@ test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} { } {- {} 0 subexpr {1<2 & 3 & 4} 13 operator & 0 subexpr {1<2 & 3} 9 operator & 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg -} {1 {syntax error in expression "1==2 & 3>2 & martha"}} +} {1 {syntax error in expression "1==2 & 3>2 & martha": expected a parenthesis enclosing function arguments}} -test parseExpr-7.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} { +test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} { testexprparser {1<2 == 3} -1 } {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-7.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} { +test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} { list [catch {testexprparser {1>=foo == 3} -1} msg] $msg -} {1 {syntax error in expression "1>=foo == 3"}} -test parseExpr-7.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} { +} {1 {syntax error in expression "1>=foo == 3": expected a parenthesis enclosing function arguments}} +test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} { testexprparser {1<2? 1 : 0} -1 } {- {} 0 subexpr {1<2? 1 : 0} 11 operator ? 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-7.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!=} { +test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} { testexprparser {1<2 == 3} -1 } {- {} 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-7.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} { +test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} { testexprparser {1<2 != 3} -1 } {- {} 0 subexpr {1<2 != 3} 9 operator != 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-7.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {nonPortable} { +test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {wideIntegerUnparsed} { list [catch {testexprparser {1<2 == 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-7.7 {ParseEqualityExpr procedure, valid RHS subexpression} { +test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} { testexprparser {1<2 == 3 == 4} -1 } {- {} 0 subexpr {1<2 == 3 == 4} 13 operator == 0 subexpr {1<2 == 3} 9 operator == 0 subexpr 1<2 5 operator < 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-7.8 {ParseEqualityExpr procedure, error in RHS subexpression} { +test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg -} {1 {syntax error in expression "1<2 == 3 != martha"}} +} {1 {syntax error in expression "1<2 == 3 != martha": expected a parenthesis enclosing function arguments}} -test parseExpr-8.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} { +test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} { testexprparser {1<<2 < 3} -1 } {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-8.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} { +test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} { list [catch {testexprparser {1>=foo < 3} -1} msg] $msg -} {1 {syntax error in expression "1>=foo < 3"}} -test parseExpr-8.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} { +} {1 {syntax error in expression "1>=foo < 3": expected a parenthesis enclosing function arguments}} +test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} { testexprparser {1<<2? 1 : 0} -1 } {- {} 0 subexpr {1<<2? 1 : 0} 11 operator ? 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-8.4 {ParseRelationalExpr procedure, next lexeme is relational op} { +test parseExpr-9.4 {ParseRelationalExpr procedure, next lexeme is relational op} { testexprparser {1<<2 < 3} -1 } {- {} 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-8.5 {ParseRelationalExpr procedure, next lexeme is relational op} { +test parseExpr-9.5 {ParseRelationalExpr procedure, next lexeme is relational op} { testexprparser {1>>2 > 3} -1 } {- {} 0 subexpr {1>>2 > 3} 9 operator > 0 subexpr 1>>2 5 operator >> 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-8.6 {ParseRelationalExpr procedure, next lexeme is relational op} { +test parseExpr-9.6 {ParseRelationalExpr procedure, next lexeme is relational op} { testexprparser {1<<2 <= 3} -1 } {- {} 0 subexpr {1<<2 <= 3} 9 operator <= 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-8.7 {ParseRelationalExpr procedure, next lexeme is relational op} { +test parseExpr-9.7 {ParseRelationalExpr procedure, next lexeme is relational op} { testexprparser {1<<2 >= 3} -1 } {- {} 0 subexpr {1<<2 >= 3} 9 operator >= 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-8.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {nonPortable} { +test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {wideIntegerUnparsed} { list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-8.9 {ParseRelationalExpr procedure, valid RHS subexpression} { +test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} { testexprparser {1<<2 < 3 < 4} -1 } {- {} 0 subexpr {1<<2 < 3 < 4} 13 operator < 0 subexpr {1<<2 < 3} 9 operator < 0 subexpr 1<<2 5 operator << 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-8.8 {ParseRelationalExpr procedure, error in RHS subexpression} { +test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg -} {1 {syntax error in expression "1<<2 < 3 > martha"}} +} {1 {syntax error in expression "1<<2 < 3 > martha": expected a parenthesis enclosing function arguments}} -test parseExpr-9.1 {ParseShiftExpr procedure, valid LHS add subexpr} { +test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} { testexprparser {1+2 << 3} -1 } {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-9.2 {ParseShiftExpr procedure, error in LHS add subexpr} { +test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} { list [catch {testexprparser {1-foo << 3} -1} msg] $msg -} {1 {syntax error in expression "1-foo << 3"}} -test parseExpr-9.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} { +} {1 {syntax error in expression "1-foo << 3": expected a parenthesis enclosing function arguments}} +test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} { testexprparser {1+2? 1 : 0} -1 } {- {} 0 subexpr {1+2? 1 : 0} 11 operator ? 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-9.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>} { +test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} { testexprparser {1+2 << 3} -1 } {- {} 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-9.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} { +test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} { testexprparser {1+2 >> 3} -1 } {- {} 0 subexpr {1+2 >> 3} 9 operator >> 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-9.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {nonPortable} { +test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {wideIntegerUnparsed} { list [catch {testexprparser {1+2 << 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-9.7 {ParseShiftExpr procedure, valid RHS subexpression} { +test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} { testexprparser {1+2 << 3 << 4} -1 } {- {} 0 subexpr {1+2 << 3 << 4} 13 operator << 0 subexpr {1+2 << 3} 9 operator << 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-9.8 {ParseShiftExpr procedure, error in RHS subexpression} { +test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg -} {1 {syntax error in expression "1+2 << 3 >> martha"}} +} {1 {syntax error in expression "1+2 << 3 >> martha": expected a parenthesis enclosing function arguments}} -test parseExpr-10.1 {ParseAddExpr procedure, valid LHS multiply subexpr} { +test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} { testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.2 {ParseAddExpr procedure, error in LHS multiply subexpr} { +test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} { list [catch {testexprparser {1/foo + 3} -1} msg] $msg -} {1 {syntax error in expression "1/foo + 3"}} -test parseExpr-10.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} { +} {1 {syntax error in expression "1/foo + 3": expected a parenthesis enclosing function arguments}} +test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} { testexprparser {1*2? 1 : 0} -1 } {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-10.4 {ParseAddExpr procedure, next lexeme is "+" or "-} { +test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} { testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} { +test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} { testexprparser {1*2 - 3} -1 } {- {} 0 subexpr {1*2 - 3} 9 operator - 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {nonPortable} { +test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} { list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-10.7 {ParseAddExpr procedure, valid RHS subexpression} { +test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} { testexprparser {1*2 + 3 + 4} -1 } {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-10.8 {ParseAddExpr procedure, error in RHS subexpression} { +test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg -} {1 {syntax error in expression "1*2 + 3 - martha"}} +} {1 {syntax error in expression "1*2 + 3 - martha": expected a parenthesis enclosing function arguments}} -test parseExpr-10.1 {ParseAddExpr procedure, valid LHS multiply subexpr} { +test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} { testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.2 {ParseAddExpr procedure, error in LHS multiply subexpr} { +test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} { list [catch {testexprparser {1/foo + 3} -1} msg] $msg -} {1 {syntax error in expression "1/foo + 3"}} -test parseExpr-10.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} { +} {1 {syntax error in expression "1/foo + 3": expected a parenthesis enclosing function arguments}} +test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} { testexprparser {1*2? 1 : 0} -1 } {- {} 0 subexpr {1*2? 1 : 0} 11 operator ? 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-10.4 {ParseAddExpr procedure, next lexeme is "+" or "-} { +test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} { testexprparser {1*2 + 3} -1 } {- {} 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} { +test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} { testexprparser {1*2 - 3} -1 } {- {} 0 subexpr {1*2 - 3} 9 operator - 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-10.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {nonPortable} { +test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} { list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-10.7 {ParseAddExpr procedure, valid RHS subexpression} { +test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} { testexprparser {1*2 + 3 + 4} -1 } {- {} 0 subexpr {1*2 + 3 + 4} 13 operator + 0 subexpr {1*2 + 3} 9 operator + 0 subexpr 1*2 5 operator * 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-10.8 {ParseAddExpr procedure, error in RHS subexpression} { +test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} { list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg -} {1 {syntax error in expression "1*2 + 3 - martha"}} +} {1 {syntax error in expression "1*2 + 3 - martha": expected a parenthesis enclosing function arguments}} -test parseExpr-11.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} { +test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} { testexprparser {+2 * 3} -1 } {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-11.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {nonPortable} { +test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {wideIntegerUnparsed} { list [catch {testexprparser {-12345678901234567890 * 3} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-11.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} { +test parseExpr-13.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} { testexprparser {+2? 1 : 0} -1 } {- {} 0 subexpr {+2? 1 : 0} 9 operator ? 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-11.4 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { +test parseExpr-13.4 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { testexprparser {-123 * 3} -1 } {- {} 0 subexpr {-123 * 3} 7 operator * 0 subexpr -123 3 operator - 0 subexpr 123 1 text 123 0 subexpr 3 1 text 3 0 {}} -test parseExpr-11.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { +test parseExpr-13.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { testexprparser {+-456 / 3} -1 } {- {} 0 subexpr {+-456 / 3} 9 operator / 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}} -test parseExpr-11.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { +test parseExpr-13.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} { testexprparser {+-456 % 3} -1 } {- {} 0 subexpr {+-456 % 3} 9 operator % 0 subexpr +-456 5 operator + 0 subexpr -456 3 operator - 0 subexpr 456 1 text 456 0 subexpr 3 1 text 3 0 {}} -test parseExpr-11.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {nonPortable} { +test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {wideIntegerUnparsed} { list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-11.8 {ParseMultiplyExpr procedure, valid RHS subexpression} { +test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} { testexprparser {-2 / 3 % 4} -1 } {- {} 0 subexpr {-2 / 3 % 4} 11 operator % 0 subexpr {-2 / 3} 7 operator / 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 subexpr 4 1 text 4 0 {}} -test parseExpr-11.9 {ParseMultiplyExpr procedure, error in RHS subexpression} { +test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} { list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg -} {1 {syntax error in expression "++2 / 3 * martha"}} +} {1 {syntax error in expression "++2 / 3 * martha": expected a parenthesis enclosing function arguments}} -test parseExpr-12.1 {ParseUnaryExpr procedure, first token is unary operator} { +test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} { testexprparser {+2} -1 } {- {} 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 {}} -test parseExpr-12.2 {ParseUnaryExpr procedure, first token is unary operator} { +test parseExpr-14.2 {ParseUnaryExpr procedure, first token is unary operator} { testexprparser {-2} -1 } {- {} 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 {}} -test parseExpr-12.3 {ParseUnaryExpr procedure, first token is unary operator} { +test parseExpr-14.3 {ParseUnaryExpr procedure, first token is unary operator} { testexprparser {~2} -1 } {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}} -test parseExpr-12.4 {ParseUnaryExpr procedure, first token is unary operator} { +test parseExpr-14.4 {ParseUnaryExpr procedure, first token is unary operator} { testexprparser {!2} -1 } {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}} -test parseExpr-12.5 {ParseUnaryExpr procedure, error in lexeme after unary op} {nonPortable} { +test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} {wideIntegerUnparsed} { list [catch {testexprparser {-12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-12.6 {ParseUnaryExpr procedure, simple unary expr after unary op} { +test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} { testexprparser {+"1234"} -1 } {- {} 0 subexpr +\"1234\" 3 operator + 0 subexpr {"1234"} 1 text 1234 0 {}} -test parseExpr-12.7 {ParseUnaryExpr procedure, another unary expr after unary op} { +test parseExpr-14.7 {ParseUnaryExpr procedure, another unary expr after unary op} { testexprparser {~!{fred}} -1 } {- {} 0 subexpr ~!{fred} 5 operator ~ 0 subexpr !{fred} 3 operator ! 0 subexpr {{fred}} 1 text fred 0 {}} -test parseExpr-12.8 {ParseUnaryExpr procedure, error in unary expr after unary op} { +test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} { list [catch {testexprparser {+-||27} -1} msg] $msg -} {1 {syntax error in expression "+-||27"}} -test parseExpr-12.9 {ParseUnaryExpr procedure, error in unary expr after unary op} { +} {1 {syntax error in expression "+-||27": unexpected operator}} +test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} { list [catch {testexprparser {+-||27} -1} msg] $msg -} {1 {syntax error in expression "+-||27"}} -test parseExpr-12.10 {ParseUnaryExpr procedure, first token is not unary op} { +} {1 {syntax error in expression "+-||27": unexpected operator}} +test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} { testexprparser {123} -1 } {- {} 0 subexpr 123 1 text 123 0 {}} -test parseExpr-12.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} { +test parseExpr-14.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} { testexprparser {(1+2)} -1 } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-12.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} {nonPortable} { +test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} {wideIntegerUnparsed} { list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-13.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} { +test parseExpr-15.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} { testexprparser {({abc}/{def})} -1 } {- {} 0 subexpr {{abc}/{def}} 5 operator / 0 subexpr {{abc}} 1 text abc 0 subexpr {{def}} 1 text def 0 {}} -test parseExpr-13.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {nonPortable} { +test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} { list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-13.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} { +test parseExpr-15.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} { testexprparser {({abc}? 2*4 : -6)} -1 } {- {} 0 subexpr {{abc}? 2*4 : -6} 13 operator ? 0 subexpr {{abc}} 1 text abc 0 subexpr 2*4 5 operator * 0 subexpr 2 1 text 2 0 subexpr 4 1 text 4 0 subexpr -6 3 operator - 0 subexpr 6 1 text 6 0 {}} -test parseExpr-13.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} { +test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} { list [catch {testexprparser {(? 123 : 456)} -1} msg] $msg -} {1 {syntax error in expression "(? 123 : 456)"}} -test parseExpr-13.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} { +} {1 {syntax error in expression "(? 123 : 456)": unexpected ternary 'then' separator}} +test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} { list [catch {testexprparser {({abc}/{def}} -1} msg] $msg -} {1 {syntax error in expression "({abc}/{def}"}} -test parseExpr-13.6 {ParsePrimaryExpr procedure, primary is literal} { +} {1 {syntax error in expression "({abc}/{def}": looking for close parenthesis}} +test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} { testexprparser {12345} -1 } {- {} 0 subexpr 12345 1 text 12345 0 {}} -test parseExpr-13.7 {ParsePrimaryExpr procedure, primary is literal} { +test parseExpr-15.7 {ParsePrimaryExpr procedure, primary is literal} { testexprparser {12345.6789} -1 } {- {} 0 subexpr 12345.6789 1 text 12345.6789 0 {}} -test parseExpr-13.8 {ParsePrimaryExpr procedure, primary is var reference} { +test parseExpr-15.8 {ParsePrimaryExpr procedure, primary is var reference} { testexprparser {$a} -1 } {- {} 0 subexpr {$a} 2 variable {$a} 1 text a 0 {}} -test parseExpr-13.9 {ParsePrimaryExpr procedure, primary is var reference} { +test parseExpr-15.9 {ParsePrimaryExpr procedure, primary is var reference} { testexprparser {$a(hello$there)} -1 } {- {} 0 subexpr {$a(hello$there)} 5 variable {$a(hello$there)} 4 text a 0 text hello 0 variable {$there} 1 text there 0 {}} -test parseExpr-13.10 {ParsePrimaryExpr procedure, primary is var reference} { +test parseExpr-15.10 {ParsePrimaryExpr procedure, primary is var reference} { testexprparser {$a()} -1 } {- {} 0 subexpr {$a()} 3 variable {$a()} 2 text a 0 text {} 0 {}} -test parseExpr-13.11 {ParsePrimaryExpr procedure, error in var reference} { +test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} { list [catch {testexprparser {$a(} -1} msg] $msg } {1 {missing )}} -test parseExpr-13.12 {ParsePrimaryExpr procedure, primary is quoted string} { +test parseExpr-15.12 {ParsePrimaryExpr procedure, primary is quoted string} { testexprparser {"abc $xyz def"} -1 } {- {} 0 subexpr {"abc $xyz def"} 5 word {"abc $xyz def"} 4 text {abc } 0 variable {$xyz} 1 text xyz 0 text { def} 0 {}} -test parseExpr-13.13 {ParsePrimaryExpr procedure, error in quoted string} { +test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} { list [catch {testexprparser {"$a(12"} -1} msg] $msg } {1 {missing )}} -test parseExpr-13.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} { +test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} { testexprparser {"abc [xyz] $def"} -1 } {- {} 0 subexpr {"abc [xyz] $def"} 6 word {"abc [xyz] $def"} 5 text {abc } 0 command {[xyz]} 0 text { } 0 variable {$def} 1 text def 0 {}} -test parseExpr-13.15 {ParsePrimaryExpr procedure, primary is command} { +test parseExpr-15.15 {ParsePrimaryExpr procedure, primary is command} { testexprparser {[def]} -1 } {- {} 0 subexpr {[def]} 1 command {[def]} 0 {}} -test parseExpr-13.16 {ParsePrimaryExpr procedure, primary is multiple commands} { +test parseExpr-15.16 {ParsePrimaryExpr procedure, primary is multiple commands} { testexprparser {[one; two; three; four;]} -1 } {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}} -test parseExpr-13.17 {ParsePrimaryExpr procedure, primary is multiple commands} { +test parseExpr-15.17 {ParsePrimaryExpr procedure, primary is multiple commands} { testexprparser {[one; two; three; four;]} -1 } {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}} -test parseExpr-13.18 {ParsePrimaryExpr procedure, missing close bracket} { +test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} { list [catch {testexprparser {[one} -1} msg] $msg } {1 {missing close-bracket}} -test parseExpr-13.19 {ParsePrimaryExpr procedure, primary is braced string} { +test parseExpr-15.19 {ParsePrimaryExpr procedure, primary is braced string} { testexprparser {{hello world}} -1 } {- {} 0 subexpr {{hello world}} 1 text {hello world} 0 {}} -test parseExpr-13.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} { +test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} { list [catch {testexprparser "\{abc\\\n" -1} msg] $msg } {1 {missing close-brace}} -test parseExpr-13.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} { +test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} { testexprparser "\{ \\ +123 \}" -1 } {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text { } 0 backslash \\\n\ 0 text {+123 } 0 {}} -test parseExpr-13.22 {ParsePrimaryExpr procedure, primary is function call} { +test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} { testexprparser {foo(123)} -1 } {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}} -test parseExpr-13.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {nonPortable} { +test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {wideIntegerUnparsed} { list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-13.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} { +test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} { list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg -} {1 {syntax error in expression "foo 27.4 123)"}} -test parseExpr-13.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {nonPortable} { +} {1 {syntax error in expression "foo 27.4 123)": expected a parenthesis enclosing function arguments}} +test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} { list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-13.26 {ParsePrimaryExpr procedure, function call, one arg} { +test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} { testexprparser {foo(27*4)} -1 } {- {} 0 subexpr foo(27*4) 7 operator foo 0 subexpr 27*4 5 operator * 0 subexpr 27 1 text 27 0 subexpr 4 1 text 4 0 {}} -test parseExpr-13.27 {ParsePrimaryExpr procedure, error in function arg} { +test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} { list [catch {testexprparser {foo(*1-2)} -1} msg] $msg -} {1 {syntax error in expression "foo(*1-2)"}} -test parseExpr-13.28 {ParsePrimaryExpr procedure, error in function arg} { +} {1 {syntax error in expression "foo(*1-2)": unexpected operator}} +test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} { list [catch {testexprparser {foo(*1-2)} -1} msg] $msg -} {1 {syntax error in expression "foo(*1-2)"}} -test parseExpr-13.29 {ParsePrimaryExpr procedure, function call, comma after arg} { +} {1 {syntax error in expression "foo(*1-2)": unexpected operator}} +test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} { testexprparser {foo(27-2, (-2*[foo]))} -1 } {- {} 0 subexpr {foo(27-2, (-2*[foo]))} 15 operator foo 0 subexpr 27-2 5 operator - 0 subexpr 27 1 text 27 0 subexpr 2 1 text 2 0 subexpr {-2*[foo]} 7 operator * 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 subexpr {[foo]} 1 command {[foo]} 0 {}} -test parseExpr-13.30 {ParsePrimaryExpr procedure, bad lexeme after comma} {nonPortable} { +test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} {wideIntegerUnparsed} { list [catch {testexprparser {foo(123, 12345678901234567890)} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-13.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} { +test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} { list [catch {testexprparser {foo(123 [foo])} -1} msg] $msg -} {1 {syntax error in expression "foo(123 [foo])"}} -test parseExpr-13.32 {ParsePrimaryExpr procedure, bad lexeme after primary} {nonPortable} { +} {1 {syntax error in expression "foo(123 [foo])": missing close parenthesis at end of function call}} +test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} {wideIntegerUnparsed} { list [catch {testexprparser {123 12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} - -test parseExpr-14.1 {GetLexeme procedure, whitespace before lexeme} { +test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} { + list [catch {testexprparser {123+,456} -1} msg] $msg +} {1 {syntax error in expression "123+,456": commas can only separate function arguments}} +test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} { + list [catch {testexprparser {123+=456} -1} msg] $msg +} {1 {syntax error in expression "123+=456": single equality character not legal in expressions}} +test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} { + list [catch {testexprparser {(: 123 : 456)} -1} msg] $msg +} {1 {syntax error in expression "(: 123 : 456)": unexpected ternary 'else' separator}} + +test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} { testexprparser { 123} -1 } {- {} 0 subexpr 123 1 text 123 0 {}} -test parseExpr-14.2 {GetLexeme procedure, whitespace before lexeme} { +test parseExpr-16.2 {GetLexeme procedure, whitespace before lexeme} { testexprparser { \ 456} -1 } {- {} 0 subexpr 456 1 text 456 0 {}} -test parseExpr-14.3 {GetLexeme procedure, no lexeme after whitespace} { +test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} { testexprparser { 123 \ } -1 } {- {} 0 subexpr 123 1 text 123 0 {}} -test parseExpr-14.4 {GetLexeme procedure, integer lexeme} { +test parseExpr-16.4 {GetLexeme procedure, integer lexeme} { testexprparser {000} -1 } {- {} 0 subexpr 000 1 text 000 0 {}} -test parseExpr-14.5 {GetLexeme procedure, integer lexeme too big} {nonPortable} { +test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} {wideIntegerUnparsed} { list [catch {testexprparser {12345678901234567890} -1} msg] $msg } {1 {integer value too large to represent}} -test parseExpr-14.6 {GetLexeme procedure, bad integer lexeme} { +test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} { list [catch {testexprparser {0999} -1} msg] $msg } {1 {"0999" is an invalid octal number}} -test parseExpr-14.7 {GetLexeme procedure, double lexeme} { +test parseExpr-16.7 {GetLexeme procedure, double lexeme} { testexprparser {0.999} -1 } {- {} 0 subexpr 0.999 1 text 0.999 0 {}} -test parseExpr-14.8 {GetLexeme procedure, double lexeme} { +test parseExpr-16.8 {GetLexeme procedure, double lexeme} { testexprparser {.123} -1 } {- {} 0 subexpr .123 1 text .123 0 {}} -test parseExpr-14.9 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} { +test parseExpr-16.9 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} { testexprparser {nan} -1 } {- {} 0 subexpr nan 1 text nan 0 {}} -test parseExpr-14.10 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} { +test parseExpr-16.10 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} { testexprparser {NaN} -1 } {- {} 0 subexpr NaN 1 text NaN 0 {}} -test parseExpr-14.11 {GetLexeme procedure, bad double lexeme too big} { +test parseExpr-16.11 {GetLexeme procedure, bad double lexeme too big} { list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg } {1 {floating-point value too large to represent}} -test parseExpr-14.12 {GetLexeme procedure, bad double lexeme} { +test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} { list [catch {testexprparser {123.4x56} -1} msg] $msg -} {1 {syntax error in expression "123.4x56"}} -test parseExpr-14.13 {GetLexeme procedure, lexeme is "["} { +} {1 {syntax error in expression "123.4x56": extra tokens at end of expression}} +test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} { testexprparser {[foo]} -1 } {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}} -test parseExpr-14.14 {GetLexeme procedure, lexeme is open brace} { +test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} { testexprparser {{bar}} -1 } {- {} 0 subexpr {{bar}} 1 text bar 0 {}} -test parseExpr-14.15 {GetLexeme procedure, lexeme is "("} { +test parseExpr-16.15 {GetLexeme procedure, lexeme is "("} { testexprparser {(123)} -1 } {- {} 0 subexpr 123 1 text 123 0 {}} -test parseExpr-14.16 {GetLexeme procedure, lexeme is ")"} { +test parseExpr-16.16 {GetLexeme procedure, lexeme is ")"} { testexprparser {(2*3)} -1 } {- {} 0 subexpr 2*3 5 operator * 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.17 {GetLexeme procedure, lexeme is "$"} { +test parseExpr-16.17 {GetLexeme procedure, lexeme is "$"} { testexprparser {$wombat} -1 } {- {} 0 subexpr {$wombat} 2 variable {$wombat} 1 text wombat 0 {}} -test parseExpr-14.18 {GetLexeme procedure, lexeme is '"'} { +test parseExpr-16.18 "GetLexeme procedure, lexeme is '\"'" { testexprparser {"fred"} -1 } {- {} 0 subexpr {"fred"} 1 text fred 0 {}} -test parseExpr-14.19 {GetLexeme procedure, lexeme is ","} { +test parseExpr-16.19 {GetLexeme procedure, lexeme is ","} { testexprparser {foo(1,2)} -1 } {- {} 0 subexpr foo(1,2) 5 operator foo 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.20 {GetLexeme procedure, lexeme is "*"} { +test parseExpr-16.20 {GetLexeme procedure, lexeme is "*"} { testexprparser {$a*$b} -1 } {- {} 0 subexpr {$a*$b} 7 operator * 0 subexpr {$a} 2 variable {$a} 1 text a 0 subexpr {$b} 2 variable {$b} 1 text b 0 {}} -test parseExpr-14.21 {GetLexeme procedure, lexeme is "/"} { +test parseExpr-16.21 {GetLexeme procedure, lexeme is "/"} { testexprparser {5/6} -1 } {- {} 0 subexpr 5/6 5 operator / 0 subexpr 5 1 text 5 0 subexpr 6 1 text 6 0 {}} -test parseExpr-14.22 {GetLexeme procedure, lexeme is "%"} { +test parseExpr-16.22 {GetLexeme procedure, lexeme is "%"} { testexprparser {5%[xxx]} -1 } {- {} 0 subexpr {5%[xxx]} 5 operator % 0 subexpr 5 1 text 5 0 subexpr {[xxx]} 1 command {[xxx]} 0 {}} -test parseExpr-14.23 {GetLexeme procedure, lexeme is "+"} { +test parseExpr-16.23 {GetLexeme procedure, lexeme is "+"} { testexprparser {1+2} -1 } {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.24 {GetLexeme procedure, lexeme is "-"} { +test parseExpr-16.24 {GetLexeme procedure, lexeme is "-"} { testexprparser {.12-0e27} -1 } {- {} 0 subexpr .12-0e27 5 operator - 0 subexpr .12 1 text .12 0 subexpr 0e27 1 text 0e27 0 {}} -test parseExpr-14.25 {GetLexeme procedure, lexeme is "?" or ":"} { +test parseExpr-16.25 {GetLexeme procedure, lexeme is "?" or ":"} { testexprparser {$b? 1 : 0} -1 } {- {} 0 subexpr {$b? 1 : 0} 8 operator ? 0 subexpr {$b} 2 variable {$b} 1 text b 0 subexpr 1 1 text 1 0 subexpr 0 1 text 0 0 {}} -test parseExpr-14.26 {GetLexeme procedure, lexeme is "<"} { +test parseExpr-16.26 {GetLexeme procedure, lexeme is "<"} { testexprparser {2<3} -1 } {- {} 0 subexpr 2<3 5 operator < 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.27 {GetLexeme procedure, lexeme is "<<"} { +test parseExpr-16.27 {GetLexeme procedure, lexeme is "<<"} { testexprparser {2<<3} -1 } {- {} 0 subexpr 2<<3 5 operator << 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.28 {GetLexeme procedure, lexeme is "<="} { +test parseExpr-16.28 {GetLexeme procedure, lexeme is "<="} { testexprparser {2<=3} -1 } {- {} 0 subexpr 2<=3 5 operator <= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.29 {GetLexeme procedure, lexeme is ">"} { +test parseExpr-16.29 {GetLexeme procedure, lexeme is ">"} { testexprparser {2>3} -1 } {- {} 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.30 {GetLexeme procedure, lexeme is ">>"} { +test parseExpr-16.30 {GetLexeme procedure, lexeme is ">>"} { testexprparser {2>>3} -1 } {- {} 0 subexpr 2>>3 5 operator >> 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.31 {GetLexeme procedure, lexeme is ">="} { +test parseExpr-16.31 {GetLexeme procedure, lexeme is ">="} { testexprparser {2>=3} -1 } {- {} 0 subexpr 2>=3 5 operator >= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.32 {GetLexeme procedure, lexeme is "=="} { +test parseExpr-16.32 {GetLexeme procedure, lexeme is "=="} { testexprparser {2==3} -1 } {- {} 0 subexpr 2==3 5 operator == 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.33 {GetLexeme procedure, bad lexeme starting with "="} { +test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} { list [catch {testexprparser {2=+3} -1} msg] $msg -} {1 {syntax error in expression "2=+3"}} -test parseExpr-14.34 {GetLexeme procedure, lexeme is "!="} { +} {1 {syntax error in expression "2=+3": extra tokens at end of expression}} +test parseExpr-16.34 {GetLexeme procedure, lexeme is "!="} { testexprparser {2!=3} -1 } {- {} 0 subexpr 2!=3 5 operator != 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.35 {GetLexeme procedure, lexeme is "!"} { +test parseExpr-16.35 {GetLexeme procedure, lexeme is "!"} { testexprparser {!2} -1 } {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.36 {GetLexeme procedure, lexeme is "&&"} { +test parseExpr-16.36 {GetLexeme procedure, lexeme is "&&"} { testexprparser {2&&3} -1 } {- {} 0 subexpr 2&&3 5 operator && 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.37 {GetLexeme procedure, lexeme is "&"} { +test parseExpr-16.37 {GetLexeme procedure, lexeme is "&"} { testexprparser {1&2} -1 } {- {} 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.38 {GetLexeme procedure, lexeme is "^"} { +test parseExpr-16.38 {GetLexeme procedure, lexeme is "^"} { testexprparser {1^2} -1 } {- {} 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.39 {GetLexeme procedure, lexeme is "||"} { +test parseExpr-16.39 {GetLexeme procedure, lexeme is "||"} { testexprparser {2||3} -1 } {- {} 0 subexpr 2||3 5 operator || 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.40 {GetLexeme procedure, lexeme is "|"} { +test parseExpr-16.40 {GetLexeme procedure, lexeme is "|"} { testexprparser {1|2} -1 } {- {} 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.41 {GetLexeme procedure, lexeme is "~"} { +test parseExpr-16.41 {GetLexeme procedure, lexeme is "~"} { testexprparser {~2} -1 } {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}} -test parseExpr-14.42 {GetLexeme procedure, lexeme is func name} { +test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} { testexprparser {george()} -1 } {- {} 0 subexpr george() 1 operator george 0 {}} -test parseExpr-14.43 {GetLexeme procedure, lexeme is func name} { +test parseExpr-16.43 {GetLexeme procedure, lexeme is func name} { testexprparser {harmonic_ratio(2,3)} -1 } {- {} 0 subexpr harmonic_ratio(2,3) 5 operator harmonic_ratio 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}} -test parseExpr-14.44 {GetLexeme procedure, unknown lexeme} { +test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} { list [catch {testexprparser {@27} -1} msg] $msg -} {1 {syntax error in expression "@27"}} +} {1 {syntax error in expression "@27": character not legal in expressions}} -test parseExpr-15.1 {PrependSubExprTokens procedure, expand token array} { +test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} { testexprparser {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} -1 } {- {} 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 13 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 9 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]&&[string compare [format %c $i] [string index $a $i]]} 5 operator && 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 subexpr {[string compare [format %c $i] [string index $a $i]]} 1 command {[string compare [format %c $i] [string index $a $i]]} 0 {}} -test parse-16.1 {LogSyntaxError procedure, error in expr longer than 60 chars} { +test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} { list [catch {testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1} msg] $msg -} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012"}} +} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": premature end of expression}} # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - diff --git a/tests/while.test b/tests/while.test index b10afdc..2fb396f 100644 --- a/tests/while.test +++ b/tests/while.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: while.test,v 1.7 2001/09/19 18:17:54 hobbs Exp $ +# RCS: @(#) $Id: while.test,v 1.8 2001/12/04 15:36:29 dkf Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -30,7 +30,7 @@ test while-1.2 {TclCompileWhileCmd: error in test expression} { set i 0 catch {while {$i<} break} msg set errorInfo -} {syntax error in expression "$i<" +} {syntax error in expression "$i<": premature end of expression ("while" test expression) while compiling "while {$i<} break"} @@ -310,7 +310,7 @@ test while-4.3 {while (not compiled): error in test expression} { set z while catch {$z {$i<} {set x 1}} msg set errorInfo -} {syntax error in expression "$i<" +} {syntax error in expression "$i<": premature end of expression while executing "$z {$i<} {set x 1}"} test while-4.4 {while (not compiled): error in test expression} { @@ -627,15 +627,3 @@ test while-7.1 {delayed substitution of body} { # cleanup ::tcltest::cleanupTests return - - - - - - - - - - - - -- cgit v0.12