# HG changeset patch # User jwe # Date 1186772855 0 # Node ID 3fe394f8502b85b1181128d2150b0b4f39538142 # Parent 56a7de3f6451ef0b0eccddb865d51045f0305d66 [project @ 2007-08-10 19:07:34 by jwe] diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2007-08-10 John W. Eaton + + * pt-idx.cc (tree_index_expression::get_struct_index): Improve + error message. + * ov-struct.cc (Fstruct, Fcell2struct): Trap invalid field names here. + 2007-08-10 Peter A. Gustafson * graphics.h, graphics.cc (axes::axes_properties): New properties, diff --git a/src/ov-struct.cc b/src/ov-struct.cc --- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -35,6 +35,7 @@ #include "ov-list.h" #include "ov-struct.h" #include "unwind-prot.h" +#include "utils.h" #include "variables.h" #include "Array-util.h" @@ -616,6 +617,12 @@ if (error_state) return retval; + if (! valid_identifier (key)) + { + error ("struct: invalid structure field name `%s'", key.c_str ()); + return retval; + } + // Value may be v, { v }, or { v1, v2, ... } // In the first two cases, we need to create a cell array of // the appropriate dimensions filled with v. In the last case, @@ -941,6 +948,13 @@ return retval; } + if (! valid_identifier (field_str)) + { + error ("cell2struct: invalid field name `%s'", + field_str.c_str ()); + break; + } + map.reshape (value_dv); map.assign (field_str, c_value); diff --git a/src/pt-idx.cc b/src/pt-idx.cc --- a/src/pt-idx.cc +++ b/src/pt-idx.cc @@ -204,7 +204,7 @@ fn = t.string_value (); if (! valid_identifier (fn)) - ::error ("invalid structure field name"); + ::error ("invalid structure field name `%s'", fn.c_str ()); } } else