summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--generic/tclParseExpr.c8
-rw-r--r--tests/expr.test5
3 files changed, 17 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 3883a50..7e9544c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-04 Don Porter <dgp@users.sourceforge.net>
+
+ TIP#274 IMPLEMENTATION
+
+ * generic/tclParseExpr.c: Exponentiation operator is now
+ * tests/expr.test: right associative. [Patch 1556802]
+
2006-11-03 Miguel Sofer <msofer@users.sf.net>
* generic/tclBasic.c (TEOVI): fix por possible leak of a Command
diff --git a/generic/tclParseExpr.c b/generic/tclParseExpr.c
index d1044fd..6f9103b 100644
--- a/generic/tclParseExpr.c
+++ b/generic/tclParseExpr.c
@@ -12,7 +12,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.46 2006/11/02 15:58:08 dgp Exp $
+ * RCS: @(#) $Id: tclParseExpr.c,v 1.47 2006/11/05 03:33:56 dgp Exp $
*/
#include "tclInt.h"
@@ -521,8 +521,8 @@ Tcl_ParseExpr(
break;
}
- /* Special association rules for the ternary operators */
if (prec[otherPtr->lexeme] == precedence) {
+ /* Special association rules for the ternary operators. */
if ((otherPtr->lexeme == QUESTION)
&& (lastOrphanPtr->lexeme != COLON)) {
break;
@@ -531,6 +531,10 @@ Tcl_ParseExpr(
&& (nodePtr->lexeme == QUESTION)) {
break;
}
+ /* Right association rules for exponentiation. */
+ if (nodePtr->lexeme == EXPON) {
+ break;
+ }
}
/* Some checks before linking */
diff --git a/tests/expr.test b/tests/expr.test
index 9fc56e5..7064f17 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.64 2006/10/30 16:30:36 dgp Exp $
+# RCS: @(#) $Id: expr.test,v 1.65 2006/11/05 03:33:57 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2.1
@@ -980,6 +980,9 @@ test expr-23.46 {INST_EXPON: Bug 1561260} -body {
test expr-23.47 {INST_EXPON: Bug 1561260} {
expr 2**32*5**32
} 1[string repeat 0 32]
+test expr-23.48 {INST_EXPON: TIP 274: right assoc} {
+expr 2**3**4
+} 2417851639229258349412352
# Some compilers get this wrong; ensure that we work around it correctly
test expr-24.1 {expr edge cases; shifting} {expr int(5)>>32} 0