pspp-dev
[Top][All Lists]
Advanced

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

Re: var_is_valid_name


From: Ben Pfaff
Subject: Re: var_is_valid_name
Date: Thu, 26 Mar 2009 16:58:13 -0700
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

John Darrington <address@hidden> writes:

> On Thu, Mar 26, 2009 at 09:29:08AM +0100, Matej Kovacic wrote:
>      
>      I am sending two test datasets - one contains variables with slovenian
>      characters, the other data with slovenian characters.
>
> One of the problems that manifests itself with the test_variables.sav
> file is caused by Pspp's somewhat strict rules about what it considers
> to be a valid variable name.
>
> If I change the implementation of var_is_valid_name to a very
> promiscuous {return true;} then this problem goes away.  This function
> is only used in three files:
>
>  src/data/por-file-reader.c
>  src/data/sys-file-reader.c
>  src/ui/gui/psppire-dict.c
>
> I think it exists mainly for historical reasons.  Can we get rid of
> it?

I think that getting rid of var_is_valid_name() would do more
than what we want.  In particular, I think that a user of the GUI
would then be able to create a variable that could not be used in
syntax, which means that it could not be used in GUI procedures
that internally use syntax.  Variable names that would be
troublesome include those that start with a digit (or consist
only of digits), or contain special characters such as spaces or
double quotes.

The real problem here is that we are disallowing an unreasonable
number of characters in identifiers, right?  To fix that, we can
adjust lex_is_id1 and lex_is_id2.  Perhaps all we need to do is
to add "|| c >= 128" to the test in lex_is_id1().  Although that
assumes that we are using a sane character encoding such as UTF-8
or ISO Latin-#, we seem to be moving internally toward UTF-8 for
everything anyhow.
-- 
"A computer is a state machine.
 Threads are for people who cant [sic] program state machines."
--Alan Cox




reply via email to

[Prev in Thread] Current Thread [Next in Thread]