os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/parseExpr.test
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/tests/parseExpr.test	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,653 @@
     1.4 +# This file contains a collection of tests for the procedures in the
     1.5 +# file tclParseExpr.c.  Sourcing this file into Tcl runs the tests and
     1.6 +# generates output for errors.  No output means no errors were found.
     1.7 +#
     1.8 +# Copyright (c) 1997 Sun Microsystems, Inc.
     1.9 +# Copyright (c) 1998-1999 by Scriptics Corporation.
    1.10 +#
    1.11 +# See the file "license.terms" for information on usage and redistribution
    1.12 +# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    1.13 +#
    1.14 +# RCS: @(#) $Id: parseExpr.test,v 1.10.2.1 2003/10/06 13:55:39 dgp Exp $
    1.15 +
    1.16 +if {[lsearch [namespace children] ::tcltest] == -1} {
    1.17 +    package require tcltest 2
    1.18 +    namespace import -force ::tcltest::*
    1.19 +}
    1.20 +
    1.21 +# Note that the Tcl expression parser (tclParseExpr.c) does not check
    1.22 +# the semantic validity of the expressions it parses. It does not check,
    1.23 +# for example, that a math function actually exists, or that the operands
    1.24 +# of "<<" are integers.
    1.25 +
    1.26 +if {[info commands testexprparser] == {}} {
    1.27 +    puts "This application hasn't been compiled with the \"testexprparser\""
    1.28 +    puts "command, so I can't test the Tcl expression parser."
    1.29 +    ::tcltest::cleanupTests
    1.30 +    return 
    1.31 +}
    1.32 +
    1.33 +# Some tests only work if wide integers (>32bit) are not found to be
    1.34 +# integers at all.
    1.35 +set ::tcltest::testConstraints(wideIntegerUnparsed) \
    1.36 +	[expr {-1 == 0xffffffff}]
    1.37 +
    1.38 +test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} {
    1.39 +    testexprparser [bytestring "1+2\0 +3"] -1
    1.40 +} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
    1.41 +test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} {
    1.42 +    testexprparser "1  + 2" -1
    1.43 +} {- {} 0 subexpr {1  + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
    1.44 +test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {wideIntegerUnparsed} {
    1.45 +    list [catch {testexprparser {12345678901234567890} -1} msg] $msg
    1.46 +} {1 {integer value too large to represent}}
    1.47 +test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} {
    1.48 +    list [catch {testexprparser {foo+} -1} msg] $msg
    1.49 +} {1 {syntax error in expression "foo+": variable references require preceding $}}
    1.50 +test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} {
    1.51 +    list [catch {testexprparser {1+2 345} -1} msg] $msg
    1.52 +} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}}
    1.53 +
    1.54 +test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} {
    1.55 +    testexprparser {2>3? 1 : 0} -1
    1.56 +} {- {} 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 {}}
    1.57 +test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} {
    1.58 +    list [catch {testexprparser {0 || foo} -1} msg] $msg
    1.59 +} {1 {syntax error in expression "0 || foo": variable references require preceding $}}
    1.60 +test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} {
    1.61 +    testexprparser {1+2} -1
    1.62 +} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
    1.63 +test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} {
    1.64 +    testexprparser {1+2 ? 3 : 4} -1
    1.65 +} {- {} 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 {}}
    1.66 +test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {wideIntegerUnparsed} {
    1.67 +    list [catch {testexprparser {1+2 ? 12345678901234567890} -1} msg] $msg
    1.68 +} {1 {integer value too large to represent}}
    1.69 +test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} {
    1.70 +    testexprparser {1? 3 : 4} -1
    1.71 +} {- {} 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 {}}
    1.72 +test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} {
    1.73 +    list [catch {testexprparser {1? fred : martha} -1} msg] $msg
    1.74 +} {1 {syntax error in expression "1? fred : martha": variable references require preceding $}}
    1.75 +test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} {
    1.76 +    list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg
    1.77 +} {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}}
    1.78 +test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} {
    1.79 +    testexprparser {27||3? 3 : 4&&9} -1
    1.80 +} {- {} 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 {}}
    1.81 +test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} {
    1.82 +    list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
    1.83 +} {1 {syntax error in expression "1? 2 : martha": variable references require preceding $}}
    1.84 +
    1.85 +test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} {
    1.86 +    testexprparser {1&&2 || 3} -1
    1.87 +} {- {} 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 {}}
    1.88 +test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} {
    1.89 +    list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
    1.90 +} {1 {syntax error in expression "1&&foo || 3": variable references require preceding $}}
    1.91 +test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} {
    1.92 +    testexprparser {1&&2? 1 : 0} -1
    1.93 +} {- {} 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 {}}
    1.94 +test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} {
    1.95 +    testexprparser {1&&2 || 3} -1
    1.96 +} {- {} 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 {}}
    1.97 +test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {wideIntegerUnparsed} {
    1.98 +    list [catch {testexprparser {1&&2 || 12345678901234567890} -1} msg] $msg
    1.99 +} {1 {integer value too large to represent}}
   1.100 +test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} {
   1.101 +    testexprparser {1&&2 || 3 || 4} -1
   1.102 +} {- {} 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 {}}
   1.103 +test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} {
   1.104 +    list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg
   1.105 +} {1 {syntax error in expression "1&&2 || 3 || martha": variable references require preceding $}}
   1.106 +
   1.107 +test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} {
   1.108 +    testexprparser {1|2 && 3} -1
   1.109 +} {- {} 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 {}}
   1.110 +test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} {
   1.111 +    list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
   1.112 +} {1 {syntax error in expression "1&&foo && 3": variable references require preceding $}}
   1.113 +test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} {
   1.114 +    testexprparser {1|2? 1 : 0} -1
   1.115 +} {- {} 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 {}}
   1.116 +test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} {
   1.117 +    testexprparser {1|2 && 3} -1
   1.118 +} {- {} 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 {}}
   1.119 +test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {wideIntegerUnparsed} {
   1.120 +    list [catch {testexprparser {1|2 && 12345678901234567890} -1} msg] $msg
   1.121 +} {1 {integer value too large to represent}}
   1.122 +test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} {
   1.123 +    testexprparser {1|2 && 3 && 4} -1
   1.124 +} {- {} 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 {}}
   1.125 +test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} {
   1.126 +    list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg
   1.127 +} {1 {syntax error in expression "1|2 && 3 && martha": variable references require preceding $}}
   1.128 +
   1.129 +test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} {
   1.130 +    testexprparser {1^2 | 3} -1
   1.131 +} {- {} 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 {}}
   1.132 +test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} {
   1.133 +    list [catch {testexprparser {1|foo | 3} -1} msg] $msg
   1.134 +} {1 {syntax error in expression "1|foo | 3": variable references require preceding $}}
   1.135 +test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} {
   1.136 +    testexprparser {1^2? 1 : 0} -1
   1.137 +} {- {} 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 {}}
   1.138 +test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} {
   1.139 +    testexprparser {1^2 | 3} -1
   1.140 +} {- {} 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 {}}
   1.141 +test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {wideIntegerUnparsed} {
   1.142 +    list [catch {testexprparser {1^2 | 12345678901234567890} -1} msg] $msg
   1.143 +} {1 {integer value too large to represent}}
   1.144 +test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} {
   1.145 +    testexprparser {1^2 | 3 | 4} -1
   1.146 +} {- {} 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 {}}
   1.147 +test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} {
   1.148 +    list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg
   1.149 +} {1 {syntax error in expression "1^2 | 3 | martha": variable references require preceding $}}
   1.150 +
   1.151 +test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} {
   1.152 +    testexprparser {1&2 ^ 3} -1
   1.153 +} {- {} 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 {}}
   1.154 +test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} {
   1.155 +    list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
   1.156 +} {1 {syntax error in expression "1^foo ^ 3": variable references require preceding $}}
   1.157 +test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} {
   1.158 +    testexprparser {1&2? 1 : 0} -1
   1.159 +} {- {} 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 {}}
   1.160 +test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} {
   1.161 +    testexprparser {1&2 ^ 3} -1
   1.162 +} {- {} 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 {}}
   1.163 +test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {wideIntegerUnparsed} {
   1.164 +    list [catch {testexprparser {1&2 ^ 12345678901234567890} -1} msg] $msg
   1.165 +} {1 {integer value too large to represent}}
   1.166 +test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} {
   1.167 +    testexprparser {1&2 ^ 3 ^ 4} -1
   1.168 +} {- {} 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 {}}
   1.169 +test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} {
   1.170 +    list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg
   1.171 +} {1 {syntax error in expression "1&2 ^ 3 ^ martha": variable references require preceding $}}
   1.172 +
   1.173 +test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} {
   1.174 +    testexprparser {1==2 & 3} -1
   1.175 +} {- {} 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 {}}
   1.176 +test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} {
   1.177 +    list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
   1.178 +} {1 {syntax error in expression "1!=foo & 3": variable references require preceding $}}
   1.179 +test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} {
   1.180 +    testexprparser {1==2? 1 : 0} -1
   1.181 +} {- {} 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 {}}
   1.182 +test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} {
   1.183 +    testexprparser {1>2 & 3} -1
   1.184 +} {- {} 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 {}}
   1.185 +test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {wideIntegerUnparsed} {
   1.186 +    list [catch {testexprparser {1==2 & 12345678901234567890} -1} msg] $msg
   1.187 +} {1 {integer value too large to represent}}
   1.188 +test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} {
   1.189 +    testexprparser {1<2 & 3 & 4} -1
   1.190 +} {- {} 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 {}}
   1.191 +test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} {
   1.192 +    list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg
   1.193 +} {1 {syntax error in expression "1==2 & 3>2 & martha": variable references require preceding $}}
   1.194 +
   1.195 +test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} {
   1.196 +    testexprparser {1<2 == 3} -1
   1.197 +} {- {} 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 {}}
   1.198 +test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} {
   1.199 +    list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
   1.200 +} {1 {syntax error in expression "1>=foo == 3": variable references require preceding $}}
   1.201 +test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} {
   1.202 +    testexprparser {1<2? 1 : 0} -1
   1.203 +} {- {} 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 {}}
   1.204 +test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} {
   1.205 +    testexprparser {1<2 == 3} -1
   1.206 +} {- {} 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 {}}
   1.207 +test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} {
   1.208 +    testexprparser {1<2 != 3} -1
   1.209 +} {- {} 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 {}}
   1.210 +test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {wideIntegerUnparsed} {
   1.211 +    list [catch {testexprparser {1<2 == 12345678901234567890} -1} msg] $msg
   1.212 +} {1 {integer value too large to represent}}
   1.213 +test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} {
   1.214 +    testexprparser {1<2 == 3 == 4} -1
   1.215 +} {- {} 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 {}}
   1.216 +test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} {
   1.217 +    list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg
   1.218 +} {1 {syntax error in expression "1<2 == 3 != martha": variable references require preceding $}}
   1.219 +
   1.220 +test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} {
   1.221 +    testexprparser {1<<2 < 3} -1
   1.222 +} {- {} 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 {}}
   1.223 +test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} {
   1.224 +    list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
   1.225 +} {1 {syntax error in expression "1>=foo < 3": variable references require preceding $}}
   1.226 +test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} {
   1.227 +    testexprparser {1<<2? 1 : 0} -1
   1.228 +} {- {} 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 {}}
   1.229 +test parseExpr-9.4 {ParseRelationalExpr procedure, next lexeme is relational op} {
   1.230 +    testexprparser {1<<2 < 3} -1
   1.231 +} {- {} 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 {}}
   1.232 +test parseExpr-9.5 {ParseRelationalExpr procedure, next lexeme is relational op} {
   1.233 +    testexprparser {1>>2 > 3} -1
   1.234 +} {- {} 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 {}}
   1.235 +test parseExpr-9.6 {ParseRelationalExpr procedure, next lexeme is relational op} {
   1.236 +    testexprparser {1<<2 <= 3} -1
   1.237 +} {- {} 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 {}}
   1.238 +test parseExpr-9.7 {ParseRelationalExpr procedure, next lexeme is relational op} {
   1.239 +    testexprparser {1<<2 >= 3} -1
   1.240 +} {- {} 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 {}}
   1.241 +test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {wideIntegerUnparsed} {
   1.242 +    list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg
   1.243 +} {1 {integer value too large to represent}}
   1.244 +test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} {
   1.245 +    testexprparser {1<<2 < 3 < 4} -1
   1.246 +} {- {} 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 {}}
   1.247 +test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} {
   1.248 +    list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg
   1.249 +} {1 {syntax error in expression "1<<2 < 3 > martha": variable references require preceding $}}
   1.250 +
   1.251 +test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} {
   1.252 +    testexprparser {1+2 << 3} -1
   1.253 +} {- {} 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 {}}
   1.254 +test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} {
   1.255 +    list [catch {testexprparser {1-foo << 3} -1} msg] $msg
   1.256 +} {1 {syntax error in expression "1-foo << 3": variable references require preceding $}}
   1.257 +test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} {
   1.258 +    testexprparser {1+2? 1 : 0} -1
   1.259 +} {- {} 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 {}}
   1.260 +test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} {
   1.261 +    testexprparser {1+2 << 3} -1
   1.262 +} {- {} 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 {}}
   1.263 +test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} {
   1.264 +    testexprparser {1+2 >> 3} -1
   1.265 +} {- {} 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 {}}
   1.266 +test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {wideIntegerUnparsed} {
   1.267 +    list [catch {testexprparser {1+2 << 12345678901234567890} -1} msg] $msg
   1.268 +} {1 {integer value too large to represent}}
   1.269 +test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} {
   1.270 +    testexprparser {1+2 << 3 << 4} -1
   1.271 +} {- {} 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 {}}
   1.272 +test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} {
   1.273 +    list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg
   1.274 +} {1 {syntax error in expression "1+2 << 3 >> martha": variable references require preceding $}}
   1.275 +
   1.276 +test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} {
   1.277 +    testexprparser {1*2 + 3} -1
   1.278 +} {- {} 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 {}}
   1.279 +test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} {
   1.280 +    list [catch {testexprparser {1/foo + 3} -1} msg] $msg
   1.281 +} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
   1.282 +test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} {
   1.283 +    testexprparser {1*2? 1 : 0} -1
   1.284 +} {- {} 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 {}}
   1.285 +test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
   1.286 +    testexprparser {1*2 + 3} -1
   1.287 +} {- {} 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 {}}
   1.288 +test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
   1.289 +    testexprparser {1*2 - 3} -1
   1.290 +} {- {} 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 {}}
   1.291 +test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} {
   1.292 +    list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
   1.293 +} {1 {integer value too large to represent}}
   1.294 +test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} {
   1.295 +    testexprparser {1*2 + 3 + 4} -1
   1.296 +} {- {} 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 {}}
   1.297 +test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} {
   1.298 +    list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
   1.299 +} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
   1.300 +
   1.301 +test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} {
   1.302 +    testexprparser {1*2 + 3} -1
   1.303 +} {- {} 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 {}}
   1.304 +test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} {
   1.305 +    list [catch {testexprparser {1/foo + 3} -1} msg] $msg
   1.306 +} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
   1.307 +test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} {
   1.308 +    testexprparser {1*2? 1 : 0} -1
   1.309 +} {- {} 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 {}}
   1.310 +test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
   1.311 +    testexprparser {1*2 + 3} -1
   1.312 +} {- {} 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 {}}
   1.313 +test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
   1.314 +    testexprparser {1*2 - 3} -1
   1.315 +} {- {} 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 {}}
   1.316 +test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} {
   1.317 +    list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
   1.318 +} {1 {integer value too large to represent}}
   1.319 +test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} {
   1.320 +    testexprparser {1*2 + 3 + 4} -1
   1.321 +} {- {} 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 {}}
   1.322 +test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} {
   1.323 +    list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
   1.324 +} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
   1.325 +
   1.326 +test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} {
   1.327 +    testexprparser {+2 * 3} -1
   1.328 +} {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.329 +test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {wideIntegerUnparsed} {
   1.330 +    list [catch {testexprparser {-12345678901234567890 * 3} -1} msg] $msg
   1.331 +} {1 {integer value too large to represent}}
   1.332 +test parseExpr-13.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} {
   1.333 +    testexprparser {+2? 1 : 0} -1
   1.334 +} {- {} 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 {}}
   1.335 +test parseExpr-13.4 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
   1.336 +    testexprparser {-123 * 3} -1
   1.337 +} {- {} 0 subexpr {-123 * 3} 7 operator * 0 subexpr -123 3 operator - 0 subexpr 123 1 text 123 0 subexpr 3 1 text 3 0 {}}
   1.338 +test parseExpr-13.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
   1.339 +    testexprparser {+-456 / 3} -1
   1.340 +} {- {} 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 {}}
   1.341 +test parseExpr-13.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
   1.342 +    testexprparser {+-456 % 3} -1
   1.343 +} {- {} 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 {}}
   1.344 +test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {wideIntegerUnparsed} {
   1.345 +    list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg
   1.346 +} {1 {integer value too large to represent}}
   1.347 +test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} {
   1.348 +    testexprparser {-2 / 3 % 4} -1
   1.349 +} {- {} 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 {}}
   1.350 +test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} {
   1.351 +    list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
   1.352 +} {1 {syntax error in expression "++2 / 3 * martha": variable references require preceding $}}
   1.353 +
   1.354 +test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} {
   1.355 +    testexprparser {+2} -1
   1.356 +} {- {} 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 {}}
   1.357 +test parseExpr-14.2 {ParseUnaryExpr procedure, first token is unary operator} {
   1.358 +    testexprparser {-2} -1
   1.359 +} {- {} 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 {}}
   1.360 +test parseExpr-14.3 {ParseUnaryExpr procedure, first token is unary operator} {
   1.361 +    testexprparser {~2} -1
   1.362 +} {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}}
   1.363 +test parseExpr-14.4 {ParseUnaryExpr procedure, first token is unary operator} {
   1.364 +    testexprparser {!2} -1
   1.365 +} {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}}
   1.366 +test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} {wideIntegerUnparsed} {
   1.367 +    list [catch {testexprparser {-12345678901234567890} -1} msg] $msg
   1.368 +} {1 {integer value too large to represent}}
   1.369 +test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} {
   1.370 +    testexprparser {+"1234"} -1
   1.371 +} {- {} 0 subexpr +\"1234\" 3 operator + 0 subexpr {"1234"} 1 text 1234 0 {}}
   1.372 +test parseExpr-14.7 {ParseUnaryExpr procedure, another unary expr after unary op} {
   1.373 +    testexprparser {~!{fred}} -1
   1.374 +} {- {} 0 subexpr ~!{fred} 5 operator ~ 0 subexpr !{fred} 3 operator ! 0 subexpr {{fred}} 1 text fred 0 {}}
   1.375 +test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} {
   1.376 +    list [catch {testexprparser {+-||27} -1} msg] $msg
   1.377 +} {1 {syntax error in expression "+-||27": unexpected operator ||}}
   1.378 +test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} {
   1.379 +    list [catch {testexprparser {+-||27} -1} msg] $msg
   1.380 +} {1 {syntax error in expression "+-||27": unexpected operator ||}}
   1.381 +test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} {
   1.382 +    testexprparser {123} -1
   1.383 +} {- {} 0 subexpr 123 1 text 123 0 {}}
   1.384 +test parseExpr-14.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} {
   1.385 +    testexprparser {(1+2)} -1
   1.386 +} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.387 +test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} {wideIntegerUnparsed} {
   1.388 +    list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
   1.389 +} {1 {integer value too large to represent}}
   1.390 +
   1.391 +test parseExpr-15.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} {
   1.392 +    testexprparser {({abc}/{def})} -1
   1.393 +} {- {} 0 subexpr {{abc}/{def}} 5 operator / 0 subexpr {{abc}} 1 text abc 0 subexpr {{def}} 1 text def 0 {}}
   1.394 +test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} {
   1.395 +    list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
   1.396 +} {1 {integer value too large to represent}}
   1.397 +test parseExpr-15.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} {
   1.398 +    testexprparser {({abc}? 2*4 : -6)} -1
   1.399 +} {- {} 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 {}}
   1.400 +test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {
   1.401 +    list [catch {testexprparser {(? 123 : 456)} -1} msg] $msg
   1.402 +} {1 {syntax error in expression "(? 123 : 456)": unexpected ternary 'then' separator}}
   1.403 +test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} {
   1.404 +    list [catch {testexprparser {({abc}/{def}} -1} msg] $msg
   1.405 +} {1 {syntax error in expression "({abc}/{def}": looking for close parenthesis}}
   1.406 +test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} {
   1.407 +    testexprparser {12345} -1
   1.408 +} {- {} 0 subexpr 12345 1 text 12345 0 {}}
   1.409 +test parseExpr-15.7 {ParsePrimaryExpr procedure, primary is literal} {
   1.410 +    testexprparser {12345.6789} -1
   1.411 +} {- {} 0 subexpr 12345.6789 1 text 12345.6789 0 {}}
   1.412 +test parseExpr-15.8 {ParsePrimaryExpr procedure, primary is var reference} {
   1.413 +    testexprparser {$a} -1
   1.414 +} {- {} 0 subexpr {$a} 2 variable {$a} 1 text a 0 {}}
   1.415 +test parseExpr-15.9 {ParsePrimaryExpr procedure, primary is var reference} {
   1.416 +    testexprparser {$a(hello$there)} -1
   1.417 +} {- {} 0 subexpr {$a(hello$there)} 5 variable {$a(hello$there)} 4 text a 0 text hello 0 variable {$there} 1 text there 0 {}}
   1.418 +test parseExpr-15.10 {ParsePrimaryExpr procedure, primary is var reference} {
   1.419 +    testexprparser {$a()} -1
   1.420 +} {- {} 0 subexpr {$a()} 3 variable {$a()} 2 text a 0 text {} 0 {}}
   1.421 +test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} {
   1.422 +    list [catch {testexprparser {$a(} -1} msg] $msg
   1.423 +} {1 {missing )}}
   1.424 +test parseExpr-15.12 {ParsePrimaryExpr procedure, primary is quoted string} {
   1.425 +    testexprparser {"abc $xyz def"} -1
   1.426 +} {- {} 0 subexpr {"abc $xyz def"} 5 word {"abc $xyz def"} 4 text {abc } 0 variable {$xyz} 1 text xyz 0 text { def} 0 {}}
   1.427 +test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} {
   1.428 +    list [catch {testexprparser {"$a(12"} -1} msg] $msg
   1.429 +} {1 {missing )}}
   1.430 +test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} {
   1.431 +    testexprparser {"abc [xyz] $def"} -1
   1.432 +} {- {} 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 {}}
   1.433 +test parseExpr-15.15 {ParsePrimaryExpr procedure, primary is command} {
   1.434 +    testexprparser {[def]} -1
   1.435 +} {- {} 0 subexpr {[def]} 1 command {[def]} 0 {}}
   1.436 +test parseExpr-15.16 {ParsePrimaryExpr procedure, primary is multiple commands} {
   1.437 +    testexprparser {[one; two; three; four;]} -1
   1.438 +} {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}}
   1.439 +test parseExpr-15.17 {ParsePrimaryExpr procedure, primary is multiple commands} {
   1.440 +    testexprparser {[one; two; three; four;]} -1
   1.441 +} {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}}
   1.442 +test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} {
   1.443 +    list [catch {testexprparser {[one} -1} msg] $msg
   1.444 +} {1 {missing close-bracket}}
   1.445 +test parseExpr-15.19 {ParsePrimaryExpr procedure, primary is braced string} {
   1.446 +    testexprparser {{hello world}} -1
   1.447 +} {- {} 0 subexpr {{hello world}} 1 text {hello world} 0 {}}
   1.448 +test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} {
   1.449 +    list [catch {testexprparser "\{abc\\\n" -1} msg] $msg
   1.450 +} {1 {missing close-brace}}
   1.451 +test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} {
   1.452 +    testexprparser "\{  \\
   1.453 + +123 \}" -1
   1.454 +} {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text {  } 0 backslash \\\n\  0 text {+123 } 0 {}}
   1.455 +test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} {
   1.456 +    testexprparser {foo(123)} -1
   1.457 +} {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}}
   1.458 +test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {wideIntegerUnparsed} {
   1.459 +    list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
   1.460 +} {1 {integer value too large to represent}}
   1.461 +test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} {
   1.462 +    list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg
   1.463 +} {1 {syntax error in expression "foo 27.4 123)": variable references require preceding $}}
   1.464 +test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} {
   1.465 +    list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg
   1.466 +} {1 {integer value too large to represent}}
   1.467 +test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} {
   1.468 +    testexprparser {foo(27*4)} -1
   1.469 +} {- {} 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 {}}
   1.470 +test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} {
   1.471 +    list [catch {testexprparser {foo(*1-2)} -1} msg] $msg
   1.472 +} {1 {syntax error in expression "foo(*1-2)": unexpected operator *}}
   1.473 +test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} {
   1.474 +    list [catch {testexprparser {foo(*1-2)} -1} msg] $msg
   1.475 +} {1 {syntax error in expression "foo(*1-2)": unexpected operator *}}
   1.476 +test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} {
   1.477 +    testexprparser {foo(27-2, (-2*[foo]))} -1
   1.478 +} {- {} 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 {}}
   1.479 +test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} {wideIntegerUnparsed} {
   1.480 +    list [catch {testexprparser {foo(123, 12345678901234567890)} -1} msg] $msg
   1.481 +} {1 {integer value too large to represent}}
   1.482 +test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} {
   1.483 +    list [catch {testexprparser {foo(123 [foo])} -1} msg] $msg
   1.484 +} {1 {syntax error in expression "foo(123 [foo])": missing close parenthesis at end of function call}}
   1.485 +test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} {wideIntegerUnparsed} {
   1.486 +    list [catch {testexprparser {123 12345678901234567890} -1} msg] $msg
   1.487 +} {1 {integer value too large to represent}}
   1.488 +test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} {
   1.489 +    list [catch {testexprparser {123+,456} -1} msg] $msg
   1.490 +} {1 {syntax error in expression "123+,456": commas can only separate function arguments}}
   1.491 +test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} {
   1.492 +    list [catch {testexprparser {123+=456} -1} msg] $msg
   1.493 +} {1 {syntax error in expression "123+=456": single equality character not legal in expressions}}
   1.494 +test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {
   1.495 +    list [catch {testexprparser {(: 123 : 456)} -1} msg] $msg
   1.496 +} {1 {syntax error in expression "(: 123 : 456)": unexpected ternary 'else' separator}}
   1.497 +test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} {
   1.498 +    # Test for Bug 681841
   1.499 +    list [catch {testexprparser {[set a [format bc]} -1} msg] $msg
   1.500 +} {1 {missing close-bracket}}
   1.501 +
   1.502 +test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} {
   1.503 +    testexprparser {   123} -1
   1.504 +} {- {} 0 subexpr 123 1 text 123 0 {}}
   1.505 +test parseExpr-16.2 {GetLexeme procedure, whitespace before lexeme} {
   1.506 +    testexprparser {  \
   1.507 +456} -1
   1.508 +} {- {} 0 subexpr 456 1 text 456 0 {}}
   1.509 +test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} {
   1.510 +    testexprparser { 123 \
   1.511 +   } -1
   1.512 +} {- {} 0 subexpr 123 1 text 123 0 {}}
   1.513 +test parseExpr-16.4 {GetLexeme procedure, integer lexeme} {
   1.514 +    testexprparser {000} -1
   1.515 +} {- {} 0 subexpr 000 1 text 000 0 {}}
   1.516 +test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} {wideIntegerUnparsed} {
   1.517 +    list [catch {testexprparser {12345678901234567890} -1} msg] $msg
   1.518 +} {1 {integer value too large to represent}}
   1.519 +
   1.520 +test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -body {
   1.521 +    testexprparser {0999} -1
   1.522 +} -returnCodes error -match glob -result {*invalid octal number*}
   1.523 +
   1.524 +test parseExpr-16.7 {GetLexeme procedure, double lexeme} {
   1.525 +    testexprparser {0.999} -1
   1.526 +} {- {} 0 subexpr 0.999 1 text 0.999 0 {}}
   1.527 +test parseExpr-16.8 {GetLexeme procedure, double lexeme} {
   1.528 +    testexprparser {.123} -1
   1.529 +} {- {} 0 subexpr .123 1 text .123 0 {}}
   1.530 +test parseExpr-16.9 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} {
   1.531 +    testexprparser {nan} -1
   1.532 +} {- {} 0 subexpr nan 1 text nan 0 {}}
   1.533 +test parseExpr-16.10 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} {
   1.534 +    testexprparser {NaN} -1
   1.535 +} {- {} 0 subexpr NaN 1 text NaN 0 {}}
   1.536 +test parseExpr-16.11 {GetLexeme procedure, bad double lexeme too big} {
   1.537 +    list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
   1.538 +} {1 {floating-point value too large to represent}}
   1.539 +test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} {
   1.540 +    list [catch {testexprparser {123.4x56} -1} msg] $msg
   1.541 +} {1 {syntax error in expression "123.4x56": extra tokens at end of expression}}
   1.542 +test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} {
   1.543 +    testexprparser {[foo]} -1
   1.544 +} {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
   1.545 +test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} {
   1.546 +    testexprparser {{bar}} -1
   1.547 +} {- {} 0 subexpr {{bar}} 1 text bar 0 {}}
   1.548 +test parseExpr-16.15 {GetLexeme procedure, lexeme is "("} {
   1.549 +    testexprparser {(123)} -1
   1.550 +} {- {} 0 subexpr 123 1 text 123 0 {}}
   1.551 +test parseExpr-16.16 {GetLexeme procedure, lexeme is ")"} {
   1.552 +    testexprparser {(2*3)} -1
   1.553 +} {- {} 0 subexpr 2*3 5 operator * 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.554 +test parseExpr-16.17 {GetLexeme procedure, lexeme is "$"} {
   1.555 +    testexprparser {$wombat} -1
   1.556 +} {- {} 0 subexpr {$wombat} 2 variable {$wombat} 1 text wombat 0 {}}
   1.557 +test parseExpr-16.18 "GetLexeme procedure, lexeme is '\"'" {
   1.558 +    testexprparser {"fred"} -1
   1.559 +} {- {} 0 subexpr {"fred"} 1 text fred 0 {}}
   1.560 +test parseExpr-16.19 {GetLexeme procedure, lexeme is ","} {
   1.561 +    testexprparser {foo(1,2)} -1
   1.562 +} {- {} 0 subexpr foo(1,2) 5 operator foo 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.563 +test parseExpr-16.20 {GetLexeme procedure, lexeme is "*"} {
   1.564 +    testexprparser {$a*$b} -1
   1.565 +} {- {} 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 {}}
   1.566 +test parseExpr-16.21 {GetLexeme procedure, lexeme is "/"} {
   1.567 +    testexprparser {5/6} -1
   1.568 +} {- {} 0 subexpr 5/6 5 operator / 0 subexpr 5 1 text 5 0 subexpr 6 1 text 6 0 {}}
   1.569 +test parseExpr-16.22 {GetLexeme procedure, lexeme is "%"} {
   1.570 +    testexprparser {5%[xxx]} -1
   1.571 +} {- {} 0 subexpr {5%[xxx]} 5 operator % 0 subexpr 5 1 text 5 0 subexpr {[xxx]} 1 command {[xxx]} 0 {}}
   1.572 +test parseExpr-16.23 {GetLexeme procedure, lexeme is "+"} {
   1.573 +    testexprparser {1+2} -1
   1.574 +} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.575 +test parseExpr-16.24 {GetLexeme procedure, lexeme is "-"} {
   1.576 +    testexprparser {.12-0e27} -1
   1.577 +} {- {} 0 subexpr .12-0e27 5 operator - 0 subexpr .12 1 text .12 0 subexpr 0e27 1 text 0e27 0 {}}
   1.578 +test parseExpr-16.25 {GetLexeme procedure, lexeme is "?" or ":"} {
   1.579 +    testexprparser {$b? 1 : 0} -1
   1.580 +} {- {} 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 {}}
   1.581 +test parseExpr-16.26 {GetLexeme procedure, lexeme is "<"} {
   1.582 +    testexprparser {2<3} -1
   1.583 +} {- {} 0 subexpr 2<3 5 operator < 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.584 +test parseExpr-16.27 {GetLexeme procedure, lexeme is "<<"} {
   1.585 +    testexprparser {2<<3} -1
   1.586 +} {- {} 0 subexpr 2<<3 5 operator << 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.587 +test parseExpr-16.28 {GetLexeme procedure, lexeme is "<="} {
   1.588 +    testexprparser {2<=3} -1
   1.589 +} {- {} 0 subexpr 2<=3 5 operator <= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.590 +test parseExpr-16.29 {GetLexeme procedure, lexeme is ">"} {
   1.591 +    testexprparser {2>3} -1
   1.592 +} {- {} 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.593 +test parseExpr-16.30 {GetLexeme procedure, lexeme is ">>"} {
   1.594 +    testexprparser {2>>3} -1
   1.595 +} {- {} 0 subexpr 2>>3 5 operator >> 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.596 +test parseExpr-16.31 {GetLexeme procedure, lexeme is ">="} {
   1.597 +    testexprparser {2>=3} -1
   1.598 +} {- {} 0 subexpr 2>=3 5 operator >= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.599 +test parseExpr-16.32 {GetLexeme procedure, lexeme is "=="} {
   1.600 +    testexprparser {2==3} -1
   1.601 +} {- {} 0 subexpr 2==3 5 operator == 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.602 +test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} {
   1.603 +    list [catch {testexprparser {2=+3} -1} msg] $msg
   1.604 +} {1 {syntax error in expression "2=+3": extra tokens at end of expression}}
   1.605 +test parseExpr-16.34 {GetLexeme procedure, lexeme is "!="} {
   1.606 +    testexprparser {2!=3} -1
   1.607 +} {- {} 0 subexpr 2!=3 5 operator != 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.608 +test parseExpr-16.35 {GetLexeme procedure, lexeme is "!"} {
   1.609 +    testexprparser {!2} -1
   1.610 +} {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}}
   1.611 +test parseExpr-16.36 {GetLexeme procedure, lexeme is "&&"} {
   1.612 +    testexprparser {2&&3} -1
   1.613 +} {- {} 0 subexpr 2&&3 5 operator && 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.614 +test parseExpr-16.37 {GetLexeme procedure, lexeme is "&"} {
   1.615 +    testexprparser {1&2} -1
   1.616 +} {- {} 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.617 +test parseExpr-16.38 {GetLexeme procedure, lexeme is "^"} {
   1.618 +    testexprparser {1^2} -1
   1.619 +} {- {} 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.620 +test parseExpr-16.39 {GetLexeme procedure, lexeme is "||"} {
   1.621 +    testexprparser {2||3} -1
   1.622 +} {- {} 0 subexpr 2||3 5 operator || 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.623 +test parseExpr-16.40 {GetLexeme procedure, lexeme is "|"} {
   1.624 +    testexprparser {1|2} -1
   1.625 +} {- {} 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
   1.626 +test parseExpr-16.41 {GetLexeme procedure, lexeme is "~"} {
   1.627 +    testexprparser {~2} -1
   1.628 +} {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}}
   1.629 +test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} {
   1.630 +    testexprparser {george()} -1
   1.631 +} {- {} 0 subexpr george() 1 operator george 0 {}}
   1.632 +test parseExpr-16.43 {GetLexeme procedure, lexeme is func name} {
   1.633 +    testexprparser {harmonic_ratio(2,3)} -1
   1.634 +} {- {} 0 subexpr harmonic_ratio(2,3) 5 operator harmonic_ratio 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
   1.635 +test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} {
   1.636 +    list [catch {testexprparser {@27} -1} msg] $msg
   1.637 +} {1 {syntax error in expression "@27": character not legal in expressions}}
   1.638 +
   1.639 +test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} {
   1.640 +    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
   1.641 +} {- {} 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 {}}
   1.642 +
   1.643 +test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} {
   1.644 +    list [catch {testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1} msg] $msg
   1.645 +} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": premature end of expression}}
   1.646 +
   1.647 +test parseExpr-19.1 {TclParseInteger: [Bug 648441]} {
   1.648 +    # Should see this as integer "0" followed by incomplete function "x"
   1.649 +    # Thus, syntax error.
   1.650 +    # If Bug 648441 is not fixed, "0x" will be seen as floating point 0.0
   1.651 +    list [catch {expr 0x} result] $result
   1.652 +} [list 1 {syntax error in expression "0x": extra tokens at end of expression}]
   1.653 +
   1.654 +# cleanup
   1.655 +::tcltest::cleanupTests
   1.656 +return