summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--generic/tclParseExpr.c8
-rw-r--r--tests/expr.test10
3 files changed, 18 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 59606cc..c0c3fed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2004-10-04 Donal K. Fellows <donal.k.fellows@man.ac.uk>
+ * generic/tclParseExpr.c (GetLexeme): Ensure that the 'eq' and
+ 'ne' operators are followed by non-alphabetic characters so
+ lexemes can't run together. [Bug 884830]
+
* doc/DictObj.3, doc/dict.n: Clarified that a dictionary is not
order-preserving. [Bug 1032243] Also added another example to
show off more ways of using a dictionary and a few other
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c
index 2a8abec..266466c 100644
--- a/generic/tclParseExpr.c
+++ b/generic/tclParseExpr.c
@@ -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: tclParseExpr.c,v 1.21 2004/04/06 22:25:54 dgp Exp $
+ * RCS: @(#) $Id: tclParseExpr.c,v 1.22 2004/10/04 13:56:37 dkf Exp $
*/
#include "tclInt.h"
@@ -1856,7 +1856,8 @@ GetLexeme(infoPtr)
return TCL_OK;
case 'e':
- if ((src[1] == 'q') && ((infoPtr->lastChar - src) > 1)) {
+ if ((src[1] == 'q') && ((infoPtr->lastChar - src) > 1) &&
+ (infoPtr->lastChar-src==2 || !isalpha(UCHAR(src[2])))) {
infoPtr->lexeme = STREQ;
infoPtr->size = 2;
infoPtr->next = src+2;
@@ -1867,7 +1868,8 @@ GetLexeme(infoPtr)
}
case 'n':
- if ((src[1] == 'e') && ((infoPtr->lastChar - src) > 1)) {
+ if ((src[1] == 'e') && ((infoPtr->lastChar - src) > 1) &&
+ (infoPtr->lastChar-src==2 || !isalpha(UCHAR(src[2])))) {
infoPtr->lexeme = STRNEQ;
infoPtr->size = 2;
infoPtr->next = src+2;
diff --git a/tests/expr.test b/tests/expr.test
index 4cfa615..4cc644e 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.27 2004/09/26 16:36:05 msofer Exp $
+# RCS: @(#) $Id: expr.test,v 1.28 2004/10/04 13:56:37 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -314,6 +314,14 @@ test expr-8.21 {CompileBitAndExpr: error in equality expr} {
catch {expr a eq b} msg
set msg
} {syntax error in expression "a eq b": variable references require preceding $}
+test expr-8.22 {CompileBitAndExpr: error in equality expr} {
+ catch {expr {false eqfalse}} msg
+ set msg
+} {syntax error in expression "false eqfalse": extra tokens at end of expression}
+test expr-8.23 {CompileBitAndExpr: error in equality expr} {
+ catch {expr {false nefalse}} msg
+ set msg
+} {syntax error in expression "false nefalse": extra tokens at end of expression}
test expr-9.1 {CompileRelationalExpr: just shift expr} {expr 3<<2} 12
test expr-9.2 {CompileRelationalExpr: just shift expr} {expr 0xff>>2} 63