[GRASS-dev] Re: [GRASS-SVN] r46717 -
grass/branches/releasebranch_6_4/scripts/v.build.all
Glynn Clements
glynn at gclements.plus.com
Thu Jun 30 19:48:37 EDT 2011
Hamish wrote:
> > > > > CMD="v.build map=${VECT}@${MAPSET}"
> > > > > - g.message "$CMD"
> > > > > + g.message message="$CMD"
> Hamish:
> > > Needed in this case because the string contains a '=',
> > > which confuses the parser.
> Glynn:
> > That should really be fixed in the parser. Even in 6.x, an
> > option name cannot contain a space.
>
> it's more general than that, e.g. this would need the option=
> to be specified:
> g.message message="minimum=[$min]"
>
> as the short-cut version will fail:
> g.message "minimum=[$min]"
That's unavoidable. If an option value begins with a sequence of
alphanumerics followed immediately by an "=", the option name must be
given.
Similarly, if the option value can be arbitrary text, the option name
must be given both to avoid this issue and to correctly handle the
case where the value starts with a dash.
But none of this changes the fact that the parser failing on e.g.
g.message "v.build map=..."
is a bug, caused by the option=value test using a crude heuristic
(only checking the character immediately prior to the first "="), when
a correct test would actually require less code.
In the above case, the first (and only) argument cannot possibly be an
option=value argument due to the space in the portion before the "=".
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev
mailing list