[gnumeric] Parsing: Change x^y^z into x^(y^z).
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnumeric] Parsing: Change x^y^z into x^(y^z).
- Date: Wed, 10 Jun 2009 12:13:05 -0400 (EDT)
commit dc8ba63a5d66ff2f0dc62c07af0710d659b0f5fa
Author: Morten Welinder <terra gnome org>
Date: Wed Jun 10 12:12:42 2009 -0400
Parsing: Change x^y^z into x^(y^z).
---
ChangeLog | 5 +++++
NEWS | 1 +
src/parser.y | 8 ++++++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 3f722e0..522001b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-06-10 Morten Welinder <terra gnome org>
+
+ * src/parser.y: Change x^y^z into x^(y^z) to indicate how we
+ parsed it.
+
2009-06-09 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/ranges.c (range_clip_to_finite): adjust limits and add
diff --git a/NEWS b/NEWS
index 25ae6a9..f69a53e 100644
--- a/NEWS
+++ b/NEWS
@@ -31,6 +31,7 @@ Morten:
* Fix NPER problems.
* Implement new functions COT and ACOT. [#585270]
* Fix GCD. [#585271]
+ * Change x^y^z into x^(y^z) to indicate parsing.
--------------------------------------------------------------------------
Gnumeric 1.9.8
diff --git a/src/parser.y b/src/parser.y
index 42bcdaf..c311c74 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -605,13 +605,17 @@ exp: CONSTANT { $$ = $1; }
| exp '/' exp { $$ = build_binop ($1, GNM_EXPR_OP_DIV, $3); }
| exp '^' exp {
GnmExpr *l = $1;
+ GnmExpr *r = $3;
- /* See bug 115941 */
if (is_signed (l)) {
+ /* See bug 115941 */
l = build_unary_op (GNM_EXPR_OP_PAREN, l);
+ } else if (GNM_EXPR_GET_OPER (r) == GNM_EXPR_OP_EXP) {
+ /* Add ()s to x^y^z */
+ r = build_unary_op (GNM_EXPR_OP_PAREN, r);
}
- $$ = build_binop (l, GNM_EXPR_OP_EXP, $3);
+ $$ = build_binop (l, GNM_EXPR_OP_EXP, r);
}
| exp '&' exp { $$ = build_binop ($1, GNM_EXPR_OP_CAT, $3); }
| exp '=' exp { $$ = build_binop ($1, GNM_EXPR_OP_EQUAL, $3); }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]