~ubuntu-branches/ubuntu/feisty/gnumeric/feisty-security

« back to all changes in this revision

Viewing changes to src/parser.y

  • Committer: Bazaar Package Importer
  • Author(s): Gauvain Pocentek
  • Date: 2006-11-14 14:02:03 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061114140203-iv3j2aii3vch6isl
Tags: 1.7.2-1ubuntu1
* Merge with debian experimental:
  - debian/control, debian/*-gtk-*, debian/rules,
    debian/shlibs.local: Xubuntu changes for
    gtk/gnome multibuild.
  - run intltool-update in po*
  - Build Depend on intltool

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *    Almer S. Tigelaar (almer@gnome.org)
14
14
 */
15
15
#include <gnumeric-config.h>
16
 
#include <glib/gi18n.h>
 
16
#include <glib/gi18n-lib.h>
17
17
#include "gnumeric.h"
18
18
#include "number-match.h"
19
19
#include "expr.h"
186
186
 
187
187
/* Bison/Yacc internals */
188
188
static int yylex (void);
189
 
static int yyerror (const char *s);
 
189
static int yyerror (char const *s);
190
190
 
191
191
typedef struct {
192
192
        char const *ptr;        /* current position of the lexer */
1356
1356
 * gnm_expr_parse_str:
1357
1357
 *
1358
1358
 * @expr_text   : The string to parse.
 
1359
 * @pp          : #GnmParsePos
1359
1360
 * @flags       : See parse-utils for descriptions
 
1361
 * @convs       : optionally NULL #GnmExprConventions
1360
1362
 * @error       : optionally NULL ptr to store details of error.
1361
1363
 *
1362
1364
 * Parse a string. if @error is non-null it will be assumed that the
1363
1365
 * caller has passed a pointer to a GnmParseError struct AND that it will
1364
1366
 * take responsibility for freeing that struct and its contents.
1365
1367
 * with parse_error_free.
 
1368
 * If @convs is NULL use the conventions from @pp.
1366
1369
 **/
1367
1370
GnmExprTop const *
1368
 
gnm_expr_parse_str (char const *expr_text, GnmParsePos const *pos,
 
1371
gnm_expr_parse_str (char const *expr_text, GnmParsePos const *pp,
1369
1372
                    GnmExprParseFlags flags,
1370
1373
                    GnmExprConventions const *convs,
1371
1374
                    GnmParseError *error)
1374
1377
        ParserState pstate;
1375
1378
 
1376
1379
        g_return_val_if_fail (expr_text != NULL, NULL);
1377
 
        g_return_val_if_fail (convs != NULL, NULL);
 
1380
        g_return_val_if_fail (pp != NULL, NULL);
1378
1381
 
1379
1382
        pstate.start = pstate.ptr = expr_text;
1380
 
        pstate.pos   = pos;
 
1383
        pstate.pos   = pp;
1381
1384
 
1382
1385
        pstate.force_absolute_col_references            = flags & GNM_EXPR_PARSE_FORCE_ABSOLUTE_COL_REFERENCES;
1383
1386
        pstate.force_absolute_row_references            = flags & GNM_EXPR_PARSE_FORCE_ABSOLUTE_ROW_REFERENCES;
1384
1387
        pstate.force_explicit_sheet_references          = flags & GNM_EXPR_PARSE_FORCE_EXPLICIT_SHEET_REFERENCES;
1385
1388
        pstate.unknown_names_are_strings                = flags & GNM_EXPR_PARSE_UNKNOWN_NAMES_ARE_STRINGS;
1386
 
        pstate.convs                                    = convs;
1387
 
 
1388
 
        pstate.decimal_point = convs->decimal_sep_dot
 
1389
        pstate.convs                                    =
 
1390
                (NULL != convs) ? convs : ((NULL != pp->sheet) ? pp->sheet->convs : gnm_expr_conventions_default);
 
1391
 
 
1392
 
 
1393
        pstate.decimal_point = pstate.convs->decimal_sep_dot
1389
1394
                ? '.'
1390
1395
                : g_utf8_get_char (format_get_decimal ()->str); /* FIXME: one char handled.  */
1391
 
        pstate.separator = convs->argument_sep_semicolon
 
1396
        pstate.separator = pstate.convs->argument_sep_semicolon
1392
1397
                ? ';'
1393
1398
                : format_get_arg_sep ();
1394
 
        pstate.array_col_separator = convs->array_col_sep_comma
 
1399
        pstate.array_col_separator = pstate.convs->array_col_sep_comma
1395
1400
                ? ','
1396
1401
                : format_get_col_sep ();
1397
1402
 
1401
1406
        if (deallocate_stack == NULL)
1402
1407
                deallocate_init ();
1403
1408
 
1404
 
        g_return_val_if_fail (pstate.pos != NULL, NULL);
1405
 
        g_return_val_if_fail (pstate.ptr != NULL, NULL);
1406
1409
        g_return_val_if_fail (state == NULL, NULL);
1407
1410
 
1408
1411
        state = &pstate;