sl@0
|
1 |
# This file contains a collection of tests for the procedures in the
|
sl@0
|
2 |
# file tclParseExpr.c. Sourcing this file into Tcl runs the tests and
|
sl@0
|
3 |
# generates output for errors. No output means no errors were found.
|
sl@0
|
4 |
#
|
sl@0
|
5 |
# Copyright (c) 1997 Sun Microsystems, Inc.
|
sl@0
|
6 |
# Copyright (c) 1998-1999 by Scriptics Corporation.
|
sl@0
|
7 |
#
|
sl@0
|
8 |
# See the file "license.terms" for information on usage and redistribution
|
sl@0
|
9 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
sl@0
|
10 |
#
|
sl@0
|
11 |
# RCS: @(#) $Id: parseExpr.test,v 1.10.2.1 2003/10/06 13:55:39 dgp Exp $
|
sl@0
|
12 |
|
sl@0
|
13 |
if {[lsearch [namespace children] ::tcltest] == -1} {
|
sl@0
|
14 |
package require tcltest 2
|
sl@0
|
15 |
namespace import -force ::tcltest::*
|
sl@0
|
16 |
}
|
sl@0
|
17 |
|
sl@0
|
18 |
# Note that the Tcl expression parser (tclParseExpr.c) does not check
|
sl@0
|
19 |
# the semantic validity of the expressions it parses. It does not check,
|
sl@0
|
20 |
# for example, that a math function actually exists, or that the operands
|
sl@0
|
21 |
# of "<<" are integers.
|
sl@0
|
22 |
|
sl@0
|
23 |
if {[info commands testexprparser] == {}} {
|
sl@0
|
24 |
puts "This application hasn't been compiled with the \"testexprparser\""
|
sl@0
|
25 |
puts "command, so I can't test the Tcl expression parser."
|
sl@0
|
26 |
::tcltest::cleanupTests
|
sl@0
|
27 |
return
|
sl@0
|
28 |
}
|
sl@0
|
29 |
|
sl@0
|
30 |
# Some tests only work if wide integers (>32bit) are not found to be
|
sl@0
|
31 |
# integers at all.
|
sl@0
|
32 |
set ::tcltest::testConstraints(wideIntegerUnparsed) \
|
sl@0
|
33 |
[expr {-1 == 0xffffffff}]
|
sl@0
|
34 |
|
sl@0
|
35 |
test parseExpr-1.1 {Tcl_ParseExpr procedure, computing string length} {
|
sl@0
|
36 |
testexprparser [bytestring "1+2\0 +3"] -1
|
sl@0
|
37 |
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
38 |
test parseExpr-1.2 {Tcl_ParseExpr procedure, computing string length} {
|
sl@0
|
39 |
testexprparser "1 + 2" -1
|
sl@0
|
40 |
} {- {} 0 subexpr {1 + 2} 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
41 |
test parseExpr-1.3 {Tcl_ParseExpr procedure, error getting initial lexeme} {wideIntegerUnparsed} {
|
sl@0
|
42 |
list [catch {testexprparser {12345678901234567890} -1} msg] $msg
|
sl@0
|
43 |
} {1 {integer value too large to represent}}
|
sl@0
|
44 |
test parseExpr-1.4 {Tcl_ParseExpr procedure, error in conditional expression} {
|
sl@0
|
45 |
list [catch {testexprparser {foo+} -1} msg] $msg
|
sl@0
|
46 |
} {1 {syntax error in expression "foo+": variable references require preceding $}}
|
sl@0
|
47 |
test parseExpr-1.5 {Tcl_ParseExpr procedure, lexemes after the expression} {
|
sl@0
|
48 |
list [catch {testexprparser {1+2 345} -1} msg] $msg
|
sl@0
|
49 |
} {1 {syntax error in expression "1+2 345": extra tokens at end of expression}}
|
sl@0
|
50 |
|
sl@0
|
51 |
test parseExpr-2.1 {ParseCondExpr procedure, valid test subexpr} {
|
sl@0
|
52 |
testexprparser {2>3? 1 : 0} -1
|
sl@0
|
53 |
} {- {} 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 {}}
|
sl@0
|
54 |
test parseExpr-2.2 {ParseCondExpr procedure, error in test subexpr} {
|
sl@0
|
55 |
list [catch {testexprparser {0 || foo} -1} msg] $msg
|
sl@0
|
56 |
} {1 {syntax error in expression "0 || foo": variable references require preceding $}}
|
sl@0
|
57 |
test parseExpr-2.3 {ParseCondExpr procedure, next lexeme isn't "?"} {
|
sl@0
|
58 |
testexprparser {1+2} -1
|
sl@0
|
59 |
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
60 |
test parseExpr-2.4 {ParseCondExpr procedure, next lexeme is "?"} {
|
sl@0
|
61 |
testexprparser {1+2 ? 3 : 4} -1
|
sl@0
|
62 |
} {- {} 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 {}}
|
sl@0
|
63 |
test parseExpr-2.5 {ParseCondExpr procedure, bad lexeme after "?"} {wideIntegerUnparsed} {
|
sl@0
|
64 |
list [catch {testexprparser {1+2 ? 12345678901234567890} -1} msg] $msg
|
sl@0
|
65 |
} {1 {integer value too large to represent}}
|
sl@0
|
66 |
test parseExpr-2.6 {ParseCondExpr procedure, valid "then" subexpression} {
|
sl@0
|
67 |
testexprparser {1? 3 : 4} -1
|
sl@0
|
68 |
} {- {} 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 {}}
|
sl@0
|
69 |
test parseExpr-2.7 {ParseCondExpr procedure, error in "then" subexpression} {
|
sl@0
|
70 |
list [catch {testexprparser {1? fred : martha} -1} msg] $msg
|
sl@0
|
71 |
} {1 {syntax error in expression "1? fred : martha": variable references require preceding $}}
|
sl@0
|
72 |
test parseExpr-2.8 {ParseCondExpr procedure, lexeme after "then" subexpr isn't ":"} {
|
sl@0
|
73 |
list [catch {testexprparser {1? 2 martha 3} -1} msg] $msg
|
sl@0
|
74 |
} {1 {syntax error in expression "1? 2 martha 3": missing colon from ternary conditional}}
|
sl@0
|
75 |
test parseExpr-2.9 {ParseCondExpr procedure, valid "else" subexpression} {
|
sl@0
|
76 |
testexprparser {27||3? 3 : 4&&9} -1
|
sl@0
|
77 |
} {- {} 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 {}}
|
sl@0
|
78 |
test parseExpr-2.10 {ParseCondExpr procedure, error in "else" subexpression} {
|
sl@0
|
79 |
list [catch {testexprparser {1? 2 : martha} -1} msg] $msg
|
sl@0
|
80 |
} {1 {syntax error in expression "1? 2 : martha": variable references require preceding $}}
|
sl@0
|
81 |
|
sl@0
|
82 |
test parseExpr-3.1 {ParseLorExpr procedure, valid logical and subexpr} {
|
sl@0
|
83 |
testexprparser {1&&2 || 3} -1
|
sl@0
|
84 |
} {- {} 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 {}}
|
sl@0
|
85 |
test parseExpr-3.2 {ParseLorExpr procedure, error in logical and subexpr} {
|
sl@0
|
86 |
list [catch {testexprparser {1&&foo || 3} -1} msg] $msg
|
sl@0
|
87 |
} {1 {syntax error in expression "1&&foo || 3": variable references require preceding $}}
|
sl@0
|
88 |
test parseExpr-3.3 {ParseLorExpr procedure, next lexeme isn't "||"} {
|
sl@0
|
89 |
testexprparser {1&&2? 1 : 0} -1
|
sl@0
|
90 |
} {- {} 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 {}}
|
sl@0
|
91 |
test parseExpr-3.4 {ParseLorExpr procedure, next lexeme is "||"} {
|
sl@0
|
92 |
testexprparser {1&&2 || 3} -1
|
sl@0
|
93 |
} {- {} 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 {}}
|
sl@0
|
94 |
test parseExpr-3.5 {ParseLorExpr procedure, bad lexeme after "||"} {wideIntegerUnparsed} {
|
sl@0
|
95 |
list [catch {testexprparser {1&&2 || 12345678901234567890} -1} msg] $msg
|
sl@0
|
96 |
} {1 {integer value too large to represent}}
|
sl@0
|
97 |
test parseExpr-3.6 {ParseLorExpr procedure, valid RHS subexpression} {
|
sl@0
|
98 |
testexprparser {1&&2 || 3 || 4} -1
|
sl@0
|
99 |
} {- {} 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 {}}
|
sl@0
|
100 |
test parseExpr-3.7 {ParseLorExpr procedure, error in RHS subexpression} {
|
sl@0
|
101 |
list [catch {testexprparser {1&&2 || 3 || martha} -1} msg] $msg
|
sl@0
|
102 |
} {1 {syntax error in expression "1&&2 || 3 || martha": variable references require preceding $}}
|
sl@0
|
103 |
|
sl@0
|
104 |
test parseExpr-4.1 {ParseLandExpr procedure, valid LHS "|" subexpr} {
|
sl@0
|
105 |
testexprparser {1|2 && 3} -1
|
sl@0
|
106 |
} {- {} 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 {}}
|
sl@0
|
107 |
test parseExpr-4.2 {ParseLandExpr procedure, error in LHS "|" subexpr} {
|
sl@0
|
108 |
list [catch {testexprparser {1&&foo && 3} -1} msg] $msg
|
sl@0
|
109 |
} {1 {syntax error in expression "1&&foo && 3": variable references require preceding $}}
|
sl@0
|
110 |
test parseExpr-4.3 {ParseLandExpr procedure, next lexeme isn't "&&"} {
|
sl@0
|
111 |
testexprparser {1|2? 1 : 0} -1
|
sl@0
|
112 |
} {- {} 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 {}}
|
sl@0
|
113 |
test parseExpr-4.4 {ParseLandExpr procedure, next lexeme is "&&"} {
|
sl@0
|
114 |
testexprparser {1|2 && 3} -1
|
sl@0
|
115 |
} {- {} 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 {}}
|
sl@0
|
116 |
test parseExpr-4.5 {ParseLandExpr procedure, bad lexeme after "&&"} {wideIntegerUnparsed} {
|
sl@0
|
117 |
list [catch {testexprparser {1|2 && 12345678901234567890} -1} msg] $msg
|
sl@0
|
118 |
} {1 {integer value too large to represent}}
|
sl@0
|
119 |
test parseExpr-4.6 {ParseLandExpr procedure, valid RHS subexpression} {
|
sl@0
|
120 |
testexprparser {1|2 && 3 && 4} -1
|
sl@0
|
121 |
} {- {} 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 {}}
|
sl@0
|
122 |
test parseExpr-4.7 {ParseLandExpr procedure, error in RHS subexpression} {
|
sl@0
|
123 |
list [catch {testexprparser {1|2 && 3 && martha} -1} msg] $msg
|
sl@0
|
124 |
} {1 {syntax error in expression "1|2 && 3 && martha": variable references require preceding $}}
|
sl@0
|
125 |
|
sl@0
|
126 |
test parseExpr-5.1 {ParseBitOrExpr procedure, valid LHS "^" subexpr} {
|
sl@0
|
127 |
testexprparser {1^2 | 3} -1
|
sl@0
|
128 |
} {- {} 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 {}}
|
sl@0
|
129 |
test parseExpr-5.2 {ParseBitOrExpr procedure, error in LHS "^" subexpr} {
|
sl@0
|
130 |
list [catch {testexprparser {1|foo | 3} -1} msg] $msg
|
sl@0
|
131 |
} {1 {syntax error in expression "1|foo | 3": variable references require preceding $}}
|
sl@0
|
132 |
test parseExpr-5.3 {ParseBitOrExpr procedure, next lexeme isn't "|"} {
|
sl@0
|
133 |
testexprparser {1^2? 1 : 0} -1
|
sl@0
|
134 |
} {- {} 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 {}}
|
sl@0
|
135 |
test parseExpr-5.4 {ParseBitOrExpr procedure, next lexeme is "|"} {
|
sl@0
|
136 |
testexprparser {1^2 | 3} -1
|
sl@0
|
137 |
} {- {} 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 {}}
|
sl@0
|
138 |
test parseExpr-5.5 {ParseBitOrExpr procedure, bad lexeme after "|"} {wideIntegerUnparsed} {
|
sl@0
|
139 |
list [catch {testexprparser {1^2 | 12345678901234567890} -1} msg] $msg
|
sl@0
|
140 |
} {1 {integer value too large to represent}}
|
sl@0
|
141 |
test parseExpr-5.6 {ParseBitOrExpr procedure, valid RHS subexpression} {
|
sl@0
|
142 |
testexprparser {1^2 | 3 | 4} -1
|
sl@0
|
143 |
} {- {} 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 {}}
|
sl@0
|
144 |
test parseExpr-5.7 {ParseBitOrExpr procedure, error in RHS subexpression} {
|
sl@0
|
145 |
list [catch {testexprparser {1^2 | 3 | martha} -1} msg] $msg
|
sl@0
|
146 |
} {1 {syntax error in expression "1^2 | 3 | martha": variable references require preceding $}}
|
sl@0
|
147 |
|
sl@0
|
148 |
test parseExpr-6.1 {ParseBitXorExpr procedure, valid LHS "&" subexpr} {
|
sl@0
|
149 |
testexprparser {1&2 ^ 3} -1
|
sl@0
|
150 |
} {- {} 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 {}}
|
sl@0
|
151 |
test parseExpr-6.2 {ParseBitXorExpr procedure, error in LHS "&" subexpr} {
|
sl@0
|
152 |
list [catch {testexprparser {1^foo ^ 3} -1} msg] $msg
|
sl@0
|
153 |
} {1 {syntax error in expression "1^foo ^ 3": variable references require preceding $}}
|
sl@0
|
154 |
test parseExpr-6.3 {ParseBitXorExpr procedure, next lexeme isn't "^"} {
|
sl@0
|
155 |
testexprparser {1&2? 1 : 0} -1
|
sl@0
|
156 |
} {- {} 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 {}}
|
sl@0
|
157 |
test parseExpr-6.4 {ParseBitXorExpr procedure, next lexeme is "^"} {
|
sl@0
|
158 |
testexprparser {1&2 ^ 3} -1
|
sl@0
|
159 |
} {- {} 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 {}}
|
sl@0
|
160 |
test parseExpr-6.5 {ParseBitXorExpr procedure, bad lexeme after "^"} {wideIntegerUnparsed} {
|
sl@0
|
161 |
list [catch {testexprparser {1&2 ^ 12345678901234567890} -1} msg] $msg
|
sl@0
|
162 |
} {1 {integer value too large to represent}}
|
sl@0
|
163 |
test parseExpr-6.6 {ParseBitXorExpr procedure, valid RHS subexpression} {
|
sl@0
|
164 |
testexprparser {1&2 ^ 3 ^ 4} -1
|
sl@0
|
165 |
} {- {} 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 {}}
|
sl@0
|
166 |
test parseExpr-6.7 {ParseBitXorExpr procedure, error in RHS subexpression} {
|
sl@0
|
167 |
list [catch {testexprparser {1&2 ^ 3 ^ martha} -1} msg] $msg
|
sl@0
|
168 |
} {1 {syntax error in expression "1&2 ^ 3 ^ martha": variable references require preceding $}}
|
sl@0
|
169 |
|
sl@0
|
170 |
test parseExpr-7.1 {ParseBitAndExpr procedure, valid LHS equality subexpr} {
|
sl@0
|
171 |
testexprparser {1==2 & 3} -1
|
sl@0
|
172 |
} {- {} 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 {}}
|
sl@0
|
173 |
test parseExpr-7.2 {ParseBitAndExpr procedure, error in LHS equality subexpr} {
|
sl@0
|
174 |
list [catch {testexprparser {1!=foo & 3} -1} msg] $msg
|
sl@0
|
175 |
} {1 {syntax error in expression "1!=foo & 3": variable references require preceding $}}
|
sl@0
|
176 |
test parseExpr-7.3 {ParseBitAndExpr procedure, next lexeme isn't "&"} {
|
sl@0
|
177 |
testexprparser {1==2? 1 : 0} -1
|
sl@0
|
178 |
} {- {} 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 {}}
|
sl@0
|
179 |
test parseExpr-7.4 {ParseBitAndExpr procedure, next lexeme is "&"} {
|
sl@0
|
180 |
testexprparser {1>2 & 3} -1
|
sl@0
|
181 |
} {- {} 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 {}}
|
sl@0
|
182 |
test parseExpr-7.5 {ParseBitAndExpr procedure, bad lexeme after "&"} {wideIntegerUnparsed} {
|
sl@0
|
183 |
list [catch {testexprparser {1==2 & 12345678901234567890} -1} msg] $msg
|
sl@0
|
184 |
} {1 {integer value too large to represent}}
|
sl@0
|
185 |
test parseExpr-7.6 {ParseBitAndExpr procedure, valid RHS subexpression} {
|
sl@0
|
186 |
testexprparser {1<2 & 3 & 4} -1
|
sl@0
|
187 |
} {- {} 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 {}}
|
sl@0
|
188 |
test parseExpr-7.7 {ParseBitAndExpr procedure, error in RHS subexpression} {
|
sl@0
|
189 |
list [catch {testexprparser {1==2 & 3>2 & martha} -1} msg] $msg
|
sl@0
|
190 |
} {1 {syntax error in expression "1==2 & 3>2 & martha": variable references require preceding $}}
|
sl@0
|
191 |
|
sl@0
|
192 |
test parseExpr-8.1 {ParseEqualityExpr procedure, valid LHS relational subexpr} {
|
sl@0
|
193 |
testexprparser {1<2 == 3} -1
|
sl@0
|
194 |
} {- {} 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 {}}
|
sl@0
|
195 |
test parseExpr-8.2 {ParseEqualityExpr procedure, error in LHS relational subexpr} {
|
sl@0
|
196 |
list [catch {testexprparser {1>=foo == 3} -1} msg] $msg
|
sl@0
|
197 |
} {1 {syntax error in expression "1>=foo == 3": variable references require preceding $}}
|
sl@0
|
198 |
test parseExpr-8.3 {ParseEqualityExpr procedure, next lexeme isn't "==" or "!="} {
|
sl@0
|
199 |
testexprparser {1<2? 1 : 0} -1
|
sl@0
|
200 |
} {- {} 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 {}}
|
sl@0
|
201 |
test parseExpr-8.4 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} {
|
sl@0
|
202 |
testexprparser {1<2 == 3} -1
|
sl@0
|
203 |
} {- {} 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 {}}
|
sl@0
|
204 |
test parseExpr-8.5 {ParseEqualityExpr procedure, next lexeme is "==" or "!="} {
|
sl@0
|
205 |
testexprparser {1<2 != 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
207 |
test parseExpr-8.6 {ParseEqualityExpr procedure, bad lexeme after "==" or "!="} {wideIntegerUnparsed} {
|
sl@0
|
208 |
list [catch {testexprparser {1<2 == 12345678901234567890} -1} msg] $msg
|
sl@0
|
209 |
} {1 {integer value too large to represent}}
|
sl@0
|
210 |
test parseExpr-8.7 {ParseEqualityExpr procedure, valid RHS subexpression} {
|
sl@0
|
211 |
testexprparser {1<2 == 3 == 4} -1
|
sl@0
|
212 |
} {- {} 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 {}}
|
sl@0
|
213 |
test parseExpr-8.8 {ParseEqualityExpr procedure, error in RHS subexpression} {
|
sl@0
|
214 |
list [catch {testexprparser {1<2 == 3 != martha} -1} msg] $msg
|
sl@0
|
215 |
} {1 {syntax error in expression "1<2 == 3 != martha": variable references require preceding $}}
|
sl@0
|
216 |
|
sl@0
|
217 |
test parseExpr-9.1 {ParseRelationalExpr procedure, valid LHS shift subexpr} {
|
sl@0
|
218 |
testexprparser {1<<2 < 3} -1
|
sl@0
|
219 |
} {- {} 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 {}}
|
sl@0
|
220 |
test parseExpr-9.2 {ParseRelationalExpr procedure, error in LHS shift subexpr} {
|
sl@0
|
221 |
list [catch {testexprparser {1>=foo < 3} -1} msg] $msg
|
sl@0
|
222 |
} {1 {syntax error in expression "1>=foo < 3": variable references require preceding $}}
|
sl@0
|
223 |
test parseExpr-9.3 {ParseRelationalExpr procedure, next lexeme isn't relational op} {
|
sl@0
|
224 |
testexprparser {1<<2? 1 : 0} -1
|
sl@0
|
225 |
} {- {} 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 {}}
|
sl@0
|
226 |
test parseExpr-9.4 {ParseRelationalExpr procedure, next lexeme is relational op} {
|
sl@0
|
227 |
testexprparser {1<<2 < 3} -1
|
sl@0
|
228 |
} {- {} 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 {}}
|
sl@0
|
229 |
test parseExpr-9.5 {ParseRelationalExpr procedure, next lexeme is relational op} {
|
sl@0
|
230 |
testexprparser {1>>2 > 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
232 |
test parseExpr-9.6 {ParseRelationalExpr procedure, next lexeme is relational op} {
|
sl@0
|
233 |
testexprparser {1<<2 <= 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
235 |
test parseExpr-9.7 {ParseRelationalExpr procedure, next lexeme is relational op} {
|
sl@0
|
236 |
testexprparser {1<<2 >= 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
238 |
test parseExpr-9.8 {ParseRelationalExpr procedure, bad lexeme after relational op} {wideIntegerUnparsed} {
|
sl@0
|
239 |
list [catch {testexprparser {1<<2 < 12345678901234567890} -1} msg] $msg
|
sl@0
|
240 |
} {1 {integer value too large to represent}}
|
sl@0
|
241 |
test parseExpr-9.9 {ParseRelationalExpr procedure, valid RHS subexpression} {
|
sl@0
|
242 |
testexprparser {1<<2 < 3 < 4} -1
|
sl@0
|
243 |
} {- {} 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 {}}
|
sl@0
|
244 |
test parseExpr-9.10 {ParseRelationalExpr procedure, error in RHS subexpression} {
|
sl@0
|
245 |
list [catch {testexprparser {1<<2 < 3 > martha} -1} msg] $msg
|
sl@0
|
246 |
} {1 {syntax error in expression "1<<2 < 3 > martha": variable references require preceding $}}
|
sl@0
|
247 |
|
sl@0
|
248 |
test parseExpr-10.1 {ParseShiftExpr procedure, valid LHS add subexpr} {
|
sl@0
|
249 |
testexprparser {1+2 << 3} -1
|
sl@0
|
250 |
} {- {} 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 {}}
|
sl@0
|
251 |
test parseExpr-10.2 {ParseShiftExpr procedure, error in LHS add subexpr} {
|
sl@0
|
252 |
list [catch {testexprparser {1-foo << 3} -1} msg] $msg
|
sl@0
|
253 |
} {1 {syntax error in expression "1-foo << 3": variable references require preceding $}}
|
sl@0
|
254 |
test parseExpr-10.3 {ParseShiftExpr procedure, next lexeme isn't "<<" or ">>"} {
|
sl@0
|
255 |
testexprparser {1+2? 1 : 0} -1
|
sl@0
|
256 |
} {- {} 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 {}}
|
sl@0
|
257 |
test parseExpr-10.4 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} {
|
sl@0
|
258 |
testexprparser {1+2 << 3} -1
|
sl@0
|
259 |
} {- {} 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 {}}
|
sl@0
|
260 |
test parseExpr-10.5 {ParseShiftExpr procedure, next lexeme is "<<" or ">>"} {
|
sl@0
|
261 |
testexprparser {1+2 >> 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
263 |
test parseExpr-10.6 {ParseShiftExpr procedure, bad lexeme after "<<" or ">>"} {wideIntegerUnparsed} {
|
sl@0
|
264 |
list [catch {testexprparser {1+2 << 12345678901234567890} -1} msg] $msg
|
sl@0
|
265 |
} {1 {integer value too large to represent}}
|
sl@0
|
266 |
test parseExpr-10.7 {ParseShiftExpr procedure, valid RHS subexpression} {
|
sl@0
|
267 |
testexprparser {1+2 << 3 << 4} -1
|
sl@0
|
268 |
} {- {} 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 {}}
|
sl@0
|
269 |
test parseExpr-10.8 {ParseShiftExpr procedure, error in RHS subexpression} {
|
sl@0
|
270 |
list [catch {testexprparser {1+2 << 3 >> martha} -1} msg] $msg
|
sl@0
|
271 |
} {1 {syntax error in expression "1+2 << 3 >> martha": variable references require preceding $}}
|
sl@0
|
272 |
|
sl@0
|
273 |
test parseExpr-11.1 {ParseAddExpr procedure, valid LHS multiply subexpr} {
|
sl@0
|
274 |
testexprparser {1*2 + 3} -1
|
sl@0
|
275 |
} {- {} 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 {}}
|
sl@0
|
276 |
test parseExpr-11.2 {ParseAddExpr procedure, error in LHS multiply subexpr} {
|
sl@0
|
277 |
list [catch {testexprparser {1/foo + 3} -1} msg] $msg
|
sl@0
|
278 |
} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
|
sl@0
|
279 |
test parseExpr-11.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} {
|
sl@0
|
280 |
testexprparser {1*2? 1 : 0} -1
|
sl@0
|
281 |
} {- {} 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 {}}
|
sl@0
|
282 |
test parseExpr-11.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
|
sl@0
|
283 |
testexprparser {1*2 + 3} -1
|
sl@0
|
284 |
} {- {} 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 {}}
|
sl@0
|
285 |
test parseExpr-11.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
|
sl@0
|
286 |
testexprparser {1*2 - 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
288 |
test parseExpr-11.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} {
|
sl@0
|
289 |
list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
|
sl@0
|
290 |
} {1 {integer value too large to represent}}
|
sl@0
|
291 |
test parseExpr-11.7 {ParseAddExpr procedure, valid RHS subexpression} {
|
sl@0
|
292 |
testexprparser {1*2 + 3 + 4} -1
|
sl@0
|
293 |
} {- {} 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 {}}
|
sl@0
|
294 |
test parseExpr-11.8 {ParseAddExpr procedure, error in RHS subexpression} {
|
sl@0
|
295 |
list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
|
sl@0
|
296 |
} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
|
sl@0
|
297 |
|
sl@0
|
298 |
test parseExpr-12.1 {ParseAddExpr procedure, valid LHS multiply subexpr} {
|
sl@0
|
299 |
testexprparser {1*2 + 3} -1
|
sl@0
|
300 |
} {- {} 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 {}}
|
sl@0
|
301 |
test parseExpr-12.2 {ParseAddExpr procedure, error in LHS multiply subexpr} {
|
sl@0
|
302 |
list [catch {testexprparser {1/foo + 3} -1} msg] $msg
|
sl@0
|
303 |
} {1 {syntax error in expression "1/foo + 3": variable references require preceding $}}
|
sl@0
|
304 |
test parseExpr-12.3 {ParseAddExpr procedure, next lexeme isn't "+" or "-"} {
|
sl@0
|
305 |
testexprparser {1*2? 1 : 0} -1
|
sl@0
|
306 |
} {- {} 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 {}}
|
sl@0
|
307 |
test parseExpr-12.4 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
|
sl@0
|
308 |
testexprparser {1*2 + 3} -1
|
sl@0
|
309 |
} {- {} 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 {}}
|
sl@0
|
310 |
test parseExpr-12.5 {ParseAddExpr procedure, next lexeme is "+" or "-"} {
|
sl@0
|
311 |
testexprparser {1*2 - 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
313 |
test parseExpr-12.6 {ParseAddExpr procedure, bad lexeme after "+" or "-"} {wideIntegerUnparsed} {
|
sl@0
|
314 |
list [catch {testexprparser {1*2 + 12345678901234567890} -1} msg] $msg
|
sl@0
|
315 |
} {1 {integer value too large to represent}}
|
sl@0
|
316 |
test parseExpr-12.7 {ParseAddExpr procedure, valid RHS subexpression} {
|
sl@0
|
317 |
testexprparser {1*2 + 3 + 4} -1
|
sl@0
|
318 |
} {- {} 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 {}}
|
sl@0
|
319 |
test parseExpr-12.8 {ParseAddExpr procedure, error in RHS subexpression} {
|
sl@0
|
320 |
list [catch {testexprparser {1*2 + 3 - martha} -1} msg] $msg
|
sl@0
|
321 |
} {1 {syntax error in expression "1*2 + 3 - martha": variable references require preceding $}}
|
sl@0
|
322 |
|
sl@0
|
323 |
test parseExpr-13.1 {ParseMultiplyExpr procedure, valid LHS unary subexpr} {
|
sl@0
|
324 |
testexprparser {+2 * 3} -1
|
sl@0
|
325 |
} {- {} 0 subexpr {+2 * 3} 7 operator * 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
326 |
test parseExpr-13.2 {ParseMultiplyExpr procedure, error in LHS unary subexpr} {wideIntegerUnparsed} {
|
sl@0
|
327 |
list [catch {testexprparser {-12345678901234567890 * 3} -1} msg] $msg
|
sl@0
|
328 |
} {1 {integer value too large to represent}}
|
sl@0
|
329 |
test parseExpr-13.3 {ParseMultiplyExpr procedure, next lexeme isn't "*", "/", or "%"} {
|
sl@0
|
330 |
testexprparser {+2? 1 : 0} -1
|
sl@0
|
331 |
} {- {} 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 {}}
|
sl@0
|
332 |
test parseExpr-13.4 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
|
sl@0
|
333 |
testexprparser {-123 * 3} -1
|
sl@0
|
334 |
} {- {} 0 subexpr {-123 * 3} 7 operator * 0 subexpr -123 3 operator - 0 subexpr 123 1 text 123 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
335 |
test parseExpr-13.5 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
|
sl@0
|
336 |
testexprparser {+-456 / 3} -1
|
sl@0
|
337 |
} {- {} 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 {}}
|
sl@0
|
338 |
test parseExpr-13.6 {ParseMultiplyExpr procedure, next lexeme is "*", "/", or "%"} {
|
sl@0
|
339 |
testexprparser {+-456 % 3} -1
|
sl@0
|
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 {}}
|
sl@0
|
341 |
test parseExpr-13.7 {ParseMultiplyExpr procedure, bad lexeme after "*", "/", or "%"} {wideIntegerUnparsed} {
|
sl@0
|
342 |
list [catch {testexprparser {--++5 / 12345678901234567890} -1} msg] $msg
|
sl@0
|
343 |
} {1 {integer value too large to represent}}
|
sl@0
|
344 |
test parseExpr-13.8 {ParseMultiplyExpr procedure, valid RHS subexpression} {
|
sl@0
|
345 |
testexprparser {-2 / 3 % 4} -1
|
sl@0
|
346 |
} {- {} 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 {}}
|
sl@0
|
347 |
test parseExpr-13.9 {ParseMultiplyExpr procedure, error in RHS subexpression} {
|
sl@0
|
348 |
list [catch {testexprparser {++2 / 3 * martha} -1} msg] $msg
|
sl@0
|
349 |
} {1 {syntax error in expression "++2 / 3 * martha": variable references require preceding $}}
|
sl@0
|
350 |
|
sl@0
|
351 |
test parseExpr-14.1 {ParseUnaryExpr procedure, first token is unary operator} {
|
sl@0
|
352 |
testexprparser {+2} -1
|
sl@0
|
353 |
} {- {} 0 subexpr +2 3 operator + 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
354 |
test parseExpr-14.2 {ParseUnaryExpr procedure, first token is unary operator} {
|
sl@0
|
355 |
testexprparser {-2} -1
|
sl@0
|
356 |
} {- {} 0 subexpr -2 3 operator - 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
357 |
test parseExpr-14.3 {ParseUnaryExpr procedure, first token is unary operator} {
|
sl@0
|
358 |
testexprparser {~2} -1
|
sl@0
|
359 |
} {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
360 |
test parseExpr-14.4 {ParseUnaryExpr procedure, first token is unary operator} {
|
sl@0
|
361 |
testexprparser {!2} -1
|
sl@0
|
362 |
} {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
363 |
test parseExpr-14.5 {ParseUnaryExpr procedure, error in lexeme after unary op} {wideIntegerUnparsed} {
|
sl@0
|
364 |
list [catch {testexprparser {-12345678901234567890} -1} msg] $msg
|
sl@0
|
365 |
} {1 {integer value too large to represent}}
|
sl@0
|
366 |
test parseExpr-14.6 {ParseUnaryExpr procedure, simple unary expr after unary op} {
|
sl@0
|
367 |
testexprparser {+"1234"} -1
|
sl@0
|
368 |
} {- {} 0 subexpr +\"1234\" 3 operator + 0 subexpr {"1234"} 1 text 1234 0 {}}
|
sl@0
|
369 |
test parseExpr-14.7 {ParseUnaryExpr procedure, another unary expr after unary op} {
|
sl@0
|
370 |
testexprparser {~!{fred}} -1
|
sl@0
|
371 |
} {- {} 0 subexpr ~!{fred} 5 operator ~ 0 subexpr !{fred} 3 operator ! 0 subexpr {{fred}} 1 text fred 0 {}}
|
sl@0
|
372 |
test parseExpr-14.8 {ParseUnaryExpr procedure, error in unary expr after unary op} {
|
sl@0
|
373 |
list [catch {testexprparser {+-||27} -1} msg] $msg
|
sl@0
|
374 |
} {1 {syntax error in expression "+-||27": unexpected operator ||}}
|
sl@0
|
375 |
test parseExpr-14.9 {ParseUnaryExpr procedure, error in unary expr after unary op} {
|
sl@0
|
376 |
list [catch {testexprparser {+-||27} -1} msg] $msg
|
sl@0
|
377 |
} {1 {syntax error in expression "+-||27": unexpected operator ||}}
|
sl@0
|
378 |
test parseExpr-14.10 {ParseUnaryExpr procedure, first token is not unary op} {
|
sl@0
|
379 |
testexprparser {123} -1
|
sl@0
|
380 |
} {- {} 0 subexpr 123 1 text 123 0 {}}
|
sl@0
|
381 |
test parseExpr-14.11 {ParseUnaryExpr procedure, not unary expr, complex primary expr} {
|
sl@0
|
382 |
testexprparser {(1+2)} -1
|
sl@0
|
383 |
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
384 |
test parseExpr-14.12 {ParseUnaryExpr procedure, not unary expr, error in primary expr} {wideIntegerUnparsed} {
|
sl@0
|
385 |
list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
|
sl@0
|
386 |
} {1 {integer value too large to represent}}
|
sl@0
|
387 |
|
sl@0
|
388 |
test parseExpr-15.1 {ParsePrimaryExpr procedure, just parenthesized subexpr} {
|
sl@0
|
389 |
testexprparser {({abc}/{def})} -1
|
sl@0
|
390 |
} {- {} 0 subexpr {{abc}/{def}} 5 operator / 0 subexpr {{abc}} 1 text abc 0 subexpr {{def}} 1 text def 0 {}}
|
sl@0
|
391 |
test parseExpr-15.2 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} {
|
sl@0
|
392 |
list [catch {testexprparser {(12345678901234567890)} -1} msg] $msg
|
sl@0
|
393 |
} {1 {integer value too large to represent}}
|
sl@0
|
394 |
test parseExpr-15.3 {ParsePrimaryExpr procedure, valid parenthesized subexpr} {
|
sl@0
|
395 |
testexprparser {({abc}? 2*4 : -6)} -1
|
sl@0
|
396 |
} {- {} 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 {}}
|
sl@0
|
397 |
test parseExpr-15.4 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {
|
sl@0
|
398 |
list [catch {testexprparser {(? 123 : 456)} -1} msg] $msg
|
sl@0
|
399 |
} {1 {syntax error in expression "(? 123 : 456)": unexpected ternary 'then' separator}}
|
sl@0
|
400 |
test parseExpr-15.5 {ParsePrimaryExpr procedure, missing ")" after in parenthesized subexpr} {
|
sl@0
|
401 |
list [catch {testexprparser {({abc}/{def}} -1} msg] $msg
|
sl@0
|
402 |
} {1 {syntax error in expression "({abc}/{def}": looking for close parenthesis}}
|
sl@0
|
403 |
test parseExpr-15.6 {ParsePrimaryExpr procedure, primary is literal} {
|
sl@0
|
404 |
testexprparser {12345} -1
|
sl@0
|
405 |
} {- {} 0 subexpr 12345 1 text 12345 0 {}}
|
sl@0
|
406 |
test parseExpr-15.7 {ParsePrimaryExpr procedure, primary is literal} {
|
sl@0
|
407 |
testexprparser {12345.6789} -1
|
sl@0
|
408 |
} {- {} 0 subexpr 12345.6789 1 text 12345.6789 0 {}}
|
sl@0
|
409 |
test parseExpr-15.8 {ParsePrimaryExpr procedure, primary is var reference} {
|
sl@0
|
410 |
testexprparser {$a} -1
|
sl@0
|
411 |
} {- {} 0 subexpr {$a} 2 variable {$a} 1 text a 0 {}}
|
sl@0
|
412 |
test parseExpr-15.9 {ParsePrimaryExpr procedure, primary is var reference} {
|
sl@0
|
413 |
testexprparser {$a(hello$there)} -1
|
sl@0
|
414 |
} {- {} 0 subexpr {$a(hello$there)} 5 variable {$a(hello$there)} 4 text a 0 text hello 0 variable {$there} 1 text there 0 {}}
|
sl@0
|
415 |
test parseExpr-15.10 {ParsePrimaryExpr procedure, primary is var reference} {
|
sl@0
|
416 |
testexprparser {$a()} -1
|
sl@0
|
417 |
} {- {} 0 subexpr {$a()} 3 variable {$a()} 2 text a 0 text {} 0 {}}
|
sl@0
|
418 |
test parseExpr-15.11 {ParsePrimaryExpr procedure, error in var reference} {
|
sl@0
|
419 |
list [catch {testexprparser {$a(} -1} msg] $msg
|
sl@0
|
420 |
} {1 {missing )}}
|
sl@0
|
421 |
test parseExpr-15.12 {ParsePrimaryExpr procedure, primary is quoted string} {
|
sl@0
|
422 |
testexprparser {"abc $xyz def"} -1
|
sl@0
|
423 |
} {- {} 0 subexpr {"abc $xyz def"} 5 word {"abc $xyz def"} 4 text {abc } 0 variable {$xyz} 1 text xyz 0 text { def} 0 {}}
|
sl@0
|
424 |
test parseExpr-15.13 {ParsePrimaryExpr procedure, error in quoted string} {
|
sl@0
|
425 |
list [catch {testexprparser {"$a(12"} -1} msg] $msg
|
sl@0
|
426 |
} {1 {missing )}}
|
sl@0
|
427 |
test parseExpr-15.14 {ParsePrimaryExpr procedure, quoted string has multiple tokens} {
|
sl@0
|
428 |
testexprparser {"abc [xyz] $def"} -1
|
sl@0
|
429 |
} {- {} 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 {}}
|
sl@0
|
430 |
test parseExpr-15.15 {ParsePrimaryExpr procedure, primary is command} {
|
sl@0
|
431 |
testexprparser {[def]} -1
|
sl@0
|
432 |
} {- {} 0 subexpr {[def]} 1 command {[def]} 0 {}}
|
sl@0
|
433 |
test parseExpr-15.16 {ParsePrimaryExpr procedure, primary is multiple commands} {
|
sl@0
|
434 |
testexprparser {[one; two; three; four;]} -1
|
sl@0
|
435 |
} {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}}
|
sl@0
|
436 |
test parseExpr-15.17 {ParsePrimaryExpr procedure, primary is multiple commands} {
|
sl@0
|
437 |
testexprparser {[one; two; three; four;]} -1
|
sl@0
|
438 |
} {- {} 0 subexpr {[one; two; three; four;]} 1 command {[one; two; three; four;]} 0 {}}
|
sl@0
|
439 |
test parseExpr-15.18 {ParsePrimaryExpr procedure, missing close bracket} {
|
sl@0
|
440 |
list [catch {testexprparser {[one} -1} msg] $msg
|
sl@0
|
441 |
} {1 {missing close-bracket}}
|
sl@0
|
442 |
test parseExpr-15.19 {ParsePrimaryExpr procedure, primary is braced string} {
|
sl@0
|
443 |
testexprparser {{hello world}} -1
|
sl@0
|
444 |
} {- {} 0 subexpr {{hello world}} 1 text {hello world} 0 {}}
|
sl@0
|
445 |
test parseExpr-15.20 {ParsePrimaryExpr procedure, error in primary, which is braced string} {
|
sl@0
|
446 |
list [catch {testexprparser "\{abc\\\n" -1} msg] $msg
|
sl@0
|
447 |
} {1 {missing close-brace}}
|
sl@0
|
448 |
test parseExpr-15.21 {ParsePrimaryExpr procedure, primary is braced string with multiple tokens} {
|
sl@0
|
449 |
testexprparser "\{ \\
|
sl@0
|
450 |
+123 \}" -1
|
sl@0
|
451 |
} {- {} 0 subexpr \{\ \ \\\n\ +123\ \} 4 word \{\ \ \\\n\ +123\ \} 3 text { } 0 backslash \\\n\ 0 text {+123 } 0 {}}
|
sl@0
|
452 |
test parseExpr-15.22 {ParsePrimaryExpr procedure, primary is function call} {
|
sl@0
|
453 |
testexprparser {foo(123)} -1
|
sl@0
|
454 |
} {- {} 0 subexpr foo(123) 3 operator foo 0 subexpr 123 1 text 123 0 {}}
|
sl@0
|
455 |
test parseExpr-15.23 {ParsePrimaryExpr procedure, bad lexeme after function name} {wideIntegerUnparsed} {
|
sl@0
|
456 |
list [catch {testexprparser {foo 12345678901234567890 123)} -1} msg] $msg
|
sl@0
|
457 |
} {1 {integer value too large to represent}}
|
sl@0
|
458 |
test parseExpr-15.24 {ParsePrimaryExpr procedure, lexeme after function name isn't "("} {
|
sl@0
|
459 |
list [catch {testexprparser {foo 27.4 123)} -1} msg] $msg
|
sl@0
|
460 |
} {1 {syntax error in expression "foo 27.4 123)": variable references require preceding $}}
|
sl@0
|
461 |
test parseExpr-15.25 {ParsePrimaryExpr procedure, bad lexeme after "("} {wideIntegerUnparsed} {
|
sl@0
|
462 |
list [catch {testexprparser {foo(12345678901234567890)} -1} msg] $msg
|
sl@0
|
463 |
} {1 {integer value too large to represent}}
|
sl@0
|
464 |
test parseExpr-15.26 {ParsePrimaryExpr procedure, function call, one arg} {
|
sl@0
|
465 |
testexprparser {foo(27*4)} -1
|
sl@0
|
466 |
} {- {} 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 {}}
|
sl@0
|
467 |
test parseExpr-15.27 {ParsePrimaryExpr procedure, error in function arg} {
|
sl@0
|
468 |
list [catch {testexprparser {foo(*1-2)} -1} msg] $msg
|
sl@0
|
469 |
} {1 {syntax error in expression "foo(*1-2)": unexpected operator *}}
|
sl@0
|
470 |
test parseExpr-15.28 {ParsePrimaryExpr procedure, error in function arg} {
|
sl@0
|
471 |
list [catch {testexprparser {foo(*1-2)} -1} msg] $msg
|
sl@0
|
472 |
} {1 {syntax error in expression "foo(*1-2)": unexpected operator *}}
|
sl@0
|
473 |
test parseExpr-15.29 {ParsePrimaryExpr procedure, function call, comma after arg} {
|
sl@0
|
474 |
testexprparser {foo(27-2, (-2*[foo]))} -1
|
sl@0
|
475 |
} {- {} 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 {}}
|
sl@0
|
476 |
test parseExpr-15.30 {ParsePrimaryExpr procedure, bad lexeme after comma} {wideIntegerUnparsed} {
|
sl@0
|
477 |
list [catch {testexprparser {foo(123, 12345678901234567890)} -1} msg] $msg
|
sl@0
|
478 |
} {1 {integer value too large to represent}}
|
sl@0
|
479 |
test parseExpr-15.31 {ParsePrimaryExpr procedure, lexeme not "," or ")" after arg} {
|
sl@0
|
480 |
list [catch {testexprparser {foo(123 [foo])} -1} msg] $msg
|
sl@0
|
481 |
} {1 {syntax error in expression "foo(123 [foo])": missing close parenthesis at end of function call}}
|
sl@0
|
482 |
test parseExpr-15.32 {ParsePrimaryExpr procedure, bad lexeme after primary} {wideIntegerUnparsed} {
|
sl@0
|
483 |
list [catch {testexprparser {123 12345678901234567890} -1} msg] $msg
|
sl@0
|
484 |
} {1 {integer value too large to represent}}
|
sl@0
|
485 |
test parseExpr-15.33 {ParsePrimaryExpr procedure, comma-specific message} {
|
sl@0
|
486 |
list [catch {testexprparser {123+,456} -1} msg] $msg
|
sl@0
|
487 |
} {1 {syntax error in expression "123+,456": commas can only separate function arguments}}
|
sl@0
|
488 |
test parseExpr-15.34 {ParsePrimaryExpr procedure, single equal-specific message} {
|
sl@0
|
489 |
list [catch {testexprparser {123+=456} -1} msg] $msg
|
sl@0
|
490 |
} {1 {syntax error in expression "123+=456": single equality character not legal in expressions}}
|
sl@0
|
491 |
test parseExpr-15.35 {ParsePrimaryExpr procedure, error in parenthesized subexpr} {
|
sl@0
|
492 |
list [catch {testexprparser {(: 123 : 456)} -1} msg] $msg
|
sl@0
|
493 |
} {1 {syntax error in expression "(: 123 : 456)": unexpected ternary 'else' separator}}
|
sl@0
|
494 |
test parseExpr-15.36 {ParsePrimaryExpr procedure, missing close-bracket} {
|
sl@0
|
495 |
# Test for Bug 681841
|
sl@0
|
496 |
list [catch {testexprparser {[set a [format bc]} -1} msg] $msg
|
sl@0
|
497 |
} {1 {missing close-bracket}}
|
sl@0
|
498 |
|
sl@0
|
499 |
test parseExpr-16.1 {GetLexeme procedure, whitespace before lexeme} {
|
sl@0
|
500 |
testexprparser { 123} -1
|
sl@0
|
501 |
} {- {} 0 subexpr 123 1 text 123 0 {}}
|
sl@0
|
502 |
test parseExpr-16.2 {GetLexeme procedure, whitespace before lexeme} {
|
sl@0
|
503 |
testexprparser { \
|
sl@0
|
504 |
456} -1
|
sl@0
|
505 |
} {- {} 0 subexpr 456 1 text 456 0 {}}
|
sl@0
|
506 |
test parseExpr-16.3 {GetLexeme procedure, no lexeme after whitespace} {
|
sl@0
|
507 |
testexprparser { 123 \
|
sl@0
|
508 |
} -1
|
sl@0
|
509 |
} {- {} 0 subexpr 123 1 text 123 0 {}}
|
sl@0
|
510 |
test parseExpr-16.4 {GetLexeme procedure, integer lexeme} {
|
sl@0
|
511 |
testexprparser {000} -1
|
sl@0
|
512 |
} {- {} 0 subexpr 000 1 text 000 0 {}}
|
sl@0
|
513 |
test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} {wideIntegerUnparsed} {
|
sl@0
|
514 |
list [catch {testexprparser {12345678901234567890} -1} msg] $msg
|
sl@0
|
515 |
} {1 {integer value too large to represent}}
|
sl@0
|
516 |
|
sl@0
|
517 |
test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -body {
|
sl@0
|
518 |
testexprparser {0999} -1
|
sl@0
|
519 |
} -returnCodes error -match glob -result {*invalid octal number*}
|
sl@0
|
520 |
|
sl@0
|
521 |
test parseExpr-16.7 {GetLexeme procedure, double lexeme} {
|
sl@0
|
522 |
testexprparser {0.999} -1
|
sl@0
|
523 |
} {- {} 0 subexpr 0.999 1 text 0.999 0 {}}
|
sl@0
|
524 |
test parseExpr-16.8 {GetLexeme procedure, double lexeme} {
|
sl@0
|
525 |
testexprparser {.123} -1
|
sl@0
|
526 |
} {- {} 0 subexpr .123 1 text .123 0 {}}
|
sl@0
|
527 |
test parseExpr-16.9 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} {
|
sl@0
|
528 |
testexprparser {nan} -1
|
sl@0
|
529 |
} {- {} 0 subexpr nan 1 text nan 0 {}}
|
sl@0
|
530 |
test parseExpr-16.10 {GetLexeme procedure, double lexeme} {nonPortable unixOnly} {
|
sl@0
|
531 |
testexprparser {NaN} -1
|
sl@0
|
532 |
} {- {} 0 subexpr NaN 1 text NaN 0 {}}
|
sl@0
|
533 |
test parseExpr-16.11 {GetLexeme procedure, bad double lexeme too big} {
|
sl@0
|
534 |
list [catch {testexprparser {123.e+99999999999999} -1} msg] $msg
|
sl@0
|
535 |
} {1 {floating-point value too large to represent}}
|
sl@0
|
536 |
test parseExpr-16.12 {GetLexeme procedure, bad double lexeme} {
|
sl@0
|
537 |
list [catch {testexprparser {123.4x56} -1} msg] $msg
|
sl@0
|
538 |
} {1 {syntax error in expression "123.4x56": extra tokens at end of expression}}
|
sl@0
|
539 |
test parseExpr-16.13 {GetLexeme procedure, lexeme is "["} {
|
sl@0
|
540 |
testexprparser {[foo]} -1
|
sl@0
|
541 |
} {- {} 0 subexpr {[foo]} 1 command {[foo]} 0 {}}
|
sl@0
|
542 |
test parseExpr-16.14 {GetLexeme procedure, lexeme is open brace} {
|
sl@0
|
543 |
testexprparser {{bar}} -1
|
sl@0
|
544 |
} {- {} 0 subexpr {{bar}} 1 text bar 0 {}}
|
sl@0
|
545 |
test parseExpr-16.15 {GetLexeme procedure, lexeme is "("} {
|
sl@0
|
546 |
testexprparser {(123)} -1
|
sl@0
|
547 |
} {- {} 0 subexpr 123 1 text 123 0 {}}
|
sl@0
|
548 |
test parseExpr-16.16 {GetLexeme procedure, lexeme is ")"} {
|
sl@0
|
549 |
testexprparser {(2*3)} -1
|
sl@0
|
550 |
} {- {} 0 subexpr 2*3 5 operator * 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
551 |
test parseExpr-16.17 {GetLexeme procedure, lexeme is "$"} {
|
sl@0
|
552 |
testexprparser {$wombat} -1
|
sl@0
|
553 |
} {- {} 0 subexpr {$wombat} 2 variable {$wombat} 1 text wombat 0 {}}
|
sl@0
|
554 |
test parseExpr-16.18 "GetLexeme procedure, lexeme is '\"'" {
|
sl@0
|
555 |
testexprparser {"fred"} -1
|
sl@0
|
556 |
} {- {} 0 subexpr {"fred"} 1 text fred 0 {}}
|
sl@0
|
557 |
test parseExpr-16.19 {GetLexeme procedure, lexeme is ","} {
|
sl@0
|
558 |
testexprparser {foo(1,2)} -1
|
sl@0
|
559 |
} {- {} 0 subexpr foo(1,2) 5 operator foo 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
560 |
test parseExpr-16.20 {GetLexeme procedure, lexeme is "*"} {
|
sl@0
|
561 |
testexprparser {$a*$b} -1
|
sl@0
|
562 |
} {- {} 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 {}}
|
sl@0
|
563 |
test parseExpr-16.21 {GetLexeme procedure, lexeme is "/"} {
|
sl@0
|
564 |
testexprparser {5/6} -1
|
sl@0
|
565 |
} {- {} 0 subexpr 5/6 5 operator / 0 subexpr 5 1 text 5 0 subexpr 6 1 text 6 0 {}}
|
sl@0
|
566 |
test parseExpr-16.22 {GetLexeme procedure, lexeme is "%"} {
|
sl@0
|
567 |
testexprparser {5%[xxx]} -1
|
sl@0
|
568 |
} {- {} 0 subexpr {5%[xxx]} 5 operator % 0 subexpr 5 1 text 5 0 subexpr {[xxx]} 1 command {[xxx]} 0 {}}
|
sl@0
|
569 |
test parseExpr-16.23 {GetLexeme procedure, lexeme is "+"} {
|
sl@0
|
570 |
testexprparser {1+2} -1
|
sl@0
|
571 |
} {- {} 0 subexpr 1+2 5 operator + 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
572 |
test parseExpr-16.24 {GetLexeme procedure, lexeme is "-"} {
|
sl@0
|
573 |
testexprparser {.12-0e27} -1
|
sl@0
|
574 |
} {- {} 0 subexpr .12-0e27 5 operator - 0 subexpr .12 1 text .12 0 subexpr 0e27 1 text 0e27 0 {}}
|
sl@0
|
575 |
test parseExpr-16.25 {GetLexeme procedure, lexeme is "?" or ":"} {
|
sl@0
|
576 |
testexprparser {$b? 1 : 0} -1
|
sl@0
|
577 |
} {- {} 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 {}}
|
sl@0
|
578 |
test parseExpr-16.26 {GetLexeme procedure, lexeme is "<"} {
|
sl@0
|
579 |
testexprparser {2<3} -1
|
sl@0
|
580 |
} {- {} 0 subexpr 2<3 5 operator < 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
581 |
test parseExpr-16.27 {GetLexeme procedure, lexeme is "<<"} {
|
sl@0
|
582 |
testexprparser {2<<3} -1
|
sl@0
|
583 |
} {- {} 0 subexpr 2<<3 5 operator << 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
584 |
test parseExpr-16.28 {GetLexeme procedure, lexeme is "<="} {
|
sl@0
|
585 |
testexprparser {2<=3} -1
|
sl@0
|
586 |
} {- {} 0 subexpr 2<=3 5 operator <= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
587 |
test parseExpr-16.29 {GetLexeme procedure, lexeme is ">"} {
|
sl@0
|
588 |
testexprparser {2>3} -1
|
sl@0
|
589 |
} {- {} 0 subexpr 2>3 5 operator > 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
590 |
test parseExpr-16.30 {GetLexeme procedure, lexeme is ">>"} {
|
sl@0
|
591 |
testexprparser {2>>3} -1
|
sl@0
|
592 |
} {- {} 0 subexpr 2>>3 5 operator >> 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
593 |
test parseExpr-16.31 {GetLexeme procedure, lexeme is ">="} {
|
sl@0
|
594 |
testexprparser {2>=3} -1
|
sl@0
|
595 |
} {- {} 0 subexpr 2>=3 5 operator >= 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
596 |
test parseExpr-16.32 {GetLexeme procedure, lexeme is "=="} {
|
sl@0
|
597 |
testexprparser {2==3} -1
|
sl@0
|
598 |
} {- {} 0 subexpr 2==3 5 operator == 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
599 |
test parseExpr-16.33 {GetLexeme procedure, bad lexeme starting with "="} {
|
sl@0
|
600 |
list [catch {testexprparser {2=+3} -1} msg] $msg
|
sl@0
|
601 |
} {1 {syntax error in expression "2=+3": extra tokens at end of expression}}
|
sl@0
|
602 |
test parseExpr-16.34 {GetLexeme procedure, lexeme is "!="} {
|
sl@0
|
603 |
testexprparser {2!=3} -1
|
sl@0
|
604 |
} {- {} 0 subexpr 2!=3 5 operator != 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
605 |
test parseExpr-16.35 {GetLexeme procedure, lexeme is "!"} {
|
sl@0
|
606 |
testexprparser {!2} -1
|
sl@0
|
607 |
} {- {} 0 subexpr !2 3 operator ! 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
608 |
test parseExpr-16.36 {GetLexeme procedure, lexeme is "&&"} {
|
sl@0
|
609 |
testexprparser {2&&3} -1
|
sl@0
|
610 |
} {- {} 0 subexpr 2&&3 5 operator && 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
611 |
test parseExpr-16.37 {GetLexeme procedure, lexeme is "&"} {
|
sl@0
|
612 |
testexprparser {1&2} -1
|
sl@0
|
613 |
} {- {} 0 subexpr 1&2 5 operator & 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
614 |
test parseExpr-16.38 {GetLexeme procedure, lexeme is "^"} {
|
sl@0
|
615 |
testexprparser {1^2} -1
|
sl@0
|
616 |
} {- {} 0 subexpr 1^2 5 operator ^ 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
617 |
test parseExpr-16.39 {GetLexeme procedure, lexeme is "||"} {
|
sl@0
|
618 |
testexprparser {2||3} -1
|
sl@0
|
619 |
} {- {} 0 subexpr 2||3 5 operator || 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
620 |
test parseExpr-16.40 {GetLexeme procedure, lexeme is "|"} {
|
sl@0
|
621 |
testexprparser {1|2} -1
|
sl@0
|
622 |
} {- {} 0 subexpr 1|2 5 operator | 0 subexpr 1 1 text 1 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
623 |
test parseExpr-16.41 {GetLexeme procedure, lexeme is "~"} {
|
sl@0
|
624 |
testexprparser {~2} -1
|
sl@0
|
625 |
} {- {} 0 subexpr ~2 3 operator ~ 0 subexpr 2 1 text 2 0 {}}
|
sl@0
|
626 |
test parseExpr-16.42 {GetLexeme procedure, lexeme is func name} {
|
sl@0
|
627 |
testexprparser {george()} -1
|
sl@0
|
628 |
} {- {} 0 subexpr george() 1 operator george 0 {}}
|
sl@0
|
629 |
test parseExpr-16.43 {GetLexeme procedure, lexeme is func name} {
|
sl@0
|
630 |
testexprparser {harmonic_ratio(2,3)} -1
|
sl@0
|
631 |
} {- {} 0 subexpr harmonic_ratio(2,3) 5 operator harmonic_ratio 0 subexpr 2 1 text 2 0 subexpr 3 1 text 3 0 {}}
|
sl@0
|
632 |
test parseExpr-16.44 {GetLexeme procedure, unknown lexeme} {
|
sl@0
|
633 |
list [catch {testexprparser {@27} -1} msg] $msg
|
sl@0
|
634 |
} {1 {syntax error in expression "@27": character not legal in expressions}}
|
sl@0
|
635 |
|
sl@0
|
636 |
test parseExpr-17.1 {PrependSubExprTokens procedure, expand token array} {
|
sl@0
|
637 |
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
|
sl@0
|
638 |
} {- {} 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 {}}
|
sl@0
|
639 |
|
sl@0
|
640 |
test parseExpr-18.1 {LogSyntaxError procedure, error in expr longer than 60 chars} {
|
sl@0
|
641 |
list [catch {testexprparser {(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)/} -1} msg] $msg
|
sl@0
|
642 |
} {1 {syntax error in expression "(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+0123456)*(+012...": premature end of expression}}
|
sl@0
|
643 |
|
sl@0
|
644 |
test parseExpr-19.1 {TclParseInteger: [Bug 648441]} {
|
sl@0
|
645 |
# Should see this as integer "0" followed by incomplete function "x"
|
sl@0
|
646 |
# Thus, syntax error.
|
sl@0
|
647 |
# If Bug 648441 is not fixed, "0x" will be seen as floating point 0.0
|
sl@0
|
648 |
list [catch {expr 0x} result] $result
|
sl@0
|
649 |
} [list 1 {syntax error in expression "0x": extra tokens at end of expression}]
|
sl@0
|
650 |
|
sl@0
|
651 |
# cleanup
|
sl@0
|
652 |
::tcltest::cleanupTests
|
sl@0
|
653 |
return
|