summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2006-07-05 05:34:42 (GMT)
committerdgp <dgp@users.sourceforge.net>2006-07-05 05:34:42 (GMT)
commitf8202fbf0e8d9c875afd03460d20b5b83c0aa10c (patch)
treedd2a47b4c7d1a184335dede04e8b90d2073b63cf /tests
parent78a8ff907a6cc9f17b52a310bef7c37890273c3c (diff)
downloadtcl-f8202fbf0e8d9c875afd03460d20b5b83c0aa10c.zip
tcl-f8202fbf0e8d9c875afd03460d20b5b83c0aa10c.tar.gz
tcl-f8202fbf0e8d9c875afd03460d20b5b83c0aa10c.tar.bz2
* generic/tclParseExpr.c: Completely new expression parser
that builds a parse tree instead of operating with deep recursion. This corrects reports of stack-blowing crashes parsing long expressions [Bug 906201] and replaces a fundamentally O(N^2) algorithm with an O(N) one [RFE 903765]. The new parser is better able to generate error messages that clearly report both the nature and context of the syntax error [Bugs 1029267, 1381715]. For now, the code for the old parser is still present and can be activated with a "#define OLD_EXPR_PARSER 1". This is for the sake of a clean implementation patch, and for ease of benchmarking. The new parser is non-recursive, so much lighter in stack consumption, but it does use more heap, so there may be cases where parsing of long expressions that succeeded with the old parser will lead to out of memory panics with the new one. There are still more improvements possible on that point, though significant progress may require changes to the Tcl_Token specifications documented for the public Tcl_Parse*() routines. ***POTENTIAL INCOMPATIBILITY*** for any callers that rely on the exact (usually terrible) error messages generated by the old parser. This includes a large number of tests in the test suite. * generic/tclInt.h: Replaced TclParseWhiteSpace() with * generic/tclParse.c: TclParseAllWhiteSpace() which is what * generic/tclParseExpr.c: all the callers really needed. Breaking whitespace runs at newlines is useful only to the command parsing function, and it can call the file scoped routine ParseWhiteSpace() to do that. * tests/expr-old.test: Removed knownBug constraints that masked * tests/expr.test: failures due to revised error messages. * tests/parseExpr.test:
Diffstat (limited to 'tests')
-rw-r--r--tests/expr-old.test6
-rw-r--r--tests/expr.test4
-rw-r--r--tests/parseExpr.test4
3 files changed, 7 insertions, 7 deletions
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 578e697..f4e2a4c 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr-old.test,v 1.34 2006/04/06 18:19:25 dgp Exp $
+# RCS: @(#) $Id: expr-old.test,v 1.35 2006/07/05 05:34:45 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -958,7 +958,7 @@ test expr-old-34.17 {errors in math functions} -constraints testmathfunctions \
list [catch {expr T1(4)} msg] $msg
} -match glob -result {1 {too many arguments for math function*}}
-test expr-old-36.1 {ExprLooksLikeInt procedure} -constraints knownBug -body {
+test expr-old-36.1 {ExprLooksLikeInt procedure} -body {
expr 0289
} -returnCodes error -match glob -result {*invalid octal number*}
test expr-old-36.2 {ExprLooksLikeInt procedure} {
@@ -1118,7 +1118,7 @@ test expr-old-37.24 {Tcl_ExprDouble handles overflows that look like int} \
testexprdouble 17976931348623165[string repeat 0 292]
} {This is a result: Inf}
test expr-old-37.25 {Tcl_ExprDouble and NaN} \
- {knownBug ieeeFloatingPoint testexprdouble} {
+ {ieeeFloatingPoint testexprdouble} {
list [catch {testexprdouble 0.0/0.0} result] $result
} {1 {floating point value is Not a Number}}
diff --git a/tests/expr.test b/tests/expr.test
index 1f84e08..980f0b9 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: expr.test,v 1.54 2006/04/06 18:19:25 dgp Exp $
+# RCS: @(#) $Id: expr.test,v 1.55 2006/07/05 05:34:45 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -6365,7 +6365,7 @@ test expr-39.24 {Tcl_ExprDoubleObj handles overflows that look like int} \
testexprdoubleobj 17976931348623165[string repeat 0 292]
} {This is a result: Inf}
test expr-39.25 {Tcl_ExprDoubleObj and NaN} \
- {knownBug testexprdoubleobj ieeeFloatingPoint} {
+ {testexprdoubleobj ieeeFloatingPoint} {
list [catch {testexprdoubleobj 0.0/0.0} result] $result
} {1 {floating point value is Not a Number}}
diff --git a/tests/parseExpr.test b/tests/parseExpr.test
index 94c429c..7deb551 100644
--- a/tests/parseExpr.test
+++ b/tests/parseExpr.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: parseExpr.test,v 1.21 2006/03/21 18:51:52 dgp Exp $
+# RCS: @(#) $Id: parseExpr.test,v 1.22 2006/07/05 05:34:45 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -620,7 +620,7 @@ test parseExpr-16.4 {GetLexeme procedure, integer lexeme} testexprparser {
test parseExpr-16.5 {GetLexeme procedure, integer lexeme too big} {testexprparser wideIs32bit} {
list [catch {testexprparser {12345678901234567890} -1} msg] $msg
} {1 {integer value too large to represent}}
-test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints {testexprparser knownBug} -body {
+test parseExpr-16.6 {GetLexeme procedure, bad integer lexeme} -constraints testexprparser -body {
testexprparser {0999} -1
} -returnCodes error -match glob -result {*invalid octal number*}
test parseExpr-16.7 {GetLexeme procedure, double lexeme} testexprparser {