Commit 045863cb authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Make the error handling more consistent.


2002-09-26  Jody Goldberg <jody@gnome.org>

	* src/parser.y : Make the error handling more consistent.

	* src/expr.c (gnm_expr_list_as_string) : optimize.

	* src/dependent.c (link_expr_dep) : place holder for intersection.  I
	  think it is ok to palm all of this off until eval time (asusming we get
	  eval time depends working)

2002-09-26  Jody Goldberg <jody@gnome.org>

	* configure.in : add openoffice
	* plugins/Makefile.am (SUBDIRS) : add openoffice

2002-09-26  Jody Goldberg <jody@gnome.org>

	* src/workbook-control-gui.c (cb_realize) : grab focus for current
	sheet.

2002-09-25  Jody Goldberg <jody@gnome.org>

	* src/expr.c (gnm_expr_is_rangeref) : new.

	* src/parser.y (yylex) : support space as the intersection operator.
parent 846f5a1e
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/parser.y : Make the error handling more consistent.
* src/expr.c (gnm_expr_list_as_string) : optimize.
* src/dependent.c (link_expr_dep) : place holder for intersection. I
think it is ok to palm all of this off until eval time (asusming we get
eval time depends working)
2002-09-26 Jody Goldberg <jody@gnome.org>
* configure.in : add openoffice
* plugins/Makefile.am (SUBDIRS) : add openoffice
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_realize) : grab focus for current
sheet.
2002-09-25 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook.c (workbook_sheet_reorganize): add missing call
to post_sheet_index_change
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_is_rangeref) : new.
* src/parser.y (yylex) : support space as the intersection operator.
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/parser.y : begin support for intersection and sets, still needs
......
......@@ -30,6 +30,7 @@ Jody:
* Make the location status box smarter about named ranges
* Begin support for intersection
* Start parsing range sets
* Simple OpenOffice importer (lots more to do)
Michael Meeks:
* Spruce up the CORBA code to use some bonobo utils.
......
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/parser.y : Make the error handling more consistent.
* src/expr.c (gnm_expr_list_as_string) : optimize.
* src/dependent.c (link_expr_dep) : place holder for intersection. I
think it is ok to palm all of this off until eval time (asusming we get
eval time depends working)
2002-09-26 Jody Goldberg <jody@gnome.org>
* configure.in : add openoffice
* plugins/Makefile.am (SUBDIRS) : add openoffice
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_realize) : grab focus for current
sheet.
2002-09-25 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook.c (workbook_sheet_reorganize): add missing call
to post_sheet_index_change
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_is_rangeref) : new.
* src/parser.y (yylex) : support space as the intersection operator.
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/parser.y : begin support for intersection and sets, still needs
......
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/parser.y : Make the error handling more consistent.
* src/expr.c (gnm_expr_list_as_string) : optimize.
* src/dependent.c (link_expr_dep) : place holder for intersection. I
think it is ok to palm all of this off until eval time (asusming we get
eval time depends working)
2002-09-26 Jody Goldberg <jody@gnome.org>
* configure.in : add openoffice
* plugins/Makefile.am (SUBDIRS) : add openoffice
2002-09-26 Jody Goldberg <jody@gnome.org>
* src/workbook-control-gui.c (cb_realize) : grab focus for current
sheet.
2002-09-25 Andreas J. Guelzow <aguelzow@taliesin.ca>
* src/workbook.c (workbook_sheet_reorganize): add missing call
to post_sheet_index_change
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/expr.c (gnm_expr_is_rangeref) : new.
* src/parser.y (yylex) : support space as the intersection operator.
2002-09-25 Jody Goldberg <jody@gnome.org>
* src/parser.y : begin support for intersection and sets, still needs
......
......@@ -771,6 +771,7 @@ plugins/qpro/Makefile
plugins/plan-perfect/Makefile
plugins/xml_sax/Makefile
plugins/applix/Makefile
plugins/openoffice/Makefile
plugins/psiconv/Makefile
plugins/mps/Makefile
plugins/sample_datasource/Makefile
......
......@@ -49,7 +49,7 @@ PSICONV_DIR=
endif
SUBDIRS_FILE_FORMATS = excel lotus-123 oleo sc sylk xbase html dif qpro \
plan-perfect xml_sax applix mps $(PSICONV_DIR)
plan-perfect xml_sax applix mps openoffice $(PSICONV_DIR)
SUBDIRS_FUNCTIONS = numtheory fn-database fn-date fn-eng fn-financial fn-info \
fn-logical fn-complex fn-lookup fn-math fn-stat fn-string fn-random \
......
2002-09-26 Jody Goldberg <jody@gnome.org>
* ms-formula-read.c (ms_excel_parse_formula) : supply handling of
pgts 26 & 27. We can ignore them but they frequently wrap the
intersection operator, the export will be a pain in the butt.
2002-09-25 Jody Goldberg <jody@gnome.org>
* ms-formula-read.c (binary_ops) : enable intersection
......
......@@ -1234,11 +1234,6 @@ ms_excel_parse_formula (ExcelWorkbook const *ewb,
}
break;
case FORMULA_PTG_MEM_FUNC:
/* Can I just ignore this ? */
ptg_length = 2; /* + GSF_LE_GET_GUINT16 (cur); */
break;
case FORMULA_PTG_REF_ERR:
ptg_length = (ver >= MS_BIFF_V8) ? 4 : 3;
parse_list_push_raw (&stack, value_new_error (NULL, gnumeric_err_REF));
......@@ -1296,6 +1291,29 @@ ms_excel_parse_formula (ExcelWorkbook const *ewb,
break;
}
case FORMULA_PTG_MEM_AREA :
/* read the sub expression */
ptg_length = GSF_LE_GET_GUINT16 (cur+4),
parse_list_push (&stack, ms_excel_parse_formula (
ewb, esheet, fn_col, fn_row, cur+6, ptg_length,
shared, array_element));
/* ignore the cached rectangles */
ptg_length += 6 /* 4 reserved 2 len */ + 2 + /* ref count */
6 * GSF_LE_GET_GUINT16 (cur + ptg_length);
break;
case FORMULA_PTG_MEM_ERR :
/* ignore this, we handle at run time */
ptg_length = 6;
break;
case FORMULA_PTG_MEM_FUNC:
/* ignore this, we handle at run time */
ptg_length = 2;
break;
case FORMULA_PTG_NAME_X : { /* FIXME: Not using sheet_idx at all ... */
GnmExpr const *tree;
guint16 extn_name_idx; /* 1 based */
......
......@@ -1479,8 +1479,8 @@ xml_sax_file_open (GnumFileOpener const *fo, IOContext *io_context,
{
XMLSaxParseState state;
g_return_if_fail (wb_view != NULL);
g_return_if_fail (input != NULL);
g_return_if_fail (IS_WORKBOOK_VIEW (wb_view));
g_return_if_fail (GSF_IS_INPUT (input));
/* init */
state.context = io_context;
......
2002-09-26 Jody Goldberg <jody@gnome.org>
* POTFILES.in : add openoffice
2002-09-26 Christian Neumair <chris@gnome-de.org>
* de.po: Updated German translation
......
......@@ -60,6 +60,8 @@ plugins/numtheory/numtheory.c
plugins/numtheory/plugin.xml.in
plugins/oleo/oleo.c
plugins/oleo/plugin.xml.in
plugins/openoffice/openoffice-read.c
plugins/openoffice/plugin.xml.in
plugins/perl/plugin.xml.in
plugins/plan-perfect/pln.c
plugins/plan-perfect/plugin.xml.in
......
......@@ -717,10 +717,12 @@ link_expr_dep (Dependent *dep, CellPos const *pos, GnmExpr const *tree)
return link_expr_dep (dep, pos, tree->binary.value_a) |
link_expr_dep (dep, pos, tree->binary.value_b);
case GNM_EXPR_OP_ANY_UNARY : return link_expr_dep (dep, pos, tree->unary.value);
case GNM_EXPR_OP_CELLREF : return link_single_dep (dep, pos, &tree->cellref.ref);
case GNM_EXPR_OP_CELLREF : return link_single_dep (dep, pos, &tree->cellref.ref);
case GNM_EXPR_OP_CONSTANT:
/* TODO: use implicit intersection */
/* TODO: pass in eval flags so that we can use implicit
* intersection
*/
if (VALUE_CELLRANGE == tree->constant.value->type)
return link_cellrange_dep (dep, pos,
&tree->constant.value->v_range.cell.a,
......@@ -780,6 +782,7 @@ link_expr_dep (Dependent *dep, CellPos const *pos, GnmExpr const *tree)
return res;
}
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
return DEPENDENT_NO_FLAG; /* handled at run time */
default:
......@@ -862,6 +865,10 @@ unlink_expr_dep (Dependent *dep, CellPos const *pos, GnmExpr const *tree)
return;
}
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
return;
default:
g_warning ("Unknown Operation type, dependencies lost");
break;
......
......@@ -1104,12 +1104,14 @@ do_expr_as_string (GnmExpr const *expr, ParsePos const *pp,
{ "%", 5, 0, 0 }, /* Percentage (NOT MODULO) */
{ NULL, 0, 0, 0 }, /* Array */
{ NULL, 0, 0, 0 }, /* Set */
{ NULL, 0, 0, 0 }, /* Range Ctor */
{ NULL, 0, 0, 0 } /* intersection */
{ ":", 1, 1, 0 }, /* Range Ctor */
{ " ", 1, 1, 0 } /* Intersection */
};
int const op = expr->any.oper;
switch (op) {
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
case GNM_EXPR_OP_ANY_BINARY: {
char *a, *b, *res;
char const *opname;
......@@ -1158,13 +1160,10 @@ do_expr_as_string (GnmExpr const *expr, ParsePos const *pp,
case GNM_EXPR_OP_FUNCALL: {
GnmExprList const * const arg_list = expr->func.arg_list;
if (arg_list != NULL) {
char *sum = gnm_expr_list_as_string (arg_list, pp);
char *res = g_strconcat (function_def_get_name (expr->func.func),
"(", sum, ")", NULL);
g_free (sum);
return res;
} else
if (arg_list != NULL)
return gnm_expr_list_as_string (arg_list, pp,
function_def_get_name (expr->func.func));
else
return g_strconcat (function_def_get_name (expr->func.func),
"()", NULL);
}
......@@ -1233,23 +1232,9 @@ do_expr_as_string (GnmExpr const *expr, ParsePos const *pp,
}
case GNM_EXPR_OP_SET:
return gnm_expr_list_as_string (expr->set.set, pp);
case GNM_EXPR_OP_RANGE_CTOR: {
char *a, *b, *res;
a = do_expr_as_string (expr->binary.value_a, pp, 0);
b = do_expr_as_string (expr->binary.value_b, pp, 0);
res = g_strconcat (a, ":", b, NULL);
g_free (a);
g_free (b);
return res;
}
}
return gnm_expr_list_as_string (expr->set.set, pp, "");
};
g_assert_not_reached ();
return g_strdup ("0");
}
......@@ -1928,6 +1913,47 @@ gnm_expr_get_range (GnmExpr const *expr)
}
}
/**
* gnm_expr_is_rangeref :
* @expr :
*
* Returns TRUE if the expression can generate a reference.
* NOTE : in the future it would be nice to know if a function
* can return a reference to tighten that up a bit.
**/
gboolean
gnm_expr_is_rangeref (GnmExpr const *expr)
{
g_return_val_if_fail (expr != NULL, FALSE);
switch (expr->any.oper) {
/* would be better if we could differential which functions can return refs */
case GNM_EXPR_OP_FUNCALL:
/* a set in a set, do we need this ? */
case GNM_EXPR_OP_SET:
case GNM_EXPR_OP_RANGE_CTOR:
case GNM_EXPR_OP_INTERSECT:
case GNM_EXPR_OP_CELLREF:
return TRUE;
case GNM_EXPR_OP_CONSTANT:
if (expr->constant.value->type == VALUE_CELLRANGE)
return TRUE;
return FALSE;
case GNM_EXPR_OP_NAME:
if (expr->name.name->active && !expr->name.name->builtin)
return gnm_expr_is_rangeref (expr->name.name->t.expr_tree);
return FALSE;
case GNM_EXPR_OP_ARRAY: /* I don't think this is possible */
default :
return FALSE;
};
}
void
gnm_expr_list_unref (GnmExprList *list)
{
......@@ -1957,38 +1983,42 @@ gnm_expr_list_eq (GnmExprList const *la, GnmExprList const *lb)
}
char *
gnm_expr_list_as_string (GnmExprList const *list, ParsePos const *pp)
gnm_expr_list_as_string (GnmExprList const *list, ParsePos const *pp,
char const *prefix)
{
int i, len = 0;
int i, len = 0, *lengths;
int argc = gnm_expr_list_length ((GnmExprList *)list);
char sep[2] = { '\0', '\0' };
char *sum, **args;
char sep, *sum, *ptr, **args;
GnmExprList const *l;
sep[0] = format_get_arg_sep ();
sep = format_get_arg_sep ();
i = 0;
args = g_malloc (sizeof (char *) * argc);
args = g_alloca (sizeof (char *) * argc);
lengths = g_alloca (sizeof (int) * argc);
for (l = list; l; l = l->next, i++) {
GnmExpr *t = l->data;
args[i] = do_expr_as_string (t, pp, 0);
len += strlen (args[i]) + 1;
args[i] = do_expr_as_string (l->data, pp, 0);
len += 1 + (lengths[i] = strlen (args[i]));
}
len++;
sum = g_malloc (len + 2);
i = 0;
sum[0] = 0;
for (l = list; l != NULL; l = l->next) {
strcat (sum, args[i++]);
if (l->next)
strcat (sum, sep);
i = strlen (prefix);
sum = g_malloc (i + len + 4);
ptr = sum;
strcpy (ptr, prefix);
ptr += i;
*ptr++ = '(';
for (l = list; l != NULL; ) {
strcpy (ptr, *args++);
ptr += *lengths++;
l = l->next;
if (l != NULL)
*ptr++ = sep;
}
ptr[0] = ')';
ptr[1] = '\0';
for (i = 0; i < argc; i++)
g_free (args[i]);
g_free (args);
while (argc-- > 0)
g_free (*(--args));
return sum;
}
......
......@@ -62,6 +62,7 @@ FunctionDefinition *gnm_expr_get_func_def (GnmExpr const *expr);
void gnm_expr_ref (GnmExpr const *expr);
void gnm_expr_unref (GnmExpr const *expr);
gboolean gnm_expr_is_shared (GnmExpr const *expr);
gboolean gnm_expr_is_rangeref (GnmExpr const *expr);
gboolean gnm_expr_equal (GnmExpr const *a, GnmExpr const *b);
char *gnm_expr_as_string (GnmExpr const *expr, ParsePos const *fp);
void gnm_expr_get_boundingbox (GnmExpr const *expr, Range *bound);
......@@ -103,8 +104,9 @@ Value *gnm_expr_eval (GnmExpr const *expr, EvalPos const *pos,
#define gnm_expr_list_length g_slist_length
#define gnm_expr_list_free g_slist_free
void gnm_expr_list_unref (GnmExprList *list);
char *gnm_expr_list_as_string (GnmExprList const *list, ParsePos const *p);
gboolean gnm_expr_list_equal (GnmExprList const *a, GnmExprList const *b);
char *gnm_expr_list_as_string (GnmExprList const *list, ParsePos const *p,
char const *prefix);
/*****************************************************************************/
......
......@@ -43,7 +43,8 @@ typedef enum {
PERR_SINGLE_RANGE,
PERR_3D_NAME,
PERR_MULTIPLE_EXPRESSIONS,
PERR_INVALID_EMPTY
PERR_INVALID_EMPTY,
PERR_SET_CONTENT_MUST_BE_RANGE
} ParseErrorID;
/* In parser.y */
......
......@@ -181,8 +181,6 @@ unregister_allocation (void const *data)
/* ------------------------------------------------------------------------- */
#define ERROR -1
/* Bison/Yacc internals */
static int yylex (void);
static int yyerror (const char *s);
......@@ -220,7 +218,7 @@ typedef struct {
/* The error returned from the */
static ParserState *state;
static int
static void
gnumeric_parse_error (ParserState *state, ParseErrorID id, char *message, int end, int relative_begin)
{
if (state->error != NULL) {
......@@ -230,8 +228,6 @@ gnumeric_parse_error (ParserState *state, ParseErrorID id, char *message, int en
state->error->end_char = end;
} else
g_free (message);
return ERROR;
}
static GnmExpr *
......@@ -342,15 +338,31 @@ build_range_ctor (GnmExpr *l, GnmExpr *r, GnmExpr *validate)
static GnmExpr *
build_intersect (GnmExpr *l, GnmExpr *r)
{
#if 0
gnumeric_parse_error (state, PERR_UNEXPECTED_TOKEN,
_("Constructed ranges use simple references"),
if (gnm_expr_is_rangeref (l) && gnm_expr_is_rangeref (r))
return build_binop (l, GNM_EXPR_OP_INTERSECT, r);
gnumeric_parse_error (
state, PERR_SET_CONTENT_MUST_BE_RANGE,
g_strdup (_("All entries in the set must be references")),
state->expr_text - state->expr_backup, 0);
return NULL;
}
static GnmExpr *
build_set (GnmExprList *list)
{
/* verify that every thing is a ref */
GnmExprList *ptr;
for (ptr = list; ptr != NULL ; ptr = ptr->next)
if (!gnm_expr_is_rangeref (ptr->data)) {
gnumeric_parse_error (
state, PERR_SET_CONTENT_MUST_BE_RANGE,
g_strdup (_("All entries in the set must be references")),
state->expr_text - state->expr_backup, 0);
return NULL;
}
}
#endif
return build_binop (l, GNM_EXPR_OP_INTERSECT, r);
}
unregister_allocation (list);
return register_expr_allocation (gnm_expr_new_set (list));
}
/**
......@@ -425,11 +437,11 @@ parser_sheet_by_name (Workbook *wb, GnmExpr *name_expr)
!state->use_excel_reference_conventions && *name == '$')
sheet = workbook_sheet_by_name (wb, name+1);
if (sheet == NULL) {
if (sheet == NULL)
gnumeric_parse_error (state, PERR_UNKNOWN_SHEET,
g_strdup_printf (_("Unknown sheet '%s'"), name),
state->expr_text - state->expr_backup, strlen (name));
}
return sheet;
}
......@@ -518,13 +530,19 @@ exp: CONSTANT { $$ = $1; }
gnumeric_parse_error (state, PERR_INVALID_EMPTY,
g_strdup_printf (_("() is an invalid expression")),
state->expr_text - state->expr_backup + 1, 0);
} else if ($2->next != NULL) {
unregister_allocation ($2);
$$ = register_expr_allocation (gnm_expr_new_set ($2));
YYERROR;
} else {
unregister_allocation ($2);
$$ = register_expr_allocation ($2->data);
gnm_expr_list_free ($2);
if ($2->next == NULL) {
$$ = register_expr_allocation ($2->data);
/* NOTE : free list not content */
gnm_expr_list_free ($2);
} else {
$$ = build_set ($2);
if ($$ == NULL) {
YYERROR;
}
}
}
}
| '{' array_cols '}' {
......@@ -556,9 +574,10 @@ exp: CONSTANT { $$ = $1; }
state->expr_text - state->expr_backup + 1, strlen (name));
}
if (expr_name == NULL) {
YYERROR;
}
unregister_allocation ($2); gnm_expr_unref ($2);
if (expr_name == NULL)
return ERROR;
$$ = register_expr_allocation (gnm_expr_new_name (expr_name, $1.first, NULL));
}
| '[' string_opt_quote ']' string_opt_quote {
......@@ -571,25 +590,19 @@ exp: CONSTANT { $$ = $1; }
pos.wb = application_workbook_get_by_name (wb_name);
if (pos.wb == NULL) {
int retval = gnumeric_parse_error (state, PERR_UNKNOWN_WORKBOOK,
gnumeric_parse_error (state, PERR_UNKNOWN_WORKBOOK,
g_strdup_printf (_("Unknown workbook '%s'"), wb_name),
state->expr_text - state->expr_backup + 1, strlen (name));
unregister_allocation ($4); gnm_expr_unref ($4);
unregister_allocation ($2); gnm_expr_unref ($2);
return retval;
YYERROR;
}
expr_name = expr_name_lookup (&pos, name);
if (expr_name == NULL) {
int retval = gnumeric_parse_error (state, PERR_UNKNOWN_NAME,
gnumeric_parse_error (state, PERR_UNKNOWN_NAME,
g_strdup_printf (_("Name '%s' does not exist in workbook '%s'"),
name, wb_name),
state->expr_text - state->expr_backup + 1, strlen (name));
unregister_allocation ($4); gnm_expr_unref ($4);
unregister_allocation ($2); gnm_expr_unref ($2);
return retval;
YYERROR;
} else {
unregister_allocation ($4); gnm_expr_unref ($4);
unregister_allocation ($2); gnm_expr_unref ($2);
......@@ -626,8 +639,9 @@ string_opt_quote : STRING
sheetref: string_opt_quote SHEET_SEP {
Sheet *sheet = parser_sheet_by_name (state->pos->wb, $1);
unregister_allocation ($1); gnm_expr_unref ($1);
if (sheet == NULL)
return ERROR;
if (sheet == NULL) {
YYERROR;
}
$$.first = sheet;
$$.last = NULL;
}
......@@ -635,11 +649,12 @@ sheetref: string_opt_quote SHEET_SEP {
Sheet *a_sheet = parser_sheet_by_name (state->pos->wb, $1);
Sheet *b_sheet = parser_sheet_by_name (state->pos->wb, $3);
if (a_sheet == NULL || b_sheet == NULL) {
YYERROR;
}
unregister_allocation ($1); gnm_expr_unref ($1);
unregister_allocation ($3); gnm_expr_unref ($3);
if (a_sheet == NULL || b_sheet == NULL)
return ERROR;
$$.first = a_sheet;
$$.last = b_sheet;
}
......@@ -649,11 +664,12 @@ sheetref: string_opt_quote SHEET_SEP {
$2->constant.value->v_str.val->str);
Sheet *sheet = parser_sheet_by_name (wb, $4);
if (sheet == NULL) {
YYERROR;
}
unregister_allocation ($2); gnm_expr_unref ($2);
unregister_allocation ($4); gnm_expr_unref ($4);
if (sheet == NULL)
return ERROR;
$$.first = sheet;
$$.last = NULL;
}
......@@ -663,12 +679,13 @@ sheetref: string_opt_quote SHEET_SEP {
Sheet *a_sheet = parser_sheet_by_name (wb, $4);
Sheet *b_sheet = parser_sheet_by_name (wb, $6);
if (a_sheet == NULL || b_sheet == NULL) {
YYERROR;
}
unregister_allocation ($2); gnm_expr_unref ($2);
unregister_allocation ($4); gnm_expr_unref ($4);
unregister_allocation ($6); gnm_expr_unref ($6);
if (a_sheet == NULL || b_sheet == NULL)
return ERROR;
$$.first = a_sheet;
$$.last = b_sheet;
}
......@@ -676,10 +693,14 @@ sheetref: string_opt_quote SHEET_SEP {
cellref: RANGEREF { $$ = $1; }
| function RANGE_SEP function { $$ = build_range_ctor ($1, $3, NULL); }
| RANGEREF RANGE_SEP function
{ $$ = build_range_ctor ($1, $3, $1); if ($$ == NULL) return ERROR; }
| function RANGE_SEP RANGEREF
{ $$ = build_range_ctor ($1, $3, $3); if ($$ == NULL) return ERROR; }
| RANGEREF RANGE_SEP function {
$$ = build_range_ctor ($1, $3, $1);
if ($$ == NULL) { YYERROR; }
}
| function RANGE_SEP RANGEREF {
$$ = build_range_ctor ($1, $3, $3);
if ($$ == NULL) { YYERROR; }
}
;
arg_list: exp {
......@@ -722,9 +743,10 @@ array_row: array_exp {
$$ = g_slist_prepend ($3, $1);
register_expr_list_allocation ($$);
} else {
return gnumeric_parse_error (state, PERR_INVALID_ARRAY_SEPARATOR,
gnumeric_parse_error (state, PERR_INVALID_ARRAY_SEPARATOR,
g_strdup_printf (_("The character %c cannot be used to separate array elements"),
state->array_col_separator), state->expr_text - state->expr_backup + 1, 1);
YYERROR;
}
}
| array_exp '\\' array_row {
......@@ -735,9 +757,10 @@ array_row: array_exp {
register_expr_list_allocation ($$);
} else {
/* FIXME: Is this the right error to display? */
return gnumeric_parse_error (state, PERR_INVALID_ARRAY_SEPARATOR,
gnumeric_parse_error (state, PERR_INVALID_ARRAY_SEPARATOR,
g_strdup_printf (_("The character %c cannot be used to separate array elements"),
state->array_col_separator), state->expr_text - state->expr_backup + 1, 1);
YYERROR;
}
}
| { $$ = NULL; }
......@@ -801,9 +824,14 @@ yylex (void)
char const *start, *end;
RangeRef ref;
gboolean is_number = FALSE;
gboolean is_space = FALSE;
while (g_unichar_isspace (g_utf8_get_char (state->expr_text)))
while (g_unichar_isspace (g_utf8_get_char (state->expr_text))) {
state->expr_text = g_utf8_next_char (state->expr_text);
is_space = TRUE;
}
if (is_space)
return ' ';
start = state->expr_text;
c = g_utf8_get_char (start);
......
......@@ -4359,7 +4359,8 @@ cb_realize (GtkWindow *toplevel, WorkbookControlGUI *wbcg)
allocation = &GTK_WIDGET (toplevel)->allocation;
gtk_window_set_default_size (toplevel,
allocation->width, allocation->height);
allocation->width, allocation->height);
wbcg_focus_cur_scg (wbcg);
}
static void
......@@ -4852,16 +4853,15 @@ wbcg_get_label_for_position (WorkbookControlGUI *wbcg, GtkWidget *source,
static gboolean
cb_wbcg_drag_motion (GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time, WorkbookControlGUI *wbcg)
gint x, gint y, guint time, WorkbookControlGUI *wbcg)
{
GtkWidget *source_widget, *arrow;
GtkWidget *source_widget;
source_widget = gtk_drag_get_source_widget (context);
if (IS_EDITABLE_LABEL (source_widget)) {
GtkWidget *label;
/*
* The user wants to reorder sheets. We simulate a
/* The user wants to reorder sheets. We simulate a
* drag motion over a label.
*/
label = wbcg_get_label_for_position (wbcg, source_widget, x);
......@@ -4874,7 +4874,7 @@ cb_wbcg_drag_motion (GtkWidget *widget, GdkDragContext *context,