summaryrefslogtreecommitdiffstats
path: root/generic/tclCompExpr.c
diff options
context:
space:
mode:
authorhobbs <hobbs>2000-05-09 00:00:34 (GMT)
committerhobbs <hobbs>2000-05-09 00:00:34 (GMT)
commit427c904742d9d5aec8068fce38a28be9ae65af08 (patch)
tree1e3bab60e826e937b67fa7d70d97f4f352fe315a /generic/tclCompExpr.c
parent9f7b9b72befea46deb71233146973eea88223af0 (diff)
downloadtcl-427c904742d9d5aec8068fce38a28be9ae65af08.zip
tcl-427c904742d9d5aec8068fce38a28be9ae65af08.tar.gz
tcl-427c904742d9d5aec8068fce38a28be9ae65af08.tar.bz2
* doc/expr.n:
* tests/expr.test: * tests/expr-old.test: added tests for 'eq' and 'ne' * generic/tclExecute.c: * generic/tclCompile.h: added INST_STREQ and INST_STRNEQ opcodes that do strict string comparisons. * generic/tclCompExpr.c: added 'eq' and 'ne' string comparison operators. * generic/tclParseExpr.c (GetLexeme): added 'eq' and 'ne' expr parse terms (string (in)equality check).
Diffstat (limited to 'generic/tclCompExpr.c')
-rw-r--r--generic/tclCompExpr.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/generic/tclCompExpr.c b/generic/tclCompExpr.c
index 0b8fabf..8a781b9 100644
--- a/generic/tclCompExpr.c
+++ b/generic/tclCompExpr.c
@@ -4,11 +4,12 @@
* This file contains the code to compile Tcl expressions.
*
* Copyright (c) 1997 Sun Microsystems, Inc.
+ * Copyright (c) 1998-2000 by Scriptics Corporation.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * RCS: @(#) $Id: tclCompExpr.c,v 1.4 1999/08/19 02:59:08 hobbs Exp $
+ * RCS: @(#) $Id: tclCompExpr.c,v 1.5 2000/05/09 00:00:34 hobbs Exp $
*/
#include "tclInt.h"
@@ -101,6 +102,8 @@ typedef struct ExprInfo {
#define OP_QUESTY 18
#define OP_LNOT 19
#define OP_BITNOT 20
+#define OP_STREQ 21
+#define OP_STRNEQ 22
/*
* Table describing the expression operators. Entries in this table must
@@ -141,6 +144,8 @@ OperatorDesc operatorTable[] = {
{"?", 0},
{"!", 1, INST_LNOT},
{"~", 1, INST_BITNOT},
+ {"eq", 2, INST_STREQ},
+ {"ne", 2, INST_STRNEQ},
{NULL}
};
@@ -536,7 +541,8 @@ CompileSubExpr(exprTokenPtr, infoPtr, envPtr)
infoPtr->hasOperators = 1;
infoPtr->exprIsJustVarRef = 0;
infoPtr->exprIsComparison =
- ((opIndex >= OP_LESS) && (opIndex <= OP_NEQ));
+ (((opIndex >= OP_LESS) && (opIndex <= OP_NEQ))
+ || ((opIndex >= OP_STREQ) && (opIndex <= OP_STRNEQ)));
break;
}