[gnumeric] parser: handle LOG10(1024) in sheets with ~8500 columns.



commit 79710bd2dbe40559772f4684aeab4f50dec60c8c
Author: Morten Welinder <terra gnome org>
Date:   Sun Jun 13 20:31:38 2010 -0400

    parser: handle LOG10(1024) in sheets with ~8500 columns.

 ChangeLog    |    3 +++
 NEWS         |    1 +
 src/parser.y |   17 ++++++++++++++++-
 3 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index bd2ea0f..cecf094 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-06-13  Morten Welinder  <terra gnome org>
 
+	* src/parser.y (yylex): Fix parsing of calls to LOG2 and LOG10 in
+	sheets with more than ~8500 columns.
+
 	* src/func.c (copy_hash_table_to_ptr_array): Don't test perl
 	samples.
 	(gnm_func_sanity_check1): Check for unwanted space after colon and
diff --git a/NEWS b/NEWS
index 86f762a..bd8721e 100644
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,7 @@ Morten:
 	* Fix RANDLEVY.
 	* Fix hidden-sheet problem.  [#621463]
 	* Improve help text sanity checks.
+	* Fix minor parsing problem.
 
 --------------------------------------------------------------------------
 Gnumeric 1.10.5
diff --git a/src/parser.y b/src/parser.y
index d0461a5..4eb6ec9 100644
--- a/src/parser.y
+++ b/src/parser.y
@@ -995,6 +995,14 @@ ignore_space_after (gunichar c)
 	}
 }
 
+static gboolean
+open_paren (const char *p)
+{
+	while (g_unichar_isspace (g_utf8_get_char (p)))
+		p = g_utf8_next_char (p);
+	return *p == '(';
+}
+
 static int
 yylex (void)
 {
@@ -1159,7 +1167,14 @@ yylex (void)
 	if (c == state->array_row_sep)
 		return eat_space (state, ARRAY_ROW_SEP);
 
-	if (start != (end = state->convs->input.range_ref (&ref, start, state->pos, state->convs))) {
+	end = state->convs->input.range_ref (&ref, start,
+					     state->pos, state->convs);
+	/*
+	 * In order to parse "LOG10(1024)" in sheets with more than ~8500
+	 * columns we do not consider anything a rangeref if it is followed
+	 * by an opening parenthesis.
+	 */
+	if (start != end && !open_paren (end)) {
 		state->ptr = end;
 		if (state->flags & GNM_EXPR_PARSE_FORCE_ABSOLUTE_REFERENCES) {
 			if (ref.a.col_relative) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]